SW_VAR_DENS_MODEL  0.9
Dept-averagedgas-particlemodel
init_2d.f90
Go to the documentation of this file.
1 !********************************************************************************
3 !
6 !********************************************************************************
7 
8 MODULE init_2d
9 
10  USE parameters_2d, ONLY : verbose_level
11  USE parameters_2d, ONLY : n_solid
12 
13  IMPLICIT none
14 
15  REAL*8, ALLOCATABLE :: q_init(:,:,:)
16 
17  REAL*8, ALLOCATABLE :: thickness_init(:,:)
18 
21  REAL*8 :: riemann_interface
22 
23  REAL*8 :: hb_w
24  REAL*8 :: u_w
25  REAL*8 :: v_w
26  REAL*8,ALLOCATABLE :: alphas_w(:)
27  REAL*8 :: t_w
28 
29  REAL*8 :: hb_e
30  REAL*8 :: u_e
31  REAL*8 :: v_e
32  REAL*8,ALLOCATABLE :: alphas_e(:)
33  REAL*8 :: t_e
34 
35 
36 CONTAINS
37 
38  !******************************************************************************
40  !
45  !******************************************************************************
46 
47  SUBROUTINE riemann_problem
48 
49  USE constitutive_2d, ONLY : qp_to_qc
50 
52 
53  ! USE geometry_2d, ONLY : x0 , xN , y0 , yN
54 
56 
57  USE solver_2d, ONLY : q
58 
59  IMPLICIT none
60 
61  ! REAL*8 :: hB !< height + topography
62  ! REAL*8 :: u !< velocity
63  ! REAL*8 :: v !< velocity
64 
65  REAL*8 :: qp(n_vars,comp_cells_x,comp_cells_y) , qj(n_vars)
66 
67  INTEGER :: j,k
68  INTEGER :: i1
69 
70  INTEGER :: i_solid
71 
72  REAL*8 :: eps
73 
74  IF ( verbose_level .GE. 1 ) THEN
75 
76  WRITE(*,*) 'Riemann problem initialization'
77  WRITE(*,*) 'x_comp(1)',x_comp(1)
78  WRITE(*,*) 'x_comp(comp_cells_x)',x_comp(comp_cells_x)
79  WRITE(*,*) 'riemann_interface',riemann_interface
80 
81  END IF
82 
83 
84  i1 = 0
85 
86  riemann_int_search:DO j = 1,comp_cells_x
87 
88  IF ( x_comp(j) .LT. riemann_interface ) THEN
89 
90  i1 = j
91 
92  ELSE
93 
94  EXIT riemann_int_search
95 
96  END IF
97 
98  END DO riemann_int_search
99 
100  eps = 1.d-10
101 
102  ! Left initial state
103  qp(1,1:i1,:) = hb_w
104  qp(2,1:i1,:) = u_w
105  qp(3,1:i1,:) = v_w
106  qp(4,1:i1,:) = t_w
107 
108  ALLOCATE( alphas_w(n_solid) )
109 
110  DO i_solid=1,n_solid
111 
112  qp(4+i_solid,1:i1,:) = alphas_w(i_solid)
113 
114  END DO
115 
116  qp(n_vars+1,1:i1,:) = 0.d0
117  qp(n_vars+2,1:i1,:) = 0.d0
118 
119  IF ( verbose_level .GE. 1 ) WRITE(*,*) 'Left state'
120 
121  DO j = 1,i1
122 
123  DO k = 1,comp_cells_y
124 
125  ! evaluate the vector of conservative variables
126  CALL qp_to_qc( qp(:,j,k) , b_cent(j,k) , qj )
127 
128  q(1:n_vars,j,k) = qj
129 
130  IF ( verbose_level .GE. 1 ) THEN
131 
132  WRITE(*,*) j,k,b_cent(j,k)
133  WRITE(*,*) qp(:,j,k)
134  WRITE(*,*) q(1:n_vars,j,k)
135 
136  END IF
137 
138  ENDDO
139 
140  END DO
141 
142  IF ( verbose_level .GE. 1 ) READ(*,*)
143 
144  ! Right initial state
145  qp(1,i1+1:comp_cells_x,:) = hb_e
146  qp(2,i1+1:comp_cells_x,:) = u_e
147  qp(3,i1+1:comp_cells_x,:) = v_e
148  qp(4,i1+1:comp_cells_x,:) = t_e
149 
150  ALLOCATE( alphas_e(n_solid) )
151 
152  DO i_solid=1,n_solid
153 
154  qp(4+i_solid,1:i1,:) = alphas_e(i_solid)
155 
156  END DO
157 
158  qp(n_vars+1,i1+1:comp_cells_x,:) = 0.d0
159  qp(n_vars+2,i1+1:comp_cells_x,:) = 0.d0
160 
161 
162  IF ( verbose_level .GE. 1 ) WRITE(*,*) 'Right state'
163 
164  DO j = i1+1,comp_cells_x
165 
166  DO k = 1,comp_cells_y
167 
168  ! evaluate the vector of conservative variables
169  CALL qp_to_qc( qp(:,j,k) , b_cent(j,k) , qj )
170 
171  q(1:n_vars,j,k) = qj
172 
173  IF ( verbose_level .GE. 1 ) THEN
174 
175  WRITE(*,*) j,k,b_cent(j,k)
176  WRITE(*,*) qp(:,j,k)
177  WRITE(*,*) q(1:n_vars,j,k)
178 
179  END IF
180 
181  END DO
182 
183  ENDDO
184 
185  IF ( verbose_level .GE. 1 ) READ(*,*)
186 
187  RETURN
188 
189  END SUBROUTINE riemann_problem
190 
191  !******************************************************************************
193  !
197  !
200  !
201  !******************************************************************************
202 
203  SUBROUTINE collapsing_volume
205  USE constitutive_2d, ONLY : qp_to_qc
206 
207  USE geometry_2d, ONLY : compute_cell_fract
208 
210 
211  USE parameters_2d, ONLY : n_vars
212 
215 
216  USE solver_2d, ONLY : q
217 
218  IMPLICIT NONE
219 
220  INTEGER :: j,k
221 
222  REAL*8 :: qp_init(n_vars+2) , qp0_init(n_vars+2)
223 
224  REAL*8 :: cell_fract(comp_cells_x,comp_cells_y)
225 
226  CALL compute_cell_fract(x_collapse,y_collapse,r_collapse,cell_fract)
227 
228  ! values outside the collapsing volume
229  qp0_init(1) = 0.d0 ! h
230  qp0_init(2) = 0.d0 ! hu
231  qp0_init(3) = 0.d0 ! hv
232  qp0_init(4) = t_collapse ! T
233  qp0_init(5:4+n_solid) = 0.d0 ! alphas
234  qp0_init(n_vars+1:n_vars+2) = 0.d0 ! u,v
235 
236  ! values within the collapsing volume
237  qp_init(1) = h_collapse
238  qp_init(2) = 0.d0
239  qp_init(3) = 0.d0
240  qp_init(4) = t_collapse
241  qp_init(5:4+n_solid) = alphas_collapse(1:n_solid)
242  qp_init(n_vars+1:n_vars+2) = 0.d0
243 
244  DO j = 1,comp_cells_x
245 
246  DO k = 1,comp_cells_y
247 
248  IF ( cell_fract(j,k) .GT. 0.d0 ) THEN
249 
250  qp_init(1) = cell_fract(j,k) * h_collapse
251 
252  CALL qp_to_qc( qp_init(1:n_vars+2) , b_cent(j,k) , q(1:n_vars,j,k) )
253 
254  ELSE
255 
256  CALL qp_to_qc( qp0_init(1:n_vars+2) , b_cent(j,k) , q(1:n_vars,j,k) )
257 
258  END IF
259 
260  END DO
261 
262  END DO
263 
264  RETURN
265 
266  END SUBROUTINE collapsing_volume
267 
268 END MODULE init_2d
real *8 t_collapse
real *8, dimension(:), allocatable alphas_w
Left sediment concentration.
Definition: init_2d.f90:26
real *8, dimension(:), allocatable x_comp
Location of the centers (x) of the control volume of the domain.
Definition: geometry_2d.f90:14
real *8, dimension(:,:), allocatable b_cent
Topography at the centers of the control volumes.
Definition: geometry_2d.f90:41
integer comp_cells_x
Number of control volumes x in the comp. domain.
Definition: geometry_2d.f90:98
real *8, dimension(:,:), allocatable thickness_init
Definition: init_2d.f90:17
real *8 u_e
Right velocity x.
Definition: init_2d.f90:30
real *8 v_w
Left velocity y.
Definition: init_2d.f90:25
Parameters.
integer comp_cells_y
Number of control volumes y in the comp. domain.
Numerical solver.
Definition: solver_2d.f90:12
real *8 riemann_interface
Riemann problem interface relative position. It is a value between 0 and 1.
Definition: init_2d.f90:21
Initial solution.
Definition: init_2d.f90:8
real *8 u_w
Left velocity x.
Definition: init_2d.f90:24
integer n_vars
Number of conservative variables.
real *8, dimension(:), allocatable alphas_collapse
Constitutive equations.
real *8, dimension(:), allocatable alphas_e
Right sediment concentration.
Definition: init_2d.f90:32
real *8 r_collapse
Grid module.
Definition: geometry_2d.f90:7
real *8 t_w
Left temperature.
Definition: init_2d.f90:27
real *8 v_e
Right velocity y.
Definition: init_2d.f90:31
integer verbose_level
subroutine compute_cell_fract(xs, ys, rs, cell_fract)
subroutine collapsing_volume
Collapsing volume initialization.
Definition: init_2d.f90:204
real *8 h_collapse
real *8 t_e
Right temperature.
Definition: init_2d.f90:33
subroutine qp_to_qc(qp, B, qc)
Physical to conservative variables.
subroutine riemann_problem
Riemann problem initialization.
Definition: init_2d.f90:48
real *8, dimension(:,:,:), allocatable q_init
Definition: init_2d.f90:15
real *8 y_collapse
real *8 hb_w
Left height.
Definition: init_2d.f90:23
real *8 x_collapse
real *8 hb_e
Right height.
Definition: init_2d.f90:29
integer n_solid
Number of solid classes.
real *8, dimension(:,:,:), allocatable q
Conservative variables.
Definition: solver_2d.f90:42