IMEXSfloW  1.0
templategithubproject
 All Classes Files Functions Variables Pages
init.f90
Go to the documentation of this file.
1 !*********************************************************************
3 !
6 !*********************************************************************
7 
8 MODULE init
9 
10  IMPLICIT none
11 
12  REAL*8, ALLOCATABLE :: q_init(:,:)
13 
16  REAL*8 :: riemann_interface
17 
18 
19  REAL*8 :: hB_L
20  REAL*8 :: u_L
21 
22  REAL*8 :: hB_R
23  REAL*8 :: u_R
24 
25 
26 CONTAINS
27 
28 
29  !*********************************************************************
31  !
36  !*********************************************************************
37 
38  SUBROUTINE riemann_problem
39 
40  USE constitutive, ONLY : qp_to_qc
41 
42  USE geometry, ONLY : x0 , xn , x_comp , comp_cells , b_cent
43 
44  USE parameters, ONLY : n_vars , verbose_level, batimetry_function_flag
45 
46  USE solver, ONLY : q
47 
48  IMPLICIT none
49 
50  REAL*8 :: hb
51  REAL*8 :: u
52 
53  !REAL*8 :: qp(n_vars) , qj(n_vars)
54  REAL*8 :: qp(n_vars,comp_cells) , qj(n_vars)
55 
56  INTEGER :: i
57  INTEGER :: i1
58 
59  REAL*8 :: eps
60 
61  riemann_int_search:DO i = 1,comp_cells
62 
63  IF ( x_comp(i) .LT. riemann_interface ) THEN
64 
65  i1 = i
66 
67  ELSE
68 
69  EXIT riemann_int_search
70 
71  END IF
72 
73  END DO riemann_int_search
74 
75  eps = 1.d-10
76 
77  DO i=1,i1
78 
79  qp(1,i) = hb_l
80 
81  qp(2,i) = u_l
82 
83  ENDDO
84 
85  DO i = 1,i1
86 
87  ! evaluate the vector of conservative variables
88  !CALL qp_to_qc( qp , B_cent(i) , qj )
89  CALL qp_to_qc( qp(:,i) , b_cent(i) , qj )
90 
91  q(1:n_vars,i) = qj
92 
93  IF ( verbose_level .GE. 1 ) WRITE(*,*) i,b_cent(i),qp
94 
95  END DO
96 
97  ! Right initial state
98 
99  DO i=i1+1,comp_cells
100 
101  qp(1,i) = hb_r
102 
103  qp(2,i) = u_r
104 
105  ENDDO
106 
107  DO i = i1+1,comp_cells
108 
109  ! evaluate the vector of conservative variables
110  !CALL qp_to_qc( qp , B_cent(i) , qj )
111  CALL qp_to_qc( qp(:,i) , b_cent(i) , qj )
112 
113  q(1:n_vars,i) = qj
114 
115  IF ( verbose_level .GE. 1 ) WRITE(*,*) i,b_cent(i),qp
116 
117  END DO
118 
119  IF ( verbose_level .GE. 1 ) READ(*,*)
120 
121  RETURN
122 
123  END SUBROUTINE riemann_problem
124 
125  !*********************************************************************
127  !
131  !*********************************************************************
132 
134 
135  USE constitutive, ONLY : qp_to_qc
136 
137  USE geometry, ONLY : x0 , xn , x_comp , comp_cells , b_cent
138 
139  USE parameters, ONLY : n_vars , verbose_level, batimetry_function_flag
140 
141  USE solver, ONLY : q
142 
143  IMPLICIT none
144 
145  REAL*8 :: qp(n_vars,comp_cells) , qj(n_vars)
146 
147  INTEGER :: j
148 
149  REAL*8 :: eps
150 
151  DO j=1,comp_cells
152 
153  qp(1,j) = water_function(x_comp(j),b_cent(j))
154 
155  qp(2,j) = velocity_function(x_comp(j),b_cent(j))
156 
157  ENDDO
158 
159  DO j = 1,comp_cells
160 
161  ! evaluate the vector of conservative variables
162  CALL qp_to_qc( qp(:,j) , b_cent(j) , qj )
163 
164  q(1:n_vars,j) = qj
165 
166  IF ( verbose_level .GE. 1 ) WRITE(*,*) j,b_cent(j),qp(:,j)
167 
168  ENDDO
169 
170  IF ( verbose_level .GE. 1 ) READ(*,*)
171 
172  RETURN
173 
174  END SUBROUTINE initial_conditions
175 
176 
177 !---------------------------------------------------------------------------
179 !
184 !---------------------------------------------------------------------------
185  REAL*8 FUNCTION water_function(x,Bj)
186  USE geometry, ONLY : batimetry_function
187 
188  IMPLICIT NONE
189 
190  REAL*8, INTENT(IN) :: x
191  REAL*8, INTENT(IN) :: bj
192 
193  ! example from Kurganov and Petrova 2007
194  !water_function=batimetry_function(x)
195  water_function=bj
196 
197  IF(x.LE.0.0)THEN
199  ENDIF
200 
201  END FUNCTION water_function
202 
203 !---------------------------------------------------------------------------
205 !
210 !---------------------------------------------------------------------------
211  REAL*8 FUNCTION velocity_function(x,Bj)
212 
213  IMPLICIT NONE
214 
215  REAL*8, INTENT(IN) :: x
216  REAL*8, INTENT(IN) :: bj
217 
218  ! example from Kurganov and Petrova 2007
219  velocity_function=0.d0
220 
221  END FUNCTION velocity_function
222 
223 
224 END MODULE init
real *8 function batimetry_function(x)
Batimetry function.
Definition: geometry.f90:206
Numerical solver.
Definition: solver.f90:12
subroutine initial_conditions
Problem initialization.
Definition: init.f90:133
subroutine riemann_problem
Riemann problem initialization.
Definition: init.f90:38
subroutine qp_to_qc(qp, B, qc)
Physical to conservative variables.
Grid module.
Definition: geometry.f90:7
Initial solution.
Definition: init.f90:8
Parameters.
Definition: parameters.f90:7
Constitutive equations.
Definition: constitutive.f90:4
real *8 function velocity_function(x, Bj)
Velocity function.
Definition: init.f90:211
real *8 function water_function(x, Bj)
Water function.
Definition: init.f90:185