9 REAL(KIND=8) :: max_velocity_at_tn
17 chmp_vit, max_vel, my_par_cc, cc_list_dirichlet_sides, cc_per, nb_inter, &
36 REAL(KIND=8) :: time, dt
37 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
38 INTEGER,
INTENT(IN) :: nb_inter
43 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(INOUT) :: cn_m1, cn
44 INTEGER,
DIMENSION(:),
INTENT(IN) :: cc_list_dirichlet_sides
45 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: chmp_vit
46 REAL(KIND=8),
INTENT(INOUT) :: max_vel
47 REAL(KIND=8),
DIMENSION(:,:),
INTENT(IN) :: visc_entro_level
48 TYPE(dyn_real_line),
DIMENSION(:),
ALLOCATABLE,
SAVE :: cc_global_d
49 TYPE(dyn_int_line),
DIMENSION(:),
POINTER,
SAVE :: cc_mode_global_js_d
50 LOGICAL,
SAVE :: once = .true., once_vel=.true.
51 LOGICAL,
SAVE :: re_init=.false.
52 INTEGER,
SAVE :: m_max_c
53 INTEGER,
DIMENSION(:),
POINTER,
SAVE :: cc_js_d
54 INTEGER,
SAVE :: my_petscworld_rank, nb_procs
55 REAL(KIND=8),
SAVE :: les_coeff1_in_level
59 INTEGER,
POINTER,
DIMENSION(:) :: cc_1_ifrom
62 INTEGER :: bloc_size, m_max_pad
64 REAL(KIND=8),
DIMENSION(cc_mesh%np) :: ff
65 REAL(KIND=8),
DIMENSION(cc_mesh%np, 2) :: cn_p1
66 REAL(KIND=8),
DIMENSION(cc_mesh%np,2,SIZE(list_mode)) :: cext
67 REAL(KIND=8),
DIMENSION(cc_mesh%np,2,SIZE(list_mode)) :: cext_reg
68 REAL(KIND=8),
DIMENSION(cc_mesh%gauss%l_G*cc_mesh%me, 2, SIZE(list_mode)) :: ff_conv
69 REAL(KIND=8),
DIMENSION(cc_mesh%gauss%l_G*cc_mesh%me, 2, SIZE(list_mode)) :: ff_comp
70 REAL(KIND=8),
DIMENSION(cc_mesh%gauss%l_G*cc_mesh%me, 6, SIZE(list_mode)) :: ff_entro
71 REAL(KIND=8),
DIMENSION(cc_mesh%gauss%l_G*cc_mesh%me, 2, SIZE(list_mode)) :: ff_phi_1mphi
72 REAL(KIND=8) :: int_mass_correct
73 REAL(KIND=8) :: tps, tps_tot, tps_cumul
74 REAL(KIND=8) :: one, zero, three
75 DATA zero, one, three/0.d0,1.d0,3.d0/
77 #include "petsc/finclude/petsc.h"
78 petscerrorcode :: ierr
79 mpi_comm,
DIMENSION(:),
POINTER :: comm_one_d
80 mat,
DIMENSION(:),
POINTER,
SAVE :: cc_mat
81 vec,
SAVE :: cb_1, cb_2, cx_1, cx_1_ghost
82 ksp,
DIMENSION(:),
POINTER,
SAVE :: cc_ksp
83 vec,
SAVE :: cb_reg_1, cb_reg_2
84 mat,
DIMENSION(:),
POINTER,
SAVE :: cc_reg_mat
85 ksp,
DIMENSION(:),
POINTER,
SAVE :: cc_reg_ksp
92 CALL mpi_comm_rank(petsc_comm_world,my_petscworld_rank,code)
93 CALL mpi_comm_size(comm_one_d(2), nb_procs, code)
98 CALL veccreateghost(comm_one_d(1), n, &
99 petsc_determine,
SIZE(cc_1_ifrom), cc_1_ifrom, cx_1, ierr)
100 CALL vecghostgetlocalform(cx_1, cx_1_ghost, ierr)
101 CALL vecduplicate(cx_1, cb_1, ierr)
102 CALL vecduplicate(cx_1, cb_2, ierr)
103 CALL vecduplicate(cx_1, cb_reg_1, ierr)
104 CALL vecduplicate(cx_1, cb_reg_2, ierr)
108 m_max_c =
SIZE(list_mode)
114 ALLOCATE(cc_global_d(m_max_c))
116 ALLOCATE(cc_global_d(i)%DRL(
SIZE(cc_mode_global_js_d(i)%DIL)))
121 ALLOCATE(cc_mat(m_max_c),cc_ksp(m_max_c))
123 IF (inputs%if_compression_mthd_JLG)
THEN
124 ALLOCATE(cc_reg_mat(m_max_c),cc_reg_ksp(m_max_c))
130 CALL
qs_regul_m(cc_mesh, cc_1_la, 3.d0, mode, cc_reg_mat(i))
131 IF (cc_per%n_bord/=0)
THEN
135 CALL
init_solver(my_par_cc,cc_reg_ksp(i),cc_reg_mat(i),comm_one_d(1),&
136 solver=my_par_cc%solver,precond=my_par_cc%precond)
139 max_velocity_at_tn = 0.d0
141 IF (inputs%if_level_set_P2)
THEN
142 les_coeff1_in_level=inputs%LES_coeff1
144 les_coeff1_in_level=4.d0*inputs%LES_coeff1
154 max_vel = max(1.1d0*max_velocity_at_tn,max_vel)
155 IF (my_petscworld_rank==0)
WRITE(*,*)
' Recomputing matrix for level set function'
156 IF (my_petscworld_rank==0)
WRITE(*,*)
' NEW MAX VEL test 1', time, max_vel
163 IF (inputs%if_moment_bdf2)
THEN
165 les_coeff1_in_level, mode, cc_mat(i))
168 les_coeff1_in_level, mode, cc_mat(i))
170 IF (cc_per%n_bord/=0)
THEN
174 CALL
init_solver(my_par_cc,cc_ksp(i),cc_mat(i),comm_one_d(1),&
175 solver=my_par_cc%solver,precond=my_par_cc%precond, opt_re_init=re_init)
183 IF (inputs%if_moment_bdf2)
THEN
189 IF (inputs%if_compression_mthd_JLG)
THEN
193 CALL
qs_00(cc_mesh,cc_1_la, cext(:,1,i), cb_reg_1)
194 CALL
qs_00(cc_mesh,cc_1_la, cext(:,2,i), cb_reg_2)
197 IF (cc_per%n_bord/=0)
THEN
198 CALL
periodic_rhs_petsc(cc_per%n_bord, cc_per%list, cc_per%perlist, cb_reg_1, cc_1_la)
199 CALL
periodic_rhs_petsc(cc_per%n_bord, cc_per%list, cc_per%perlist, cb_reg_2, cc_1_la)
204 cc_global_d(i)%DRL(1:n) =
level_set_exact(nb_inter,1,cc_mesh%rr(:,cc_js_d), mode, time)
205 cc_global_d(i)%DRL(n+1:) = 0.d0
206 CALL
dirichlet_rhs(cc_mode_global_js_d(i)%DIL-1,cc_global_d(i)%DRL,cb_reg_1)
207 cc_global_d(i)%DRL(1:n) =
level_set_exact(nb_inter,2,cc_mesh%rr(:,cc_js_d), mode, time)
208 cc_global_d(i)%DRL(n+1:) = 0.d0
209 CALL
dirichlet_rhs(cc_mode_global_js_d(i)%DIL-1,cc_global_d(i)%DRL,cb_reg_2)
214 CALL
solver(cc_reg_ksp(i),cb_reg_1,cx_1,reinit=.false.,
verbose=my_par_cc%verbose)
215 CALL vecghostupdatebegin(cx_1,insert_values,scatter_forward,ierr)
216 CALL vecghostupdateend(cx_1,insert_values,scatter_forward,ierr)
217 CALL
extract(cx_1_ghost,1,1,cc_1_la,cext_reg(:,1,i))
220 CALL
solver(cc_reg_ksp(i),cb_reg_2,cx_1,reinit=.false.,
verbose=my_par_cc%verbose)
221 CALL vecghostupdatebegin(cx_1,insert_values,scatter_forward,ierr)
222 CALL vecghostupdateend(cx_1,insert_values,scatter_forward,ierr)
223 CALL
extract(cx_1_ghost,1,1,cc_1_la,cext_reg(:,2,i))
224 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
234 IF (inputs%if_compression_mthd_JLG)
THEN
236 list_mode, cext, cext_reg, visc_entro_level,&
237 les_coeff1_in_level, nb_procs, ff_entro, ff_phi_1mphi)
240 chmp_vit, cext, nb_procs, ff_comp)
241 ff_conv=ff_conv-ff_comp
244 les_coeff1_in_level, nb_procs, ff_entro, ff_phi_1mphi)
247 IF (inputs%if_mass_correction)
THEN
250 int_mass_correct = 0.d0
258 IF (inputs%if_moment_bdf2)
THEN
259 ff = (2/dt)*cn(:,1,i) - (1/(2*dt))*cn_m1(:,1,i) &
262 mode, 1, cb_1, cext(:,1,i), &
263 ff_entro(:,:,i), -ff_phi_1mphi(:,1,i), int_mass_correct)
265 ff = (2/dt)*cn(:,2,i) - (1/(2*dt))*cn_m1(:,2,i) &
268 mode, 2, cb_2, cext(:,2,i), &
269 ff_entro(:,:,i), -ff_phi_1mphi(:,2,i), int_mass_correct)
273 mode, 1, cb_1, cext(:,1,i), &
274 ff_entro(:,:,i), -ff_phi_1mphi(:,1,i), int_mass_correct)
278 mode, 2, cb_2, cext(:,2,i), &
279 ff_entro(:,:,i), -ff_phi_1mphi(:,2,i), int_mass_correct)
283 IF (cc_per%n_bord/=0)
THEN
290 cc_global_d(i)%DRL(1:n) =
level_set_exact(nb_inter,1,cc_mesh%rr(:,cc_js_d), mode, time)
291 cc_global_d(i)%DRL(n+1:) = 0.d0
292 CALL
dirichlet_rhs(cc_mode_global_js_d(i)%DIL-1,cc_global_d(i)%DRL,cb_1)
293 cc_global_d(i)%DRL(1:n) =
level_set_exact(nb_inter,2,cc_mesh%rr(:,cc_js_d), mode, time)
294 cc_global_d(i)%DRL(n+1:) = 0.d0
295 CALL
dirichlet_rhs(cc_mode_global_js_d(i)%DIL-1,cc_global_d(i)%DRL,cb_2)
297 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
304 CALL
solver(cc_ksp(i),cb_1,cx_1,reinit=.false.,
verbose=my_par_cc%verbose)
305 CALL vecghostupdatebegin(cx_1,insert_values,scatter_forward,ierr)
306 CALL vecghostupdateend(cx_1,insert_values,scatter_forward,ierr)
307 CALL
extract(cx_1_ghost,1,1,cc_1_la,cn_p1(:,1))
310 CALL
solver(cc_ksp(i),cb_2,cx_1,reinit=.false.,
verbose=my_par_cc%verbose)
311 CALL vecghostupdatebegin(cx_1,insert_values,scatter_forward,ierr)
312 CALL vecghostupdateend(cx_1,insert_values,scatter_forward,ierr)
313 CALL
extract(cx_1_ghost,1,1,cc_1_la,cn_p1(:,2))
314 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
325 cn_m1(:,:,i) = cn(:,:,i)
328 tps =
user_time() - tps; tps_cumul=tps_cumul+tps
359 INTEGER,
INTENT(IN) :: nb_procs
360 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
361 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: v_in, c_in
362 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(OUT) :: c_out
363 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%me,6,SIZE(list_mode)) :: gradc, w
364 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%me,2,SIZE(list_mode)) :: div, cgauss
366 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
367 REAL(KIND=8),
DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
368 INTEGER :: m, l , i, mode, index, k
369 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,6) :: vs
370 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,2) :: cs
371 INTEGER,
DIMENSION(:,:),
POINTER :: jj
372 INTEGER,
POINTER :: me
373 REAL(KIND=8) :: ray, tps
374 REAL(KIND=8),
DIMENSION(3) :: temps
375 INTEGER :: m_max_pad, bloc_size
376 #include "petsc/finclude/petsc.h"
377 mpi_comm :: communicator
384 DO i = 1,
SIZE(list_mode)
387 DO m = 1, mesh%dom_me
390 vs(:,k) = v_in(j_loc,k,i)
393 cs(:,k) = c_in(j_loc,k,i)
400 ray = sum(mesh%rr(1,j_loc)*ww(:,l))
403 w(index,1,i) = sum(vs(:,1)*ww(:,l))
404 w(index,3,i) = sum(vs(:,3)*ww(:,l))
405 w(index,5,i) = sum(vs(:,5)*ww(:,l))
407 w(index,2,i) = sum(vs(:,2)*ww(:,l))
408 w(index,4,i) = sum(vs(:,4)*ww(:,l))
409 w(index,6,i) = sum(vs(:,6)*ww(:,l))
411 div(index,1,i) = sum(vs(:,1)*dw_loc(1,:)) + sum(vs(:,1)*ww(:,l))/ray &
412 + (mode/ray)*sum(vs(:,4)*ww(:,l)) + sum(vs(:,5)*dw_loc(2,:))
413 div(index,2,i) = sum(vs(:,2)*dw_loc(1,:)) + sum(vs(:,2)*ww(:,l))/ray &
414 - (mode/ray)*sum(vs(:,3)*ww(:,l)) + sum(vs(:,6)*dw_loc(2,:))
418 gradc(index,1,i) = sum(cs(:,1)*dw_loc(1,:))
419 gradc(index,2,i) = sum(cs(:,2)*dw_loc(1,:))
420 gradc(index,3,i) = mode/ray*sum(cs(:,2)*ww(:,l))
421 gradc(index,4,i) = -mode/ray*sum(cs(:,1)*ww(:,l))
422 gradc(index,5,i) = sum(cs(:,1)*dw_loc(2,:))
423 gradc(index,6,i) = sum(cs(:,2)*dw_loc(2,:))
425 cgauss(index,1,i) = sum(cs(:,1)*ww(:,l))
426 cgauss(index,2,i) = sum(cs(:,2)*ww(:,l))
437 bloc_size =
SIZE(gradc,1)/nb_procs+1
438 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
463 INTEGER,
INTENT(IN) :: nb_procs
464 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
465 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: v_in, c_in
466 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(OUT) :: c_out
467 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%me,6,SIZE(list_mode)) :: gradc, w
468 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%me,2,SIZE(list_mode)) :: cgauss
469 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
470 REAL(KIND=8),
DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
471 INTEGER :: m, l , i, mode, index, k
472 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,6) :: vs
473 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,2) :: cs
474 INTEGER,
DIMENSION(:,:),
POINTER :: jj
475 INTEGER,
POINTER :: me
476 REAL(KIND=8) :: ray, tps, norm_vel_l2, volume_3d
477 INTEGER :: m_max_pad, bloc_size
478 #include "petsc/finclude/petsc.h"
479 mpi_comm,
DIMENSION(2) :: communicator
486 DO i = 1,
SIZE(list_mode)
489 DO m = 1, mesh%dom_me
492 vs(:,k) = v_in(j_loc,k,i)
495 cs(:,k) = c_in(j_loc,k,i)
502 ray = sum(mesh%rr(1,j_loc)*ww(:,l))
505 w(index,1,i) = sum(vs(:,1)*ww(:,l))
506 w(index,3,i) = sum(vs(:,3)*ww(:,l))
507 w(index,5,i) = sum(vs(:,5)*ww(:,l))
509 w(index,2,i) = sum(vs(:,2)*ww(:,l))
510 w(index,4,i) = sum(vs(:,4)*ww(:,l))
511 w(index,6,i) = sum(vs(:,6)*ww(:,l))
515 gradc(index,1,i) = sum(cs(:,1)*dw_loc(1,:))
516 gradc(index,2,i) = sum(cs(:,2)*dw_loc(1,:))
517 gradc(index,3,i) = mode/ray*sum(cs(:,2)*ww(:,l))
518 gradc(index,4,i) = -mode/ray*sum(cs(:,1)*ww(:,l))
519 gradc(index,5,i) = sum(cs(:,1)*dw_loc(2,:))
520 gradc(index,6,i) = sum(cs(:,2)*dw_loc(2,:))
522 cgauss(index,1,i) = sum(cs(:,1)*ww(:,l))
523 cgauss(index,2,i) = sum(cs(:,2)*ww(:,l))
528 bloc_size = mesh%gauss%l_G*mesh%me/nb_procs+1
529 bloc_size = mesh%gauss%l_G*(bloc_size/mesh%gauss%l_G)+mesh%gauss%l_G
530 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
534 volume_3d = volume_3d*2*acos(-1.d0)
535 norm_vel_l2 =
norm_sf(communicator,
'L2', mesh, list_mode, v_in)/volume_3d
539 mesh%hloc_gauss, mesh%gauss%l_G, nb_procs, bloc_size, m_max_pad)
554 REAL(KIND=8),
INTENT(OUT) :: reslt
555 REAL(KIND=8) :: vol_loc, vol_out
556 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
557 INTEGER :: m, l , i , ni, code
559 #include "petsc/finclude/petsc.h"
560 mpi_comm :: communicator
563 DO m = 1, mesh%dom_me
565 DO l = 1, mesh%gauss%l_G
567 DO ni = 1, mesh%gauss%n_w; i = j_loc(ni)
568 ray = ray + mesh%rr(1,i)*mesh%gauss%ww(ni,l)
570 vol_loc = vol_loc + ray*mesh%gauss%rj(l,m)
573 CALL mpi_allreduce(vol_loc,vol_out,1,mpi_double_precision, mpi_sum, communicator, code)
584 REAL(KIND=8),
INTENT(IN) :: stab
585 INTEGER,
INTENT(IN) :: mode
586 INTEGER,
DIMENSION(mesh%gauss%n_w) :: jj_loc
587 INTEGER,
DIMENSION(mesh%gauss%n_w) :: idxm, idxn
588 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,mesh%gauss%n_w,mesh%gauss%l_G) :: wwprod
589 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,mesh%gauss%n_w) :: a_loc
591 INTEGER :: m, l, ni, nj, i, j, iglob, jglob, n_w
592 REAL(KIND=8) :: viscolm, xij, viscomode, hm, hh
593 #include "petsc/finclude/petsc.h"
595 petscerrorcode :: ierr
597 CALL matzeroentries(matrix, ierr)
598 CALL matsetoption(matrix, mat_row_oriented, petsc_false, ierr)
600 DO l = 1, mesh%gauss%l_G
601 DO ni = 1, mesh%gauss%n_w
602 DO nj = 1, mesh%gauss%n_w
603 wwprod(ni,nj,l) = mesh%gauss%ww(ni,l)*mesh%gauss%ww(nj,l)
609 DO m = 1, mesh%dom_me
610 jj_loc = mesh%jj(:,m)
613 DO nj = 1, mesh%gauss%n_w;
615 jglob = la%loc_to_glob(1,j)
617 DO ni = 1, mesh%gauss%n_w;
619 iglob = la%loc_to_glob(1,i)
624 DO l = 1, mesh%gauss%l_G
627 DO ni = 1, n_w; i = jj_loc(ni)
628 ray = ray + mesh%rr(1,i)*mesh%gauss%ww(ni,l)
632 hm=0.5d0/inputs%m_max
633 viscolm = (stab*hh)**2*mesh%gauss%rj(l,m)
634 viscomode = (stab*hm)**2*mesh%gauss%rj(l,m)
638 xij = sum(mesh%gauss%dw(:,nj,l,m)*mesh%gauss%dw(:,ni,l,m))
640 a_loc(ni,nj) = a_loc(ni,nj) + ray * viscolm* xij &
641 + ray*wwprod(ni,nj,l)*mesh%gauss%rj(l,m) &
642 + viscomode*mode**2*wwprod(ni,nj,l)/ray
647 CALL matsetvalues(matrix,n_w,idxm,n_w,idxn,a_loc,add_values,ierr)
649 CALL matassemblybegin(matrix,mat_final_assembly,ierr)
650 CALL matassemblyend(matrix,mat_final_assembly,ierr)
655 coeff1_in_level, nb_procs, v_out, c_out)
664 INTEGER,
INTENT(IN) :: nb_procs
665 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
666 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: c_in
667 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: c_reg_in
668 REAL(KIND=8),
DIMENSION(:,:),
INTENT(IN) :: visc_entro_real
669 REAL(KIND=8),
INTENT(IN) :: coeff1_in_level
670 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)),
INTENT(OUT) :: v_out
671 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)),
INTENT(OUT) :: c_out
672 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)) :: gradc_in, gradc_reg_in
673 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)) :: c_in_gauss
674 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
675 REAL(KIND=8),
DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
676 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,2) :: c_in_loc
677 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,2) :: c_reg_in_loc
678 INTEGER,
DIMENSION(:,:),
POINTER :: jj
679 INTEGER,
POINTER :: me
680 REAL(KIND=8) :: ray, hh, hm
681 INTEGER :: m, l , i, mode, index, k
682 INTEGER :: m_max_pad, bloc_size
683 #include "petsc/finclude/petsc.h"
684 mpi_comm,
DIMENSION(2) :: communicator
690 DO i = 1,
SIZE(list_mode)
693 DO m = 1, mesh%dom_me
696 c_in_loc(:,k) = c_in(j_loc,k,i)
697 c_reg_in_loc(:,k) = c_reg_in(j_loc,k,i)
705 hh=mesh%hloc_gauss(index)
707 hm=0.5d0/inputs%m_max
710 ray = sum(mesh%rr(1,j_loc)*ww(:,l))
713 c_in_gauss(index,1,i) = sum(c_in_loc(:,1)*ww(:,l))
714 c_in_gauss(index,2,i) = sum(c_in_loc(:,2)*ww(:,l))
717 gradc_in(index,1,i) = sum(c_in_loc(:,1)*dw_loc(1,:))*hh
718 gradc_in(index,2,i) = sum(c_in_loc(:,2)*dw_loc(1,:))*hh
719 gradc_in(index,3,i) = mode/ray*sum(c_in_loc(:,2)*ww(:,l))*hm
720 gradc_in(index,4,i) = -mode/ray*sum(c_in_loc(:,1)*ww(:,l))*hm
721 gradc_in(index,5,i) = sum(c_in_loc(:,1)*dw_loc(2,:))*hh
722 gradc_in(index,6,i) = sum(c_in_loc(:,2)*dw_loc(2,:))*hh
725 gradc_reg_in(index,1,i) = sum(c_reg_in_loc(:,1)*dw_loc(1,:))*hh
726 gradc_reg_in(index,2,i) = sum(c_reg_in_loc(:,2)*dw_loc(1,:))*hh
727 gradc_reg_in(index,3,i) = mode/ray*sum(c_reg_in_loc(:,2)*ww(:,l))*hm
728 gradc_reg_in(index,4,i) = -mode/ray*sum(c_reg_in_loc(:,1)*ww(:,l))*hm
729 gradc_reg_in(index,5,i) = sum(c_reg_in_loc(:,1)*dw_loc(2,:))*hh
730 gradc_reg_in(index,6,i) = sum(c_reg_in_loc(:,2)*dw_loc(2,:))*hh
734 bloc_size =
SIZE(c_in_gauss,1)/nb_procs+1
735 bloc_size = l_g*(bloc_size/l_g)+l_g
736 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
741 mesh%hloc_gauss, coeff1_in_level, v_out, c_out, nb_procs, bloc_size, m_max_pad)
746 coeff1_in_level, nb_procs, v_out, c_out)
755 INTEGER,
INTENT(IN) :: nb_procs
756 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
757 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: c_in
758 REAL(KIND=8),
DIMENSION(:,:),
INTENT(IN) :: visc_entro_real
759 REAL(KIND=8),
INTENT(IN) :: coeff1_in_level
760 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)),
INTENT(OUT) :: v_out
761 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)),
INTENT(OUT) :: c_out
762 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%dom_me,6,SIZE(list_mode)) :: gradc_in
763 REAL(KIND=8),
DIMENSION(mesh%gauss%l_G*mesh%dom_me,2,SIZE(list_mode)) :: c_in_gauss
764 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
765 REAL(KIND=8),
DIMENSION(mesh%gauss%k_d,mesh%gauss%n_w) :: dw_loc
766 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w,2) :: c_in_loc
767 INTEGER,
DIMENSION(:,:),
POINTER :: jj
768 INTEGER,
POINTER :: me
769 REAL(KIND=8) :: ray, hh, hm
770 INTEGER :: m, l , i, mode, index, k
771 INTEGER :: m_max_pad, bloc_size
772 #include "petsc/finclude/petsc.h"
773 mpi_comm,
DIMENSION(2) :: communicator
779 DO i = 1,
SIZE(list_mode)
782 DO m = 1, mesh%dom_me
785 c_in_loc(:,k) = c_in(j_loc,k,i)
793 hh=mesh%hloc_gauss(index)
795 hm=0.5d0/inputs%m_max
798 ray = sum(mesh%rr(1,j_loc)*ww(:,l))
801 c_in_gauss(index,1,i) = sum(c_in_loc(:,1)*ww(:,l))
802 c_in_gauss(index,2,i) = sum(c_in_loc(:,2)*ww(:,l))
805 gradc_in(index,1,i) = sum(c_in_loc(:,1)*dw_loc(1,:))*hh
806 gradc_in(index,2,i) = sum(c_in_loc(:,2)*dw_loc(1,:))*hh
807 gradc_in(index,3,i) = mode/ray*sum(c_in_loc(:,2)*ww(:,l))*hm
808 gradc_in(index,4,i) = -mode/ray*sum(c_in_loc(:,1)*ww(:,l))*hm
809 gradc_in(index,5,i) = sum(c_in_loc(:,1)*dw_loc(2,:))*hh
810 gradc_in(index,6,i) = sum(c_in_loc(:,2)*dw_loc(2,:))*hh
815 bloc_size =
SIZE(c_in_gauss,1)/nb_procs+1
816 bloc_size = l_g*(bloc_size/l_g)+l_g
817 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
822 mesh%hloc_gauss, coeff1_in_level, v_out, c_out, nb_procs, bloc_size, m_max_pad)
831 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode
832 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: c1_in
833 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: c2_in
834 REAL(KIND=8),
INTENT(OUT) :: int_out
835 INTEGER,
DIMENSION(mesh%gauss%n_w) :: j_loc
837 REAL(KIND=8) :: int_c1_in, int_c1_in_loc, int_c1_in_f
838 REAL(KIND=8) :: int_c2_in, int_c2_in_loc, int_c2_in_f
839 INTEGER :: m, l , i, index, code
840 #include "petsc/finclude/petsc.h"
841 mpi_comm,
DIMENSION(2) :: communicator
846 DO i = 1,
SIZE(list_mode)
848 IF (list_mode(i)==0)
THEN
849 DO m = 1, mesh%dom_me
851 DO l = 1, mesh%gauss%l_G
854 ray = sum(mesh%rr(1,j_loc)*mesh%gauss%ww(:,l))
857 int_c1_in_loc = int_c1_in_loc + c1_in(index,1,i)*ray*mesh%gauss%rj(l,m)
858 int_c2_in_loc = int_c2_in_loc + c2_in(index,1,i)*ray*mesh%gauss%rj(l,m)
864 int_c1_in_loc = int_c1_in_loc*2*acos(-1.d0)
865 CALL mpi_allreduce(int_c1_in_loc, int_c1_in_f, 1, mpi_double_precision, mpi_sum, &
866 communicator(2), code)
867 CALL mpi_allreduce(int_c1_in_f, int_c1_in, 1, mpi_double_precision, mpi_sum, &
868 communicator(1), code)
870 int_c2_in_loc = int_c2_in_loc*2*acos(-1.d0)
871 CALL mpi_allreduce(int_c2_in_loc, int_c2_in_f, 1, mpi_double_precision, mpi_sum, &
872 communicator(2), code)
873 CALL mpi_allreduce(int_c2_in_f, int_c2_in, 1, mpi_double_precision, mpi_sum, &
874 communicator(1), code)
876 IF (int_c2_in.LE.1.d-14)
THEN
879 int_out=-int_c1_in/int_c2_in
885 fcompr, ff_phi_1mphi, stab_mass)
892 REAL(KIND=8),
DIMENSION(:),
INTENT(IN) :: ff, ff_gauss
893 REAL(KIND=8),
DIMENSION(:),
INTENT(IN) :: level_set_ext
894 INTEGER ,
INTENT(IN) :: mode
895 INTEGER ,
INTENT(IN) :: type
896 REAL(KIND=8),
DIMENSION(:,:),
INTENT(IN) :: fcompr
897 REAL(KIND=8),
DIMENSION(:),
INTENT(IN) :: ff_phi_1mphi
898 REAL(KIND=8),
INTENT(IN) :: stab_mass
899 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w) :: ff_loc, level_set_loc
900 INTEGER,
DIMENSION(mesh%gauss%n_w) :: jj_loc
901 REAL(KIND=8),
DIMENSION(3) :: fcomprl
902 REAL(KIND=8),
DIMENSION(mesh%gauss%n_w) :: v_loc
903 INTEGER,
DIMENSION(mesh%gauss%n_w) :: idxm
904 INTEGER :: i, m, l, ni, iglob, index
905 REAL(KIND=8) :: fl, ray
906 #include "petsc/finclude/petsc.h"
908 petscerrorcode :: ierr
910 CALL vecset(vect, 0.d0, ierr)
913 DO m = 1, mesh%dom_me
914 jj_loc = mesh%jj(:,m)
916 level_set_loc = level_set_ext(jj_loc)
918 DO ni = 1, mesh%gauss%n_w
920 iglob = la%loc_to_glob(1,i)
925 DO l = 1, mesh%gauss%l_G
928 DO ni = 1, mesh%gauss%n_w
930 ray = ray + mesh%rr(1,i)*mesh%gauss%ww(ni,l)
934 fl = (sum(ff_loc(:)*mesh%gauss%ww(:,l)) + ff_gauss(index)+stab_mass*ff_phi_1mphi(index))*mesh%gauss%rj(l,m)*ray
938 fcomprl(1) = fcompr(index,1)*mesh%gauss%rj(l,m)*ray
939 fcomprl(2) = -mode*fcompr(index,4)*mesh%gauss%rj(l,m)
940 fcomprl(3) = fcompr(index,5)*mesh%gauss%rj(l,m)*ray
942 ELSE IF (type==2)
THEN
943 fcomprl(1) = fcompr(index,2)*mesh%gauss%rj(l,m)*ray
944 fcomprl(2) = mode*fcompr(index,3)*mesh%gauss%rj(l,m)
945 fcomprl(3) = fcompr(index,6)*mesh%gauss%rj(l,m)*ray
947 CALL
error_petsc(
'error in type while calling qs_00_level_set_gauss')
950 DO ni = 1, mesh%gauss%n_w
952 v_loc(ni) = v_loc(ni) + mesh%gauss%ww(ni,l) *fl
954 v_loc(ni) = v_loc(ni) + (fcomprl(1)*mesh%gauss%dw(1,ni,l,m) + fcomprl(2)*mesh%gauss%ww(ni,l) &
955 + fcomprl(3)*mesh%gauss%dw(2,ni,l,m))
959 CALL vecsetvalues(vect, mesh%gauss%n_w, idxm, v_loc, add_values, ierr)
961 CALL vecassemblybegin(vect,ierr)
962 CALL vecassemblyend(vect,ierr)
subroutine, public fft_par_dot_prod_dcl(communicator, V1_in, V2_in, c_out, nb_procs, bloc_size, m_max_pad, temps)
subroutine, public create_my_ghost(mesh, LA, ifrom)
subroutine dirichlet_rhs(js_D, bs_D, b)
subroutine, public three_level_level_set(comm_one_d, time, cc_1_LA, dt, list_mode, cc_mesh, cn_m1, cn, chmp_vit, max_vel, my_par_cc, cc_list_dirichlet_sides, cc_per, nb_inter, visc_entro_level)
real(kind=8) function, dimension(size(rr, 2)), public source_in_level_set(interface_nb, TYPE, rr, m, t)
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, public fft_par_entro_visc_dcl(communicator, V1_in, c1_in, c_in_real, hloc_gauss, coeff1_in_level, V_out, c_out, nb_procs, bloc_size, m_max_pad, temps)
subroutine smb_compr_visc_entro_gauss_fft_par(communicator, mesh, list_mode, c_in, c_reg_in, visc_entro_real, coeff1_in_level, nb_procs, V_out, c_out)
subroutine dirichlet_nodes_parallel(mesh, list_dirichlet_sides, js_d)
subroutine compute_int_mass_correct(communicator, mesh, list_mode, c1_in, c2_in, int_out)
subroutine solver(my_ksp, b, x, reinit, verbose)
subroutine dirichlet_m_parallel(matrix, glob_js_D)
subroutine, public fft_par_compr_entro_visc_dcl(communicator, V1_in, V2_in, c1_in, c_in_real, hloc_gauss, coeff1_in_level, V_out, c_out, nb_procs, bloc_size, m_max_pad, temps)
subroutine, public fft_compression_level_set_dcl(communicator_F, communicator_S, V1_in, V2_in, c_in, c_out, hloc_gauss, l_G, nb_procs, bloc_size, m_max_pad, temps)
subroutine qs_00(mesh, ff, u0)
real(kind=8) function norm_sf(communicator, norm_type, mesh, list_mode, v)
subroutine qs_regul_m(mesh, LA, stab, mode, matrix)
subroutine qs_diff_mass_scal_m_level(mesh, LA, visco, mass, stab, mode, matrix)
real(kind=8) function user_time()
subroutine, public periodic_rhs_petsc(n_bord, list, perlist, v_rhs, LA)
subroutine qs_00_level_set_gauss(mesh, LA, ff, ff_gauss, mode, type, vect, level_set_ext, fcompr, ff_phi_1mphi, stab_mass)
subroutine smb_visc_entro_gauss_fft_par(communicator, mesh, list_mode, c_in, visc_entro_real, coeff1_in_level, nb_procs, V_out, c_out)
subroutine error_petsc(string)
subroutine, public periodic_matrix_petsc(n_bord, list, perlist, matrix, LA)
subroutine smb_compression_gauss_fft_par(communicator, mesh, list_mode, V_in, c_in, nb_procs, c_out)
subroutine, public extract(xghost, ks, ke, LA, phi)
real(kind=8) function, dimension(size(rr, 2)), public level_set_exact(interface_nb, TYPE, rr, m, t)
subroutine create_local_petsc_matrix(communicator, LA, matrix, clean)
subroutine twod_volume(communicator, mesh, RESLT)
subroutine smb_ugradc_gauss_fft_par(communicator, mesh, list_mode, V_in, c_in, nb_procs, c_out)