SFEMaNS  version 5.3
Reference documentation for SFEMaNS
sub_ns_with_momentum_art_comp.f90
Go to the documentation of this file.
1 !
2 !Authors LC 2019/11 based on sub_ns_with_vel
3 !
5  USE my_util
6 #include "petsc/finclude/petsc.h"
7  USE petsc
10  PRIVATE
11 CONTAINS
12 
13  SUBROUTINE bdf1_art_comp_with_m(comm_one_d, time, vv_3_LA, pp_1_LA, vvz_per, pp_per, &
14  dt, re, list_mode, pp_mesh, vv_mesh, pn_m1, pn, un_m1, un, hn_p2, bn_p2, tempn, &
15  density_m1, density, density_p1, visco_dyn, level_set_p1, visc_entro_level)
16  !==============================
17  USE def_type_mesh
18  USE fem_m_axi
19  USE fem_rhs_axi
20  USE fem_tn_axi
21  USE dir_nodes_petsc
22  USE periodic
23  USE st_matrix
24  USE solve_petsc
25  USE dyn_line
26  USE boundary
28  USE sub_plot
29  USE st_matrix
30  USE input_data
31  USE sft_parallele
34  USE tn_axi
35  USE verbose
37  USE subroutine_mass
38  USE my_util
39  IMPLICIT NONE
40  REAL(KIND=8) :: time, dt, Re
41  INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
42  TYPE(mesh_type), INTENT(IN) :: pp_mesh, vv_mesh
43  TYPE(petsc_csr_la) :: vv_3_LA, pp_1_LA
44  TYPE(periodic_type), INTENT(IN) :: vvz_per, pp_per
45  REAL(KIND=8), DIMENSION(:,:,:), INTENT(INOUT) :: pn_m1, pn
46  REAL(KIND=8), DIMENSION(:,:,:), INTENT(INOUT) :: un_m1, un
47  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: tempn
48  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: Hn_p2, Bn_p2
49  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: density_m1, density, density_p1
50  REAL(KIND=8), DIMENSION(:,:,:,:), INTENT(IN) :: level_set_p1
51  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: visco_dyn
52  REAL(KIND=8), DIMENSION(:,:), INTENT(OUT) :: visc_entro_level
53  REAL(KIND=8), DIMENSION(vv_mesh%np,6,SIZE(list_mode)) :: Hn_p2_aux
54  !===Saved variables
55  INTEGER, SAVE :: m_max_c
56  TYPE(dyn_real_line),DIMENSION(:), ALLOCATABLE, SAVE :: pp_global_D
57  TYPE(dyn_int_line), DIMENSION(:), POINTER, SAVE :: pp_mode_global_js_D
58  TYPE(dyn_int_line), DIMENSION(3), SAVE :: vv_js_D
59  TYPE(dyn_int_line), DIMENSION(:), POINTER, SAVE :: vv_mode_global_js_D
60  TYPE(dyn_real_line),DIMENSION(:), ALLOCATABLE, SAVE :: vel_global_D
61  LOGICAL, SAVE :: once = .true.
62  INTEGER, SAVE :: my_petscworld_rank
63  REAL(KIND=8), SAVE :: nu_bar
64  REAL(KIND=8), SAVE :: stab_bar
65  REAL(KIND=8), DIMENSION(:,:,:), ALLOCATABLE, SAVE :: momentum, momentum_m1, momentum_m2
66  INTEGER, SAVE :: bloc_size, m_max_pad, nb_procs
67  REAL(KIND=8), ALLOCATABLE, DIMENSION(:,:,:,:), SAVE :: visc_grad_vel_m1
68  REAL(KIND=8), ALLOCATABLE, DIMENSION(:,:,:,:), SAVE :: tensor_m1_gauss
69  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE, SAVE :: visc_entro_real
70  !===End saved variables
71 
72  !----------Declaration sans save-------------------------------------------------------
73  INTEGER, POINTER, DIMENSION(:) :: pp_1_ifrom, vv_3_ifrom
74 
75  INTEGER :: i, k, m, n, n1, n2, n3, n123, nb_inter
76  INTEGER :: code, nu_mat, mode
77  REAL(KIND=8) :: moyenne
78  !allocations des variables locales
79  REAL(KIND=8), DIMENSION(pp_mesh%np, 2, SIZE(list_mode)) :: div
80  REAL(KIND=8), DIMENSION(pp_mesh%np, 2, SIZE(list_mode)) :: visco_dyn_P1, visc_div
81  REAL(KIND=8), DIMENSION(pp_mesh%np, 2) :: pn_p1
82  REAL(KIND=8), DIMENSION(vv_mesh%np, 6) :: un_p1
83  REAL(KIND=8), DIMENSION(vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: rotb_b, rotb_b_aux
84  REAL(KIND=8), DIMENSION(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: visc_grad_vel
85  REAL(KIND=8), DIMENSION(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: stab_grad_mom
86  REAL(KIND=8), DIMENSION(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: visc_entro_grad_mom
87  REAL(KIND=8), DIMENSION(vv_mesh%gauss%l_G*vv_mesh%dom_me,2,SIZE(list_mode)) :: stab_div_vel
88  REAL(KIND=8), DIMENSION(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: tensor_surface_gauss
89  REAL(KIND=8), DIMENSION(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: tensor_gauss
90  REAL(KIND=8), DIMENSION(3,vv_mesh%np,6,SIZE(list_mode)) :: tensor
91  REAL(KIND=8), DIMENSION(vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: rhs_gauss
92  REAL(KIND=8), DIMENSION(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6) :: visc_grad_vel_ext
93  REAL(KIND=8), DIMENSION(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6) :: tensor_gauss_ext
94  REAL(KIND=8), DIMENSION(vv_mesh%np,6,SIZE(list_mode)) :: uext, momentumext, momentum_exact, momentumext_div
95  REAL(KIND=8), DIMENSION(inputs%nb_fluid-1, vv_mesh%np, 2, SIZE(list_mode)) :: level_set_FEM_P2
96 
97  REAL(KIND=8), DIMENSION(vv_mesh%np) :: vel_loc, vel_tot
98  REAL(KIND=8) :: coeff, vloc, cfl, cfl_max, norm
99  INTEGER :: nb_procs_LES, bloc_size_LES, m_max_pad_LES, bloc_size_P1
100  !April 17th 2008, JLG
101  REAL(KIND=8) :: one, zero, three
102  DATA zero, one, three/0.d0,1.d0,3.d0/
103 
104  !Communicators for Petsc, in space and Fourier------------------------------
105  petscerrorcode :: ierr
106  mpi_comm, DIMENSION(:), POINTER :: comm_one_d
107  mat, DIMENSION(:), POINTER, SAVE :: vel_mat
108  mat, SAVE :: mass_mat, mass_mat0
109  vec, SAVE :: vb_3_145, vb_3_236, vx_3, vx_3_ghost
110  vec, SAVE :: pb_1, pb_2, px_1, px_1_ghost
111  ksp, DIMENSION(:), POINTER, SAVE :: vel_ksp
112  ksp, SAVE :: mass_ksp, mass_ksp0
113  !------------------------------END OF DECLARATION--------------------------------------
114 
115  IF (once) THEN
116  once = .false.
117  CALL mpi_comm_rank(petsc_comm_world,my_petscworld_rank,code)
118 
119  !===CREATE PETSC VECTORS AND GHOSTS
120  CALL create_my_ghost(vv_mesh,vv_3_la,vv_3_ifrom)
121  n = 3*vv_mesh%dom_np
122  CALL veccreateghost(comm_one_d(1), n, &
123  petsc_determine, SIZE(vv_3_ifrom), vv_3_ifrom, vx_3, ierr)
124  CALL vecghostgetlocalform(vx_3, vx_3_ghost, ierr)
125  CALL vecduplicate(vx_3, vb_3_145, ierr)
126  CALL vecduplicate(vx_3, vb_3_236, ierr)
127 
128  CALL create_my_ghost(pp_mesh,pp_1_la,pp_1_ifrom)
129  n = pp_mesh%dom_np
130  CALL veccreateghost(comm_one_d(1), n, &
131  petsc_determine, SIZE(pp_1_ifrom), pp_1_ifrom, px_1, ierr)
132  CALL vecghostgetlocalform(px_1, px_1_ghost, ierr)
133  CALL vecduplicate(px_1, pb_1, ierr)
134  CALL vecduplicate(px_1, pb_2, ierr)
135  !===End CREATE PETSC VECTORS AND GHOSTS
136 
137  !===Number of modes on proc
138  m_max_c = SIZE(list_mode)
139  !===End umber of modes on proc
140 
141  !===Momentum Initialization
142  ALLOCATE(momentum(SIZE(un,1),SIZE(un,2), SIZE(un,3)),&
143  momentum_m1(SIZE(un,1),SIZE(un,2), SIZE(un,3)), &
144  momentum_m2(SIZE(un,1),SIZE(un,2), SIZE(un,3)))
145  CALL mpi_comm_size(comm_one_d(2), nb_procs, code)
146  bloc_size = SIZE(un,1)/nb_procs+1
147  m_max_pad = 3*SIZE(list_mode)*nb_procs/2
148 
149  IF (inputs%if_level_set) THEN
150  CALL fft_scalar_vect_dcl(comm_one_d(2), un_m1, density_m1, momentum_m1, 1, nb_procs, &
151  bloc_size, m_max_pad)
152  CALL fft_scalar_vect_dcl(comm_one_d(2), un, density, momentum, 1, nb_procs, &
153  bloc_size, m_max_pad)
154  ELSE
155  momentum_m1 = un_m1
156  momentum = un
157  END IF
158  !===End Momentum Initialization
159 
160  !===Tensors_m1 allocation and intialization
161  ALLOCATE(tensor_m1_gauss(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)))
162  CALL smb_compute_tensor_gauss(comm_one_d(2), vv_mesh, list_mode, un_m1, momentum_m1, &
163  nb_procs, bloc_size, m_max_pad, tensor, tensor_m1_gauss)
164 
165  ALLOCATE(visc_grad_vel_m1(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)))
166  CALL smb_explicit_diffu_sym(comm_one_d(2), vv_mesh, list_mode, nb_procs, &
167  visco_dyn/re, un_m1, visc_grad_vel_m1)
168  !===End Tensors_m1 allocation and intialization
169 
170  !===Allocation entropy visc
171  CALL mpi_comm_size(comm_one_d(2), nb_procs_les, code)
172  bloc_size_les = vv_mesh%gauss%l_G*vv_mesh%dom_me/nb_procs_les+1
173  bloc_size_les = vv_mesh%gauss%l_G*(bloc_size_les/vv_mesh%gauss%l_G)+vv_mesh%gauss%l_G
174  m_max_pad_les = 3*SIZE(list_mode)*nb_procs_les/2
175  ALLOCATE(visc_entro_real(2*m_max_pad_les-1,bloc_size_les))
176  visc_entro_real = 0.d0
177  !===End Allocation entropy visc
178 
179  !===PREPARE pp_mode_global_js_D ARRAY FOR PRESSURE
180  !===ATTENTION pressure BCs are no longer implemented
181  !===JLG June 9 2017
182  !CALL scalar_glob_js_D(pp_mesh, list_mode, pp_1_LA, pp_mode_global_js_D)
183  CALL scalar_without_glob_js_d(pp_mesh, list_mode, pp_1_la, pp_mode_global_js_d)
184  ALLOCATE(pp_global_d(m_max_c))
185  DO i = 1, m_max_c
186  ALLOCATE(pp_global_d(i)%DRL(SIZE(pp_mode_global_js_d(i)%DIL)))
187  END DO
188  !===End PREPARE pp_mode_global_js_D ARRAY FOR PRESSURE
189 
190  !===PREPARE TYPE OF BOUNDARY CONDITIONS AND js_D ARRAY FOR VELOCITY
191  CALL vector_glob_js_d(vv_mesh, list_mode, vv_3_la, inputs%vv_list_dirichlet_sides, &
192  vv_js_d, vv_mode_global_js_d)
193 
194  ALLOCATE(vel_global_d(m_max_c))
195  DO i = 1, m_max_c
196  ALLOCATE(vel_global_d(i)%DRL(SIZE(vv_mode_global_js_d(i)%DIL)))
197  END DO
198  !===END PREPARE TYPE OF BOUNDARY CONDITIONS AND js_D ARRAY FOR VELOCITY
199 
200  !===ASSEMBLE MASS MATRIX
201  CALL create_local_petsc_matrix(comm_one_d(1), pp_1_la, mass_mat, clean=.false.)
202  CALL qs_diff_mass_scal_m (pp_mesh, pp_1_la, 0.d0, 1.d0, 0.d0, 0, mass_mat)
203  DO i = 1, m_max_c
204  IF (list_mode(i)==0) cycle
205  CALL dirichlet_m_parallel(mass_mat,pp_mode_global_js_d(i)%DIL)
206  END DO
207  CALL init_solver(inputs%my_par_mass,mass_ksp,mass_mat,comm_one_d(1),&
208  solver=inputs%my_par_mass%solver,precond=inputs%my_par_mass%precond)
209 
210  IF (minval(list_mode)==0) THEN
211  CALL create_local_petsc_matrix(comm_one_d(1), pp_1_la, mass_mat0, clean=.false.)
212  CALL qs_diff_mass_scal_m (pp_mesh, pp_1_la, 0.d0, 1.d0, 0.d0, 0, mass_mat0)
213  DO i = 1, m_max_c
214  IF (list_mode(i).NE.0) cycle
215  CALL dirichlet_m_parallel(mass_mat0,pp_mode_global_js_d(i)%DIL)
216  CALL init_solver(inputs%my_par_mass,mass_ksp0,mass_mat0,comm_one_d(1),&
217  solver=inputs%my_par_mass%solver,precond=inputs%my_par_mass%precond)
218  END DO
219  END IF
220  !===END ASSEMBLE MASS MATRIX
221 
222  !===ASSEMBLING VELOCITY MATRICES
223  ALLOCATE(vel_mat(2*m_max_c),vel_ksp(2*m_max_c))
224 
225  ! Definition of nu_bar
226  IF (inputs%if_level_set) THEN
227  nu_bar = 0.d0
228  stab_bar = 0.d0
229  DO n = 1, inputs%nb_fluid
230  nu_bar = max(nu_bar,inputs%dyna_visc_fluid(n)/inputs%density_fluid(n))
231  stab_bar = max(stab_bar,1.d0/inputs%density_fluid(n))
232  END DO
233  !LC: To be tested thoroughly
234  nu_bar = 2.d0*nu_bar
235  stab_bar = 1.1d0*stab_bar
236  ELSE
237  nu_bar = 1.d0
238  stab_bar = 1.d0
239  END IF
240 
241  DO i = 1, m_max_c
242  mode = list_mode(i)
243  !===VELOCITY
244  nu_mat = 2*i-1
245  CALL create_local_petsc_matrix(comm_one_d(1), vv_3_la, vel_mat(nu_mat), clean=.false.)
246  IF (inputs%if_moment_bdf2) THEN
247  CALL qs_diff_mass_vect_3x3_divpenal_art_comp (1, vv_3_la, vv_mesh, nu_bar/re, three/(2*dt), &
248  inputs%LES_coeff1_mom, inputs%stab_bdy_ns, stab_bar*inputs%penal_coeff_art_comp, &
249  i, mode, vel_mat(nu_mat))
250  ELSE
251  CALL qs_diff_mass_vect_3x3_divpenal_art_comp (1, vv_3_la, vv_mesh, nu_bar/re, one/(dt), &
252  inputs%LES_coeff1_mom, inputs%stab_bdy_ns, stab_bar*inputs%penal_coeff_art_comp, &
253  i, mode, vel_mat(nu_mat))
254  END IF
255  IF (inputs%my_periodic%nb_periodic_pairs/=0) THEN
256  CALL periodic_matrix_petsc(vvz_per%n_bord, vvz_per%list,vvz_per%perlist, &
257  vel_mat(nu_mat), vv_3_la)
258  END IF
259  CALL dirichlet_m_parallel(vel_mat(nu_mat),vv_mode_global_js_d(i)%DIL)
260  CALL init_solver(inputs%my_par_vv,vel_ksp(nu_mat),vel_mat(nu_mat),comm_one_d(1),&
261  solver=inputs%my_par_vv%solver,precond=inputs%my_par_vv%precond)
262  nu_mat = nu_mat+1
263  CALL create_local_petsc_matrix(comm_one_d(1), vv_3_la, vel_mat(nu_mat), clean=.false.)
264  IF (inputs%if_moment_bdf2) THEN
265  CALL qs_diff_mass_vect_3x3_divpenal_art_comp (2, vv_3_la, vv_mesh, nu_bar/re, three/(2*dt), &
266  inputs%LES_coeff1_mom, inputs%stab_bdy_ns, stab_bar*inputs%penal_coeff_art_comp, &
267  i, mode, vel_mat(nu_mat))
268  ELSE
269  CALL qs_diff_mass_vect_3x3_divpenal_art_comp (2, vv_3_la, vv_mesh, nu_bar/re, one/(dt), &
270  inputs%LES_coeff1_mom, inputs%stab_bdy_ns, stab_bar*inputs%penal_coeff_art_comp, &
271  i, mode, vel_mat(nu_mat))
272  END IF
273  IF (inputs%my_periodic%nb_periodic_pairs/=0) THEN
274  CALL periodic_matrix_petsc(vvz_per%n_bord, vvz_per%list,vvz_per%perlist, &
275  vel_mat(nu_mat), vv_3_la)
276  END IF
277  CALL dirichlet_m_parallel(vel_mat(nu_mat),vv_mode_global_js_d(i)%DIL)
278  CALL init_solver(inputs%my_par_vv,vel_ksp(nu_mat),vel_mat(nu_mat),comm_one_d(1),&
279  solver=inputs%my_par_vv%solver,precond=inputs%my_par_vv%precond)
280  !===End VELOCITY
281  ENDDO
282  !===End ASSEMBLING VELOCITY MATRICES
283  ENDIF !===End of once
284 
285  !===Compute rhs by FFT at Gauss points
286 
287  !===Compute extrapolation velocity and momentum
288  IF (inputs%if_moment_bdf2) THEN
289  uext = 2*un-un_m1
290  IF (inputs%if_level_set) THEN
291  !Second time order: momentumext = rho_np1*(2*un-un_m1)
292  CALL fft_scalar_vect_dcl(comm_one_d(2), uext, density_p1, momentumext, 1,nb_procs, &
293  bloc_size, m_max_pad)
294  ELSE
295  momentumext = 2*momentum - momentum_m1
296  END IF
297  !TEST LC DEBUG: above 2nd order extrapolation not stable
298  IF (inputs%if_level_set) THEN
299  !First time order: momentumext = rho_np1*un
300  CALL fft_scalar_vect_dcl(comm_one_d(2), un, density_p1, momentumext_div, 1, nb_procs, &
301  bloc_size, m_max_pad)
302  ELSE
303  momentumext_div = momentum
304  END IF
305  !END TEST LC DEBUG
306  ELSE
307  uext = un
308  IF (inputs%if_level_set) THEN
309  !First time order: momentumext = rho_np1*un
310  CALL fft_scalar_vect_dcl(comm_one_d(2), un, density_p1, momentumext, 1, nb_procs, &
311  bloc_size, m_max_pad)
312  ELSE
313  momentumext = momentum
314  END IF
315  momentumext_div=momentumext
316  END IF
317  !===End Compute extrapolation velocity and momentum
318 
319  !===Precession should be in condlim
320  IF (inputs%precession) THEN
321  CALL error_petsc('for momentum ns: precession should be in condlim')
322  END IF
323 
324  !===Compute Lorentz force if mhd
325  IF (inputs%type_pb=='mhd') THEN
326  !===Compute Lorentz force if mhd in quasi-static limit
327  IF (inputs%if_quasi_static_approx) THEN
328  DO i = 1, m_max_c
329  mode = list_mode(i)
330  hn_p2_aux(:,:,i) = h_b_quasi_static('H', vv_mesh%rr, mode)
331  END DO
332  CALL smb_curlh_cross_b_gauss_sft_par(comm_one_d(2),vv_mesh,list_mode,hn_p2_aux,bn_p2,rotb_b_aux)
333  DO i = 1, m_max_c
334  mode = list_mode(i)
335  hn_p2_aux(:,:,i) = h_b_quasi_static('B', vv_mesh%rr, mode)
336  END DO
337  CALL smb_curlh_cross_b_gauss_sft_par(comm_one_d(2),vv_mesh,list_mode,hn_p2,hn_p2_aux,rotb_b)
338  rotb_b = rotb_b + rotb_b_aux
339  ELSE !===Compute Lorentz force if mhd
340  CALL smb_curlh_cross_b_gauss_sft_par(comm_one_d(2),vv_mesh,list_mode,hn_p2,bn_p2,rotb_b)
341  END IF
342  ELSE
343  rotb_b = 0.d0
344  END IF
345  !===End compute Lorentz force if mhd
346 
347  !===Compute diffusion/artificial compression corrections and surface tension
348  IF (inputs%if_level_set) THEN
349  !===Compute visco_dyn/Re*Grad(un) and nu_bar*Grad(momentum)
350  CALL smb_explicit_diffu_correction(comm_one_d(2), vv_mesh, list_mode, nb_procs, &
351  visco_dyn/re, nu_bar/re, un, momentumext, visc_grad_vel, stab_grad_mom)
352  !===End compute visco_dyn/Re*Grad(un) and nu_bar/Re*Grad(momentum)
353 
354  !===Compute Div(un) - stab_bar*Div(momentum)
355  CALL smb_explicit_div_correction(comm_one_d(2), vv_mesh, list_mode, stab_bar, un, momentumext_div, stab_div_vel)
356  stab_div_vel=inputs%penal_coeff_art_comp*stab_div_vel
357  !===End Compute Div(un) - stab_bar*Div(momentum)
358 
359  IF (inputs%if_surface_tension) THEN
360  !===Compute coeff_surface*Grad(level_set):Grad(level_set)
361  IF (inputs%if_level_set_P2) THEN
362  CALL smb_surface_tension(comm_one_d(2), vv_mesh, list_mode, nb_procs, &
363  level_set_p1, tensor_surface_gauss)
364  ELSE
365  DO nb_inter = 1, inputs%nb_fluid-1
366  DO i = 1, SIZE(list_mode)
367  DO k = 1, 2
368  CALL inject_p1_p2(pp_mesh%jj, vv_mesh%jj, level_set_p1(nb_inter,:,k,i), &
369  level_set_fem_p2(nb_inter,:,k,i))
370  END DO
371  END DO
372  END DO
373  CALL smb_surface_tension(comm_one_d(2), vv_mesh, list_mode, nb_procs, &
374  level_set_fem_p2, tensor_surface_gauss)
375  END IF
376  ELSE
377  tensor_surface_gauss = 0.d0
378  END IF
379  ELSE
380  visc_grad_vel = 0.d0
381  stab_grad_mom = 0.d0
382  stab_div_vel = 0.d0
383  tensor_surface_gauss = 0.d0
384  END IF
385  !===End Compute diffusion/ artificial compression corrections and surface tension
386 
387  !===Compute entropy viscosity: (-LES_coeff1+visc_entro)*Grad(momentumext)
388  IF (inputs%LES.AND.inputs%if_LES_in_momentum) THEN
389  CALL smb_explicit_les(comm_one_d(2), vv_mesh, list_mode, nb_procs, &
390  visc_entro_real, momentumext, visc_entro_grad_mom)
391  ELSE
392  visc_entro_grad_mom=0.d0
393  END IF
394  !===End compute entropy viscosity: (-LES_coeff1+visc_entro)*Grad(momentumext)
395 
396  !===Compute tensor product of momentum by velocity
397  CALL smb_compute_tensor_gauss(comm_one_d(2), vv_mesh, list_mode, un, momentum, &
398  nb_procs, bloc_size, m_max_pad, tensor, tensor_gauss)
399  !===End Compute tensor product of momentum by velocity
400 
401  !===PREPARE BOUNDARY CONDITION FOR MOMENTUM
402  CALL momentum_dirichlet(comm_one_d(2), vv_mesh, list_mode, time, nb_procs, density_p1, &
403  momentum_exact, vv_js_d)
404  !===End PREPARE BOUNDARY CONDITION FOR MOMENTUM
405 
406  !===End Compute rhs by FFT at Gauss points
407 
408  !===Computation of rhs at Gauss points for every mode
409  IF (inputs%if_moment_bdf2) THEN
410  CALL rhs_ns_gauss_3x3_art_comp_mom(vv_mesh, pp_mesh, comm_one_d(2), list_mode, time, &
411  (4*momentum-momentum_m1)/(2*inputs%dt), pn, -rotb_b, rhs_gauss, tempn, density_p1)
412  ELSE
413  CALL rhs_ns_gauss_3x3_art_comp_mom(vv_mesh, pp_mesh, comm_one_d(2), list_mode, time, &
414  (momentum)/(inputs%dt), pn, -rotb_b, rhs_gauss, tempn, density_p1)
415  END IF
416  !===End Computation of rhs at Gauss points for every mode
417 
418  !------------BEGIN LOOP ON FOURIER MODES FOR MOMENTUM---------------
419  DO i = 1, m_max_c
420  mode = list_mode(i)
421 
422  !===Assemble vb_3_145, vb_3_236 using rhs_gauss
423  IF (inputs%if_moment_bdf2) THEN
424 
425  !===Compute 2nd time order explicit tensors
426  tensor_gauss_ext = 2*tensor_gauss(:,:,:,i) - tensor_m1_gauss(:,:,:,i)
427  visc_grad_vel_ext = 2*visc_grad_vel(:,:,:,i) - visc_grad_vel_m1(:,:,:,i)
428  !===Update terms at m1
429  tensor_m1_gauss(:,:,:,i) = tensor_gauss(:,:,:,i)
430  visc_grad_vel_m1(:,:,:,i) = visc_grad_vel(:,:,:,i)
431 
432  CALL rhs_3x3_art_comp(vv_mesh, vv_3_la, mode, rhs_gauss(:,:,i), vb_3_145, vb_3_236, &
433  opt_tensor=tensor_gauss_ext+tensor_surface_gauss(:,:,:,i) &
434  -visc_grad_vel_ext+stab_grad_mom(:,:,:,i)-visc_entro_grad_mom(:,:,:,i), &
435  opt_grad_div=-stab_div_vel(:,:,i))
436  ELSE
437  CALL rhs_3x3_art_comp(vv_mesh, vv_3_la, mode, rhs_gauss(:,:,i), vb_3_145, vb_3_236, &
438  opt_tensor=tensor_gauss(:,:,:,i)+tensor_surface_gauss(:,:,:,i) &
439  -visc_grad_vel(:,:,:,i)+stab_grad_mom(:,:,:,i)-visc_entro_grad_mom(:,:,:,i), &
440  opt_grad_div=-stab_div_vel(:,:,i))
441  END IF
442 
443  !===Periodic boundary conditions
444  IF (inputs%my_periodic%nb_periodic_pairs/=0) THEN
445  CALL periodic_rhs_petsc(vvz_per%n_bord, vvz_per%list, vvz_per%perlist, vb_3_236, vv_3_la)
446  CALL periodic_rhs_petsc(vvz_per%n_bord, vvz_per%list, vvz_per%perlist, vb_3_145, vv_3_la)
447  END IF
448 
449  !===Axis boundary conditions
450  n1 = SIZE(vv_js_d(1)%DIL)
451  n2 = SIZE(vv_js_d(2)%DIL)
452  n3 = SIZE(vv_js_d(3)%DIL)
453  n123 = n1+n2+n3
454  vel_global_d(i)%DRL(1:n1) = momentum_exact(vv_js_d(1)%DIL,1,i)
455  vel_global_d(i)%DRL(n1+1:n1+n2) = momentum_exact(vv_js_d(2)%DIL,4,i)
456  vel_global_d(i)%DRL(n1+n2+1:n123)= momentum_exact(vv_js_d(3)%DIL,5,i)
457  vel_global_d(i)%DRL(n123+1:) = 0.d0
458  CALL dirichlet_rhs(vv_mode_global_js_d(i)%DIL-1,vel_global_d(i)%DRL,vb_3_145)
459  vel_global_d(i)%DRL(1:n1) = momentum_exact(vv_js_d(1)%DIL,2,i)
460  vel_global_d(i)%DRL(n1+1:n1+n2) = momentum_exact(vv_js_d(2)%DIL,3,i)
461  vel_global_d(i)%DRL(n1+n2+1:n123)= momentum_exact(vv_js_d(3)%DIL,6,i)
462  CALL dirichlet_rhs(vv_mode_global_js_d(i)%DIL-1,vel_global_d(i)%DRL,vb_3_236)
463  !===End Assemble vb_3_145, vb_3_236 using rhs_gauss
464 
465  !===Solve linear system for momentum equation
466  !===Solve system 1, ur_c, ut_s, uz_c
467  nu_mat =2*i-1
468  CALL solver(vel_ksp(nu_mat),vb_3_145,vx_3,reinit=.false.,verbose=inputs%my_par_vv%verbose)
469  CALL vecghostupdatebegin(vx_3,insert_values,scatter_forward,ierr)
470  CALL vecghostupdateend(vx_3,insert_values,scatter_forward,ierr)
471  CALL extract(vx_3_ghost,1,1,vv_3_la,un_p1(:,1))
472  CALL extract(vx_3_ghost,2,2,vv_3_la,un_p1(:,4))
473  CALL extract(vx_3_ghost,3,3,vv_3_la,un_p1(:,5))
474  !===Solve system 2, ur_s, ut_c, uz_s
475  nu_mat = nu_mat + 1
476  CALL solver(vel_ksp(nu_mat),vb_3_236,vx_3,reinit=.false.,verbose=inputs%my_par_vv%verbose)
477  CALL vecghostupdatebegin(vx_3,insert_values,scatter_forward,ierr)
478  CALL vecghostupdateend(vx_3,insert_values,scatter_forward,ierr)
479  CALL extract(vx_3_ghost,1,1,vv_3_la,un_p1(:,2))
480  CALL extract(vx_3_ghost,2,2,vv_3_la,un_p1(:,3))
481  CALL extract(vx_3_ghost,3,3,vv_3_la,un_p1(:,6))
482  !===End Solve linear system for momentum equation
483 
484  !===Correction of zero mode
485  IF (mode==0) THEN
486  un_p1(:,2) = 0.d0
487  un_p1(:,4) = 0.d0
488  un_p1(:,6) = 0.d0
489  END IF
490  !===End Correction of zero mode
491 
492  !===Update momentum
493  momentum_m2(:,:,i) = momentum_m1(:,:,i)
494  momentum_m1(:,:,i) = momentum(:,:,i)
495  momentum(:,:,i) = un_p1
496  !===End Update momentum
497  END DO
498  !------------END LOOP ON FOURIER MODES FOR MOMENTUM---------------
499 
500  !===Update Velocity
501  un_m1 = un
502  IF (inputs%if_level_set) THEN
503  CALL fft_scalar_vect_dcl(comm_one_d(2), momentum, density_p1, un, 2, nb_procs, &
504  bloc_size, m_max_pad)
505  ELSE
506  un = momentum
507  END IF
508  !===End Update Velocity
509 
510  !------------BEGIN LOOP ON FOURIER MODES FOR DIVERGENCE P1-----------
511  DO i = 1, m_max_c
512  mode = list_mode(i)
513 
514  !===Assemble divergence of velocity in arrays pb_1, pb_2
515  CALL qs_01_div_hybrid_2006(vv_mesh, pp_mesh, pp_1_la, mode, un(:,:,i), pb_1, pb_2)
516  !===End assembling; pb_1, and pb_2 are petsc vectors for the rhs divergence
517 
518  IF (inputs%my_periodic%nb_periodic_pairs/=0) THEN
519  CALL periodic_rhs_petsc(pp_per%n_bord, pp_per%list, pp_per%perlist, pb_1, pp_1_la)
520  CALL periodic_rhs_petsc(pp_per%n_bord, pp_per%list, pp_per%perlist, pb_2, pp_1_la)
521  END IF
522 
523  !===ATENTION BCs are no longer implemented for pressure
524  !===Boundary condition on axis for pressure
525  pp_global_d(i)%DRL = 0.d0
526  CALL dirichlet_rhs(pp_mode_global_js_d(i)%DIL-1,pp_global_d(i)%DRL,pb_1)
527  CALL dirichlet_rhs(pp_mode_global_js_d(i)%DIL-1,pp_global_d(i)%DRL,pb_2)
528  !===End boundary condition on axis for pressure
529 
530  !===Solve mass matrix for pressure correction
531  IF (mode==0) THEN
532  CALL solver(mass_ksp0,pb_1,px_1,reinit=.false.,verbose=inputs%my_par_mass%verbose)
533  ELSE
534  CALL solver(mass_ksp,pb_1,px_1,reinit=.false.,verbose=inputs%my_par_mass%verbose)
535  END IF
536  CALL vecghostupdatebegin(px_1,insert_values,scatter_forward,ierr)
537  CALL vecghostupdateend(px_1,insert_values,scatter_forward,ierr)
538  CALL extract(px_1_ghost,1,1,pp_1_la,div(:,1,i))
539  IF (mode==0) THEN
540  CALL solver(mass_ksp0,pb_2,px_1,reinit=.false.,verbose=inputs%my_par_mass%verbose)
541  ELSE
542  CALL solver(mass_ksp,pb_2,px_1,reinit=.false.,verbose=inputs%my_par_mass%verbose)
543  END IF
544  CALL vecghostupdatebegin(px_1,insert_values,scatter_forward,ierr)
545  CALL vecghostupdateend(px_1,insert_values,scatter_forward,ierr)
546  CALL extract(px_1_ghost,1,1,pp_1_la,div(:,2,i))
547  !===End solve mass matrix for pressure correction
548  END DO
549  !------------END LOOP ON FOURIER MODES FOR DIVERGENCE P1-------------
550 
551  !===Compute visco_dyn*div on P1 elements
552  DO i = 1, m_max_c
553  DO k=1, 2
554  CALL project_p2_p1(vv_mesh%jj, pp_mesh%jj, visco_dyn(:,k,i), visco_dyn_p1(:,k,i))
555  END DO
556  END DO
557  bloc_size_p1 = SIZE(div,1)/nb_procs+1
558  CALL fft_par_prod_dcl(comm_one_d(2), visco_dyn_p1, div, visc_div, nb_procs, bloc_size_p1, m_max_pad)
559  !===End Compute visco_dyn*div on P1 elements
560 
561  !------------BEGIN LOOP ON FOURIER MODES FOR PRESSURE----------------
562  DO i = 1, m_max_c
563  mode = list_mode(i)
564  !===Pressure computation
565  pn_p1(:,:) = pn(:,:,i)
566  DO k=1, 2
567  pn_p1(:,k) = pn_p1(:,k) - inputs%penal_coeff_art_comp*div(:,k,i)
568  END DO
569  !===End Pressure computation
570 
571  !===Handling of mean pressure
572  IF (mode == 0) THEN
573  CALL moy(comm_one_d(1),pp_mesh, pn_p1(:,1),moyenne)
574  pn_p1(:,1) = pn_p1(:,1)-moyenne
575  ENDIF
576  !===End of handling of mean pressure
577 
578  !===Correction of zero mode
579  IF (mode==0) THEN
580  pn_p1(:,2) = 0.d0
581  END IF
582  !===Correction of zero mode
583 
584  !===Update pressures
585  pn_m1(:,:,i) = pn(:,:,i)
586  pn(:,:,i) = pn_p1
587  !===End Update pressures
588  ENDDO
589  !------------END LOOP ON FOURIER MODES FOR PRESSURE------------------
590 
591  !===Verbose divergence of velocity
592  IF (inputs%verbose_divergence) THEN
593  norm = norm_sf(comm_one_d, 'H1', vv_mesh, list_mode, un)
594  talk_to_me%div_L2 = norm_sf(comm_one_d, 'div', vv_mesh, list_mode, un)/norm
595  talk_to_me%weak_div_L2 = norm_sf(comm_one_d, 'L2', pp_mesh, list_mode, div)/norm
596  END IF
597  !===End verbose divergence of velocity
598 
599  !===Computation of CFL
600  IF (inputs%verbose_CFL) THEN
601  vel_loc = 0.d0
602  DO i = 1, m_max_c
603  IF (list_mode(i)==0) THEN
604  coeff = 1.d0
605  ELSE
606  coeff = .5d0
607  END IF
608  vel_loc = vel_loc + coeff*(un(:,1,i)**2+un(:,2,i)**2+un(:,3,i)**2 &
609  +un(:,4,i)**2+un(:,5,i)**2+un(:,6,i)**2)
610  END DO
611  CALL mpi_comm_size(comm_one_d(2),nb_procs,code)
612  CALL mpi_allreduce(vel_loc,vel_tot,vv_mesh%np,mpi_double_precision, mpi_sum, comm_one_d(2), code)
613  vel_tot = sqrt(vel_tot)
614  cfl = 0.d0
615  DO m = 1, vv_mesh%dom_me
616  vloc = maxval(vel_tot(vv_mesh%jj(:,m)))
617  cfl = max(vloc*dt/min(vv_mesh%hloc(m),maxval(vv_mesh%hm)),cfl)
618  END DO
619  CALL mpi_allreduce(cfl,cfl_max,1,mpi_double_precision, mpi_max, comm_one_d(1), code)
620  talk_to_me%CFL=cfl_max
621  talk_to_me%time=time
622  END IF
623  !===End Computation of CFL
624 
625  !===Compute entropy viscosity
626  IF (inputs%if_level_set) THEN
627  IF (inputs%LES) THEN
628  CALL compute_entropy_viscosity_mom(comm_one_d, vv_3_la, vv_mesh, pp_mesh, time, list_mode, &
629  momentum, momentum_m1, momentum_m2, pn_m1, un_m1, tensor, visc_grad_vel, tensor_surface_gauss, &
630  rotb_b, visco_dyn, density_m1, density, density_p1, tempn, visc_entro_real, visc_entro_level)
631  ELSE
632  visc_entro_real = 0.d0
633  visc_entro_level= 0.d0
634  END IF
635  ELSE
636  IF (inputs%if_LES_in_momentum) THEN
637  CALL compute_entropy_viscosity_mom_no_level_set(comm_one_d, vv_3_la, vv_mesh, pp_mesh, time, list_mode, &
638  momentum, momentum_m1, momentum_m2, pn_m1, un_m1, tensor, rotb_b, tempn, visc_entro_real)
639  ELSE
640  visc_entro_real=0.d0
641  END IF
642  !visc_entro_level not allocated so nothing to do
643  END IF
644  !===End Compute entropy viscosity
645 
646  END SUBROUTINE bdf1_art_comp_with_m
647  !============================================
648 
649  SUBROUTINE smb_curlh_cross_b_gauss_sft_par(communicator,mesh,list_mode,V_in,W_in,V_out)
650  !=================================
651  USE sft_parallele
652  USE chaine_caractere
653  USE input_data
654  USE def_type_mesh
655  IMPLICIT NONE
656  TYPE(mesh_type), INTENT(IN) :: mesh
657  INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
658  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: V_in, W_in
659  REAL(KIND=8), DIMENSION(:,:,:) :: V_out
660  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%me,6,SIZE(list_mode)) :: RotV, V, W
661  INTEGER, DIMENSION(mesh%gauss%n_w) :: j_loc
662  REAL(KIND=8), DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
663  INTEGER :: m, l , i, mode, index, k
664  REAL(KIND=8), DIMENSION(mesh%gauss%n_w,6) :: Vs, Ws
665  REAL(KIND=8) :: ray
666  REAL(KIND=8) :: tps
667  REAL(KIND=8), DIMENSION(3) :: temps
668  !===FOR FFT_PAR_CROSS_PROD_DCL
669  INTEGER :: nb_procs, bloc_size, m_max_pad, code
670  mpi_comm :: communicator
671 
672  tps = user_time()
673  DO i = 1, SIZE(list_mode)
674  mode = list_mode(i)
675  index = 0
676  DO m = 1, mesh%me
677  j_loc = mesh%jj(:,m)
678  DO k = 1, 6
679  vs(:,k) = v_in(j_loc,k,i)
680  ws(:,k) = w_in(j_loc,k,i)
681  END DO
682 
683  DO l = 1, mesh%gauss%l_G
684  index = index + 1
685  dw_loc = mesh%gauss%dw(:,:,l,m)
686 
687  !===Compute radius of Gauss point
688  ray = sum(mesh%rr(1,j_loc)*mesh%gauss%ww(:,l))
689 
690  !-----------------vitesse sur les points de Gauss---------------------------
691  w(index,1,i) = sum(ws(:,1)*mesh%gauss%ww(:,l))
692  w(index,3,i) = sum(ws(:,3)*mesh%gauss%ww(:,l))
693  w(index,5,i) = sum(ws(:,5)*mesh%gauss%ww(:,l))
694 
695  w(index,2,i) = sum(ws(:,2)*mesh%gauss%ww(:,l))
696  w(index,4,i) = sum(ws(:,4)*mesh%gauss%ww(:,l))
697  w(index,6,i) = sum(ws(:,6)*mesh%gauss%ww(:,l))
698  v(index,1,i) = sum(vs(:,1)*mesh%gauss%ww(:,l))
699  v(index,3,i) = sum(vs(:,3)*mesh%gauss%ww(:,l))
700  v(index,5,i) = sum(vs(:,5)*mesh%gauss%ww(:,l))
701 
702  v(index,2,i) = sum(vs(:,2)*mesh%gauss%ww(:,l))
703  v(index,4,i) = sum(vs(:,4)*mesh%gauss%ww(:,l))
704  v(index,6,i) = sum(vs(:,6)*mesh%gauss%ww(:,l))
705  !-----------------rotational sur les points de Gauss---------------------------
706  !coeff sur les cosinus
707  rotv(index,1,i) = mode/ray*v(index,6,i) &
708  -sum(vs(:,3)*dw_loc(2,:))
709  rotv(index,4,i) = sum(vs(:,2)*dw_loc(2,:)) &
710  -sum(vs(:,6)*dw_loc(1,:))
711  rotv(index,5,i) = 1/ray*v(index,3,i) &
712  +sum(vs(:,3)*dw_loc(1,:)) &
713  -mode/ray*v(index,2,i)
714  !coeff sur les sinus
715  rotv(index,2,i) =-mode/ray*v(index,5,i) &
716  -sum(vs(:,4)*dw_loc(2,:))
717  rotv(index,3,i) = sum(vs(:,1)*dw_loc(2,:)) &
718  -sum(vs(:,5)*dw_loc(1,:))
719  rotv(index,6,i) = 1/ray*v(index,4,i) &
720  +sum(vs(:,4)*dw_loc(1,:))&
721  +mode/ray*v(index,1,i)
722  ENDDO
723  ENDDO
724  END DO
725  temps = 0
726 
727  CALL mpi_comm_size(communicator, nb_procs, code)
728  bloc_size = SIZE(rotv,1)/nb_procs+1
729  m_max_pad = 3*SIZE(list_mode)*nb_procs/2
730 
731  CALL fft_par_cross_prod_dcl(communicator, rotv, w, v_out, nb_procs, bloc_size, m_max_pad, temps)
732  tps = user_time() - tps
733 
734  END SUBROUTINE smb_curlh_cross_b_gauss_sft_par
735 
736  SUBROUTINE smb_explicit_diffu_correction(communicator, mesh, list_mode, nb_procs, visc_dyn, stab_mom, &
737  vel, mom, v_out, v2_out)
739  USE sft_parallele
740  USE chaine_caractere
741  USE boundary
742  USE input_data
743  IMPLICIT NONE
744  TYPE(mesh_type), TARGET :: mesh
745  INTEGER, INTENT(IN) :: nb_procs
746  INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
747  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: visc_dyn
748  REAL(KIND=8) :: stab_mom
749  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: vel
750  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: mom
751  REAL(KIND=8), DIMENSION(3,mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)), INTENT(OUT) :: V_out
752  REAL(KIND=8), DIMENSION(3,mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)), INTENT(OUT) :: V2_out
753  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)) :: grad1_vel, grad2_vel, grad3_vel
754  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)) :: gradT1_vel, gradT2_vel, gradT3_vel
755  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)) :: grad1_mom, grad2_mom, grad3_mom
756  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)) :: gradT1_mom, gradT2_mom, gradT3_mom
757  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)) :: part_tensor_1, part_tensor_2
758  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)) :: part_visc_sym_grad_1
759  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)) :: part_visc_sym_grad_2
760  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)) :: visc_dyn_gauss
761  INTEGER, DIMENSION(mesh%gauss%n_w) :: j_loc
762  REAL(KIND=8), DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
763  REAL(KIND=8), DIMENSION(mesh%gauss%n_w,6) :: vel_loc, mom_loc
764  REAL(KIND=8) :: ray
765  INTEGER :: m, l , i, mode, index, k
766  INTEGER :: m_max_pad, bloc_size
767  mpi_comm :: communicator
768 
769  CALL gauss(mesh)
770 
771  DO i = 1, SIZE(list_mode)
772  mode = list_mode(i)
773  index = 0
774  DO m = 1, mesh%dom_me
775  j_loc = mesh%jj(:,m)
776  DO k = 1, 6
777  vel_loc(:,k) = vel(j_loc,k,i)
778  mom_loc(:,k) = mom(j_loc,k,i)
779  END DO
780  DO l = 1, l_g
781  index = index + 1
782  dw_loc = dw(:,:,l,m)
783 
784  !===Compute radius of Gauss point
785  ray = sum(mesh%rr(1,j_loc)*ww(:,l))
786 
787  !-----------------Dynamic viscosity on Gauss points---------------------------
788  visc_dyn_gauss(index,1,i) = sum(visc_dyn(j_loc,1,i)*ww(:,l))
789  visc_dyn_gauss(index,2,i) = sum(visc_dyn(j_loc,2,i)*ww(:,l))
790 
791  !-----------------Grad u_r on Gauss points------------------------------------
792  grad1_vel(index,1,i) = sum(vel_loc(:,1)*dw_loc(1,:))
793  grad1_vel(index,2,i) = sum(vel_loc(:,2)*dw_loc(1,:))
794  grad1_vel(index,3,i) = (mode*sum(vel_loc(:,2)*ww(:,l)) - sum(vel_loc(:,3)*ww(:,l)))/ray
795  grad1_vel(index,4,i) = (-mode*sum(vel_loc(:,1)*ww(:,l)) - sum(vel_loc(:,4)*ww(:,l)))/ray
796  grad1_vel(index,5,i) = sum(vel_loc(:,1)*dw_loc(2,:))
797  grad1_vel(index,6,i) = sum(vel_loc(:,2)*dw_loc(2,:))
798  !-----------------Grad mom_r on Gauss points----------------------------------
799  grad1_mom(index,1,i) = stab_mom*sum(mom_loc(:,1)*dw_loc(1,:))
800  grad1_mom(index,2,i) = stab_mom*sum(mom_loc(:,2)*dw_loc(1,:))
801  grad1_mom(index,3,i) = stab_mom*(mode*sum(mom_loc(:,2)*ww(:,l)) - sum(mom_loc(:,3)*ww(:,l)))/ray
802  grad1_mom(index,4,i) = stab_mom*(-mode*sum(mom_loc(:,1)*ww(:,l)) - sum(mom_loc(:,4)*ww(:,l)))/ray
803  grad1_mom(index,5,i) = stab_mom*sum(mom_loc(:,1)*dw_loc(2,:))
804  grad1_mom(index,6,i) = stab_mom*sum(mom_loc(:,2)*dw_loc(2,:))
805 
806  !-----------------Grad u_th on Gauss points-----------------------------------
807  grad2_vel(index,1,i) = sum(vel_loc(:,3)*dw_loc(1,:))
808  grad2_vel(index,2,i) = sum(vel_loc(:,4)*dw_loc(1,:))
809  grad2_vel(index,3,i) = (mode*sum(vel_loc(:,4)*ww(:,l)) + sum(vel_loc(:,1)*ww(:,l)))/ray
810  grad2_vel(index,4,i) = (-mode*sum(vel_loc(:,3)*ww(:,l)) + sum(vel_loc(:,2)*ww(:,l)))/ray
811  grad2_vel(index,5,i) = sum(vel_loc(:,3)*dw_loc(2,:))
812  grad2_vel(index,6,i) = sum(vel_loc(:,4)*dw_loc(2,:))
813  !-----------------Grad mom_th on Gauss points---------------------------------
814  grad2_mom(index,1,i) = stab_mom*sum(mom_loc(:,3)*dw_loc(1,:))
815  grad2_mom(index,2,i) = stab_mom*sum(mom_loc(:,4)*dw_loc(1,:))
816  grad2_mom(index,3,i) = stab_mom*(mode*sum(mom_loc(:,4)*ww(:,l)) + sum(mom_loc(:,1)*ww(:,l)))/ray
817  grad2_mom(index,4,i) = stab_mom*(-mode*sum(mom_loc(:,3)*ww(:,l)) + sum(mom_loc(:,2)*ww(:,l)))/ray
818  grad2_mom(index,5,i) = stab_mom*sum(mom_loc(:,3)*dw_loc(2,:))
819  grad2_mom(index,6,i) = stab_mom*sum(mom_loc(:,4)*dw_loc(2,:))
820 
821 
822  !-----------------Grad u_z on Gauss points------------------------------------
823  grad3_vel(index,1,i) = sum(vel_loc(:,5)*dw_loc(1,:))
824  grad3_vel(index,2,i) = sum(vel_loc(:,6)*dw_loc(1,:))
825  grad3_vel(index,3,i) = mode*sum(vel_loc(:,6)*ww(:,l))/ray
826  grad3_vel(index,4,i) = -mode*sum(vel_loc(:,5)*ww(:,l))/ray
827  grad3_vel(index,5,i) = sum(vel_loc(:,5)*dw_loc(2,:))
828  grad3_vel(index,6,i) = sum(vel_loc(:,6)*dw_loc(2,:))
829  !-----------------Grad mom_z on Gauss points----------------------------------
830  grad3_mom(index,1,i) = stab_mom*sum(mom_loc(:,5)*dw_loc(1,:))
831  grad3_mom(index,2,i) = stab_mom*sum(mom_loc(:,6)*dw_loc(1,:))
832  grad3_mom(index,3,i) = stab_mom*mode*sum(mom_loc(:,6)*ww(:,l))/ray
833  grad3_mom(index,4,i) = stab_mom*(-mode*sum(mom_loc(:,5)*ww(:,l)))/ray
834  grad3_mom(index,5,i) = stab_mom*sum(mom_loc(:,5)*dw_loc(2,:))
835  grad3_mom(index,6,i) = stab_mom*sum(mom_loc(:,6)*dw_loc(2,:))
836  ENDDO
837  ENDDO
838  END DO
839 
840  !-----------------GradT u_r on Gauss points------------------------------------
841  gradt1_vel(:,1,:) = grad1_vel(:,1,:)
842  gradt1_vel(:,2,:) = grad1_vel(:,2,:)
843  gradt1_vel(:,3,:) = grad2_vel(:,1,:)
844  gradt1_vel(:,4,:) = grad2_vel(:,2,:)
845  gradt1_vel(:,5,:) = grad3_vel(:,1,:)
846  gradt1_vel(:,6,:) = grad3_vel(:,2,:)
847  !-----------------GradT mom_r on Gauss points----------------------------------
848  gradt1_mom(:,1,:) = grad1_mom(:,1,:)
849  gradt1_mom(:,2,:) = grad1_mom(:,2,:)
850  gradt1_mom(:,3,:) = grad2_mom(:,1,:)
851  gradt1_mom(:,4,:) = grad2_mom(:,2,:)
852  gradt1_mom(:,5,:) = grad3_mom(:,1,:)
853  gradt1_mom(:,6,:) = grad3_mom(:,2,:)
854 
855  !-----------------GradT u_th on Gauss points-----------------------------------
856  gradt2_vel(:,1,:) = grad1_vel(:,3,:)
857  gradt2_vel(:,2,:) = grad1_vel(:,4,:)
858  gradt2_vel(:,3,:) = grad2_vel(:,3,:)
859  gradt2_vel(:,4,:) = grad2_vel(:,4,:)
860  gradt2_vel(:,5,:) = grad3_vel(:,3,:)
861  gradt2_vel(:,6,:) = grad3_vel(:,4,:)
862  !-----------------GradT mom_th on Gauss points---------------------------------
863  gradt2_mom(:,1,:) = grad1_mom(:,3,:)
864  gradt2_mom(:,2,:) = grad1_mom(:,4,:)
865  gradt2_mom(:,3,:) = grad2_mom(:,3,:)
866  gradt2_mom(:,4,:) = grad2_mom(:,4,:)
867  gradt2_mom(:,5,:) = grad3_mom(:,3,:)
868  gradt2_mom(:,6,:) = grad3_mom(:,4,:)
869 
870  !-----------------GradT u_z on Gauss points------------------------------------
871  gradt3_vel(:,1,:) = grad1_vel(:,5,:)
872  gradt3_vel(:,2,:) = grad1_vel(:,6,:)
873  gradt3_vel(:,3,:) = grad2_vel(:,5,:)
874  gradt3_vel(:,4,:) = grad2_vel(:,6,:)
875  gradt3_vel(:,5,:) = grad3_vel(:,5,:)
876  gradt3_vel(:,6,:) = grad3_vel(:,6,:)
877  !-----------------GradT mom_z on Gauss points----------------------------------
878  gradt3_mom(:,1,:) = grad1_mom(:,5,:)
879  gradt3_mom(:,2,:) = grad1_mom(:,6,:)
880  gradt3_mom(:,3,:) = grad2_mom(:,5,:)
881  gradt3_mom(:,4,:) = grad2_mom(:,6,:)
882  gradt3_mom(:,5,:) = grad3_mom(:,5,:)
883  gradt3_mom(:,6,:) = grad3_mom(:,6,:)
884 
885  !===Grad_vel = Grad_vel + Grad_vel^T
886  grad1_vel = grad1_vel + gradt1_vel
887  grad2_vel = grad2_vel + gradt2_vel
888  grad3_vel = grad3_vel + gradt3_vel
889  !===Grad_mom = Grad_mom + Grad_mom^T
890  grad1_mom = grad1_mom + gradt1_mom
891  grad2_mom = grad2_mom + gradt2_mom
892  grad3_mom = grad3_mom + gradt3_mom
893 
894  !===Compute (visc_dyn)*Grad^s(vel)
895  part_tensor_1 = grad1_vel(:,:,:)
896  part_tensor_2(:,1:4,:) = grad2_vel(:,3:6,:)
897  part_tensor_2(:,5:6,:) = grad3_vel(:,5:6,:)
898  m_max_pad = 3*SIZE(list_mode)*nb_procs/2
899  bloc_size = SIZE(grad1_vel,1)/nb_procs+1
900  CALL fft_compute_diffu_mom(communicator,part_tensor_1, part_tensor_2, visc_dyn_gauss, &
901  part_visc_sym_grad_1, part_visc_sym_grad_2, nb_procs, bloc_size, m_max_pad)
902 
903  !===Using strain rate tensor symmetry to get V_out = visc_dyn*Grad^s(vel)
904  v_out(1,:,:,:) = part_visc_sym_grad_1
905  v_out(2,:,1:2,:) = part_visc_sym_grad_1(:,3:4,:)
906  v_out(2,:,3:6,:) = part_visc_sym_grad_2(:,1:4,:)
907  v_out(3,:,1:2,:) = part_visc_sym_grad_1(:,5:6,:)
908  v_out(3,:,3:4,:) = part_visc_sym_grad_2(:,3:4,:)
909  v_out(3,:,5:6,:) = part_visc_sym_grad_2(:,5:6,:)
910 
911  !===Compute V2_out = stab_mom*Grad^s(mom)
912  v2_out(1,:,:,:) = grad1_mom
913  v2_out(2,:,:,:) = grad2_mom
914  v2_out(3,:,:,:) = grad3_mom
915 
916  END SUBROUTINE smb_explicit_diffu_correction
917 
918  SUBROUTINE smb_explicit_div_correction(communicator, mesh, list_mode, stab, vel, mom, c_out)
920  USE sft_parallele
921  USE chaine_caractere
922  USE boundary
923  USE input_data
924  IMPLICIT NONE
925  TYPE(mesh_type), TARGET :: mesh
926  INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
927  REAL(KIND=8), INTENT(IN) :: stab
928  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: vel
929  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: mom
930  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)), INTENT(OUT) :: c_out
931  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)) :: div_vel
932  REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)) :: div_mom
933  INTEGER, DIMENSION(mesh%gauss%n_w) :: j_loc
934  REAL(KIND=8), DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
935  REAL(KIND=8), DIMENSION(mesh%gauss%n_w,6) :: vel_loc
936  REAL(KIND=8), DIMENSION(mesh%gauss%n_w,6) :: mom_loc
937  REAL(KIND=8) :: ray
938  INTEGER :: m, l , i, mode, index, k
939  petscerrorcode :: ierr
940  petscmpiint :: rank
941  mpi_comm :: communicator
942  CALL mpi_comm_rank(communicator,rank,ierr)
943  CALL gauss(mesh)
944 
945  DO i = 1, SIZE(list_mode)
946  mode = list_mode(i)
947  index = 0
948  DO m = 1, mesh%dom_me
949  j_loc = mesh%jj(:,m)
950  DO k = 1, 6
951  vel_loc(:,k) = vel(j_loc,k,i)
952  mom_loc(:,k) = mom(j_loc,k,i)
953  END DO
954  DO l = 1, l_g
955  index = index + 1
956  dw_loc = dw(:,:,l,m)
957 
958  !===Compute radius of Gauss point
959  ray = sum(mesh%rr(1,j_loc)*ww(:,l))
960 
961  !-----------------Divergence vel on Gauss points---------------------------------
962  div_vel(index,1,i) = sum(vel_loc(:,1)*dw_loc(1,:)) &
963  + sum(vel_loc(:,1)*ww(:,l))/ray &
964  + mode*sum(vel_loc(:,4)*ww(:,l))/ray &
965  + sum(vel_loc(:,5)*dw_loc(2,:))
966  div_vel(index,2,i) = sum(vel_loc(:,2)*dw_loc(1,:)) &
967  + sum(vel_loc(:,2)*ww(:,l))/ray &
968  - mode*sum(vel_loc(:,3)*ww(:,l))/ray &
969  + sum(vel_loc(:,6)*dw_loc(2,:))
970 
971  !-----------------Divergence mom on Gauss points---------------------------------
972  div_mom(index,1,i) = sum(mom_loc(:,1)*dw_loc(1,:)) &
973  + sum(mom_loc(:,1)*ww(:,l))/ray &
974  + mode*sum(mom_loc(:,4)*ww(:,l))/ray &
975  + sum(mom_loc(:,5)*dw_loc(2,:))
976  div_mom(index,2,i) = sum(mom_loc(:,2)*dw_loc(1,:)) &
977  + sum(mom_loc(:,2)*ww(:,l))/ray &
978  - mode*sum(mom_loc(:,3)*ww(:,l))/ray &
979  + sum(mom_loc(:,6)*dw_loc(2,:))
980  ENDDO
981  ENDDO
982  END DO
983 
984  !===Compute c_out
985  c_out = div_vel - stab*div_mom
986 
987  END SUBROUTINE smb_explicit_div_correction
988 
989 !!$ SUBROUTINE smb_explicit_div_correction_new(communicator, mesh, list_mode, nb_procs, visc_dyn, stab, vel, mom, c_out)
990 !!$ USE Gauss_points
991 !!$ USE sft_parallele
992 !!$ USE chaine_caractere
993 !!$ USE boundary
994 !!$ USE input_data
995 !!$ IMPLICIT NONE
996 !!$ TYPE(mesh_type), TARGET :: mesh
997 !!$ INTEGER, INTENT(IN) :: nb_procs
998 !!$ INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
999 !!$ REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: visc_dyn
1000 !!$ REAL(KIND=8), INTENT(IN) :: stab
1001 !!$ REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: vel
1002 !!$ REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: mom
1003 !!$ REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)), INTENT(OUT) :: c_out
1004 !!$ REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)) :: div_vel
1005 !!$ REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)) :: div_mom
1006 !!$ REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)) :: visc_div_vel
1007 !!$ REAL(KIND=8), DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)) :: visc_dyn_gauss
1008 !!$ INTEGER, DIMENSION(mesh%gauss%n_w) :: j_loc
1009 !!$ REAL(KIND=8), DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
1010 !!$ REAL(KIND=8), DIMENSION(mesh%gauss%n_w,6) :: vel_loc
1011 !!$ REAL(KIND=8), DIMENSION(mesh%gauss%n_w,6) :: mom_loc
1012 !!$ REAL(KIND=8) :: ray
1013 !!$ INTEGER :: m, l , i, mode, index, k
1014 !!$ INTEGER :: m_max_pad, bloc_size
1015 !!$
1016 !!$ PetscErrorCode :: ierr
1017 !!$ PetscMPIInt :: rank
1018 !!$ MPI_Comm :: communicator
1019 !!$ CALL MPI_Comm_rank(communicator,rank,ierr)
1020 !!$ CALL gauss(mesh)
1021 !!$
1022 !!$ DO i = 1, SIZE(list_mode)
1023 !!$ mode = list_mode(i)
1024 !!$ index = 0
1025 !!$ DO m = 1, mesh%dom_me
1026 !!$ j_loc = mesh%jj(:,m)
1027 !!$ DO k = 1, 6
1028 !!$ vel_loc(:,k) = vel(j_loc,k,i)
1029 !!$ mom_loc(:,k) = mom(j_loc,k,i)
1030 !!$ END DO
1031 !!$ DO l = 1, l_G
1032 !!$ index = index + 1
1033 !!$ dw_loc = dw(:,:,l,m)
1034 !!$
1035 !!$ !===Compute radius of Gauss point
1036 !!$ ray = SUM(mesh%rr(1,j_loc)*ww(:,l))
1037 !!$
1038 !!$ !-----------------Dynamic viscosity on Gauss points---------------------------
1039 !!$ visc_dyn_gauss(index,1,i) = SUM(visc_dyn(j_loc,1,i)*ww(:,l))
1040 !!$ visc_dyn_gauss(index,2,i) = SUM(visc_dyn(j_loc,2,i)*ww(:,l))
1041 !!$
1042 !!$ !-----------------Divergence vel on Gauss points---------------------------------
1043 !!$ div_vel(index,1,i) = SUM(vel_loc(:,1)*dw_loc(1,:)) &
1044 !!$ + SUM(vel_loc(:,1)*ww(:,l))/ray &
1045 !!$ + mode*SUM(vel_loc(:,4)*ww(:,l))/ray &
1046 !!$ + SUM(vel_loc(:,5)*dw_loc(2,:))
1047 !!$ div_vel(index,2,i) = SUM(vel_loc(:,2)*dw_loc(1,:)) &
1048 !!$ + SUM(vel_loc(:,2)*ww(:,l))/ray &
1049 !!$ - mode*SUM(vel_loc(:,3)*ww(:,l))/ray &
1050 !!$ + SUM(vel_loc(:,6)*dw_loc(2,:))
1051 !!$
1052 !!$ !-----------------Divergence mom on Gauss points---------------------------------
1053 !!$ div_mom(index,1,i) = SUM(mom_loc(:,1)*dw_loc(1,:)) &
1054 !!$ + SUM(mom_loc(:,1)*ww(:,l))/ray &
1055 !!$ + mode*SUM(mom_loc(:,4)*ww(:,l))/ray &
1056 !!$ + SUM(mom_loc(:,5)*dw_loc(2,:))
1057 !!$ div_mom(index,2,i) = SUM(mom_loc(:,2)*dw_loc(1,:)) &
1058 !!$ + SUM(mom_loc(:,2)*ww(:,l))/ray &
1059 !!$ - mode*SUM(mom_loc(:,3)*ww(:,l))/ray &
1060 !!$ + SUM(mom_loc(:,6)*dw_loc(2,:))
1061 !!$ ENDDO
1062 !!$ ENDDO
1063 !!$ END DO
1064 !!$
1065 !!$ m_max_pad = 3*SIZE(list_mode)*nb_procs/2
1066 !!$ bloc_size = SIZE(div_vel,1)/nb_procs+1
1067 !!$ CALL FFT_PAR_PROD_DCL(communicator, visc_dyn_gauss, div_vel, visc_div_vel, nb_procs, bloc_size, m_max_pad)
1068 !!$
1069 !!$ !===Compute c_out
1070 !!$ c_out = visc_div_vel - stab*div_mom
1071 !!$
1072 !!$ END SUBROUTINE smb_explicit_div_correction_new
1073 
1074  SUBROUTINE smb_compute_tensor_gauss(communicator, mesh, list_mode, vel, mom, nb_procs, &
1075  bloc_size, m_max_pad, tensor, tensor_gauss)
1077  USE sft_parallele
1078  USE chaine_caractere
1079  USE boundary
1080  USE input_data
1081  IMPLICIT NONE
1082  TYPE(mesh_type), TARGET :: mesh
1083  INTEGER, INTENT(IN) :: nb_procs
1084  INTEGER, INTENT(IN) :: bloc_size
1085  INTEGER, INTENT(IN) :: m_max_pad
1086  INTEGER, DIMENSION(:), INTENT(IN) :: list_mode
1087  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: vel
1088  REAL(KIND=8), DIMENSION(:,:,:), INTENT(IN) :: mom
1089  REAL(KIND=8), DIMENSION(3,mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)), INTENT(OUT) :: tensor_gauss
1090  REAL(KIND=8), DIMENSION(3,mesh%np,6,SIZE(list_mode)) , INTENT(OUT) :: tensor
1091  INTEGER, DIMENSION(mesh%gauss%n_w) :: j_loc
1092  REAL(KIND=8), DIMENSION(mesh%gauss%n_w,6) :: tensor_loc
1093  INTEGER :: m, l , i, mode, index, k, n
1094  mpi_comm :: communicator
1095 
1096  CALL gauss(mesh)
1097 
1098  CALL fft_tensor_dcl(communicator, mom, vel, tensor, nb_procs, bloc_size, m_max_pad)
1099 
1100  DO n = 1, 3
1101  DO i = 1, SIZE(list_mode)
1102  mode = list_mode(i)
1103  index = 0
1104  DO m = 1, mesh%dom_me
1105  j_loc = mesh%jj(:,m)
1106  DO k = 1, 6
1107  tensor_loc(:,k) = tensor(n,j_loc,k,i)
1108  END DO
1109  DO l = 1, l_g
1110  index = index + 1
1111  !-----------------Tensor on Gauss points-----------------
1112  tensor_gauss(n,index,1,i) = sum(tensor_loc(:,1)*ww(:,l))
1113  tensor_gauss(n,index,2,i) = sum(tensor_loc(:,2)*ww(:,l))
1114  tensor_gauss(n,index,3,i) = sum(tensor_loc(:,3)*ww(:,l))
1115  tensor_gauss(n,index,4,i) = sum(tensor_loc(:,4)*ww(:,l))
1116  tensor_gauss(n,index,5,i) = sum(tensor_loc(:,5)*ww(:,l))
1117  tensor_gauss(n,index,6,i) = sum(tensor_loc(:,6)*ww(:,l))
1118  END DO
1119  ENDDO
1120  ENDDO
1121  END DO
1122 
1123  END SUBROUTINE smb_compute_tensor_gauss
1124 
1125  SUBROUTINE moy(communicator,mesh,p,RESLT)
1126  !===========================
1127  !moyenne
1128  USE def_type_mesh
1129  IMPLICIT NONE
1130  TYPE(mesh_type) :: mesh
1131  REAL(KIND=8), DIMENSION(:) , INTENT(IN) :: p
1132  REAL(KIND=8) , INTENT(OUT) :: RESLT
1133  REAL(KIND=8) :: vol_loc, vol_out, r_loc, r_out
1134  INTEGER :: m, l , i , ni, code
1135  INTEGER, DIMENSION(mesh%gauss%n_w) :: j_loc
1136  REAL(KIND=8) :: ray
1137  mpi_comm :: communicator
1138  r_loc = 0.d0
1139  vol_loc = 0.d0
1140 
1141  DO m = 1, mesh%dom_me
1142  j_loc = mesh%jj(:,m)
1143  DO l = 1, mesh%gauss%l_G
1144  ray = 0
1145  DO ni = 1, mesh%gauss%n_w; i = j_loc(ni)
1146  ray = ray + mesh%rr(1,i)*mesh%gauss%ww(ni,l)
1147  END DO
1148 
1149  r_loc = r_loc + sum(p(j_loc(:))*mesh%gauss%ww(:,l))*ray*mesh%gauss%rj(l,m)
1150  vol_loc = vol_loc + ray*mesh%gauss%rj(l,m)
1151 
1152  ENDDO
1153  ENDDO
1154 
1155  CALL mpi_allreduce(r_loc,r_out,1,mpi_double_precision, mpi_sum, communicator, code)
1156  CALL mpi_allreduce(vol_loc,vol_out,1,mpi_double_precision, mpi_sum, communicator, code)
1157  reslt = r_out / vol_out
1158 
1159  END SUBROUTINE moy
1160 
subroutine solver(my_ksp, b, x, reinit, verbose)
Definition: solver.f90:99
subroutine, public rhs_ns_gauss_3x3_art_comp_mom(vv_mesh, pp_mesh, communicator, list_mode, time, V1m, pn, rotv_v, rhs_gauss, tempn, density)
subroutine, public bdf1_art_comp_with_m(comm_one_d, time, vv_3_LA, pp_1_LA, vvz_per, pp_per, dt, Re, list_mode, pp_mesh, vv_mesh, pn_m1, pn, un_m1, un, Hn_p2, Bn_p2, tempn, density_m1, density, density_p1, visco_dyn, level_set_p1, visc_entro_level)
subroutine, public extract(xghost, ks, ke, LA, phi)
Definition: st_csr.f90:34
integer, public l_g
subroutine, public create_my_ghost(mesh, LA, ifrom)
Definition: st_csr.f90:15
subroutine, public smb_surface_tension(communicator, mesh, list_mode, nb_procs, level_set, tensor_surface_gauss)
subroutine, public fft_tensor_dcl(communicator, V1_in, V2_in, V_out, nb_procs, bloc_size, m_max_pad, temps, opt_tension)
subroutine qs_01_div_hybrid_2006(vv_mesh, pp_mesh, pp_LA, mode, gg, pb_1, pb_2)
subroutine, public smb_compute_tensor_gauss(communicator, mesh, list_mode, vel, mom, nb_procs, bloc_size, m_max_pad, tensor, tensor_gauss)
subroutine, public project_p2_p1(jj_P2, jj_P1, pp_P2, pp_P1)
Definition: sub_mass.f90:291
subroutine, public compute_entropy_viscosity_mom(comm_one_d, vv_3_LA, vv_mesh, pp_mesh, time, list_mode, momentum, momentum_m1, momentum_m2, pn_m1, un_m1, tensor_m1, visc_grad_vel_m1, tensor_surface_gauss, rotb_b_m1, visco_dyn_m1, density_m2, density_m1, density, tempn, visc_entro_real, visc_entro_level_real)
subroutine create_local_petsc_matrix(communicator, LA, matrix, clean)
Definition: solver.f90:147
subroutine error_petsc(string)
Definition: my_util.f90:16
type(my_data), public inputs
real(kind=8) function user_time()
Definition: my_util.f90:8
subroutine, public fft_par_cross_prod_dcl(communicator, V1_in, V2_in, V_out, nb_procs, bloc_size, m_max_pad, temps)
subroutine smb_explicit_diffu_correction(communicator, mesh, list_mode, nb_procs, visc_dyn, stab_mom, vel, mom, V_out, V2_out)
subroutine, public smb_explicit_diffu_sym(communicator, mesh, list_mode, nb_procs, visc_dyn, vel, V_out)
subroutine qs_diff_mass_scal_m(mesh, LA, visco, mass, stab, mode, matrix)
Definition: fem_M_axi.f90:130
subroutine, public fft_compute_diffu_mom(communicator, V1_in, V2_in, V3_in, V1_out, V2_out, nb_procs, bloc_size, m_max_pad, temps)
subroutine, public fft_par_prod_dcl(communicator, c1_in, c2_in, c_out, nb_procs, bloc_size, m_max_pad, temps)
subroutine init_solver(my_par, my_ksp, matrix, communicator, solver, precond, opt_re_init)
Definition: solver.f90:12
subroutine dirichlet_rhs(js_D, bs_D, b)
subroutine rhs_3x3_art_comp(mesh, vv_3_LA, mode, rhs_in, vb_145, vb_236, opt_tensor, opt_grad_div)
subroutine vector_glob_js_d(vv_mesh, list_mode, vv_3_LA, vv_list_dirichlet_sides, vv_js_D, vv_mode_global_js_D)
subroutine, public compute_entropy_viscosity_mom_no_level_set(comm_one_d, vv_3_LA, vv_mesh, pp_mesh, time, list_mode, momentum, momentum_m1, momentum_m2, pn_m1, un_m1, tensor_m1, rotb_b_m1, tempn, visc_entro_real)
subroutine, public periodic_matrix_petsc(n_bord, list, perlist, matrix, LA)
Definition: tn_axi.f90:5
subroutine smb_explicit_div_correction(communicator, mesh, list_mode, stab, vel, mom, c_out)
subroutine, public momentum_dirichlet(communicator, mesh, list_mode, t, nb_procs, density, momentum_exact, vv_js_D)
subroutine dirichlet_m_parallel(matrix, glob_js_D)
type(my_verbose), public talk_to_me
Definition: verbose.f90:27
real(kind=8) function norm_sf(communicator, norm_type, mesh, list_mode, v)
Definition: tn_axi.f90:40
subroutine, public fft_scalar_vect_dcl(communicator, V1_in, V2_in, V_out, pb, nb_procs, bloc_size, m_max_pad, temps)
subroutine qs_diff_mass_vect_3x3_divpenal_art_comp(type_op, LA, mesh, visco, mass, stab, stab_bdy_ns, stab_art_comp, i_mode, mode, matrix)
Definition: fem_M_axi.f90:1205
subroutine, public smb_explicit_les(communicator, mesh, list_mode, nb_procs, visc_entro_real, mom, V_out)
subroutine, public inject_p1_p2(jj_c, jj_f, pp_c, pp_f)
Definition: sub_mass.f90:270
subroutine gauss(mesh)
subroutine moy(communicator, mesh, p, RESLT)
real(kind=8), dimension(:,:,:,:), pointer dw
real(kind=8), dimension(:,:), pointer ww
subroutine, public periodic_rhs_petsc(n_bord, list, perlist, v_rhs, LA)
subroutine smb_curlh_cross_b_gauss_sft_par(communicator, mesh, list_mode, V_in, W_in, V_out)
subroutine scalar_without_glob_js_d(pp_mesh, list_mode, pp_1_LA, pp_mode_global_js_D)