14 #include "petsc/finclude/petsc.h" 28 REAL(KIND=8),
TARGET,
ALLOCATABLE,
DIMENSION(:,:,:) :: un, un_m1
32 REAL(KIND=8),
TARGET,
ALLOCATABLE,
DIMENSION(:,:,:) ::
pn, pn_m1
41 REAL(KIND=8),
TARGET,
ALLOCATABLE,
DIMENSION(:,:,:) :: density, density_m1, density_m2
51 REAL(KIND=8),
TARGET,
ALLOCATABLE,
DIMENSION(:,:,:) :: tempn,
tempn_m1 58 REAL(KIND=8),
TARGET,
ALLOCATABLE,
DIMENSION(:,:,:) ::
bn,
bn1,
bext 76 REAL(KIND=8),
TARGET,
ALLOCATABLE,
DIMENSION(:,:,:) ::
v_to_max 77 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:,:) ::
h_to_ns 78 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:,:) ::
b_to_ns 80 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:,:) ::
t_to_ns 81 REAL(KIND=8),
TARGET,
ALLOCATABLE,
DIMENSION(:,:,:) ::
v_to_energy 92 INTEGER,
TARGET,
ALLOCATABLE,
DIMENSION(:) :: list_mode
103 mpi_comm :: comm_cart
104 mpi_comm,
DIMENSION(:),
POINTER :: comm_one_d, comm_one_d_ns, &
105 comm_one_d_temp, coord_cart
113 SUBROUTINE initial(vv_mesh_out, pp_mesh_out, H_mesh_out, phi_mesh_out, temp_mesh_out, &
114 interface_h_phi_out, interface_h_mu_out, list_mode_out, &
115 un_out, pn_out, hn_out, bn_out, phin_out, v_to_max_out, &
116 vol_heat_capacity_field_out, temperature_diffusivity_field_out, &
117 mu_h_field_out, sigma_field_out, &
118 time_out, m_max_c_out, comm_one_d_out, comm_one_d_ns_out, comm_one_d_temp_out, &
119 tempn_out, level_set_out, density_out, der_un_out)
121 #include "petsc/finclude/petsc.h" 124 TYPE(
mesh_type),
POINTER :: pp_mesh_out, vv_mesh_out
125 TYPE(
mesh_type),
POINTER :: H_mesh_out, phi_mesh_out
126 TYPE(
mesh_type),
POINTER :: temp_mesh_out
128 TYPE(
interface_type),
POINTER :: interface_H_mu_out, interface_H_phi_out
129 INTEGER,
POINTER,
DIMENSION(:) :: list_mode_out
130 REAL(KIND=8),
POINTER,
DIMENSION(:,:,:) :: un_out, pn_out, Hn_out, Bn_out, phin_out, v_to_Max_out, tempn_out, density_out
131 REAL(KIND=8),
POINTER,
DIMENSION(:,:,:,:):: level_set_out
132 REAL(KIND=8),
POINTER,
DIMENSION(:) :: sigma_field_out, mu_H_field_out
133 REAL(KIND=8),
POINTER,
DIMENSION(:) :: vol_heat_capacity_field_out, temperature_diffusivity_field_out
134 REAL(KIND=8) :: time_out
135 INTEGER :: m_max_c_out
136 mpi_comm,
DIMENSION(:),
POINTER :: comm_one_d_out, comm_one_d_ns_out, comm_one_d_temp_out
142 list_mode,
inputs%number_of_planes_in_real_space)
144 vv_mesh_out => vv_mesh
145 pp_mesh_out => pp_mesh
151 list_mode_out => list_mode
157 density_out => density
168 comm_one_d_out => comm_one_d
169 comm_one_d_ns_out => comm_one_d_ns
170 comm_one_d_temp_out => comm_one_d_temp
183 REAL(KIND=8),
INTENT(in) :: time_in
184 REAL(KIND=8),
DIMENSION(vv_mesh%np,2,SIZE(list_mode)) :: visco_dyn_m1
185 REAL(KIND=8),
DIMENSION(vv_mesh%np,2,SIZE(list_mode)) :: one_over_sigma_ns
197 inputs%dyna_visc_fluid, visco_dyn_m1)
198 IF (
inputs%variation_sigma_fluid)
THEN 200 1.d0/
inputs%sigma_fluid, one_over_sigma_ns)
202 one_over_sigma_ns = 0.d0
210 IF (
inputs%type_pb==
'fhd')
THEN 213 IF (.NOT.
inputs%if_steady_current_fhd)
THEN 221 inputs%my_par_temperature,
inputs%temperature_list_dirichlet_sides, &
222 inputs%temperature_list_robin_sides,
inputs%convection_coeff, &
236 IF (
inputs%if_navier_stokes_with_taylor)
THEN 252 IF (
inputs%type_pb ==
'fhd' .AND.
inputs%if_steady_current_fhd)
THEN 260 time,
inputs%dt,
inputs%Rem, list_mode,
h_phi_per,
la_h,
la_pmag,
la_phi,
la_mhd, one_over_sigma_ns,
jj_v_to_h)
272 time,
inputs%dt,
inputs%Rem, list_mode,
h_phi_per,
la_h,
la_pmag,
la_phi,
la_mhd, one_over_sigma_ns,
jj_v_to_h)
283 LOGICAL,
SAVE :: once_zero_out_mode=.true.
284 INTEGER,
POINTER,
DIMENSION(:),
SAVE :: select_mode_ns, select_mode_mxw
286 IF (once_zero_out_mode)
THEN 287 once_zero_out_mode=.false.
288 IF (
inputs%if_zero_out_modes)
THEN 293 IF (
inputs%if_zero_out_modes)
THEN 294 IF (
h_mesh%me /=0 .AND.
SIZE(select_mode_mxw)>0)
THEN 295 hn(:,:,select_mode_mxw) = 0.d0
296 hn1(:,:,select_mode_mxw) = 0.d0
298 IF (
phi_mesh%me /= 0 .AND.
SIZE(select_mode_mxw)>0)
THEN 299 phin(:,:,select_mode_mxw) = 0.d0
300 phin1(:,:,select_mode_mxw) = 0.d0
302 IF (vv_mesh%me /=0 .AND.
SIZE(select_mode_ns)>0)
THEN 303 un(:,:,select_mode_ns) = 0.d0
304 pn(:,:,select_mode_ns) = 0.d0
305 IF(
inputs%if_navier_stokes_with_taylor)
THEN 306 DO kp = 1,
inputs%taylor_order-1
307 der_un(kp)%DRT( :,:,select_mode_ns) = 0.d0
308 der_pn(kp)%DRT( :,:,select_mode_ns) = 0.d0
311 incpn(:,:,select_mode_ns) = 0.d0
312 un_m1(:,:,select_mode_ns) = 0.d0
313 pn_m1(:,:,select_mode_ns) = 0.d0
325 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_mode_to_zero_out
326 INTEGER,
DIMENSION(:) :: list_mode
327 INTEGER,
POINTER,
DIMENSION(:) :: select_mode
329 INTEGER,
DIMENSION(1) :: kloc
331 DO i = 1,
SIZE(list_mode_to_zero_out)
332 IF (minval(abs(list_mode-list_mode_to_zero_out(i)))==0)
THEN 336 ALLOCATE(select_mode(inc))
338 DO i = 1,
SIZE(list_mode_to_zero_out)
339 IF (minval(abs(list_mode-list_mode_to_zero_out(i)))==0)
THEN 341 kloc = minloc(abs(list_mode-list_mode_to_zero_out(i)))
342 select_mode(inc) = kloc(1)
353 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: vn
354 INTEGER,
DIMENSION(:),
INTENT(IN) :: connectivity_structure
355 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(OUT) :: coupling_variable
361 coupling_variable(:,k,i) = extension_velocity(k, mesh, list_mode(i), time, 1)
365 IF (mesh%me /=0)
THEN 366 DO j = 1,
SIZE(connectivity_structure)
367 IF (connectivity_structure(j) == -1) cycle
368 coupling_variable(j,:,:) = vn(connectivity_structure(j),:,:)
375 SUBROUTINE projection_temperature(mesh, vn, connectivity_structure, coupling_variable) !===projection of temp on another mesh subroutine added
378 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: vn
379 INTEGER,
DIMENSION(:),
INTENT(IN) :: connectivity_structure
380 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(OUT) :: coupling_variable
383 IF (mesh%me /=0 )
THEN 384 DO j = 1,
SIZE(connectivity_structure)
385 IF (connectivity_structure(j) == -1) cycle
386 coupling_variable(connectivity_structure(j),:,:) = vn(j,:,:)
393 SUBROUTINE projection_mag_field(mesh, vn, connectivity_structure, if_restriction, coupling_variable) !===projection of mag field on another mesh subroutine added
397 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(IN) :: vn
398 INTEGER,
DIMENSION(:),
INTENT(IN) :: connectivity_structure
399 LOGICAL,
INTENT(IN) :: if_restriction
400 REAL(KIND=8),
DIMENSION(:,:,:),
INTENT(OUT) :: coupling_variable
403 DO j = 1,
SIZE(connectivity_structure)
404 IF (connectivity_structure(j) == -1) cycle
405 IF (if_restriction)
THEN 406 coupling_variable(connectivity_structure(j),:,:) = vn(j,:,:)
408 coupling_variable(j,:,:) = vn(connectivity_structure(j),:,:)
411 IF (if_restriction)
THEN 412 IF (
h_mesh%gauss%n_w/=mesh%gauss%n_w)
THEN 414 coupling_variable(mesh%jj(4,m),:,:) = (coupling_variable(mesh%jj(2,m),:,:) &
415 + coupling_variable(mesh%jj(3,m),:,:))/2
416 coupling_variable(mesh%jj(5,m),:,:) = (coupling_variable(mesh%jj(3,m),:,:) &
417 + coupling_variable(mesh%jj(1,m),:,:))/2
418 coupling_variable(mesh%jj(6,m),:,:) = (coupling_variable(mesh%jj(1,m),:,:) &
419 + coupling_variable(mesh%jj(2,m),:,:))/2
428 SUBROUTINE save_run(it, freq_restart)
431 INTEGER,
INTENT(IN) :: it, freq_restart
434 IF (pp_mesh%me /= 0)
THEN 435 IF(
inputs%if_navier_stokes_with_taylor)
THEN 441 list_mode, un, un_m1,
pn, pn_m1, &
445 list_mode, un, un_m1,
pn, pn_m1, &
492 #include "petsc/finclude/petsc.h" 495 TYPE(
mesh_type) :: vv_mesh_glob, pp_mesh_glob
496 TYPE(
mesh_type) :: H_mesh_glob, phi_mesh_glob, pmag_mesh_glob, temp_mesh_glob
497 TYPE(
mesh_type) :: p1_mesh_glob, p2_mesh_glob, p1_c0_mesh_glob, p2_c0_mesh_glob_temp
500 INTEGER,
DIMENSION(:),
ALLOCATABLE :: list_dom_H, list_dom_temp
501 INTEGER,
DIMENSION(:),
ALLOCATABLE :: list_dom, list_inter, part, list_dummy, list_inter_temp
502 INTEGER,
DIMENSION(:),
ALLOCATABLE :: H_in_to_new, temp_in_to_new
503 CHARACTER(len=200) :: data_file
504 CHARACTER(len=200) :: data_directory
505 CHARACTER(len=200) :: tit_part, mesh_part_name
506 CHARACTER(len=200) :: data_fichier
508 INTEGER :: k, kp, m, n, i, j
509 INTEGER :: code, rank, rank_S, nb_procs, petsc_rank, bloc_size, m_max_pad
510 REAL(KIND=8) :: time_u, time_h, time_T, error, max_vel_S
511 LOGICAL :: ns_periodic, mxw_periodic, temp_periodic
512 CHARACTER(len=2) :: tit
513 petscmpiint :: nb_procs_f, nb_procs_s
516 CALL mpi_comm_size(petsc_comm_world,nb_procs,code)
517 CALL mpi_comm_rank(petsc_comm_world,petsc_rank,code)
521 IF (
inputs%test_de_convergence)
THEN 522 IF (
inputs%numero_du_test_debug<1 .OR.
inputs%numero_du_test_debug>40)
THEN 523 CALL error_petsc(
'BUG in INIT: debug_test_number is not in the correct range')
525 WRITE(tit,
'(i2)')
inputs%numero_du_test_debug
526 data_file =
'data_'//trim(adjustl(tit))
527 data_directory =
inputs%data_directory_debug
528 data_fichier = trim(adjustl(data_directory))//
'/debug_'//trim(adjustl(data_file))
532 data_fichier = trim(adjustl(data_directory))//
'/'//trim(adjustl(data_file))
542 IF (
inputs%test_de_convergence)
THEN 543 inputs%directory = data_directory
547 IF (
inputs%nb_dom_phi==0)
THEN 548 inputs%phi_nb_dirichlet_sides = 0
553 IF (
ASSOCIATED(
inputs%phi_list_dirichlet_sides))
DEALLOCATE(
inputs%phi_list_dirichlet_sides)
554 ALLOCATE(
inputs%phi_list_dirichlet_sides(0))
555 IF (
ASSOCIATED(
inputs%list_inter_H_phi))
DEALLOCATE(
inputs%list_inter_H_phi)
556 ALLOCATE(
inputs%list_inter_H_phi(0))
560 nb_procs_s =
inputs%ndim(1)
561 nb_procs_f =
inputs%ndim(2)
563 CALL error_petsc(
'BUG in INIT, nb_proc_space*nb_proc_fourier/=nb_procs')
568 CALL mpi_comm_size(comm_one_d(2),nb_procs,code)
569 CALL mpi_comm_rank(comm_one_d(2),rank,code)
570 IF (nb_procs_f/=nb_procs)
THEN 571 CALL error_petsc(
'BUG in INIT, nb_procs_F/=nb_procs')
580 IF (
inputs%select_mode)
THEN 586 list_mode(i) = i + rank*
m_max_c - 1
591 IF (
inputs%my_periodic%nb_periodic_pairs< 1)
THEN 592 ns_periodic=.false.; mxw_periodic=.false.; temp_periodic = .false.
597 ns_periodic=.true.; mxw_periodic=.true.; temp_periodic=.true.
606 IF (
inputs%if_navier_stokes_with_taylor)
THEN 607 IF (petsc_rank==0)
WRITE(*,*)
'INIT: Everything that is not Navier-Stokes is disabled, for Taylor Method' 616 ALLOCATE(list_dom_h(
inputs%nb_dom_H), h_in_to_new(
inputs%nb_dom_H))
618 IF (
SIZE(list_dom_h) <
SIZE(
inputs%list_dom_ns))
THEN 619 CALL error_petsc(
' BUG: NS must be a subset of Maxwell ')
621 DO k = 1,
inputs%nb_dom_ns
622 IF (minval(abs(
inputs%list_dom_H -
inputs%list_dom_ns(k))) /= 0)
THEN 623 CALL error_petsc(
' BUG: NS must be a subset of Maxwell ')
625 DO kp = 1,
inputs%nb_dom_H
626 IF (
inputs%list_dom_H(kp) ==
inputs%list_dom_ns(k))
EXIT 629 list_dom_h(k) =
inputs%list_dom_ns(k)
633 IF (minval(abs(
inputs%list_dom_H(k) -
inputs%list_dom_ns)) == 0) cycle
636 list_dom_h(m) =
inputs%list_dom_H(k)
638 IF (m/=
inputs%nb_dom_H)
THEN 645 list_dom_h =
inputs%list_dom_H
648 ALLOCATE(h_in_to_new(0))
653 ALLOCATE(list_dom_temp(
inputs%nb_dom_temp), temp_in_to_new(
inputs%nb_dom_temp))
654 IF (
SIZE(list_dom_temp) <
SIZE(
inputs%list_dom_ns))
THEN 655 CALL error_petsc(
' BUG: NS must be a subset of temp ')
657 DO k = 1,
inputs%nb_dom_ns
658 IF (minval(abs(
inputs%list_dom_temp -
inputs%list_dom_ns(k))) /= 0)
THEN 659 CALL error_petsc(
' BUG: NS must be a subset of temp ')
661 DO kp = 1,
inputs%nb_dom_temp
662 IF (
inputs%list_dom_temp(kp) ==
inputs%list_dom_ns(k))
EXIT 664 temp_in_to_new(k) = kp
665 list_dom_temp(k) =
inputs%list_dom_ns(k)
668 DO k = 1,
inputs%nb_dom_temp
669 IF (minval(abs(
inputs%list_dom_temp(k) -
inputs%list_dom_ns)) == 0) cycle
671 temp_in_to_new(m) = k
672 list_dom_temp(m) =
inputs%list_dom_temp(k)
674 IF (m/=
inputs%nb_dom_temp)
THEN 678 ALLOCATE(temp_in_to_new(0))
683 IF (
SIZE(list_dom_h) <
SIZE(list_dom_temp))
THEN 684 CALL error_petsc(
' BUG: temp must be a subset of H ')
686 DO k = 1,
inputs%nb_dom_temp
687 IF (minval(abs(list_dom_h - list_dom_temp(k))) /= 0)
THEN 688 CALL error_petsc(
' BUG: temp must be a subset of H ')
696 nsize =
SIZE(list_dom_temp)
697 ALLOCATE(list_dom(nsize))
698 list_dom = list_dom_temp
699 ALLOCATE(list_inter(
SIZE(
inputs%list_inter_v_T)))
700 list_inter =
inputs%list_inter_v_T
702 nsize =
SIZE(
inputs%list_dom_ns)
703 ALLOCATE(list_dom(nsize))
704 list_dom =
inputs%list_dom_ns
705 ALLOCATE(list_inter(0))
708 nsize =
SIZE(list_dom_h)+
SIZE(
inputs%list_dom_phi)
709 ALLOCATE(list_dom(nsize))
710 list_dom(1:
SIZE(list_dom_h)) = list_dom_h
711 IF (
SIZE(
inputs%list_dom_phi)>0)
THEN 712 list_dom(
SIZE(list_dom_h)+1:) =
inputs%list_dom_phi
714 nsize =
SIZE(
inputs%list_inter_mu)+
SIZE(
inputs%list_inter_H_phi)
715 ALLOCATE(list_inter(nsize))
716 IF (
SIZE(
inputs%list_inter_mu)>0)
THEN 717 list_inter(1:
SIZE(
inputs%list_inter_mu)) =
inputs%list_inter_mu
719 IF (
SIZE(
inputs%list_inter_H_phi)>0)
THEN 720 list_inter(
SIZE(
inputs%list_inter_mu)+1:) =
inputs%list_inter_H_phi
724 ALLOCATE(list_inter_temp(0))
729 list_inter, 1, p1_mesh_glob,
inputs%iformatted)
731 list_inter, 2, p2_mesh_glob,
inputs%iformatted)
733 IF (
inputs%type_fe_velocity==3)
THEN 740 list_inter_temp, 2, p2_c0_mesh_glob_temp,
inputs%iformatted)
743 ALLOCATE(list_dummy(0))
745 inputs%list_inter_H_phi, 1, p1_c0_mesh_glob,
inputs%iformatted)
749 ALLOCATE(part(p1_mesh_glob%me))
750 WRITE(tit_part,
'(i4)')
inputs%ndim(1)
751 mesh_part_name=
'mesh_part_S'//trim(adjustl(tit_part))//
'.'//trim(adjustl(
inputs%file_name))
752 IF (
inputs%if_read_partition)
THEN 753 OPEN(unit=51, file=mesh_part_name, status=
'unknown',
form=
'formatted')
756 WRITE(*,*)
'read partition' 758 WRITE(*,*)
'create partition' 760 inputs%list_dom_phi, p1_mesh_glob,list_inter,part,
inputs%my_periodic)
761 IF (petsc_rank==0)
THEN 762 OPEN(unit=51, file=mesh_part_name, status=
'replace',
form=
'formatted')
771 IF (
inputs%type_fe_velocity==2)
THEN 772 CALL extract_mesh(comm_one_d(1),nb_procs_s,p1_mesh_glob,part,
inputs%list_dom_ns,pp_mesh_glob,pp_mesh)
773 CALL extract_mesh(comm_one_d(1),nb_procs_s,p2_mesh_glob,part,
inputs%list_dom_ns,vv_mesh_glob,vv_mesh)
774 ELSE IF (
inputs%type_fe_velocity==3)
THEN 775 CALL extract_mesh(comm_one_d(1),nb_procs_s,p2_mesh_glob,part,
inputs%list_dom_ns,pp_mesh_glob,pp_mesh)
776 CALL extract_mesh(comm_one_d(1),nb_procs_s,p3_mesh_glob,part,
inputs%list_dom_ns,vv_mesh_glob,vv_mesh)
778 CALL error_petsc(
'Bug in INIT, inputs%type_fe_velocity not correct')
785 ALLOCATE(comm_one_d_ns(2))
786 CALL mpi_comm_dup(comm_one_d(2), comm_one_d_ns(2), code)
788 CALL mpi_comm_rank(comm_one_d(1),rank_s,code)
789 IF (pp_mesh%me/=0)
THEN 790 CALL mpi_comm_split (comm_one_d(1),1,rank_s,comm_one_d_ns(1),code)
792 CALL mpi_comm_split (comm_one_d(1),mpi_undefined,rank_s,comm_one_d_ns(1),code)
798 IF (minval(abs(vv_mesh%rr(1,vv_mesh%jj(n,m)) &
799 -pp_mesh%rr(1,pp_mesh%jj(:,m))))>1.d-16 &
800 .OR. minval(abs(vv_mesh%rr(2,vv_mesh%jj(n,m))&
801 -pp_mesh%rr(2,pp_mesh%jj(:,m))))>1.d-16)
THEN 802 CALL error_petsc(
'BUG in INIT, vv and pp global meshes are different')
808 IF (ns_periodic)
THEN 813 IF (
inputs%if_level_set_P2)
THEN 821 IF (pp_mesh%me/=0)
THEN 830 IF (
inputs%is_mesh_symmetric)
THEN 841 vv_mesh%edge_stab=.false.
842 pp_mesh%edge_stab=.false.
851 IF (
inputs%type_fe_H==1)
THEN 852 CALL extract_mesh(comm_one_d(1),nb_procs_s,p1_mesh_glob,part,list_dom_h,h_mesh_glob,
h_mesh)
854 CALL extract_mesh(comm_one_d(1),nb_procs_s,p2_mesh_glob,part,list_dom_h,h_mesh_glob,
h_mesh)
856 IF (
inputs%type_fe_phi==1)
THEN 871 CALL extract_mesh(comm_one_d(1),nb_procs_s,p2_c0_mesh_glob_temp,part,list_dom_temp,temp_mesh_glob,
temp_mesh)
872 ALLOCATE(comm_one_d_temp(2))
873 CALL mpi_comm_dup(comm_one_d(2), comm_one_d_temp(2), code)
874 CALL mpi_comm_rank(comm_one_d(1),rank_s,code)
876 CALL mpi_comm_split (comm_one_d(1),1,rank_s,comm_one_d_temp(1),code)
878 CALL mpi_comm_split (comm_one_d(1),mpi_undefined,rank_s,comm_one_d_temp(1),code)
886 IF (
inputs%type_fe_velocity==3)
THEN 891 DEALLOCATE(list_dummy)
895 DEALLOCATE(list_inter_temp)
910 IF (error/maxval(abs(
h_mesh%rr(1,1) -
h_mesh%rr(1,:))) .GE. 5.d-14)
THEN 911 CALL error_petsc(.GE.
'BUG in INIT, (error/MAXVAL(ABS(H_mesh%rr(1,1) -H_mesh%rr(1,:))) 5.d-14')
917 IF (vv_mesh%me/=0)
THEN 920 DO n = 1,
SIZE(
h_mesh%jj,1)
921 error = error + maxval(abs(vv_mesh%rr(k,vv_mesh%jj(n,:))-
h_mesh%rr(k,
h_mesh%jj(n,1:vv_mesh%me))))
924 IF (error/maxval(abs(
h_mesh%rr(1,1) -
h_mesh%rr(1,:))) .GE. 5.d-14)
THEN 925 CALL error_petsc(.GE.
'BUG in INIT, (error/MAXVAL(ABS(H_mesh%rr(1,1) -H_mesh%rr(1,:))) 5.d-14')
928 error = error + maxval(abs(vv_mesh%rr(1,vv_mesh%jj(4,1:vv_mesh%me)) &
930 + maxval(abs(vv_mesh%rr(1,vv_mesh%jj(5,:)) &
932 + maxval(abs(vv_mesh%rr(1,vv_mesh%jj(6,:)) &
934 + maxval(abs(vv_mesh%rr(2,vv_mesh%jj(4,:)) &
936 + maxval(abs(vv_mesh%rr(2,vv_mesh%jj(5,:)) &
938 + maxval(abs(vv_mesh%rr(2,vv_mesh%jj(6,:)) &
940 IF (error/maxval(abs(
h_mesh%rr(1,1) -
h_mesh%rr(1,:))) .GE. 5.d-14)
THEN 941 WRITE(*,*)
' WARNING: vv_mesh and H_mesh do not coincide on the NS domain.' 942 WRITE(*,*)
' WARNING: Either you use curved elements P2 elements or BUG, ', &
949 error = error+ maxval(abs(vv_mesh%rr(n,vv_mesh%jj(1:3,k))-
h_mesh%rr(n,
h_mesh%jj(1:3,k))))
952 IF (error/maxval(abs(
h_mesh%rr(1,1) -
h_mesh%rr(1,:))) .GE. 5.d-14)
THEN 953 CALL error_petsc(
'vv_mesh and H_mesh do NOT have the same P1 nodes')
960 CALL load_interface(h_mesh_glob, h_mesh_glob,
inputs%list_inter_mu, interface_h_mu_glob, .false.)
961 CALL load_interface(h_mesh_glob, phi_mesh_glob,
inputs%list_inter_H_phi, interface_h_phi_glob, .true.)
980 IF (mxw_periodic)
THEN 982 WRITE(*,*)
'periodic MHD done' 987 phi_mesh_glob,
phi_mesh, interface_h_phi_glob, interface_h_mu_glob, &
996 IF (
inputs%is_mesh_symmetric)
THEN 1010 h_mesh%edge_stab = .false.
1013 IF (1.LE.
inputs%type_fe_H .AND.
inputs%type_fe_H.LE.2)
THEN 1017 IF (1.LE.
inputs%type_fe_phi .AND.
inputs%type_fe_phi.LE.2)
THEN 1026 IF (
h_mesh%i_d(m) == list_dom_h(k))
THEN 1034 IF (
inputs%analytical_permeability)
THEN 1039 IF (
h_mesh%i_d(m) == list_dom_h(k))
THEN 1057 IF (vv_mesh%me/=0)
THEN 1061 error = error + maxval(abs(vv_mesh%rr(k,vv_mesh%jj(n,:))-
temp_mesh%rr(k,
temp_mesh%jj(n,1:vv_mesh%me))))
1065 CALL error_petsc(.GE.
'BUG in INIT, (error/MAXVAL(ABS(temp_mesh%rr(1,1) -temp_mesh%rr(1,:))) 5.d-14')
1068 error = error + maxval(abs(vv_mesh%rr(1,vv_mesh%jj(4,1:vv_mesh%me)) &
1070 + maxval(abs(vv_mesh%rr(1,vv_mesh%jj(5,:)) &
1072 + maxval(abs(vv_mesh%rr(1,vv_mesh%jj(6,:)) &
1074 + maxval(abs(vv_mesh%rr(2,vv_mesh%jj(4,:)) &
1076 + maxval(abs(vv_mesh%rr(2,vv_mesh%jj(5,:)) &
1078 + maxval(abs(vv_mesh%rr(2,vv_mesh%jj(6,:)) &
1081 WRITE(*,*)
' WARNING: vv_mesh and temp_mesh do not coincide on the NS domain.' 1082 WRITE(*,*)
' WARNING: Either you use curved elements P2 elements or BUG, ', &
1087 DO k = 1, vv_mesh%me
1089 error = error+ maxval(abs(vv_mesh%rr(n,vv_mesh%jj(1:3,k))-
temp_mesh%rr(n,
temp_mesh%jj(1:3,k))))
1093 CALL error_petsc(
'vv_mesh and temp_mesh do NOT have the same P1 nodes')
1099 IF (temp_periodic)
THEN 1119 DO k=1,
inputs%nb_dom_temp
1120 IF (
temp_mesh%i_d(m) == list_dom_temp(k))
THEN 1129 DO k=1,
inputs%nb_dom_temp
1130 IF (
temp_mesh%i_d(m) == list_dom_temp(k))
THEN 1139 IF (vv_mesh%me /=0)
THEN 1140 DO m = 1, vv_mesh%me
1141 IF (maxval(abs(
h_mesh%rr(:,
h_mesh%jj(1:3,m))-vv_mesh%rr(:,vv_mesh%jj(1:3,m))))/=0.d0)
THEN 1142 CALL error_petsc(
' BUG in init: H_mesh and vv_mesh do not coincide ')
1147 IF (
ALLOCATED(list_dom_h))
DEALLOCATE(list_dom_h)
1151 IF (vv_mesh%me /=0)
THEN 1152 DO m = 1, vv_mesh%me
1153 IF (maxval(abs(
temp_mesh%rr(:,
temp_mesh%jj(1:3,m))-vv_mesh%rr(:,vv_mesh%jj(1:3,m))))/=0.d0)
THEN 1154 CALL error_petsc(
' BUG in init: temp_mesh and vv_mesh do not coincide ')
1159 IF (
ALLOCATED(list_dom_temp))
DEALLOCATE(list_dom_temp)
1178 IF(
inputs%if_navier_stokes_with_taylor)
THEN 1181 DO kp = 1,
inputs%taylor_order-1
1186 ALLOCATE(un_m1(vv_mesh%np, 6,
m_max_c))
1187 ALLOCATE(pn_m1(pp_mesh%np, 2,
m_max_c))
1190 ALLOCATE(density_m2(vv_mesh%np, 2,
m_max_c))
1191 ALLOCATE(density_m1(vv_mesh%np, 2,
m_max_c))
1192 ALLOCATE(density(vv_mesh%np, 2,
m_max_c))
1194 ALLOCATE(un(vv_mesh%np, 6,
m_max_c))
1198 IF (
inputs%if_level_set_P2)
THEN 1201 CALL mpi_comm_size(comm_one_d_ns(2), nb_procs, code)
1202 bloc_size = vv_mesh%gauss%l_G*vv_mesh%dom_me/nb_procs+1
1203 bloc_size = vv_mesh%gauss%l_G*(bloc_size/vv_mesh%gauss%l_G)+vv_mesh%gauss%l_G
1204 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
1209 CALL mpi_comm_size(comm_one_d_ns(2), nb_procs, code)
1210 bloc_size = pp_mesh%gauss%l_G*pp_mesh%dom_me/nb_procs+1
1211 bloc_size = pp_mesh%gauss%l_G*(bloc_size/pp_mesh%gauss%l_G)+pp_mesh%gauss%l_G
1212 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
1240 DO m = 1, vv_mesh%me
1263 IF (vv_mesh%me/=0)
THEN 1264 DO m = 1, vv_mesh%me
1284 IF (vv_mesh%me/=0)
THEN 1285 IF (
inputs%irestart_u)
THEN 1286 IF(
inputs%if_navier_stokes_with_taylor)
THEN 1299 IF(
inputs%if_navier_stokes_with_taylor)
THEN 1303 CALL init_velocity_pressure(vv_mesh, pp_mesh, time_u, &
1307 IF (
inputs%if_level_set_P2)
THEN 1308 CALL init_level_set(vv_mesh, time_u, &
1311 CALL init_level_set(pp_mesh, time_u, &
1314 bloc_size =
SIZE(un,1)/
inputs%ndim(2) + 1
1315 m_max_pad = 3*
SIZE(list_mode)*
inputs%ndim(2)/2
1317 CALL mpi_allreduce(max_vel_s,
max_vel, 1, mpi_double_precision, &
1318 mpi_max, comm_one_d_ns(1), code)
1324 inputs%density_fluid, density_m1)
1326 inputs%density_fluid, density)
1332 IF (list_mode(i) == 0)
THEN 1335 IF(
inputs%if_navier_stokes_with_taylor)
THEN 1336 DO kp = 1,
inputs%taylor_order-1
1337 der_un(kp)%DRT( :,2*k,i)= 0.d0
1340 un_m1(:,2*k,i) = 0.d0
1344 IF(
inputs%if_navier_stokes_with_taylor)
THEN 1345 DO kp = 1,
inputs%taylor_order-1
1346 der_pn(kp)%DRT( :,2,i) = 0.d0
1350 density(:,2,i) = 0.d0
1353 density_m1(:,2,i) = 0.d0
1362 IF(.NOT.
inputs%if_navier_stokes_with_taylor)
THEN 1363 density_m2 = density_m1
1369 IF ( (
inputs%type_pb==
'mxw') .AND. (
h_mesh%me/=0) )
THEN 1376 IF (
inputs%type_pb==
'mxx')
THEN 1381 v_to_max(:,k,i) = extension_velocity(k,
h_mesh, list_mode(i), time_u, 1)
1387 IF (vv_mesh%me /=0)
THEN 1395 IF(
inputs%if_navier_stokes_with_taylor)
THEN 1396 DO kp = 1,
inputs%taylor_order-1
1397 DEALLOCATE(
der_un(kp)%DRT)
1398 DEALLOCATE(
der_pn(kp)%DRT)
1407 DEALLOCATE(density_m2)
1408 DEALLOCATE(density_m1)
1421 IF (
inputs%irestart_h)
THEN 1429 IF (
inputs%if_permeability_variable_in_theta)
THEN 1430 CALL mpi_comm_size(comm_one_d(2), nb_procs, code)
1431 m_max_pad = 3*
SIZE(list_mode)*nb_procs/2
1432 bloc_size =
SIZE(
bn,1)/nb_procs+1
1434 h_mesh,
hn,
bn, nb_procs, bloc_size, m_max_pad, time)
1436 h_mesh,
hn1,
bn1, nb_procs, bloc_size, m_max_pad, time)
1449 IF (list_mode(i) == 0)
THEN 1468 IF (
inputs%irestart_T)
THEN 1476 IF (list_mode(i) == 0)
THEN 1487 time = max(time_u,time_h,time_t)
1494 IF (
inputs%analytical_permeability.OR.
inputs%nb_dom_phi>0)
THEN 1495 CALL error_petsc(
' BUG in INIT : sigma reconstruct via level set not implemented with vacuum or variable mu')
1505 REAL(KIND=8),
DIMENSION(ndim) :: vect_in
1506 REAL(KIND=8),
DIMENSION(ndim) :: vect_out
1508 INTEGER ::
TYPE, i_deb, i_fin
1509 REAL(KIND=8),
DIMENSION(vv_mesh%np,2,SIZE(list_mode)) :: sigma_ns
1513 i_deb = (type-1)*
h_mesh%np+1
1514 i_fin = i_deb +
h_mesh%np -1
1515 IF (modulo(
TYPE,2)==0 .AND. list_mode(i)==0)
THEN 1518 hn(:,
TYPE,i) = vect_in(i_deb:i_fin)
1522 phin(:,
TYPE,i) =0.d0
1527 i_fin = i_deb +
h_mesh%np -1
1528 IF (modulo(
TYPE,2)==0 .AND. list_mode(i)==0)
THEN 1529 hn1(:,
TYPE,i) = 0.d0
1531 hn1(:,
TYPE,i) = vect_in(i_deb:i_fin)
1535 phin1(:,
TYPE,i) =0.d0
1539 hn,
bn,
phin,
hn1,
bn1,
phin1,
v_to_max,
inputs%stab,
sigma_field,
r_fourier,
index_fourier, &
1544 i_deb = (type-1)*
h_mesh%np+1
1545 i_fin = i_deb +
h_mesh%np -1
1546 vect_out(i_deb:i_fin) =
hn(:,
TYPE,i)
1551 i_fin = i_deb +
h_mesh%np -1
1552 vect_out(i_deb:i_fin) =
hn1(:,
TYPE,i)
1561 CHARACTER(len=200),
DIMENSION(:,:),
ALLOCATABLE :: inline
1563 CHARACTER(len=3) :: tit
1569 CALL getarg(narg+1,tit)
1570 IF (tit ==
' ')
THEN 1578 ALLOCATE(inline(2,narg))
1581 CALL getarg(2*(i-1)+1,inline(1,i))
1582 CALL getarg(2*i ,inline(2,i))
1585 inputs%test_de_convergence = .false.
1586 inputs%numero_du_test_debug = 0
1587 inputs%data_directory_debug =
'.' 1589 IF (trim(adjustl(inline(1,i))) ==
'debug')
THEN 1590 inputs%test_de_convergence = .true.
1591 READ(inline(2,i),*)
inputs%numero_du_test_debug
1592 ELSE IF (trim(adjustl(inline(1,i))) ==
'debug_dir')
THEN 1593 inputs%data_directory_debug=inline(2,i)
1602 INTEGER :: m, type_fe, index, l, ierr, i
1603 REAL(KIND=8) :: diam_loc, diam
1605 IF (mesh%gauss%n_w==3)
THEN 1607 ELSE IF (mesh%gauss%n_w==6)
THEN 1609 ELSE IF (mesh%gauss%n_w==10)
THEN 1612 CALL error_petsc(
'BUG in compute_local_mesh_size')
1614 ALLOCATE(mesh%hloc(mesh%dom_me))
1615 ALLOCATE(mesh%hloc_gauss(mesh%gauss%l_G*mesh%dom_me))
1618 DO m = 1, mesh%dom_me
1619 mesh%hloc(m) = sqrt(sum(mesh%gauss%rj(:,m)))/type_fe
1620 DO l = 1, mesh%gauss%l_G
1622 mesh%hloc_gauss(index) = mesh%hloc(m)
1629 if(mesh%dom_me==0)
THEN 1632 diam_loc = sum(mesh%gauss%rj)
1634 CALL mpi_allreduce(diam_loc,diam,1,mpi_double_precision,mpi_sum,comm_one_d(1),ierr)
1635 mesh%global_diameter = sqrt(diam)
1638 diam_loc = maxval(mesh%rr(1,:))
1639 CALL mpi_allreduce(diam_loc,diam,1,mpi_double_precision,mpi_max,comm_one_d(1),ierr)
1642 mesh%hm(i) = 0.5d0*diam/
inputs%m_max
1648 REAL(KIND=8) :: h_min, h_min_F
1651 IF (
inputs%if_level_set_P2)
THEN 1652 h_min_f=minval(vv_mesh%hloc_gauss)
1654 h_min_f=minval(pp_mesh%hloc_gauss)
1656 CALL mpi_allreduce(h_min_f, h_min, 1, mpi_double_precision, &
1657 mpi_min, comm_one_d_ns(1), code)
1658 inputs%h_min_distance =
inputs%multiplier_for_h_min_distance*h_min
type(petsc_csr_la), public vizu_grad_phi_la
real(kind=8), dimension(:,:,:), allocatable, target v_to_max
subroutine write_restart_ns_taylor(communicator, vv_mesh, pp_mesh, time, list_mode, un, der_un, pn, der_pn, filename, it, freq_restart, opt_level_set, opt_level_set_m1, opt_max_vel, opt_mono)
real(kind=8), dimension(:,:,:), allocatable, target tempn_m1
subroutine, public st_scr_maxwell_mu_h_p_phi(communicator, H_mesh_glob, H_mesh, pmag_mesh_glob, pmag_mesh, phi_mesh_glob, phi_mesh, interface_glob, interface_H_mu_glob, LA_H, LA_pmag, LA_phi, LA_mhd, opt_per)
subroutine write_restart_temp(communicator, temp_mesh, time, list_mode, tempn, tempn_m1, filename, it, freq_restart, opt_mono)
subroutine, public load_interface(mesh_master, mesh_slave, list_inter, mesh_INTERFACE, disjoint)
real(kind=8), dimension(:,:,:), allocatable, target bn
subroutine read_restart_ns_taylor(communicator, time, list_mode, un, der_un, pn, der_pn, filename, val_init, interpol, opt_level_set, opt_level_set_m1, opt_max_vel, opt_mono, opt_it)
integer, dimension(:), allocatable jj_v_to_h
subroutine, public prep_periodic_bloc(my_periodic, mesh, periodic, nb_bloc)
real(kind=8), dimension(:,:,:), allocatable, target pdt_h_to_energy
subroutine, public fft_max_vel_dcl(communicator, V1_in, V_out, nb_procs, bloc_size, m_max_pad)
subroutine, public load_dg_mesh_free_format(dir, fil, list_dom, list_inter, type_fe, mesh, mesh_formatted)
type(interface_type), target interface_h_mu
subroutine, public prodmat_maxwell_int_by_parts(vect_in, vect_out, ndim, i)
subroutine, public fft_par_var_eta_prod_t_dcl(communicator, eta, H_mesh, c_in, c_out, nb_procs, bloc_size, m_max_pad, time, temps)
subroutine read_restart_ns(communicator, time, list_mode, un, un_m1, pn, pn_m1, incpn, incpn_m1, filename, val_init, interpol, opt_level_set, opt_level_set_m1, opt_max_vel, opt_mono, opt_it, opt_dt)
subroutine, public three_level_temperature(comm_one_d, time, temp_1_LA, dt, list_mode, temp_mesh, tempn_m1, tempn, chmp_vit, chmp_mag, chmp_pdt_H, vol_heat_capacity, temp_diffusivity, my_par_cc, temp_list_dirichlet_sides, temp_list_robin_sides, convection_coeff, exterior_temperature, temp_per)
subroutine compute_local_mesh_size(mesh)
subroutine, public navier_stokes_decouple(comm_one_d_ns, time, vv_3_LA, pp_1_LA, list_mode, pp_mesh, vv_mesh, incpn_m1, incpn, pn_m1, pn, un_m1, un, vvz_per, pp_per, Hn_p2, Bn_p2, density_m2, density_m1, density, visco_dyn, tempn, level_set_m1, level_set, visc_entro_level)
subroutine, public prep_periodic_h_p_phi_bc(my_periodic, H_mesh, pmag_mesh, phi_mesh, H_p_phi_per)
subroutine projection_temperature(mesh, vn, connectivity_structure, coupling_variable)
subroutine, public create_p3_mesh(p1_mesh, p2_mesh, p3_mesh, type_fe)
type(periodic_type) vvrtz_per
type(petsc_csr_la) pp_1_la
real(kind=8), dimension(:,:,:), allocatable, target h_to_energy
subroutine error_petsc(string)
type(dyn_real_array_three), dimension(:), allocatable der_pn
subroutine zero_out_modes
subroutine read_restart_maxwell(communicator, H_mesh, phi_mesh, time, list_mode, Hn, Hn1, Bn, Bn1, phin, phin1, filename, val_init, interpol, opt_mono, opt_it, opt_dt)
type(petsc_csr_la) temp_1_la
subroutine, public free_interface(interf)
type(mesh_type), target temp_mesh
real(kind=8), dimension(:,:,:), allocatable t_to_ns
subroutine prepare_zero_out_modes(list_mode, list_mode_to_zero_out, select_mode)
real(kind=8), dimension(:), allocatable, target temperature_diffusivity_field
subroutine, public reconstruct_variable(comm_one_d, list_mode, mesh_P1, mesh_P2, level_set, values, variable)
real(kind=8), dimension(:,:,:), allocatable, target bext
integer, dimension(:), allocatable, public vv_mz_la
subroutine, public save_run(it, freq_restart)
subroutine compute_local_mesh_size_level_set
real(kind=8), dimension(:,:,:), allocatable, target bn1
real(kind=8), dimension(:,:,:), allocatable incpn_m1
subroutine, public maxwell_decouple(comm_one_d, H_mesh, pmag_mesh, phi_mesh, interface_H_phi,interface_H_mu, Hn, Bn, phin, Hn1, Bn1, phin1, vel, stab_in, sigma_in,R_fourier, index_fourier, mu_H_field, mu_phi, time, dt, Rem, list_mode,
subroutine, public part_mesh_m_t_h_phi(nb_proc, list_u, list_T_in, list_h_in, list_phi, mesh, list_of_interfaces, part, my_periodic)
real(kind=8), dimension(:,:,:), allocatable, target pn
subroutine, public free_mesh(mesh)
real(kind=8), dimension(:,:,:,:), allocatable, target level_set_m1
type(petsc_csr_la) la_pmag
type(periodic_type) h_phi_per
type(petsc_csr_la), public vizu_rot_u_la
type(petsc_csr_la) la_phi
subroutine, public symmetric_points(mesh_loc, mesh_glob, ltg_LA)
real(kind=8), dimension(:,:,:), allocatable b_to_ns
type(interface_type), target interface_h_phi
subroutine projection_mag_field(mesh, vn, connectivity_structure, if_restriction, coupling_variable)
subroutine, public sfemans_initialize_postprocessing(comm_one_d, vv_mesh_in, pp_mesh, H_mesh, phi_mesh, temp_mesh, list_mode_in, opt_nb_plane)
real(kind=8), dimension(:), allocatable, target sigma_field
type(petsc_csr_la) la_mhd
type(periodic_type) vvrt_per
type(periodic_type) temp_per
subroutine, public initial(vv_mesh_out, pp_mesh_out, H_mesh_out, phi_mesh_out, temp_mesh_out, interface_H_phi_out, interface_H_mu_out, list_mode_out, un_out, pn_out, Hn_out, Bn_out, phin_out, v_to_Max_out, vol_heat_capacity_field_out, temperature_diffusivity_field_out, mu_H_field_out, sigma_field_out, time_out, m_max_c_out, comm_one_d_out, comm_one_d_ns_out, comm_one_d_temp_out, tempn_out, level_set_out, density_out, der_un_out)
type(periodic_type) pp_per
subroutine, public create_cart_comm(ndim, comm_cart, comm_one_d, coord_cart)
real(kind=8), dimension(:,:,:), allocatable, target hext
type(mesh_type), target h_mesh
subroutine, public prep_periodic(my_periodic, mesh, periodic)
subroutine, public st_aij_csr_glob_block(communicator, kmax, mesh_glob, mesh, LA, opt_per)
real(kind=8), dimension(:), allocatable, target vol_heat_capacity_field
subroutine write_restart_maxwell(communicator, H_mesh, phi_mesh, time, list_mode, Hn, Hn1, Bn, Bn1, phin, phin1, filename, it, freq_restart, opt_mono, opt_dt)
subroutine sfemansinitialize
type(mesh_type), target phi_mesh
real(kind=8), dimension(:,:,:), allocatable, target v_to_energy
subroutine projection_velocity(mesh, vn, connectivity_structure, coupling_variable)
real(kind=8), dimension(:,:,:), allocatable h_to_ns
real(kind=8), dimension(:,:,:), allocatable, target hn1
subroutine write_restart_ns(communicator, vv_mesh, pp_mesh, time, list_mode, un, un_m1, pn, pn_m1, incpn, incpn_m1, filename, it, freq_restart, opt_level_set, opt_level_set_m1, opt_max_vel, opt_mono, opt_dt)
integer, dimension(:), allocatable, public h_mz_la
subroutine, public extract_mesh(communicator, nb_proc, mesh_glob, part, list_dom, mesh, mesh_loc)
real(kind=8), dimension(:,:,:), allocatable, target hn
type(petsc_csr_la), public vizu_rot_h_la
subroutine, public run_sfemans(time_in, it)
type(dyn_real_array_three), dimension(:), allocatable, target der_un
subroutine, public three_level_mass(comm_one_d, time, level_set_LA_P1, level_set_LA_P2, list_mode, mesh_P1, mesh_P2, chmp_vit_P2, max_vel, level_set_per, density_m2, density_m1, density, level_set_m1, level_set, visc_entro_level)
real(kind=8), dimension(:,:,:,:), allocatable, target level_set
real(kind=8), dimension(:,:), allocatable visc_entro_level
integer, dimension(:), allocatable jj_v_to_temp
subroutine, public navier_stokes_taylor(comm_one_d_ns, time, vv_3_LA, pp_1_LA, list_mode, pp_mesh, vv_mesh, pn, der_pn, un, der_un, vvz_per, pp_per)
real(kind=8), dimension(:), allocatable, target mu_h_field
subroutine read_restart_temp(communicator, time, list_mode, tempn, tempn_m1, filename, val_init, interpol, opt_mono)
type(mesh_type), target pmag_mesh
real(kind=8), dimension(:,:,:), allocatable, target phin1
subroutine, public init_velocity_pressure_taylor(vv_mesh, pp_mesh, list_mode, time, pn, der_pn, un, der_un)
real(kind=8), dimension(:,:,:), allocatable, target phin
real(kind=8), dimension(:,:,:), allocatable incpn
subroutine assign_boundary
subroutine, public gauss_points_2d(mesh, type_fe)
type(periodic_type) level_set_per
section doc_intro_frame_work_num_app Numerical approximation subsection doc_intro_fram_work_num_app_Fourier_FEM Fourier Finite element representation The SFEMaNS code uses a hybrid Fourier Finite element formulation The Fourier decomposition allows to approximate the problem’s solutions for each Fourier mode modulo nonlinear terms that are made explicit The variables are then approximated on a meridian section of the domain with a finite element method The numerical approximation of a function f $f f is written in the following generic form