11 SUBROUTINE bdf2_ns_stress_bc_with_u(comm_one_d, time, vv_3_LA, pp_1_LA, vvz_per, pp_per, dt, Re, list_mode, pp_mesh, &
12 vv_mesh, incpn_m1, incpn, pn_m1, pn, un_m1, un, &
13 chmp_mag, bn_p2, opt_tempn)
36 REAL(KIND=8) :: time, dt, re
37 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
38 TYPE(mesh_type),
INTENT(IN) :: pp_mesh, vv_mesh
41 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(INOUT) :: incpn_m1, incpn
42 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(INOUT) :: pn_m1, pn
43 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(INOUT) :: un_m1, un
44 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN),
OPTIONAL:: opt_tempn
45 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: chmp_mag, bn_p2
46 REAL(KIND=8),
DIMENSION(vv_mesh%np,6,SIZE(list_mode)):: chmp_mag_aux
48 INTEGER,
SAVE :: m_max_c
51 TYPE(dyn_real_line),
DIMENSION(:),
ALLOCATABLE,
SAVE :: pp_global_d
52 TYPE(dyn_int_line),
DIMENSION(:),
POINTER,
SAVE :: pp_mode_global_js_d
55 TYPE(dyn_int_line),
DIMENSION(:),
POINTER,
SAVE :: vv_mode_global_js_d
56 TYPE(dyn_real_line),
DIMENSION(:),
ALLOCATABLE,
SAVE :: vel_global_d
57 LOGICAL,
SAVE :: once = .true.
58 INTEGER,
SAVE :: my_petscworld_rank
59 REAL(KIND=8),
DIMENSION(:,:,:,:),
ALLOCATABLE,
SAVE :: visco_entro_sym_grad_u
63 INTEGER,
POINTER,
DIMENSION(:) :: pp_1_ifrom, vv_3_ifrom
65 INTEGER :: i, k, m, n, n1, n2, n3, n123
66 INTEGER :: nb_procs, code, nu_mat, mode
67 REAL(KIND=8) :: moyenne
69 REAL(KIND=8),
DIMENSION(pp_mesh%np, 2, SIZE(list_mode)) :: div
70 REAL(KIND=8),
DIMENSION(pp_mesh%np, 2) :: pn_p1, phi
71 REAL(KIND=8),
DIMENSION(vv_mesh%np, 6) :: un_p1
72 REAL(KIND=8),
DIMENSION(vv_mesh%np, 6, SIZE(list_mode)) :: un_m2
73 REAL(KIND=8),
DIMENSION(vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: rotv_v, rotb_b, rotb_b_aux
74 REAL(KIND=8),
DIMENSION(vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: kelvin_force
75 REAL(KIND=8),
DIMENSION(vv_mesh%gauss%l_G*vv_mesh%dom_me,6,SIZE(list_mode)) :: rhs_gauss
76 REAL(KIND=8),
DIMENSION(vv_mesh%np,6,SIZE(list_mode)) :: uext
77 REAL(KIND=8),
DIMENSION(vv_mesh%np) :: vel_loc, vel_tot
78 REAL(KIND=8) :: tps, tps_tot, tps_cumul, coeff, vloc, cfl, cfl_max, norm
80 REAL(KIND=8) :: one, zero, three
81 DATA zero, one, three/0.d0,1.d0,3.d0/
84 #include "petsc/finclude/petsc.h"
85 petscerrorcode :: ierr
86 mpi_comm,
DIMENSION(:),
POINTER :: comm_one_d
87 mat,
DIMENSION(:),
POINTER,
SAVE :: vel_mat
88 mat,
DIMENSION(:),
POINTER,
SAVE :: press_mat
89 mat,
SAVE :: mass_mat, mass_mat0
90 vec,
SAVE :: vb_3_145, vb_3_236, vx_3, vx_3_ghost
91 vec,
SAVE :: pb_1, pb_2, px_1, px_1_ghost
92 ksp,
DIMENSION(:),
POINTER,
SAVE :: vel_ksp, press_ksp
93 ksp,
SAVE :: mass_ksp, mass_ksp0
98 CALL mpi_comm_rank(petsc_comm_world,my_petscworld_rank,code)
103 CALL veccreateghost(comm_one_d(1), n, &
104 petsc_determine,
SIZE(vv_3_ifrom), vv_3_ifrom, vx_3, ierr)
105 CALL vecghostgetlocalform(vx_3, vx_3_ghost, ierr)
106 CALL vecduplicate(vx_3, vb_3_145, ierr)
107 CALL vecduplicate(vx_3, vb_3_236, ierr)
111 CALL veccreateghost(comm_one_d(1), n, &
112 petsc_determine,
SIZE(pp_1_ifrom), pp_1_ifrom, px_1, ierr)
113 CALL vecghostgetlocalform(px_1, px_1_ghost, ierr)
114 CALL vecduplicate(px_1, pb_1, ierr)
115 CALL vecduplicate(px_1, pb_2, ierr)
119 m_max_c =
SIZE(list_mode)
125 ALLOCATE(pp_global_d(m_max_c))
127 ALLOCATE(pp_global_d(i)%DRL(
SIZE(pp_mode_global_js_d(i)%DIL)))
132 CALL
vector_glob_js_d(vv_mesh, list_mode, vv_3_la, inputs%vv_list_dirichlet_sides, &
133 vv_js_d, vv_mode_global_js_d)
135 ALLOCATE(vel_global_d(m_max_c))
137 ALLOCATE(vel_global_d(i)%DRL(
SIZE(vv_mode_global_js_d(i)%DIL)))
144 IF (inputs%my_periodic%nb_periodic_pairs/=0)
THEN
148 IF (list_mode(i)==0) cycle
151 CALL
init_solver(inputs%my_par_mass,mass_ksp,mass_mat,comm_one_d(1),&
152 solver=inputs%my_par_mass%solver,precond=inputs%my_par_mass%precond)
154 IF (minval(list_mode)==0)
THEN
157 IF (inputs%my_periodic%nb_periodic_pairs/=0)
THEN
161 IF (list_mode(i).NE.0) cycle
163 CALL
init_solver(inputs%my_par_mass,mass_ksp0,mass_mat0,comm_one_d(1),&
164 solver=inputs%my_par_mass%solver,precond=inputs%my_par_mass%precond)
170 ALLOCATE(visco_entro_sym_grad_u(3,vv_mesh%gauss%l_G*vv_mesh%dom_me,6,
SIZE(list_mode)))
171 visco_entro_sym_grad_u = 0.d0
172 ALLOCATE(vel_mat(2*m_max_c),vel_ksp(2*m_max_c))
173 ALLOCATE(press_mat(m_max_c),press_ksp(m_max_c))
180 inputs%LES_coeff1, inputs%stab_bdy_ns, mode, vel_mat(nu_mat))
181 IF (inputs%my_periodic%nb_periodic_pairs/=0)
THEN
183 vel_mat(nu_mat), vv_3_la)
186 CALL
init_solver(inputs%my_par_vv,vel_ksp(nu_mat),vel_mat(nu_mat),comm_one_d(1),&
187 solver=inputs%my_par_vv%solver,precond=inputs%my_par_vv%precond)
191 inputs%LES_coeff1, inputs%stab_bdy_ns, mode, vel_mat(nu_mat))
192 IF (inputs%my_periodic%nb_periodic_pairs/=0)
THEN
194 vel_mat(nu_mat), vv_3_la)
197 CALL
init_solver(inputs%my_par_vv,vel_ksp(nu_mat),vel_mat(nu_mat),comm_one_d(1),&
198 solver=inputs%my_par_vv%solver,precond=inputs%my_par_vv%precond)
206 IF (inputs%my_periodic%nb_periodic_pairs/=0)
THEN
210 CALL
init_solver(inputs%my_par_pp,press_ksp(i),press_mat(i),comm_one_d(1),&
211 solver=inputs%my_par_pp%solver,precond=inputs%my_par_pp%precond)
224 IF (inputs%type_pb==
'mhd')
THEN
226 IF (inputs%if_quasi_static_approx)
THEN
237 rotb_b = rotb_b + rotb_b_aux
241 rotv_v = rotv_v - rotb_b
244 IF (inputs%type_pb==
'fhd')
THEN
247 rotv_v = rotv_v - kelvin_force
250 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
254 IF (inputs%verbose_CFL)
THEN
257 IF (list_mode(i)==0)
THEN
262 vel_loc = vel_loc + coeff*(un(:,1,i)**2+un(:,2,i)**2+un(:,3,i)**2 &
263 +un(:,4,i)**2+un(:,5,i)**2+un(:,6,i)**2)
265 CALL mpi_comm_size(comm_one_d(2),nb_procs,code)
266 CALL mpi_allreduce(vel_loc,vel_tot,vv_mesh%np,mpi_double_precision, mpi_sum, comm_one_d(2), code)
267 vel_tot = sqrt(vel_tot)
269 DO m = 1, vv_mesh%dom_me
270 vloc = maxval(vel_tot(vv_mesh%jj(:,m)))
271 cfl = max(vloc*dt/min(vv_mesh%hloc(m),0.5d0/inputs%m_max),cfl)
273 CALL mpi_allreduce(cfl,cfl_max,1,mpi_double_precision, mpi_max, comm_one_d(1), code)
274 talk_to_me%CFL=cfl_max
280 IF (present(opt_tempn))
THEN
282 (4*un-un_m1)/(2*inputs%dt), pn, (4.d0*incpn-incpn_m1)/3.d0, &
283 rotv_v, rhs_gauss, opt_tempn=opt_tempn)
286 (4*un-un_m1)/(2*inputs%dt), pn, (4.d0*incpn-incpn_m1)/3.d0, &
296 pn_p1(:,:) = pn(:,:,i)
300 CALL
rhs_3x3(vv_mesh, vv_3_la, mode, rhs_gauss(:,:,i), vb_3_145, vb_3_236, &
301 opt_tensor=-visco_entro_sym_grad_u(:,:,:,i))
303 CALL
rhs_3x3(vv_mesh, vv_3_la, mode, rhs_gauss(:,:,i), vb_3_145, vb_3_236)
306 IF (inputs%my_periodic%nb_periodic_pairs/=0)
THEN
307 CALL
periodic_rhs_petsc(vvz_per%n_bord, vvz_per%list, vvz_per%perlist, vb_3_236, vv_3_la)
308 CALL
periodic_rhs_petsc(vvz_per%n_bord, vvz_per%list, vvz_per%perlist, vb_3_145, vv_3_la)
311 n1 =
SIZE(vv_js_d(1)%DIL)
312 n2 =
SIZE(vv_js_d(2)%DIL)
313 n3 =
SIZE(vv_js_d(3)%DIL)
315 vel_global_d(i)%DRL(1:n1) =
vv_exact(1,vv_mesh%rr(:,vv_js_d(1)%DIL), mode, time)
316 vel_global_d(i)%DRL(n1+1:n1+n2) =
vv_exact(4,vv_mesh%rr(:,vv_js_d(2)%DIL), mode, time)
317 vel_global_d(i)%DRL(n1+n2+1:n123)=
vv_exact(5,vv_mesh%rr(:,vv_js_d(3)%DIL), mode, time)
318 vel_global_d(i)%DRL(n123+1:) = 0.d0
319 CALL
dirichlet_rhs(vv_mode_global_js_d(i)%DIL-1,vel_global_d(i)%DRL,vb_3_145)
320 vel_global_d(i)%DRL(1:n1) =
vv_exact(2,vv_mesh%rr(:,vv_js_d(1)%DIL), mode, time)
321 vel_global_d(i)%DRL(n1+1:n1+n2) =
vv_exact(3,vv_mesh%rr(:,vv_js_d(2)%DIL), mode, time)
322 vel_global_d(i)%DRL(n1+n2+1:n123)=
vv_exact(6,vv_mesh%rr(:,vv_js_d(3)%DIL), mode, time)
323 CALL
dirichlet_rhs(vv_mode_global_js_d(i)%DIL-1,vel_global_d(i)%DRL,vb_3_236)
324 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
331 CALL
solver(vel_ksp(nu_mat),vb_3_145,vx_3,reinit=.false.,
verbose=inputs%my_par_vv%verbose)
332 CALL vecghostupdatebegin(vx_3,insert_values,scatter_forward,ierr)
333 CALL vecghostupdateend(vx_3,insert_values,scatter_forward,ierr)
334 CALL
extract(vx_3_ghost,1,1,vv_3_la,un_p1(:,1))
335 CALL
extract(vx_3_ghost,2,2,vv_3_la,un_p1(:,4))
336 CALL
extract(vx_3_ghost,3,3,vv_3_la,un_p1(:,5))
340 CALL
solver(vel_ksp(nu_mat),vb_3_236,vx_3,reinit=.false.,
verbose=inputs%my_par_vv%verbose)
341 CALL vecghostupdatebegin(vx_3,insert_values,scatter_forward,ierr)
342 CALL vecghostupdateend(vx_3,insert_values,scatter_forward,ierr)
343 CALL
extract(vx_3_ghost,1,1,vv_3_la,un_p1(:,2))
344 CALL
extract(vx_3_ghost,2,2,vv_3_la,un_p1(:,3))
345 CALL
extract(vx_3_ghost,3,3,vv_3_la,un_p1(:,6))
347 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
355 IF (inputs%my_periodic%nb_periodic_pairs/=0)
THEN
362 pp_global_d(i)%DRL = 0.d0
363 CALL
dirichlet_rhs(pp_mode_global_js_d(i)%DIL-1,pp_global_d(i)%DRL,pb_1)
364 CALL
dirichlet_rhs(pp_mode_global_js_d(i)%DIL-1,pp_global_d(i)%DRL,pb_2)
368 CALL
solver(press_ksp(i),pb_1,px_1,reinit=.false.,
verbose=inputs%my_par_pp%verbose)
369 CALL vecghostupdatebegin(px_1,insert_values,scatter_forward,ierr)
370 CALL vecghostupdateend(px_1,insert_values,scatter_forward,ierr)
371 CALL
extract(px_1_ghost,1,1,pp_1_la,phi(:,1))
373 CALL
solver(press_ksp(i),pb_2,px_1,reinit=.false.,
verbose=inputs%my_par_pp%verbose)
374 CALL vecghostupdatebegin(px_1,insert_values,scatter_forward,ierr)
375 CALL vecghostupdateend(px_1,insert_values,scatter_forward,ierr)
376 CALL
extract(px_1_ghost,1,1,pp_1_la,phi(:,2))
378 phi = -phi*(1.5d0/dt)
379 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
385 CALL
solver(mass_ksp0,pb_1,px_1,reinit=.false.,
verbose=inputs%my_par_mass%verbose)
387 CALL
solver(mass_ksp,pb_1,px_1,reinit=.false.,
verbose=inputs%my_par_mass%verbose)
389 CALL vecghostupdatebegin(px_1,insert_values,scatter_forward,ierr)
390 CALL vecghostupdateend(px_1,insert_values,scatter_forward,ierr)
391 CALL
extract(px_1_ghost,1,1,pp_1_la,div(:,1,i))
393 CALL
solver(mass_ksp0,pb_2,px_1,reinit=.false.,
verbose=inputs%my_par_mass%verbose)
395 CALL
solver(mass_ksp,pb_2,px_1,reinit=.false.,
verbose=inputs%my_par_mass%verbose)
397 CALL vecghostupdatebegin(px_1,insert_values,scatter_forward,ierr)
398 CALL vecghostupdateend(px_1,insert_values,scatter_forward,ierr)
399 CALL
extract(px_1_ghost,1,1,pp_1_la,div(:,2,i))
405 pn_p1(:,k) = pn_p1(:,k) + phi(:,k) - 2*div(:,k,i)/re - inputs%div_stab_in_ns*div(:,k,i)
407 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
414 CALL
moy(comm_one_d(1),pp_mesh, pn_p1(:,1),moyenne)
415 pn_p1(:,1) = pn_p1(:,1)-moyenne
429 un_m2(:,:,i) = un_m1(:,:,i)
432 un_m1(:,:,i) = un(:,:,i)
434 pn_m1(:,:,i) = pn(:,:,i)
436 incpn_m1(:,:,i) = incpn(:,:,i)
438 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
443 IF (inputs%verbose_divergence)
THEN
444 norm =
norm_sf(comm_one_d,
'H1', vv_mesh, list_mode, un)
445 talk_to_me%div_L2 =
norm_sf(comm_one_d,
'div', vv_mesh, list_mode, un)/norm
446 talk_to_me%weak_div_L2 =
norm_sf(comm_one_d,
'L2', pp_mesh, list_mode, div)/norm
451 IF (present(opt_tempn))
THEN
453 un, un_m1, un_m2, pn_m1, rotv_v, visco_entro_sym_grad_u, opt_tempn)
456 un, un_m1, un_m2, pn_m1, rotv_v, visco_entro_sym_grad_u)
504 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
505 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: v_in
506 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(OUT) :: v_out
507 LOGICAL,
INTENT(IN) :: precession_in
508 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%me,6,SIZE(list_mode)) :: rotv, w, om
509 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
510 REAL(KIND=8),
DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
511 INTEGER :: m, l , i, mode, index, k
512 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,6) :: vs, omega_s
514 REAL(KIND=8) :: tps, pi
515 REAL(KIND=8),
DIMENSION(3) :: temps
516 REAL(KIND=8),
DIMENSION(:,:,:),
ALLOCATABLE,
SAVE :: omega
517 LOGICAL,
SAVE :: once=.true.
519 INTEGER :: nb_procs, bloc_size, m_max_pad, code
520 #include "petsc/finclude/petsc.h"
521 mpi_comm :: communicator
525 ALLOCATE(omega(mesh%np,6,
SIZE(list_mode)))
528 DO i=1,
SIZE(list_mode)
529 IF (list_mode(i) == 1)
THEN
531 omega(:,1,i) = inputs%taux_precession * sin(inputs%angle_s_pi*pi)
532 omega(:,4,i) = -inputs%taux_precession * sin(inputs%angle_s_pi*pi)
533 ELSE IF (list_mode(i) == 0)
THEN
535 omega(:,5,i) = inputs%taux_precession * cos(inputs%angle_s_pi*pi)
541 DO i = 1,
SIZE(list_mode)
547 vs(:,k) = v_in(j_loc,k,i)
548 omega_s(:,k) = omega(mesh%jj(:,m),k,i)
551 DO l = 1, mesh%gauss%l_G
553 dw_loc = mesh%gauss%dw(:,:,l,m)
556 ray = sum(mesh%rr(1,j_loc)*mesh%gauss%ww(:,l))
559 w(index,1,i) = sum(vs(:,1)*mesh%gauss%ww(:,l))
560 w(index,3,i) = sum(vs(:,3)*mesh%gauss%ww(:,l))
561 w(index,5,i) = sum(vs(:,5)*mesh%gauss%ww(:,l))
563 w(index,2,i) = sum(vs(:,2)*mesh%gauss%ww(:,l))
564 w(index,4,i) = sum(vs(:,4)*mesh%gauss%ww(:,l))
565 w(index,6,i) = sum(vs(:,6)*mesh%gauss%ww(:,l))
567 om(index,1,i) = sum(omega_s(:,1)*mesh%gauss%ww(:,l))
568 om(index,3,i) = sum(omega_s(:,3)*mesh%gauss%ww(:,l))
569 om(index,5,i) = sum(omega_s(:,5)*mesh%gauss%ww(:,l))
571 om(index,2,i) = sum(omega_s(:,2)*mesh%gauss%ww(:,l))
572 om(index,4,i) = sum(omega_s(:,4)*mesh%gauss%ww(:,l))
573 om(index,6,i) = sum(omega_s(:,6)*mesh%gauss%ww(:,l))
576 rotv(index,1,i) = mode/ray*w(index,6,i) &
577 -sum(vs(:,3)*dw_loc(2,:))
578 rotv(index,4,i) = sum(vs(:,2)*dw_loc(2,:)) &
579 -sum(vs(:,6)*dw_loc(1,:))
580 rotv(index,5,i) = 1/ray*w(index,3,i) &
581 +sum(vs(:,3)*dw_loc(1,:)) &
582 -mode/ray*w(index,2,i)
584 rotv(index,2,i) =-mode/ray*w(index,5,i) &
585 -sum(vs(:,4)*dw_loc(2,:))
586 rotv(index,3,i) = sum(vs(:,1)*dw_loc(2,:)) &
587 -sum(vs(:,5)*dw_loc(1,:))
588 rotv(index,6,i) = 1/ray*w(index,4,i) &
589 +sum(vs(:,4)*dw_loc(1,:))&
590 +mode/ray*w(index,1,i)
596 IF (.NOT.precession_in)
THEN
602 rotv = rotv + 2.d0 * om
606 CALL mpi_comm_size(communicator, nb_procs, code)
607 bloc_size =
SIZE(rotv,1)/nb_procs+1
608 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
622 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
623 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: v_in, w_in
624 REAL(KIND=8),
DIMENSION(:,:,:) :: v_out
625 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%me,6,SIZE(list_mode)) :: rotv, v, w
626 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
627 REAL(KIND=8),
DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
628 INTEGER :: m, l , i, mode, index, k
629 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,6) :: vs, ws
632 REAL(KIND=8),
DIMENSION(3) :: temps
634 INTEGER :: nb_procs, bloc_size, m_max_pad, code
635 #include "petsc/finclude/petsc.h"
636 mpi_comm :: communicator
639 DO i = 1,
SIZE(list_mode)
645 vs(:,k) = v_in(j_loc,k,i)
646 ws(:,k) = w_in(j_loc,k,i)
649 DO l = 1, mesh%gauss%l_G
651 dw_loc = mesh%gauss%dw(:,:,l,m)
654 ray = sum(mesh%rr(1,j_loc)*mesh%gauss%ww(:,l))
657 w(index,1,i) = sum(ws(:,1)*mesh%gauss%ww(:,l))
658 w(index,3,i) = sum(ws(:,3)*mesh%gauss%ww(:,l))
659 w(index,5,i) = sum(ws(:,5)*mesh%gauss%ww(:,l))
661 w(index,2,i) = sum(ws(:,2)*mesh%gauss%ww(:,l))
662 w(index,4,i) = sum(ws(:,4)*mesh%gauss%ww(:,l))
663 w(index,6,i) = sum(ws(:,6)*mesh%gauss%ww(:,l))
664 v(index,1,i) = sum(vs(:,1)*mesh%gauss%ww(:,l))
665 v(index,3,i) = sum(vs(:,3)*mesh%gauss%ww(:,l))
666 v(index,5,i) = sum(vs(:,5)*mesh%gauss%ww(:,l))
668 v(index,2,i) = sum(vs(:,2)*mesh%gauss%ww(:,l))
669 v(index,4,i) = sum(vs(:,4)*mesh%gauss%ww(:,l))
670 v(index,6,i) = sum(vs(:,6)*mesh%gauss%ww(:,l))
673 rotv(index,1,i) = mode/ray*v(index,6,i) &
674 -sum(vs(:,3)*dw_loc(2,:))
675 rotv(index,4,i) = sum(vs(:,2)*dw_loc(2,:)) &
676 -sum(vs(:,6)*dw_loc(1,:))
677 rotv(index,5,i) = 1/ray*v(index,3,i) &
678 +sum(vs(:,3)*dw_loc(1,:)) &
679 -mode/ray*v(index,2,i)
681 rotv(index,2,i) =-mode/ray*v(index,5,i) &
682 -sum(vs(:,4)*dw_loc(2,:))
683 rotv(index,3,i) = sum(vs(:,1)*dw_loc(2,:)) &
684 -sum(vs(:,5)*dw_loc(1,:))
685 rotv(index,6,i) = 1/ray*v(index,4,i) &
686 +sum(vs(:,4)*dw_loc(1,:))&
687 +mode/ray*v(index,1,i)
698 CALL mpi_comm_size(communicator, nb_procs, code)
699 bloc_size =
SIZE(rotv,1)/nb_procs+1
700 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
718 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
719 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: scal_in, vect_in
720 REAL(KIND=8),
DIMENSION(:,:,:) :: vect_out
721 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%me,2,SIZE(list_mode)) :: scal_in_gauss
722 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%me,2,SIZE(list_mode)) :: vect_in_square
723 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%me,6,SIZE(list_mode)) :: grad_vect_in_square
724 INTEGER :: i, mode, index, m, k, l
725 INTEGER,
DIMENSION(:,:),
POINTER :: jj
726 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
727 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,2) :: scal_in_loc, vect_in_square_loc
728 REAL(KIND=8),
DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
731 INTEGER :: nb_procs, bloc_size, m_max_pad, code
732 #include "petsc/finclude/petsc.h"
733 mpi_comm :: communicator
738 CALL mpi_comm_size(communicator, nb_procs, code)
739 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
744 DO i = 1,
SIZE(list_mode)
746 DO m = 1, mesh%dom_me
749 scal_in_loc(:,k) = scal_in(j_loc,k,i)
754 scal_in_gauss(index,1,i) = sum(scal_in_loc(:,1)*ww(:,l))
755 scal_in_gauss(index,2,i) = sum(scal_in_loc(:,2)*ww(:,l))
761 bloc_size =
SIZE(vect_in,1)/nb_procs+1
762 CALL
fft_par_dot_prod_dcl(communicator, vect_in, vect_in, vect_in_square, nb_procs, bloc_size, m_max_pad)
765 DO i = 1,
SIZE(list_mode)
768 DO m = 1, mesh%dom_me
771 vect_in_square_loc(:,k) = vect_in_square(j_loc,k,i)
776 rad = sum(mesh%rr(1,jj(:,m))*ww(:,l))
777 grad_vect_in_square(index,1,i) = sum(vect_in_square_loc(:,1)*dw_loc(1,:))
778 grad_vect_in_square(index,2,i) = sum(vect_in_square_loc(:,2)*dw_loc(1,:))
779 grad_vect_in_square(index,3,i) = mode/rad * sum(vect_in_square_loc(:,2)*ww(:,l))
780 grad_vect_in_square(index,4,i) = - mode/rad * sum(vect_in_square_loc(:,1)*ww(:,l))
781 grad_vect_in_square(index,5,i) = sum(vect_in_square_loc(:,1)*dw_loc(2,:))
782 grad_vect_in_square(index,6,i) = sum(vect_in_square_loc(:,2)*dw_loc(2,:))
788 bloc_size =
SIZE(scal_in_gauss,1)/nb_procs+1
789 CALL
fft_kelvin_force(communicator, 0.5*grad_vect_in_square, scal_in_gauss, vect_out, nb_procs, bloc_size, m_max_pad)
793 SUBROUTINE moy(communicator,mesh,p,RESLT)
799 REAL(KIND=8),
DIMENSION(:) ,
INTENT(IN) :: p
800 REAL(KIND=8) ,
INTENT(OUT) :: reslt
801 REAL(KIND=8) :: vol_loc, vol_out, r_loc, r_out
802 INTEGER :: m, l , i , ni, code
803 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
805 #include "petsc/finclude/petsc.h"
806 mpi_comm :: communicator
810 DO m = 1, mesh%dom_me
812 DO l = 1, mesh%gauss%l_G
814 DO ni = 1, mesh%gauss%n_w; i = j_loc(ni)
815 ray = ray + mesh%rr(1,i)*mesh%gauss%ww(ni,l)
818 r_loc = r_loc + sum(p(j_loc(:))*mesh%gauss%ww(:,l))*ray*mesh%gauss%rj(l,m)
819 vol_loc = vol_loc + ray*mesh%gauss%rj(l,m)
824 CALL mpi_allreduce(r_loc,r_out,1,mpi_double_precision, mpi_sum, communicator, code)
825 CALL mpi_allreduce(vol_loc,vol_out,1,mpi_double_precision, mpi_sum, communicator, code)
826 reslt = r_out / vol_out
subroutine, public fft_par_dot_prod_dcl(communicator, V1_in, V2_in, c_out, nb_procs, bloc_size, m_max_pad, temps)
subroutine, public fft_kelvin_force(communicator, V1_in, V2_in, V_out, nb_procs, bloc_size, m_max_pad, temps)
subroutine smb_curlh_cross_b_gauss_sft_par(communicator, mesh, list_mode, V_in, W_in, V_out)
subroutine smb_kelvin_force_gauss_sft_par(communicator, mesh, list_mode, scal_in, vect_in, vect_out)
subroutine, public create_my_ghost(mesh, LA, ifrom)
subroutine dirichlet_rhs(js_D, bs_D, b)
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 scalar_glob_js_d(pp_mesh, list_mode, pp_1_LA, pp_mode_global_js_D)
subroutine init_solver(my_par, my_ksp, matrix, communicator, solver, precond, opt_re_init)
subroutine rhs_3x3(mesh, vv_3_LA, mode, rhs_in, vb_145, vb_236, opt_tensor, opt_tensor_scaln_bdy)
real(kind=8) function, dimension(size(rr, 2), 6), public h_b_quasi_static(char_h_b, rr, m)
subroutine qs_diff_mass_scal_m(mesh, LA, visco, mass, stab, mode, matrix)
subroutine, public rhs_ns_gauss_3x3(vv_mesh, pp_mesh, communicator, list_mode, time, V1m, pn, pn_inc, rotv_v, rhs_gauss, opt_tempn)
subroutine solver(my_ksp, b, x, reinit, verbose)
subroutine dirichlet_m_parallel(matrix, glob_js_D)
subroutine moy(mesh, p, RESULT)
real(kind=8) function, dimension(size(rr, 2)), public vv_exact(TYPE, rr, m, t)
real(kind=8) function norm_sf(communicator, norm_type, mesh, list_mode, v)
subroutine qs_01_div_hybrid_2006(uu_mesh, pp_mesh, mode, gg, u0_c)
subroutine, public bdf2_ns_stress_bc_with_u(comm_one_d, time, vv_3_LA, pp_1_LA, vvz_per, pp_per, dt, Re, list_mode, pp_mesh, vv_mesh, incpn_m1, incpn, pn_m1, pn, un_m1, un, chmp_mag, Bn_p2, opt_tempn)
real(kind=8) function user_time()
subroutine, public periodic_rhs_petsc(n_bord, list, perlist, v_rhs, LA)
subroutine, public compute_entropy_viscosity(comm_one_d, vv_3_LA, vv_mesh, pp_mesh, time, list_mode, vvz_per, un, un_m1, un_m2, pn_m1, rotv_v_m1, visco_entro_grad_u, opt_tempn)
subroutine smb_cross_prod_gauss_sft_par(communicator, mesh, list_mode, V_in, V_out, precession_in)
subroutine, public fft_par_cross_prod_dcl(communicator, V1_in, V2_in, V_out, nb_procs, bloc_size, m_max_pad, temps)
subroutine, public periodic_matrix_petsc(n_bord, list, perlist, matrix, LA)
subroutine, public extract(xghost, ks, ke, LA, phi)
subroutine create_local_petsc_matrix(communicator, LA, matrix, clean)
subroutine qs_diff_mass_vect_3x3_divpenal(type_op, LA, mesh, visco, mass, stab, stab_bdy_ns, mode, matrix)