SFEMaNS  version 4.1 (work in progress)
Reference documentation for SFEMaNS
 All Classes Files Functions Variables Groups Pages
read_my_data.f90
Go to the documentation of this file.
2  USE def_type_mesh
3  USE solve_petsc
4  TYPE my_data
5  LOGICAL :: iformatted
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
11  INTEGER :: m_max
12  INTEGER, DIMENSION(:), POINTER :: list_mode_lect
13  !===Data time iterations========================================================
14  INTEGER :: nb_iteration
15  REAL(KIND=8) :: dt
16  !===Data for LES================================================================
17  LOGICAL :: LES
18  REAL(KIND=8) :: LES_coeff1, LES_coeff2, LES_coeff3, LES_coeff4
19  LOGICAL :: if_LES_in_momentum
20  !===Data for precession=========================================================
21  REAL(KIND=8) :: taux_precession, angle_s_pi
22  LOGICAL :: precession
23  !===Data for NS penalization====================================================
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
28  !===Data for Navier-Stokes======================================================
29  LOGICAL :: if_navier_stokes_with_u
30  LOGICAL :: if_tensor_sym
31  LOGICAL :: if_moment_bdf2
32  LOGICAL :: irestart_u
33  INTEGER :: nb_dom_ns
34  INTEGER, DIMENSION(:), POINTER :: list_dom_ns
35  REAL(KIND=8) :: Re
36  TYPE(solver_param) :: my_par_vv, my_par_pp, my_par_mass
37  INTEGER :: pp_nb_dirichlet_sides
38  INTEGER, DIMENSION(:), POINTER :: pp_list_dirichlet_sides
39  INTEGER, DIMENSION(3) :: vv_nb_dirichlet_sides
40  TYPE(dyn_int_line), DIMENSION(3) :: vv_list_dirichlet_sides
41  INTEGER :: vv_nb_dirichlet
42  INTEGER :: vv_nb_dirichlet_normal_velocity
43  INTEGER, DIMENSION(:), POINTER :: vv_list_dirichlet_normal_velocity_sides
44  !===Data for Maxwell============================================================
45  LOGICAL :: if_maxwell_with_H
46  LOGICAL :: irestart_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
57  TYPE(solver_param) :: my_par_H_p_phi
58  INTEGER :: phi_nb_dirichlet_sides
59  INTEGER, DIMENSION(:), POINTER :: phi_list_dirichlet_sides
60  LOGICAL :: if_quasi_static_approx
61  !===Data for temperature========================================================
62  LOGICAL :: if_temperature
63  LOGICAL :: irestart_T
64  REAL(KIND=8) :: gravity_coefficient
65  REAL(KIND=8), DIMENSION(:), POINTER :: temperature_diffusivity
66  REAL(KIND=8), DIMENSION(:), POINTER :: vol_heat_capacity
67  TYPE(solver_param) :: my_par_temperature
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
74  !===Data for level set==========================================================
75  LOGICAL :: if_level_set
76  TYPE(solver_param) :: my_par_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
83  INTEGER :: nb_fluid
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
93  !===Computed data for level set
94  REAL(KIND=8) :: h_min_distance
95  LOGICAL :: if_level_set_P2
96  LOGICAL :: if_compression_mthd_JLG
97  !===Data for periodicity========================================================
98  TYPE(periodic_data) :: my_periodic
99  !===Data for convergence tests==================================================
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
104  !===Data for Arpack=============================================================
105  LOGICAL :: if_arpack
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
110  !===Data for stress bc==========================================================
111  REAL(KIND=8) :: stab_bdy_ns
112  !===Data for postprocessing=====================================================
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
122  CONTAINS
123  procedure, PUBLIC :: init
124  END TYPE my_data
125 CONTAINS
126  SUBROUTINE init(a)
127  class(my_data), INTENT(INOUT) :: a
128  !===Logicals
129  a%iformatted=.false.
130  a%if_read_partition=.false.
131  a%select_mode=.false.
132  a%LES=.false.
133  a%if_LES_in_momentum=.false.
134  a%precession=.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.
141  a%irestart_u=.false.
142  a%if_maxwell_with_H=.false.
143  a%irestart_h=.false.
144  a%irestart_T=.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.
157  !===Done in sfemansinitialize. Do not touch. a%test_de_convergence
158  a%if_arpack=.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.
173  !===Reals
174  a%LES_coeff1=0.d0
175  a%LES_coeff2=0.d0
176  a%LES_coeff3=0.d0
177  a%LES_coeff4=0.d0
178  a%taux_precession=0.d0
179  a%angle_s_pi=0.d0
180  a%div_stab_in_ns=0.d0
181  a%stab=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
186  a%norm_ref=0.d0
187  a%arpack_tolerance=0.d0
188  a%stab_bdy_ns=0.d0
189  a%h_min_distance=0.d0
190  a%multiplier_for_h_min_distance=0.d0
191  !===Integers
192  a%vv_nb_dirichlet=0
193  a%vv_nb_dirichlet_normal_velocity=0
194  a%freq_restart = 10000000
195  a%freq_en = 10000000
196  a%freq_plot = 10000000
197  END SUBROUTINE init
198 END MODULE my_data_module
199 
201  USE my_data_module
202  IMPLICIT NONE
203  PUBLIC :: read_my_data
204  TYPE(my_data), PUBLIC :: inputs
205  PRIVATE
206 
207 CONTAINS
208 
209  SUBROUTINE read_my_data(data_fichier)
210  USE chaine_caractere
211  USE my_util
212  IMPLICIT NONE
213  LOGICAL :: test
214  CHARACTER(len=200), INTENT(IN) :: data_fichier
215  INTEGER :: k
216  CHARACTER(len=8), DIMENSION(3) :: vel_component=(/'uradial','utheta ','uzaxis '/)
217 
218  !===Initialize data to zero and false by default===============================
219  CALL inputs%init
220 
221  !===Open data file=============================================================
222  OPEN(unit = 21, file = data_fichier, form = 'formatted', status = 'unknown')
223 
224  !===Location of mesh============================================================
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
229 
230  !===Processor distribution======================================================
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)
235 
236  !===Fourier modes===============================================================
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')
241  END IF
242  CALL find_string(21,'===Select Fourier modes? (true/false)', test)
243  IF (test) THEN
244  READ (21,*) inputs%select_mode
245  ELSE
246  inputs%select_mode = .false.
247  END IF
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
252  END IF
253 
254  !===Type of problem to be solved================================================
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')
259  END IF
260 
261  !===Restarts====================================================================
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
267  ELSE
268  inputs%irestart_h = .false.
269  END IF
270  CALL find_string(21, '===Restart on temperature (true/false)', test)
271  IF (test) THEN
272  READ (21 ,*) inputs%irestart_T
273  ELSE
274  inputs%irestart_T = .false.
275  END IF
276 
277  !===Mesh partitioning===========================================================
278  CALL find_string(21, '===Do we read metis partition? (true/false)', test)
279  IF (test) THEN
280  READ (21,*) inputs%if_read_partition
281  ELSE
282  inputs%if_read_partition = .false.
283  END IF
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.')
288  END IF
289 
290  !===Time integration============================================================
291  CALL read_until(21, '===Time step and number of time iterations')
292  READ(21,*) inputs%dt, inputs%nb_iteration
293 
294  !===Check numerical stability===================================================
295  CALL find_string(21, '===Check numerical stability (true/false)', test)
296  IF (test) THEN
297  READ (21,*) inputs%check_numerical_stability
298  ELSE
299  inputs%check_numerical_stability = .false.
300  END IF
301 
302  !===Periodicity=================================================================
303  CALL find_string(21, '===How many pieces of periodic boundary?', test)
304  IF (test) THEN
305  READ (21,*) inputs%my_periodic%nb_periodic_pairs
306  ELSE
307  inputs%my_periodic%nb_periodic_pairs = 0
308  END IF
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)
315  END DO
316  END IF
317 
318  !===Mesh symmetry===============================================================
319  CALL find_string(21, '===Is the mesh symmetric (true/false)?', test)
320  IF (test) THEN
321  READ (21,*) inputs%is_mesh_symmetric
322  ELSE
323  inputs%is_mesh_symmetric = .false.
324  END IF
325 
326  !===Navier Stokes data==========================================================
327  IF (inputs%type_pb=='nst' .OR. inputs%type_pb=='mhd' .OR. inputs%type_pb=='fhd' .OR. inputs%irestart_u) THEN
328  !==========Navier Stokes with u or m===============!
329  CALL find_string(21, '===Solve Navier-Stokes with u (true) or m (false)?', test)
330  IF (test) THEN
331  READ(21,*) inputs%if_navier_stokes_with_u
332  ELSE
333  inputs%if_navier_stokes_with_u = .true.
334  END IF
335 
336 !!$ CALL find_string(21, '===Is tensor symmetric (true/false)?', test)
337 !!$ IF (test) THEN
338 !!$ READ(21,*) inputs%if_tensor_sym
339 !!$ ELSE
340 !!$ IF(inputs%if_navier_stokes_with_u) THEN
341 !!$ inputs%if_tensor_sym = .FALSE.
342 !!$ ELSE
343 !!$ inputs%if_tensor_sym = .TRUE.
344 !!$ END IF
345 !!$ END IF
346  !===Tensor symmetric always used.
347  inputs%if_tensor_sym = .true.
348 
349  IF (.NOT.inputs%if_navier_stokes_with_u) THEN
350  CALL find_string(21, '===Do we solve momentum with bdf2 (true/false)?', test)
351  IF (test) THEN
352  READ(21,*) inputs%if_moment_bdf2
353  ELSE
354  inputs%if_moment_bdf2=.false.
355  END IF
356  END IF
357 
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
363 
364  !==========Dirichlet BCs for velocity==============!
365  DO k = 1, 3
366  CALL find_string(21, '===How many boundary pieces for Dirichlet BCs on '//trim(vel_component(k))//'?', test)
367  IF (test) THEN
368  CALL error_petsc( '===How many boundary pieces for Dirichlet BCs on '//trim(vel_component(k))//'? is disabled')
369  !READ(21,*) inputs%vv_nb_dirichlet_sides(k)
370  ELSE
371  inputs%vv_nb_dirichlet_sides(k) = 0
372  END IF
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
377  ELSE
378  ALLOCATE(inputs%vv_list_dirichlet_sides(k)%DIL(0))
379  END IF
380  END DO
381  CALL find_string(21, '===How many boundary pieces for full Dirichlet BCs on velocity?', test)
382  IF (test) THEN
383  READ(21,*) inputs%vv_nb_dirichlet
384  ELSE
385  inputs%vv_nb_dirichlet=0
386  END IF
387  IF (inputs%vv_nb_dirichlet>0) THEN
388  DO k = 1, 3
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
392  END DO
393  ELSE
394  DO k = 1, 3
395  ALLOCATE(inputs%vv_list_dirichlet_sides(k)%DIL(0))
396  END DO
397  END IF
398 
399  !===Homogeneous normal velocity====================!
400  CALL find_string(21, '===How many boundary pieces for homogeneous normal velocity?', test)
401  IF (test) THEN
402  READ(21,*) inputs%vv_nb_dirichlet_normal_velocity
403  ELSE
404  inputs%vv_nb_dirichlet_normal_velocity=0
405  END IF
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
410  CALL find_string(21, '===stab_bdy_ns', test)
411  IF (test) THEN
412  READ (21,*) inputs%stab_bdy_ns
413  ELSE
414  inputs%stab_bdy_ns=1.d0
415  END IF
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')
420  END IF
421  END DO
422  END IF
423 
424  !===Stress boundary conditions=====================! !Disabled
425  CALL find_string(21, '===Stress boundary conditions? (true/false)', test)
426  IF (test) THEN
427  CALL error_petsc('===Stress boundary conditions Does not work any more')
428  END IF
429 
430  !==========Dirichlet BCs for pressure==============! !Disabled
431  !CALL find_string(21, '===How many boundary pieces for Dirichlet BCs on pressure?', test)
432  test=.false.
433  IF (test) THEN
434  READ(21,*) inputs%pp_nb_dirichlet_sides
435  ELSE
436  inputs%pp_nb_dirichlet_sides = 0
437  END IF
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
442  ELSE
443  ALLOCATE(inputs%pp_list_dirichlet_sides(0))
444  END IF
445 
446  !==========Reynolds number=========================!
447  CALL read_until(21, '===Reynolds number')
448  READ(21,*) inputs%Re
449 
450  !==========DIV penalty=============================!
451  IF (inputs%if_navier_stokes_with_u) THEN
452  CALL find_string(21, '===Coefficient for penalty of divergence in NS?', test)
453  IF (test) THEN
454  READ(21,*) inputs%div_stab_in_ns
455  ELSE
456  inputs%div_stab_in_ns = 0.d0
457  END IF
458  END IF
459 
460  !==========Precession==============================!
461  CALL find_string(21, '===Is there a precession term (true/false)?', test)
462  IF (test) THEN
463  READ(21,*) inputs%precession
464  ELSE
465  inputs%precession = .false.
466  END IF
467  IF (inputs%precession) THEN
468  CALL read_until(21, '===Precession rate')
469  READ(21,*) inputs%taux_precession
470  CALL read_until(21, '===Precession angle over pi')
471  READ(21,*) inputs%angle_s_pi
472  ELSE
473  inputs%taux_precession = 0.d0
474  inputs%angle_s_pi = 0.d0
475  END IF
476 
477  !==========NS penalty==============================!
478  CALL find_string(21, '===Use penalty in NS domain (true/false)?', test)
479  IF (test) THEN
480  READ(21,*) inputs%if_ns_penalty
481  ELSE
482  inputs%if_ns_penalty = .false.
483  END IF
484  IF (inputs%if_ns_penalty) THEN
485  CALL find_string(21, '===Use nonzero velocity in solids (true/false)?', test)
486  IF (test) THEN
487  READ(21,*) inputs%if_impose_vel_in_solids
488  ELSE
489  inputs%if_impose_vel_in_solids = .false.
490  END IF
491  CALL find_string(21, '===Compute z momentum (true/false)?', test)
492  IF (test) THEN
493  READ(21,*) inputs%if_compute_momentum_pseudo_force
494  ELSE
495  inputs%if_compute_momentum_pseudo_force = .false.
496  END IF
497  ELSE
498  inputs%if_impose_vel_in_solids = .false.
499  inputs%if_compute_momentum_pseudo_force = .false.
500  END IF
501 
502  !==========Solver parameters for velocity==========!
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)
510  IF (test) THEN
511  READ(21,*) inputs%my_par_vv%verbose
512  END IF
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
517 
518  !==========Solver parameters for pressure==========!
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)
526  IF (test) THEN
527  READ(21,*) inputs%my_par_pp%verbose
528  END IF
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
533 
534  !==========Solver parameters for mass matrix=======!
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)
542  IF (test) THEN
543  READ(21,*) inputs%my_par_mass%verbose
544  END IF
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
549 
550  !==========LES coefficients========================!
551  CALL find_string(21, '===Use LES? (true/false)', test)
552  IF (test) THEN
553  READ(21,*) inputs%LES
554  ELSE
555  inputs%LES = .false.
556  END IF
557 
558  IF (inputs%LES) THEN
559  CALL find_string(21, '===Coefficients for LES', test)
560  IF (test) THEN
561  CALL error_petsc('===Coefficients for LES is disabled')
562  END IF
563  !===LES_coeff4 is fixed and coeff3 is disabled
564  inputs%LES_coeff4 = 0.125d0
565  inputs%LES_coeff3 = 0.d0
566  !===LES_coeff2 in [0.15,1.0] for viscosity entropy
567  !===LES_coeff2 is equal to 1.d10 for test with first order viscosity
568  CALL read_until(21, '===Coefficient multiplying residual')
569  READ(21,*) inputs%LES_coeff2
570  !===LES_coeff1 is equal to LES_coeff4*MAX(velocity)=0.125d0*MAX(velocity)
571  CALL find_string(21, '===Coefficient for explicit LES', test)
572  IF (test) THEN
573  READ(21,*) inputs%LES_coeff1
574  ELSE
575  inputs%LES_coeff1 = 0.d0
576  END IF
577  ELSE
578  inputs%LES_coeff1 = 0.d0
579  inputs%LES_coeff2 = 0.d0
580  inputs%LES_coeff3 = 0.d0
581  inputs%LES_coeff4 = 0.d0
582  END IF
583  END IF
584  IF (.NOT.inputs%if_navier_stokes_with_u) THEN
585  CALL find_string(21, '===Use LES in momentum? (true/false)', test)
586  IF (test) THEN
587  READ(21,*) inputs%if_LES_in_momentum
588  ELSE
589  inputs%if_LES_in_momentum=.true.
590  END IF
591  END IF
592 
593  !===Maxwell data================================================================
594  IF (inputs%type_pb=='mxw' .OR. inputs%type_pb=='mhd' .OR. inputs%type_pb=='fhd') THEN
595  !==========Maxwell with H or B=====================!
596  CALL find_string(21, '===Solve Maxwell with H (true) or B (false)?', test)
597  IF (test) THEN
598  READ(21,*) inputs%if_maxwell_with_H
599  ELSE
600  inputs%if_maxwell_with_H = .false.
601  END IF
602 
603  !==========Quasi-static approximation==============!
604  CALL find_string(21, '===Quasi-static approximation (true) or (false)?', test)
605  IF (test) THEN
606  READ(21,*) inputs%if_quasi_static_approx
607  ELSE
608  inputs%if_quasi_static_approx = .false.
609  END IF
610 
611  !==========Subdomains for H========================!
612  CALL read_until(21, '===Number of subdomains in magnetic field (H) mesh')
613  READ(21,*) inputs%nb_dom_H ! number of sub_domains for 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
617 
618  !==========Interfaces H/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
625  END IF
626 
627  !==========Dirichlet BCs for H=====================!
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
634  END IF
635 
636  !==========Permeability for H======================!
637  CALL find_string(21, '===Is permeability defined analytically (true/false)?', test)
638  IF (test) THEN
639  READ(21,*) inputs%analytical_permeability
640  ELSE
641  inputs%analytical_permeability = .false.
642  END IF
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
647  END IF
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)
651  IF (test) THEN
652  READ(21,*) inputs%if_permeability_variable_in_theta
653  END IF
654  END IF
655 
656  !==========FEM or Gaussian integration for mu_bar==!
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)
660  IF (test) THEN
661  READ(21,*) inputs%if_use_fem_integration_for_mu_bar
662  END IF
663  END IF
664 
665  !==========Conductivity for H======================!
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
669 
670  !==========Finite element type=====================!
671  CALL read_until(21, '===Type of finite element for magnetic field')
672  READ(21,*) inputs%type_fe_H
673 
674  !==========Magnetic Reynolds number================!
675  CALL read_until(21, '===Magnetic Reynolds number')
676  READ(21,*) inputs%Rem
677 
678  !==========Stabilization parameters================!
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)
684  ELSE
685  inputs%stab(3) = 0.d0
686  END IF
687 
688  !==========Subdomains for phi======================!
689  CALL find_string(21, '===Number of subdomains in magnetic potential (phi) mesh', test)
690  IF (test) THEN
691  READ (21,*) inputs%nb_dom_phi
692  ELSE
693  inputs%nb_dom_phi = 0
694  END IF
695  ALLOCATE(inputs%list_dom_phi(inputs%nb_dom_phi))
696  IF (inputs%nb_dom_phi>0) THEN
697  !==========List of subdomains for phi======================!
698  CALL read_until(21, '===List of subdomains for magnetic potential (phi) mesh')
699  READ(21,*) inputs%list_dom_phi
700 
701  !==========Dirichlet BCs on 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
708  ELSE
709  ALLOCATE(inputs%phi_list_dirichlet_sides(0))
710  END IF
711 
712  !==========H/phi interface=========================!
713  CALL read_until(21, '===Number of interfaces between H and phi')
714  READ(21,*) inputs%nb_inter ! number of interfaces between H and phi
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
719  END IF
720 
721  !==========Permeability in vacuum==================!
722  CALL read_until(21, '===Permeability in vacuum')
723  READ(21,*) inputs%mu_phi
724 
725  !==========Finite element type=====================!
726  CALL read_until(21, '===Type of finite element for scalar potential')
727  READ(21,*) inputs%type_fe_phi
728 
729  !==========Stabilization parameters================!
730  CALL read_until(21, '===Stabilization coefficient (interface H/phi)')
731  READ(21,*) inputs%stab(2)
732  END IF
733 
734  !==========Solver parameters=======================!
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)
742  IF (test) THEN
743  READ(21,*) inputs%my_par_H_p_phi%verbose
744  END IF
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
749  END IF
750 
751  !===Data temperature==============================================================
752  CALL find_string(21, '===Is there a temperature field?', test)
753  IF (test) THEN
754  READ (21,*) inputs%if_temperature
755  ELSE
756  inputs%if_temperature = .false.
757  END IF
758  IF (inputs%if_temperature) THEN
759  !==========Gravity coefficient for temperature=====!
760  CALL find_string(21, '===Non-dimensional gravity coefficient', test)
761  IF (test) THEN
762  READ (21,*) inputs%gravity_coefficient
763  ELSE
764  inputs%gravity_coefficient = 0.d0
765  END IF
766  !==========Subdomains for temp=====================!
767  CALL read_until(21, '===Number of subdomains in temperature mesh')
768  READ(21,*) inputs%nb_dom_temp ! number of sub_domains for 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)) ! Two choices for the user, indicate 1) the heat capacity and the conductivity (necessary if non uniform heat capacity) or 2) the diffusivity only
773  ALLOCATE(inputs%temperature_diffusivity(inputs%nb_dom_temp)) ! In both cases, temperature_diffusivity is used, it contains the conductivities in 1) and the diffusivities in 2)
774  CALL find_string(21, '===Volumetric heat capacity (1:nb_dom_temp)', test)
775  IF (test) THEN ! Case 1)
776  READ(21,*) inputs%vol_heat_capacity
777  CALL read_until(21, '===Thermal conductivity (1:nb_dom_temp)')
778  READ(21,*) inputs%temperature_diffusivity
779  ELSE ! Case 2)
780  inputs%vol_heat_capacity = 1.d0 ! Heat capacity is equalized to one so that it does not impact the calculus
781  CALL read_until(21, '===Diffusivity coefficient for temperature (1:nb_dom_temp)')
782  READ(21,*) inputs%temperature_diffusivity
783  END IF
784  !==========Dirichlet BCs on temperature============!
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
791  ELSE
792  ALLOCATE(inputs%temperature_list_dirichlet_sides(0))
793  END IF
794  !==========Interfaces between vel and temp=========!
795  CALL find_string(21, '===Number of interfaces between velocity and temperature only domains (for nst applications)', test)
796  IF (test) THEN
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
801  ELSE
802  ALLOCATE(inputs%list_inter_v_T(0))
803  END IF
804  !==========Solver parameters=======================!
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)
812  IF (test) THEN
813  READ(21,*) inputs%my_par_temperature%verbose
814  END IF
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
819  END IF
820 
821  !===Data Level set================================================================
822  CALL find_string(21, '===Is there a level set?', test)
823  IF (test) THEN
824  READ (21,*) inputs%if_level_set
825  ELSE
826  inputs%if_level_set = .false.
827  END IF
828  IF (inputs%if_level_set) THEN
829  !==========Number of fluids========================!
830  CALL read_until(21, '===How many fluids?')
831  READ(21,*) inputs%nb_fluid
832  !==========Level_set multiplier for h_min==========!
833  CALL read_until(21, '===multiplier for h_min for level set')
834  READ(21,*) inputs%multiplier_for_h_min_distance
835  !==========Level_set c_max=========================!
836  !===Disabled functionality
837  inputs%level_set_cmax=0.d0
838  !==========Level_set compression factor============!
839  CALL read_until(21, '===Compression factor for level set')
840  READ(21,*) inputs%level_set_comp_factor
841  !==========Densities of fluids=====================!
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
845  !==========Dynamic viscosities of fluids===========!
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
849  !==========Conductivities of fluids================!
850  IF (inputs%type_pb=='mhd' .OR. inputs%type_pb=='fhd') THEN
851  CALL find_string(21, '===Conductivity of fluid 0, fluid 1, ...', test)
852  IF (test) THEN
853  inputs%variation_sigma_fluid =.true.
854  ALLOCATE(inputs%sigma_fluid(inputs%nb_fluid))
855  READ(21,*) inputs%sigma_fluid
856  ELSE
857  inputs%variation_sigma_fluid =.false.
858  END IF
859  END IF
860  !==========Surface tension=========================!
861  CALL find_string(21, '===Is there a surface tension?', test)
862  IF (test) THEN
863  READ (21,*) inputs%if_surface_tension
864  ELSE
865  inputs%if_surface_tension = .false.
866  END IF
867  IF (inputs%if_surface_tension) THEN
868  !==========Coefficient for surface tension======!
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
872  END IF
873  !==========Mass correction=========================!
874  CALL find_string(21, '===Do we apply mass correction? (true/false)', test)
875  IF (test) THEN
876  READ (21,*) inputs%if_mass_correction
877  ELSE
878  inputs%if_mass_correction=.true.
879  END IF
880  !==========Dirichlet BCs on level_set==============!
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
887  ELSE
888  ALLOCATE(inputs%level_set_list_dirichlet_sides(0))
889  END IF
890  !==========Solver parameters=======================!
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)
898  IF (test) THEN
899  READ(21,*) inputs%my_par_level_set%verbose
900  END IF
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
905 
906  !==========Reconstruction parameters===============!
907  CALL find_string(21, '===How are the variables reconstructed from the level set function? (lin, reg)', test)
908  IF (test) THEN
909  READ (21,*) inputs%level_set_reconstruction_type
910  ELSE
911  inputs%level_set_reconstruction_type = 'reg'
912  END IF
913  IF (inputs%level_set_reconstruction_type=='reg') THEN
914  CALL find_string(21, '===Value of the regularization coefficient in (0,0.5]', test)
915  IF (test) THEN
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
920  END IF
921  ELSE
922  inputs%level_set_tanh_coeff_reconstruction = 0.45d0
923  END IF
924  ELSE IF (inputs%level_set_reconstruction_type/='lin') THEN
925  CALL error_petsc('BUG in read_my_data: variable reconstruction type not correct')
926  END IF
927  !==========Level set overshoot=====================!
928  IF(inputs%level_set_reconstruction_type/='reg') THEN
929  CALL find_string(21, '===Do we kill level set overshoot? (true/false)', test)
930  IF (test) THEN
931  READ (21,*) inputs%if_kill_overshoot
932  ELSE
933  inputs%if_kill_overshoot=.false.
934  END IF
935  ELSE
936  inputs%if_kill_overshoot=.false.
937  END IF
938 
939  !==========Level set type finite element===========!
940  CALL find_string(21, '===Do we use P2 finite element for level_set? (true/false)', test)
941  IF (test) THEN
942  READ(21,*) inputs%if_level_set_P2
943  ELSE
944  inputs%if_level_set_P2=.false.
945  END IF
946 
947  !==========Level set compression method============!
948  CALL find_string(21, '===Do we use JLG compression method for level_set? (true/false)', test)
949  IF (test) THEN
950  READ(21,*) inputs%if_compression_mthd_JLG
951  ELSE
952  inputs%if_compression_mthd_JLG=.true.
953  END IF
954 
955  !==========Check coherence=========================!
956  IF (inputs%type_pb=='mxw') THEN
957  CALL error_petsc('BUG in read_my_data: Level_set without Navier-Stokes')
958  END IF
959  END IF
960 
961  !===Data for arpack (eigenvalue problems)=======================================
962  !==========Frequency parameters====================!
963  IF (inputs%type_pb=='mxw') THEN
964  CALL find_string(21, '===Do we use Arpack?', test)
965  IF (test) THEN
966  READ (21,*) inputs%if_arpack
967  ELSE
968  inputs%if_arpack = .false.
969  END IF
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
977  CALL read_until(21, &
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)
981  IF (test) THEN
982  READ (21,*) inputs%if_arpack_vtu_2d
983  ELSE
984  inputs%if_arpack_vtu_2d = .false.
985  END IF
986  END IF
987  ELSE
988  !==========Arpack currently works only for Maxwell=!
989  inputs%if_arpack = .false.
990  END IF
991 
992  !===Data for post processing====================================================
993  CALL find_string(21, '===Number of planes in real space for Visualization', test)
994  IF (test) THEN
995  READ (21,*) inputs%number_of_planes_in_real_space
996  ELSE
997  inputs%number_of_planes_in_real_space = 10
998  END IF
999 
1000  !==========Frequency parameters====================!
1001  CALL find_string(21, '===Frequency to write restart file', test)
1002  IF (test) THEN
1003  READ (21,*) inputs%freq_restart
1004  ELSE
1005  inputs%freq_restart = 100000000
1006  END IF
1007  CALL find_string(21, '===Frequency to write energies', test)
1008  IF (test) THEN
1009  READ (21,*) inputs%freq_en
1010  ELSE
1011  inputs%freq_en = 100000000
1012  END IF
1013  CALL find_string(21, '===Frequency to create plots', test)
1014  IF (test) THEN
1015  READ (21,*) inputs%freq_plot
1016  ELSE
1017  inputs%freq_plot = 100000000
1018  END IF
1019  CALL find_string(21, '===Just postprocessing without computing? (true/false)', test)
1020  IF (test) THEN
1021  READ (21,*) inputs%if_just_processing
1022  ELSE
1023  inputs%if_just_processing = .false.
1024  END IF
1025 
1026 
1027  !==========Modes to be zeroed out==================!
1028  IF (inputs%type_pb=='mhd') THEN
1029  CALL find_string(21, '===Should some modes be zeroed out?', test)
1030  IF (test) THEN
1031  READ (21,*) inputs%if_zero_out_modes
1032  ELSE
1033  inputs%if_zero_out_modes = .false.
1034  END IF
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
1046  END IF
1047  END IF
1048 
1049  !==========Verbose=================================!
1050  CALL find_string(21, '===Verbose timing? (true/false)', test)
1051  IF (test) THEN
1052  READ (21,*) inputs%verbose_timing
1053  ELSE
1054  inputs%verbose_timing = .false.
1055  END IF
1056  CALL find_string(21, '===Verbose divergence? (true/false)', test)
1057  IF (test) THEN
1058  READ (21,*) inputs%verbose_divergence
1059  ELSE
1060  inputs%verbose_divergence = .false.
1061  END IF
1062  CALL find_string(21, '===Verbose CFL? (true/false)', test)
1063  IF (test) THEN
1064  READ (21,*) inputs%verbose_CFL
1065  ELSE
1066  inputs%verbose_CFL = .false.
1067  END IF
1068 
1069  !===Norms for reference tests===================================================
1070  IF (inputs%test_de_convergence) THEN
1071  CALL read_until(21, '===Reference results')
1072  DO k = 1, 4
1073  READ(21,*) inputs%norm_ref(k)
1074  END DO
1075  ELSE
1076  inputs%norm_ref = 1.d0
1077  END IF
1078 
1079  !===mxw becomes mxx if restart_u and mxw========================================
1080  IF (inputs%type_pb == 'mxw' .AND. inputs%irestart_u) THEN
1081  inputs%type_pb = 'mxx'
1082  END IF
1083 
1084  CLOSE(21)
1085 
1086  !===Check coherence of data=====================================================
1088  RETURN
1089 
1090  END SUBROUTINE read_my_data
1091 
1093  USE my_util
1094  IMPLICIT NONE
1095  INTEGER :: k, mode_min, mode_max, delta_mode
1096  LOGICAL :: test
1097 
1098  !===Dirichlet BCs for Navier-Stokes=============================================
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
1101  !==========Velocity================================!
1102  DO k = 1, 3
1103  IF (inputs%vv_nb_dirichlet_sides(k)<1) cycle
1104  test = check_coherence_with_periodic_bcs(inputs%vv_list_dirichlet_sides(k)%DIL)
1105  IF (test) THEN
1106  CALL error_petsc(' BUG in read_my_data: Incompatible Dirichlet'// &
1107  ' and periodic BCs on velocity')
1108  END IF
1109  END DO
1110  !==========Pressure================================!
1111  IF (inputs%pp_nb_dirichlet_sides>0) THEN
1112  test = check_coherence_with_periodic_bcs(inputs%pp_list_dirichlet_sides)
1113  IF (test) THEN
1114  CALL error_petsc(' BUG in read_my_data: Incompatible Dirichlet'// &
1115  ' and periodic BCs on pressure')
1116  END IF
1117  END IF
1118  END IF
1119  END IF
1120 
1121  !===No penalty with momentum formulation========================================
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')
1124  END IF
1125 
1126  !===Dirichlet BCs for temperature for Navier-Stokes=============================
1127  IF (inputs%if_temperature.AND. inputs%my_periodic%nb_periodic_pairs>0) THEN
1128  IF (inputs%temperature_nb_dirichlet_sides>0) THEN
1129  test = check_coherence_with_periodic_bcs(inputs%temperature_list_dirichlet_sides)
1130  IF (test) THEN
1131  CALL error_petsc(' BUG in read_my_data: Incompatible Dirichlet'// &
1132  ' and periodic BCs on temperature')
1133  END IF
1134  END IF
1135  END IF
1136 
1137  !===Dirichlet BCs for Level_set for Navier-Stokes=============================
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
1140  test = check_coherence_with_periodic_bcs(inputs%level_set_list_dirichlet_sides)
1141  IF (test) THEN
1142  CALL error_petsc(' BUG in read_my_data: Incompatible Dirichlet'// &
1143  ' and periodic BCs on level_set')
1144  END IF
1145  END IF
1146  END IF
1147 
1148  !===Dirichlet BCs magnetic field for Maxwell====================================
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
1151  !==========Magnetic field==========================!
1152  IF (inputs%nb_dirichlet_sides_H>0) THEN
1153  test = check_coherence_with_periodic_bcs(inputs%list_dirichlet_sides_H)
1154  IF (test) THEN
1155  CALL error_petsc(' BUG in read_my_data: Incompatible Dirichlet'// &
1156  ' and periodic BCs on magnetic field')
1157  END IF
1158  END IF
1159 
1160  !==========Scalar potential========================!
1161  IF (inputs%nb_dom_phi>0 .AND. inputs%phi_nb_dirichlet_sides>0) THEN
1162  test = check_coherence_with_periodic_bcs(inputs%phi_list_dirichlet_sides)
1163  IF (test) THEN
1164  CALL error_petsc(' BUG in read_my_data: Incompatible Dirichlet'// &
1165  ' and periodic BCs on scalar potential')
1166  END IF
1167  END IF
1168  END IF
1169  END IF
1170 
1171  !===Check temperature with Maxwell==============================================
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')
1175  END IF
1176  END IF
1177 
1178  !===Check Arpack================================================================
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')
1183  END IF
1184  END IF
1185 
1186  !===Check Fourier modes=========================================================
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 ')
1193  END IF
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 ')
1198  END IF
1199  END DO
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 ')
1203  END IF
1204  END DO
1205  END IF
1206  END IF
1207 
1208  !===Irestart for postprocessing=================================================
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.
1214  END IF
1215 
1216  !===Allocate dummy list_dom_* for new partitioning==============================
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))
1221 
1222  END SUBROUTINE check_coherence_of_data
1223 
1224  FUNCTION check_coherence_with_periodic_bcs(list) RESULT(test)
1225  IMPLICIT NONE
1226  INTEGER, DIMENSION(:) :: list
1227  LOGICAL :: test
1228  INTEGER :: k, n
1229 
1230  test = .false.
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
1234  test = .true.
1235  RETURN
1236  END IF
1237  END DO
1238  END DO
1240 
1241 END MODULE input_data
1242 
logical function check_coherence_with_periodic_bcs(list)
subroutine, public read_my_data(data_fichier)
subroutine check_coherence_of_data
subroutine read_until(unit, string)
subroutine find_string(unit, string, okay)
subroutine error_petsc(string)
Definition: my_util.f90:15
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
Definition: doc_intro.h:193