6 CHARACTER(LEN=200) :: directory, file_name
7 LOGICAL :: if_read_partition
8 CHARACTER(LEN=3) :: type_pb
9 INTEGER,
DIMENSION(2) :: ndim
10 LOGICAL :: select_mode
12 INTEGER,
DIMENSION(:),
POINTER :: list_mode_lect
14 INTEGER :: nb_iteration
18 REAL(KIND=8) :: LES_coeff1, LES_coeff2, LES_coeff3, LES_coeff4
19 LOGICAL :: if_LES_in_momentum
21 REAL(KIND=8) :: taux_precession, angle_s_pi
24 LOGICAL :: if_ns_penalty
25 LOGICAL :: if_impose_vel_in_solids
26 LOGICAL :: if_compute_momentum_pseudo_force
27 REAL(KIND=8) :: div_stab_in_ns
29 LOGICAL :: if_navier_stokes_with_u
30 LOGICAL :: if_tensor_sym
31 LOGICAL :: if_moment_bdf2
34 INTEGER,
DIMENSION(:),
POINTER :: list_dom_ns
37 INTEGER :: pp_nb_dirichlet_sides
38 INTEGER,
DIMENSION(:),
POINTER :: pp_list_dirichlet_sides
39 INTEGER,
DIMENSION(3) :: vv_nb_dirichlet_sides
41 INTEGER :: vv_nb_dirichlet
42 INTEGER :: vv_nb_dirichlet_normal_velocity
43 INTEGER,
DIMENSION(:),
POINTER :: vv_list_dirichlet_normal_velocity_sides
45 LOGICAL :: if_maxwell_with_H
47 INTEGER :: nb_dom_H, nb_dom_phi, nb_inter, nb_inter_mu
48 INTEGER :: type_fe_H, type_fe_phi, nb_dirichlet_sides_H
49 INTEGER,
DIMENSION(:),
POINTER :: list_dom_H, list_dom_phi, list_inter_H_phi
50 INTEGER,
DIMENSION(:),
POINTER :: list_inter_mu, list_dirichlet_sides_H
51 REAL(KIND=8) :: Rem, mu_phi
52 LOGICAL :: analytical_permeability
53 LOGICAL :: if_use_fem_integration_for_mu_bar
54 LOGICAL :: if_permeability_variable_in_theta
55 REAL(KIND=8),
DIMENSION(:),
POINTER :: mu_H, sigma
56 REAL(KIND=8),
DIMENSION(3) :: stab
58 INTEGER :: phi_nb_dirichlet_sides
59 INTEGER,
DIMENSION(:),
POINTER :: phi_list_dirichlet_sides
60 LOGICAL :: if_quasi_static_approx
62 LOGICAL :: if_temperature
64 REAL(KIND=8) :: gravity_coefficient
65 REAL(KIND=8),
DIMENSION(:),
POINTER :: temperature_diffusivity
66 REAL(KIND=8),
DIMENSION(:),
POINTER :: vol_heat_capacity
68 INTEGER :: temperature_nb_dirichlet_sides
69 INTEGER,
DIMENSION(:),
POINTER :: temperature_list_dirichlet_sides
70 INTEGER :: nb_dom_temp
71 INTEGER,
DIMENSION(:),
POINTER :: list_dom_temp
72 INTEGER :: nb_inter_v_T
73 INTEGER,
DIMENSION(:),
POINTER :: list_inter_v_T
75 LOGICAL :: if_level_set
77 INTEGER :: level_set_nb_dirichlet_sides
78 INTEGER,
DIMENSION(:),
POINTER :: level_set_list_dirichlet_sides
79 REAL(KIND=8) :: level_set_cmax
80 REAL(KIND=8) :: level_set_comp_factor
81 CHARACTER(LEN=3) :: level_set_reconstruction_type
82 REAL(KIND=8) :: level_set_tanh_coeff_reconstruction
84 REAL(KIND=8),
DIMENSION(:),
POINTER :: density_fluid
85 REAL(KIND=8),
DIMENSION(:),
POINTER :: dyna_visc_fluid
86 LOGICAL :: variation_sigma_fluid
87 REAL(KIND=8),
DIMENSION(:),
POINTER :: sigma_fluid
88 LOGICAL :: if_surface_tension
89 REAL(KIND=8),
DIMENSION(:),
POINTER :: coeff_surface
90 LOGICAL :: if_mass_correction
91 LOGICAL :: if_kill_overshoot
92 REAL(KIND=8) :: multiplier_for_h_min_distance
94 REAL(KIND=8) :: h_min_distance
95 LOGICAL :: if_level_set_P2
96 LOGICAL :: if_compression_mthd_JLG
100 LOGICAL :: test_de_convergence
101 CHARACTER(len=200) :: data_directory_debug
102 INTEGER :: numero_du_test_debug
103 REAL(KIND=8),
DIMENSION(4) :: norm_ref
106 CHARACTER(len=2) :: arpack_which
107 INTEGER :: nb_eigenvalues, arpack_iter_max
108 REAL(KIND=8) :: arpack_tolerance
109 LOGICAL :: if_arpack_vtu_2d
111 REAL(KIND=8) :: stab_bdy_ns
113 INTEGER :: number_of_planes_in_real_space
114 LOGICAL :: check_numerical_stability
115 LOGICAL :: is_mesh_symmetric
116 LOGICAL :: if_zero_out_modes
117 INTEGER :: nb_select_mode_ns, nb_select_mode_mxw
118 INTEGER,
DIMENSION(:),
POINTER :: list_select_mode_ns, list_select_mode_mxw
119 INTEGER :: freq_restart, freq_en, freq_plot
120 LOGICAL :: verbose_timing, verbose_divergence, verbose_CFL
121 LOGICAL :: if_just_processing
127 class(
my_data),
INTENT(INOUT) :: a
130 a%if_read_partition=.false.
131 a%select_mode=.false.
133 a%if_LES_in_momentum=.false.
135 a%if_ns_penalty=.false.
136 a%if_impose_vel_in_solids=.false.
137 a%if_compute_momentum_pseudo_force=.false.
138 a%if_navier_stokes_with_u=.false.
139 a%if_tensor_sym=.false.
140 a%if_moment_bdf2=.false.
142 a%if_maxwell_with_H=.false.
145 a%analytical_permeability=.false.
146 a%if_use_fem_integration_for_mu_bar=.false.
147 a%if_permeability_variable_in_theta=.false.
148 a%if_quasi_static_approx=.false.
149 a%if_temperature=.false.
150 a%if_level_set=.false.
151 a%variation_sigma_fluid=.false.
152 a%if_surface_tension=.false.
153 a%if_mass_correction=.false.
154 a%if_kill_overshoot=.false.
155 a%if_level_set_P2=.false.
156 a%if_compression_mthd_JLG=.false.
159 a%if_arpack_vtu_2d=.false.
160 a%check_numerical_stability=.false.
161 a%is_mesh_symmetric=.false.
162 a%if_zero_out_modes=.false.
163 a%verbose_timing =.false.
164 a%verbose_divergence=.false.
165 a%verbose_CFL=.false.
166 a%if_just_processing=.false.
167 a%my_par_vv%verbose=.false.
168 a%my_par_pp%verbose=.false.
169 a%my_par_mass%verbose=.false.
170 a%my_par_H_p_phi%verbose=.false.
171 a%my_par_temperature%verbose=.false.
172 a%my_par_level_set%verbose=.false.
178 a%taux_precession=0.d0
180 a%div_stab_in_ns=0.d0
182 a%gravity_coefficient=0.d0
183 a%level_set_cmax=0.d0
184 a%level_set_comp_factor=0.d0
185 a%level_set_tanh_coeff_reconstruction=0.d0
187 a%arpack_tolerance=0.d0
189 a%h_min_distance=0.d0
190 a%multiplier_for_h_min_distance=0.d0
193 a%vv_nb_dirichlet_normal_velocity=0
194 a%freq_restart = 10000000
196 a%freq_plot = 10000000
214 CHARACTER(len=200),
INTENT(IN) :: data_fichier
216 CHARACTER(len=8),
DIMENSION(3) :: vel_component=(/
'uradial',
'utheta ',
'uzaxis '/)
222 OPEN(unit = 21, file = data_fichier,
form =
'formatted', status =
'unknown')
225 CALL
read_until(21,
'===Is mesh file formatted (true/false)?')
226 READ(21,*) inputs%iformatted
227 CALL
read_until(21,
'===Directory and name of mesh file')
228 READ(21,*) inputs%directory, inputs%file_name
231 CALL
read_until(21,
'===Number of processors in meridian section')
232 READ (21,*) inputs%ndim(1)
233 CALL
read_until(21,
'===Number of processors in Fourier space')
234 READ (21,*) inputs%ndim(2)
237 CALL
read_until(21,
'===Number of Fourier modes')
238 READ(21,*) inputs%m_max
239 IF (mod(inputs%m_max,inputs%ndim(2))/= 0)
THEN
240 CALL
error_petsc(
'BUG in read_my_data, MOD(nb_select_mode,nb_procs_F)/= 0')
242 CALL
find_string(21,
'===Select Fourier modes? (true/false)', test)
244 READ (21,*) inputs%select_mode
246 inputs%select_mode = .false.
248 IF (inputs%select_mode)
THEN
249 ALLOCATE(inputs%list_mode_lect(inputs%m_max))
250 CALL
read_until(21,
'===List of Fourier modes (if select_mode=.TRUE.)')
251 READ(21,*) inputs%list_mode_lect
255 CALL
read_until(21,
'===Problem type: (nst, mxw, mhd, fhd)')
256 READ(21,*) inputs%type_pb
257 IF (inputs%type_pb/=
'nst' .AND. inputs%type_pb/=
'mhd' .AND. inputs%type_pb/=
'mxw' .AND. inputs%type_pb/=
'fhd')
THEN
258 CALL
error_petsc(
'BUG in read_my_data, type_pb of probleme not yet defined')
262 CALL
read_until(21,
'===Restart on velocity (true/false)')
263 READ (21 ,*) inputs%irestart_u
264 IF (inputs%type_pb==
'mhd' .OR. inputs%type_pb==
'mxw' .OR. inputs%type_pb==
'fhd')
THEN
265 CALL
read_until(21,
'===Restart on magnetic field (true/false)')
266 READ (21 ,*) inputs%irestart_h
268 inputs%irestart_h = .false.
270 CALL
find_string(21,
'===Restart on temperature (true/false)', test)
272 READ (21 ,*) inputs%irestart_T
274 inputs%irestart_T = .false.
278 CALL
find_string(21,
'===Do we read metis partition? (true/false)', test)
280 READ (21,*) inputs%if_read_partition
282 inputs%if_read_partition = .false.
284 IF (.NOT.inputs%if_read_partition .AND. (inputs%irestart_u .OR. inputs%irestart_h .OR. inputs%irestart_T))
THEN
285 call
error_petsc(
'Possibility of bug: set "===Do we read metis partition? (true/false) "' // &
286 'parameter to .true. when restarting a computation since number of procs, ' // &
287 'or machine, or type_pb may have changed. Make sure your mesh_part file is the correct one.')
291 CALL
read_until(21,
'===Time step and number of time iterations')
292 READ(21,*) inputs%dt, inputs%nb_iteration
295 CALL
find_string(21,
'===Check numerical stability (true/false)', test)
297 READ (21,*) inputs%check_numerical_stability
299 inputs%check_numerical_stability = .false.
303 CALL
find_string(21,
'===How many pieces of periodic boundary?', test)
305 READ (21,*) inputs%my_periodic%nb_periodic_pairs
307 inputs%my_periodic%nb_periodic_pairs = 0
309 IF (inputs%my_periodic%nb_periodic_pairs.GE.1)
THEN
310 ALLOCATE(inputs%my_periodic%list_periodic(2,inputs%my_periodic%nb_periodic_pairs))
311 ALLOCATE(inputs%my_periodic%vect_e(2,inputs%my_periodic%nb_periodic_pairs))
312 CALL
read_until(21,
'===Indices of periodic boundaries and corresponding vectors')
313 DO k = 1, inputs%my_periodic%nb_periodic_pairs
314 READ(21,*) inputs%my_periodic%list_periodic(:,k), inputs%my_periodic%vect_e(:,k)
319 CALL
find_string(21,
'===Is the mesh symmetric (true/false)?', test)
321 READ (21,*) inputs%is_mesh_symmetric
323 inputs%is_mesh_symmetric = .false.
327 IF (inputs%type_pb==
'nst' .OR. inputs%type_pb==
'mhd' .OR. inputs%type_pb==
'fhd' .OR. inputs%irestart_u)
THEN
329 CALL
find_string(21,
'===Solve Navier-Stokes with u (true) or m (false)?', test)
331 READ(21,*) inputs%if_navier_stokes_with_u
333 inputs%if_navier_stokes_with_u = .true.
347 inputs%if_tensor_sym = .true.
349 IF (.NOT.inputs%if_navier_stokes_with_u)
THEN
350 CALL
find_string(21,
'===Do we solve momentum with bdf2 (true/false)?', test)
352 READ(21,*) inputs%if_moment_bdf2
354 inputs%if_moment_bdf2=.false.
358 CALL
read_until(21,
'===Number of subdomains in Navier-Stokes mesh')
359 READ(21,*) inputs%nb_dom_ns
360 ALLOCATE(inputs%list_dom_ns(inputs%nb_dom_ns))
361 CALL
read_until(21,
'===List of subdomains for Navier-Stokes mesh')
362 READ(21,*) inputs%list_dom_ns
366 CALL
find_string(21,
'===How many boundary pieces for Dirichlet BCs on '//trim(vel_component(k))//
'?', test)
368 CALL
error_petsc(
'===How many boundary pieces for Dirichlet BCs on '//trim(vel_component(k))//
'? is disabled')
371 inputs%vv_nb_dirichlet_sides(k) = 0
373 IF (inputs%vv_nb_dirichlet_sides(k)>0)
THEN
374 ALLOCATE(inputs%vv_list_dirichlet_sides(k)%DIL(inputs%vv_nb_dirichlet_sides(k)))
375 CALL
read_until(21,
'===List of boundary pieces for Dirichlet BCs on '//trim(vel_component(k)))
376 READ(21,*) inputs%vv_list_dirichlet_sides(k)%DIL
378 ALLOCATE(inputs%vv_list_dirichlet_sides(k)%DIL(0))
381 CALL
find_string(21,
'===How many boundary pieces for full Dirichlet BCs on velocity?', test)
383 READ(21,*) inputs%vv_nb_dirichlet
385 inputs%vv_nb_dirichlet=0
387 IF (inputs%vv_nb_dirichlet>0)
THEN
389 ALLOCATE(inputs%vv_list_dirichlet_sides(k)%DIL(inputs%vv_nb_dirichlet))
390 CALL
read_until(21,
'===List of boundary pieces for full Dirichlet BCs on velocity')
391 READ(21,*) inputs%vv_list_dirichlet_sides(k)%DIL
395 ALLOCATE(inputs%vv_list_dirichlet_sides(k)%DIL(0))
400 CALL
find_string(21,
'===How many boundary pieces for homogeneous normal velocity?', test)
402 READ(21,*) inputs%vv_nb_dirichlet_normal_velocity
404 inputs%vv_nb_dirichlet_normal_velocity=0
406 IF (inputs%vv_nb_dirichlet_normal_velocity>0)
THEN
407 ALLOCATE(inputs%vv_list_dirichlet_normal_velocity_sides(inputs%vv_nb_dirichlet_normal_velocity))
408 CALL
read_until(21,
'===List of boundary pieces for homogeneous normal velocity')
409 READ(21,*) inputs%vv_list_dirichlet_normal_velocity_sides
412 READ (21,*) inputs%stab_bdy_ns
414 inputs%stab_bdy_ns=1.d0
416 DO k = 1, inputs%vv_nb_dirichlet_normal_velocity
417 IF (minval(abs(inputs%vv_list_dirichlet_normal_velocity_sides(k) &
418 - inputs%vv_list_dirichlet_sides(1)%DIL))==0)
THEN
419 CALL
error_petsc(
'Boundary conditions are mixed up')
425 CALL
find_string(21,
'===Stress boundary conditions? (true/false)', test)
427 CALL
error_petsc(
'===Stress boundary conditions Does not work any more')
434 READ(21,*) inputs%pp_nb_dirichlet_sides
436 inputs%pp_nb_dirichlet_sides = 0
438 IF (inputs%pp_nb_dirichlet_sides>0)
THEN
439 ALLOCATE(inputs%pp_list_dirichlet_sides(inputs%pp_nb_dirichlet_sides))
440 CALL
read_until(21,
'===List of boundary pieces for Dirichlet BCs on pressure')
441 READ(21,*) inputs%pp_list_dirichlet_sides
443 ALLOCATE(inputs%pp_list_dirichlet_sides(0))
451 IF (inputs%if_navier_stokes_with_u)
THEN
452 CALL
find_string(21,
'===Coefficient for penalty of divergence in NS?', test)
454 READ(21,*) inputs%div_stab_in_ns
456 inputs%div_stab_in_ns = 0.d0
461 CALL
find_string(21,
'===Is there a precession term (true/false)?', test)
463 READ(21,*) inputs%precession
465 inputs%precession = .false.
467 IF (inputs%precession)
THEN
469 READ(21,*) inputs%taux_precession
470 CALL
read_until(21,
'===Precession angle over pi')
471 READ(21,*) inputs%angle_s_pi
473 inputs%taux_precession = 0.d0
474 inputs%angle_s_pi = 0.d0
478 CALL
find_string(21,
'===Use penalty in NS domain (true/false)?', test)
480 READ(21,*) inputs%if_ns_penalty
482 inputs%if_ns_penalty = .false.
484 IF (inputs%if_ns_penalty)
THEN
485 CALL
find_string(21,
'===Use nonzero velocity in solids (true/false)?', test)
487 READ(21,*) inputs%if_impose_vel_in_solids
489 inputs%if_impose_vel_in_solids = .false.
491 CALL
find_string(21,
'===Compute z momentum (true/false)?', test)
493 READ(21,*) inputs%if_compute_momentum_pseudo_force
495 inputs%if_compute_momentum_pseudo_force = .false.
498 inputs%if_impose_vel_in_solids = .false.
499 inputs%if_compute_momentum_pseudo_force = .false.
503 CALL
read_until(21,
'===Maximum number of iterations for velocity solver')
504 READ(21,*) inputs%my_par_vv%it_max
505 CALL
read_until(21,
'===Relative tolerance for velocity solver')
506 READ(21,*) inputs%my_par_vv%rel_tol
507 CALL
read_until(21,
'===Absolute tolerance for velocity solver')
508 READ(21,*) inputs%my_par_vv%abs_tol
509 CALL
find_string(21,
'===Velocity solver verbose? (true/false)', test)
511 READ(21,*) inputs%my_par_vv%verbose
513 CALL
read_until(21,
'===Solver type for velocity (FGMRES, CG, ...)')
514 READ(21,*) inputs%my_par_vv%solver
515 CALL
read_until(21,
'===Preconditionner type for velocity solver (HYPRE, JACOBI, MUMPS...)')
516 READ(21,*) inputs%my_par_vv%precond
519 CALL
read_until(21,
'===Maximum number of iterations for pressure solver')
520 READ(21,*) inputs%my_par_pp%it_max
521 CALL
read_until(21,
'===Relative tolerance for pressure solver')
522 READ(21,*) inputs%my_par_pp%rel_tol
523 CALL
read_until(21,
'===Absolute tolerance for pressure solver')
524 READ(21,*) inputs%my_par_pp%abs_tol
525 CALL
find_string(21,
'===Pressure solver verbose? (true/false)',test)
527 READ(21,*) inputs%my_par_pp%verbose
529 CALL
read_until(21,
'===Solver type for pressure (FGMRES, CG, ...)')
530 READ(21,*) inputs%my_par_pp%solver
531 CALL
read_until(21,
'===Preconditionner type for pressure solver (HYPRE, JACOBI, MUMPS...)')
532 READ(21,*) inputs%my_par_pp%precond
535 CALL
read_until(21,
'===Maximum number of iterations for mass matrix solver')
536 READ(21,*) inputs%my_par_mass%it_max
537 CALL
read_until(21,
'===Relative tolerance for mass matrix solver')
538 READ(21,*) inputs%my_par_mass%rel_tol
539 CALL
read_until(21,
'===Absolute tolerance for mass matrix solver')
540 READ(21,*) inputs%my_par_mass%abs_tol
541 CALL
find_string(21,
'===Mass matrix solver verbose? (true/false)',test)
543 READ(21,*) inputs%my_par_mass%verbose
545 CALL
read_until(21,
'===Solver type for mass matrix (FGMRES, CG, ...)')
546 READ(21,*) inputs%my_par_mass%solver
547 CALL
read_until(21,
'===Preconditionner type for mass matrix solver (HYPRE, JACOBI, MUMPS...)')
548 READ(21,*) inputs%my_par_mass%precond
551 CALL
find_string(21,
'===Use LES? (true/false)', test)
553 READ(21,*) inputs%LES
559 CALL
find_string(21,
'===Coefficients for LES', test)
561 CALL
error_petsc(
'===Coefficients for LES is disabled')
564 inputs%LES_coeff4 = 0.125d0
565 inputs%LES_coeff3 = 0.d0
568 CALL
read_until(21,
'===Coefficient multiplying residual')
569 READ(21,*) inputs%LES_coeff2
571 CALL
find_string(21,
'===Coefficient for explicit LES', test)
573 READ(21,*) inputs%LES_coeff1
575 inputs%LES_coeff1 = 0.d0
578 inputs%LES_coeff1 = 0.d0
579 inputs%LES_coeff2 = 0.d0
580 inputs%LES_coeff3 = 0.d0
581 inputs%LES_coeff4 = 0.d0
584 IF (.NOT.inputs%if_navier_stokes_with_u)
THEN
585 CALL
find_string(21,
'===Use LES in momentum? (true/false)', test)
587 READ(21,*) inputs%if_LES_in_momentum
589 inputs%if_LES_in_momentum=.true.
594 IF (inputs%type_pb==
'mxw' .OR. inputs%type_pb==
'mhd' .OR. inputs%type_pb==
'fhd')
THEN
596 CALL
find_string(21,
'===Solve Maxwell with H (true) or B (false)?', test)
598 READ(21,*) inputs%if_maxwell_with_H
600 inputs%if_maxwell_with_H = .false.
604 CALL
find_string(21,
'===Quasi-static approximation (true) or (false)?', test)
606 READ(21,*) inputs%if_quasi_static_approx
608 inputs%if_quasi_static_approx = .false.
612 CALL
read_until(21,
'===Number of subdomains in magnetic field (H) mesh')
613 READ(21,*) inputs%nb_dom_H
614 ALLOCATE(inputs%list_dom_H(inputs%nb_dom_H))
615 CALL
read_until(21,
'===List of subdomains for magnetic field (H) mesh')
616 READ(21,*) inputs%list_dom_H
619 CALL
read_until(21,
'===Number of interfaces in H mesh')
620 READ(21,*) inputs%nb_inter_mu
621 ALLOCATE(inputs%list_inter_mu(inputs%nb_inter_mu))
622 IF (inputs%nb_inter_mu>0)
THEN
623 CALL
read_until(21,
'===List of interfaces in H mesh')
624 READ(21,*) inputs%list_inter_mu
628 CALL
read_until(21,
'===Number of Dirichlet sides for Hxn')
629 READ(21,*) inputs%nb_dirichlet_sides_H
630 ALLOCATE(inputs%list_dirichlet_sides_H(inputs%nb_dirichlet_sides_H))
631 IF (inputs%nb_dirichlet_sides_H>0)
THEN
632 CALL
read_until(21,
'===List of Dirichlet sides for Hxn')
633 READ(21,*) inputs%list_dirichlet_sides_H
637 CALL
find_string(21,
'===Is permeability defined analytically (true/false)?', test)
639 READ(21,*) inputs%analytical_permeability
641 inputs%analytical_permeability = .false.
643 IF (.NOT.inputs%analytical_permeability)
THEN
644 CALL
read_until(21,
'===Permeability in the conductive part (1:nb_dom_H)')
645 ALLOCATE(inputs%mu_H(inputs%nb_dom_H))
646 READ(21,*) inputs%mu_H
648 inputs%if_permeability_variable_in_theta = .false.
649 IF (inputs%analytical_permeability)
THEN
650 CALL
find_string(21,
'===Is permeability variable in theta (true/false)?', test)
652 READ(21,*) inputs%if_permeability_variable_in_theta
657 inputs%if_use_fem_integration_for_mu_bar = .true.
658 IF (inputs%analytical_permeability)
THEN
659 CALL
find_string(21,
'===Use FEM Interpolation for magnetic permeability (true/false)?', test)
661 READ(21,*) inputs%if_use_fem_integration_for_mu_bar
666 CALL
read_until(21,
'===Conductivity in the conductive part (1:nb_dom_H)')
667 ALLOCATE(inputs%sigma(inputs%nb_dom_H))
668 READ(21,*) inputs%sigma
671 CALL
read_until(21,
'===Type of finite element for magnetic field')
672 READ(21,*) inputs%type_fe_H
675 CALL
read_until(21,
'===Magnetic Reynolds number')
676 READ(21,*) inputs%Rem
679 CALL
read_until(21,
'===Stabilization coefficient (divergence)')
680 READ(21,*) inputs%stab(1)
681 IF (inputs%nb_inter_mu>0 .OR. inputs%nb_dirichlet_sides_H>0)
THEN
682 CALL
read_until(21,
'===Stabilization coefficient for Dirichlet H and/or interface H/H')
683 READ(21,*) inputs%stab(3)
685 inputs%stab(3) = 0.d0
689 CALL
find_string(21,
'===Number of subdomains in magnetic potential (phi) mesh', test)
691 READ (21,*) inputs%nb_dom_phi
693 inputs%nb_dom_phi = 0
695 ALLOCATE(inputs%list_dom_phi(inputs%nb_dom_phi))
696 IF (inputs%nb_dom_phi>0)
THEN
698 CALL
read_until(21,
'===List of subdomains for magnetic potential (phi) mesh')
699 READ(21,*) inputs%list_dom_phi
702 CALL
read_until(21,
'===How many boundary pieces for Dirichlet BCs on phi?')
703 READ(21,*) inputs%phi_nb_dirichlet_sides
704 IF (inputs%phi_nb_dirichlet_sides>0)
THEN
705 ALLOCATE(inputs%phi_list_dirichlet_sides(inputs%phi_nb_dirichlet_sides))
706 CALL
read_until(21,
'===List of boundary pieces for Dirichlet BCs on phi')
707 READ(21,*) inputs%phi_list_dirichlet_sides
709 ALLOCATE(inputs%phi_list_dirichlet_sides(0))
713 CALL
read_until(21,
'===Number of interfaces between H and phi')
714 READ(21,*) inputs%nb_inter
715 ALLOCATE(inputs%list_inter_H_phi(inputs%nb_inter))
716 CALL
read_until(21,
'===List of interfaces between H and phi')
717 IF (inputs%nb_inter>0)
THEN
718 READ(21,*) inputs%list_inter_H_phi
722 CALL
read_until(21,
'===Permeability in vacuum')
723 READ(21,*) inputs%mu_phi
726 CALL
read_until(21,
'===Type of finite element for scalar potential')
727 READ(21,*) inputs%type_fe_phi
730 CALL
read_until(21,
'===Stabilization coefficient (interface H/phi)')
731 READ(21,*) inputs%stab(2)
735 CALL
read_until(21,
'===Maximum number of iterations for Maxwell solver')
736 READ(21,*) inputs%my_par_H_p_phi%it_max
737 CALL
read_until(21,
'===Relative tolerance for Maxwell solver')
738 READ(21,*) inputs%my_par_H_p_phi%rel_tol
739 CALL
read_until(21,
'===Absolute tolerance for Maxwell solver')
740 READ(21,*) inputs%my_par_H_p_phi%abs_tol
741 CALL
find_string(21,
'===Maxwell solver verbose? (true/false)',test)
743 READ(21,*) inputs%my_par_H_p_phi%verbose
745 CALL
read_until(21,
'===Solver type for Maxwell (FGMRES, CG, ...)')
746 READ(21,*) inputs%my_par_H_p_phi%solver
747 CALL
read_until(21,
'===Preconditionner type for Maxwell solver (HYPRE, JACOBI, MUMPS...)')
748 READ(21,*) inputs%my_par_H_p_phi%precond
752 CALL
find_string(21,
'===Is there a temperature field?', test)
754 READ (21,*) inputs%if_temperature
756 inputs%if_temperature = .false.
758 IF (inputs%if_temperature)
THEN
760 CALL
find_string(21,
'===Non-dimensional gravity coefficient', test)
762 READ (21,*) inputs%gravity_coefficient
764 inputs%gravity_coefficient = 0.d0
767 CALL
read_until(21,
'===Number of subdomains in temperature mesh')
768 READ(21,*) inputs%nb_dom_temp
769 ALLOCATE(inputs%list_dom_temp(inputs%nb_dom_temp))
770 CALL
read_until(21,
'===List of subdomains for temperature mesh')
771 READ(21,*) inputs%list_dom_temp
772 ALLOCATE(inputs%vol_heat_capacity(inputs%nb_dom_temp))
773 ALLOCATE(inputs%temperature_diffusivity(inputs%nb_dom_temp))
774 CALL
find_string(21,
'===Volumetric heat capacity (1:nb_dom_temp)', test)
776 READ(21,*) inputs%vol_heat_capacity
777 CALL
read_until(21,
'===Thermal conductivity (1:nb_dom_temp)')
778 READ(21,*) inputs%temperature_diffusivity
780 inputs%vol_heat_capacity = 1.d0
781 CALL
read_until(21,
'===Diffusivity coefficient for temperature (1:nb_dom_temp)')
782 READ(21,*) inputs%temperature_diffusivity
785 CALL
read_until(21,
'===How many boundary pieces for Dirichlet BCs on temperature?')
786 READ(21,*) inputs%temperature_nb_dirichlet_sides
787 IF (inputs%temperature_nb_dirichlet_sides>0)
THEN
788 ALLOCATE(inputs%temperature_list_dirichlet_sides(inputs%temperature_nb_dirichlet_sides))
789 CALL
read_until(21,
'===List of boundary pieces for Dirichlet BCs on temperature')
790 READ(21,*) inputs%temperature_list_dirichlet_sides
792 ALLOCATE(inputs%temperature_list_dirichlet_sides(0))
795 CALL
find_string(21,
'===Number of interfaces between velocity and temperature only domains (for nst applications)', test)
797 READ(21,*) inputs%nb_inter_v_T
798 ALLOCATE(inputs%list_inter_v_T(inputs%nb_inter_v_T))
799 CALL
read_until(21,
'===List of interfaces between velocity and temperature only domains (for nst applications)')
800 READ(21,*) inputs%list_inter_v_T
802 ALLOCATE(inputs%list_inter_v_T(0))
805 CALL
read_until(21,
'===Maximum number of iterations for temperature solver')
806 READ(21,*) inputs%my_par_temperature%it_max
807 CALL
read_until(21,
'===Relative tolerance for temperature solver')
808 READ(21,*) inputs%my_par_temperature%rel_tol
809 CALL
read_until(21,
'===Absolute tolerance for temperature solver')
810 READ(21,*) inputs%my_par_temperature%abs_tol
811 CALL
find_string(21,
'===Temperature solver verbose? (true/false)',test)
813 READ(21,*) inputs%my_par_temperature%verbose
815 CALL
read_until(21,
'===Solver type for temperature (FGMRES, CG, ...)')
816 READ(21,*) inputs%my_par_temperature%solver
817 CALL
read_until(21,
'===Preconditionner type for temperature solver (HYPRE, JACOBI, MUMPS...)')
818 READ(21,*) inputs%my_par_temperature%precond
822 CALL
find_string(21,
'===Is there a level set?', test)
824 READ (21,*) inputs%if_level_set
826 inputs%if_level_set = .false.
828 IF (inputs%if_level_set)
THEN
831 READ(21,*) inputs%nb_fluid
833 CALL
read_until(21,
'===multiplier for h_min for level set')
834 READ(21,*) inputs%multiplier_for_h_min_distance
837 inputs%level_set_cmax=0.d0
839 CALL
read_until(21,
'===Compression factor for level set')
840 READ(21,*) inputs%level_set_comp_factor
842 ALLOCATE(inputs%density_fluid( inputs%nb_fluid))
843 CALL
read_until(21,
'===Density of fluid 0, fluid 1, ...')
844 READ(21,*) inputs%density_fluid
846 ALLOCATE(inputs%dyna_visc_fluid( inputs%nb_fluid))
847 CALL
read_until(21,
'===Dynamic viscosity of fluid 0, fluid 1, ...')
848 READ(21,*) inputs%dyna_visc_fluid
850 IF (inputs%type_pb==
'mhd' .OR. inputs%type_pb==
'fhd')
THEN
851 CALL
find_string(21,
'===Conductivity of fluid 0, fluid 1, ...', test)
853 inputs%variation_sigma_fluid =.true.
854 ALLOCATE(inputs%sigma_fluid(inputs%nb_fluid))
855 READ(21,*) inputs%sigma_fluid
857 inputs%variation_sigma_fluid =.false.
861 CALL
find_string(21,
'===Is there a surface tension?', test)
863 READ (21,*) inputs%if_surface_tension
865 inputs%if_surface_tension = .false.
867 IF (inputs%if_surface_tension)
THEN
869 CALL
read_until(21,
'===Coefficients of surface tension for level set 0, level set 1, ...')
870 ALLOCATE(inputs%coeff_surface(inputs%nb_fluid-1))
871 READ(21,*) inputs%coeff_surface
874 CALL
find_string(21,
'===Do we apply mass correction? (true/false)', test)
876 READ (21,*) inputs%if_mass_correction
878 inputs%if_mass_correction=.true.
881 CALL
read_until(21,
'===How many boundary pieces for Dirichlet BCs on level set?')
882 READ(21,*) inputs%level_set_nb_dirichlet_sides
883 IF (inputs%level_set_nb_dirichlet_sides>0)
THEN
884 ALLOCATE(inputs%level_set_list_dirichlet_sides(inputs%level_set_nb_dirichlet_sides))
885 CALL
read_until(21,
'===List of boundary pieces for Dirichlet BCs on level set')
886 READ(21,*) inputs%level_set_list_dirichlet_sides
888 ALLOCATE(inputs%level_set_list_dirichlet_sides(0))
891 CALL
read_until(21,
'===Maximum number of iterations for level set solver')
892 READ(21,*) inputs%my_par_level_set%it_max
893 CALL
read_until(21,
'===Relative tolerance for level set solver')
894 READ(21,*) inputs%my_par_level_set%rel_tol
895 CALL
read_until(21,
'===Absolute tolerance for level set solver')
896 READ(21,*) inputs%my_par_level_set%abs_tol
897 CALL
find_string(21,
'===Level set solver verbose? (true/false)',test)
899 READ(21,*) inputs%my_par_level_set%verbose
901 CALL
read_until(21,
'===Solver type for level set (FGMRES, CG, ...)')
902 READ(21,*) inputs%my_par_level_set%solver
903 CALL
read_until(21,
'===Preconditionner type for level set solver (HYPRE, JACOBI, MUMPS...)')
904 READ(21,*) inputs%my_par_level_set%precond
907 CALL
find_string(21,
'===How are the variables reconstructed from the level set function? (lin, reg)', test)
909 READ (21,*) inputs%level_set_reconstruction_type
911 inputs%level_set_reconstruction_type =
'reg'
913 IF (inputs%level_set_reconstruction_type==
'reg')
THEN
914 CALL
find_string(21,
'===Value of the regularization coefficient in (0,0.5]', test)
916 READ (21,*) inputs%level_set_tanh_coeff_reconstruction
917 IF (inputs%level_set_tanh_coeff_reconstruction.LE.1d-2 .OR. &
918 .5d0 .LE. inputs%level_set_tanh_coeff_reconstruction)
THEN
919 inputs%level_set_tanh_coeff_reconstruction = 0.45d0
922 inputs%level_set_tanh_coeff_reconstruction = 0.45d0
924 ELSE IF (inputs%level_set_reconstruction_type/=
'lin')
THEN
925 CALL
error_petsc(
'BUG in read_my_data: variable reconstruction type not correct')
928 IF(inputs%level_set_reconstruction_type/=
'reg')
THEN
929 CALL
find_string(21,
'===Do we kill level set overshoot? (true/false)', test)
931 READ (21,*) inputs%if_kill_overshoot
933 inputs%if_kill_overshoot=.false.
936 inputs%if_kill_overshoot=.false.
940 CALL
find_string(21,
'===Do we use P2 finite element for level_set? (true/false)', test)
942 READ(21,*) inputs%if_level_set_P2
944 inputs%if_level_set_P2=.false.
948 CALL
find_string(21,
'===Do we use JLG compression method for level_set? (true/false)', test)
950 READ(21,*) inputs%if_compression_mthd_JLG
952 inputs%if_compression_mthd_JLG=.true.
956 IF (inputs%type_pb==
'mxw')
THEN
957 CALL
error_petsc(
'BUG in read_my_data: Level_set without Navier-Stokes')
963 IF (inputs%type_pb==
'mxw')
THEN
966 READ (21,*) inputs%if_arpack
968 inputs%if_arpack = .false.
970 IF (inputs%if_arpack)
THEN
971 CALL
read_until(21,
'===Number of eigenvalues to compute')
972 READ (21,*) inputs%nb_eigenvalues
973 CALL
read_until(21,
'===Maximum number of Arpack iterations')
974 READ (21,*) inputs%arpack_iter_max
975 CALL
read_until(21,
'===Tolerance for Arpack')
976 READ (21,*) inputs%arpack_tolerance
978 '===Which eigenvalues (''LM'', ''SM'', ''SR'', ''LR'' ''LI'', ''SI'')')
979 READ (21,*) inputs%arpack_which
980 CALL
find_string(21,
'===Create 2D vtu files for Arpack? (true/false)', test)
982 READ (21,*) inputs%if_arpack_vtu_2d
984 inputs%if_arpack_vtu_2d = .false.
989 inputs%if_arpack = .false.
993 CALL
find_string(21,
'===Number of planes in real space for Visualization', test)
995 READ (21,*) inputs%number_of_planes_in_real_space
997 inputs%number_of_planes_in_real_space = 10
1001 CALL
find_string(21,
'===Frequency to write restart file', test)
1003 READ (21,*) inputs%freq_restart
1005 inputs%freq_restart = 100000000
1007 CALL
find_string(21,
'===Frequency to write energies', test)
1009 READ (21,*) inputs%freq_en
1011 inputs%freq_en = 100000000
1013 CALL
find_string(21,
'===Frequency to create plots', test)
1015 READ (21,*) inputs%freq_plot
1017 inputs%freq_plot = 100000000
1019 CALL
find_string(21,
'===Just postprocessing without computing? (true/false)', test)
1021 READ (21,*) inputs%if_just_processing
1023 inputs%if_just_processing = .false.
1028 IF (inputs%type_pb==
'mhd')
THEN
1029 CALL
find_string(21,
'===Should some modes be zeroed out?', test)
1031 READ (21,*) inputs%if_zero_out_modes
1033 inputs%if_zero_out_modes = .false.
1035 IF (inputs%if_zero_out_modes)
THEN
1036 CALL
read_until(21,
'===How many Navier-Stokes modes to zero out?')
1037 READ(21,*) inputs%nb_select_mode_ns
1038 ALLOCATE(inputs%list_select_mode_ns(inputs%nb_select_mode_ns))
1039 CALL
read_until(21,
'===List of Navier-Stokes modes to zero out?')
1040 READ(21,*) inputs%list_select_mode_ns
1041 CALL
read_until(21,
'===How Maxwell modes to zero out?')
1042 READ(21,*) inputs%nb_select_mode_mxw
1043 ALLOCATE(inputs%list_select_mode_mxw(inputs%nb_select_mode_mxw))
1044 CALL
read_until(21,
'===List of Maxwell modes to zero out?')
1045 READ(21,*) inputs%list_select_mode_mxw
1050 CALL
find_string(21,
'===Verbose timing? (true/false)', test)
1052 READ (21,*) inputs%verbose_timing
1054 inputs%verbose_timing = .false.
1056 CALL
find_string(21,
'===Verbose divergence? (true/false)', test)
1058 READ (21,*) inputs%verbose_divergence
1060 inputs%verbose_divergence = .false.
1062 CALL
find_string(21,
'===Verbose CFL? (true/false)', test)
1064 READ (21,*) inputs%verbose_CFL
1066 inputs%verbose_CFL = .false.
1070 IF (inputs%test_de_convergence)
THEN
1073 READ(21,*) inputs%norm_ref(k)
1076 inputs%norm_ref = 1.d0
1080 IF (inputs%type_pb ==
'mxw' .AND. inputs%irestart_u)
THEN
1081 inputs%type_pb =
'mxx'
1095 INTEGER :: k, mode_min, mode_max, delta_mode
1099 IF (inputs%my_periodic%nb_periodic_pairs>0)
THEN
1100 IF (inputs%type_pb==
'nst' .OR. inputs%type_pb==
'mhd' .OR. inputs%irestart_u)
THEN
1103 IF (inputs%vv_nb_dirichlet_sides(k)<1) cycle
1106 CALL
error_petsc(
' BUG in read_my_data: Incompatible Dirichlet'// &
1107 ' and periodic BCs on velocity')
1111 IF (inputs%pp_nb_dirichlet_sides>0)
THEN
1114 CALL
error_petsc(
' BUG in read_my_data: Incompatible Dirichlet'// &
1115 ' and periodic BCs on pressure')
1122 IF (.NOT.inputs%if_navier_stokes_with_u .AND. inputs%if_ns_penalty)
THEN
1123 CALL
error_petsc(
'BUG in read_my_data: No penalty with momentum formulation')
1127 IF (inputs%if_temperature.AND. inputs%my_periodic%nb_periodic_pairs>0)
THEN
1128 IF (inputs%temperature_nb_dirichlet_sides>0)
THEN
1131 CALL
error_petsc(
' BUG in read_my_data: Incompatible Dirichlet'// &
1132 ' and periodic BCs on temperature')
1138 IF (inputs%if_level_set.AND. inputs%my_periodic%nb_periodic_pairs>0)
THEN
1139 IF (inputs%level_set_nb_dirichlet_sides>0)
THEN
1142 CALL
error_petsc(
' BUG in read_my_data: Incompatible Dirichlet'// &
1143 ' and periodic BCs on level_set')
1149 IF (inputs%my_periodic%nb_periodic_pairs>0)
THEN
1150 IF (inputs%type_pb==
'mxw' .OR. inputs%type_pb==
'mhd' .OR. inputs%type_pb==
'fhd')
THEN
1152 IF (inputs%nb_dirichlet_sides_H>0)
THEN
1155 CALL
error_petsc(
' BUG in read_my_data: Incompatible Dirichlet'// &
1156 ' and periodic BCs on magnetic field')
1161 IF (inputs%nb_dom_phi>0 .AND. inputs%phi_nb_dirichlet_sides>0)
THEN
1164 CALL
error_petsc(
' BUG in read_my_data: Incompatible Dirichlet'// &
1165 ' and periodic BCs on scalar potential')
1172 IF (inputs%my_periodic%nb_periodic_pairs>0)
THEN
1173 IF (inputs%if_temperature .AND. inputs%type_pb==
'mxw')
THEN
1174 CALL
error_petsc(
'Bug in read_my_data: incompatible temperature with maxwell')
1179 IF (inputs%if_arpack)
THEN
1180 IF (inputs%ndim(2) /= inputs%m_max)
THEN
1181 CALL
error_petsc(
'Bug in read_my_data: #Fourier modes'// &
1182 ' not equal to #processors in Fourier direction')
1187 IF (inputs%select_mode .AND. .NOT.inputs%if_arpack)
THEN
1188 IF (
SIZE(inputs%list_mode_lect)/=1)
THEN
1189 mode_max = maxval(inputs%list_mode_lect)
1190 mode_min = minval(inputs%list_mode_lect)
1191 IF (mod(mode_max-mode_min,
SIZE(inputs%list_mode_lect)-1)/=0)
THEN
1192 CALL
error_petsc(
'Bug in read_my_data: Fourier modes not equally spaced ')
1194 delta_mode = (mode_max-mode_min)/(
SIZE(inputs%list_mode_lect)-1)
1195 DO k = 0,
SIZE(inputs%list_mode_lect)-1
1196 IF (minval(abs(inputs%list_mode_lect-(delta_mode*k+mode_min)))/=0)
THEN
1197 CALL
error_petsc(
'Bug in read_my_data: Fourier modes not equally spaced ')
1200 DO k = 1,
SIZE(inputs%list_mode_lect)-1
1201 IF (inputs%list_mode_lect(k+1).LE.inputs%list_mode_lect(k))
THEN
1202 CALL
error_petsc(
'Bug in read_my_data: Fourier modes not in increasing order ')
1209 IF (inputs%if_just_processing)
THEN
1210 inputs%irestart_u = .false.
1211 inputs%irestart_h = .false.
1212 IF (inputs%type_pb/=
'mxw') inputs%irestart_u = .true.
1213 IF (inputs%type_pb/=
'nst') inputs%irestart_h = .true.
1217 IF (.NOT.
ASSOCIATED(inputs%list_dom_ns))
ALLOCATE(inputs%list_dom_ns(0))
1218 IF (.NOT.
ASSOCIATED(inputs%list_dom_H))
ALLOCATE(inputs%list_dom_H(0))
1219 IF (.NOT.
ASSOCIATED(inputs%list_dom_phi))
ALLOCATE(inputs%list_dom_phi(0))
1220 IF (.NOT.
ASSOCIATED(inputs%list_dom_temp))
ALLOCATE(inputs%list_dom_temp(0))
1226 INTEGER,
DIMENSION(:) :: list
1231 DO k = 1, inputs%my_periodic%nb_periodic_pairs
1232 DO n = 1,
SIZE(list)
1233 IF (minval(abs(list(n)-inputs%my_periodic%list_periodic(:,k)))==0)
THEN
subroutine read_until(unit, string)
subroutine find_string(unit, string, okay)
subroutine error_petsc(string)
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