Skip to content

Commit 619e9f1

Browse files
authored
Hyper edits (#2)
* fix checker * tau_wrt * misc changes * lint
1 parent 62f436f commit 619e9f1

File tree

12 files changed

+81
-72
lines changed

12 files changed

+81
-72
lines changed

docs/documentation/case.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ To restart the simulation from $k$-th time step, see [Restarting Cases](running.
508508
| `vel_wrt(i)` | Logical | Add the $i$-direction velocity to the database |
509509
| `E_wrt` | Logical | Add the total energy to the database |
510510
| `pres_wrt` | Logical | Add the pressure to the database |
511+
| `tau_wrt` | Logical | Add the elastic stresses to the database |
511512
| `alpha_wrt(i)` | Logical | Add the volume fraction of fluid $i$ to the database |
512513
| `gamma_wrt` | Logical | Add the specific heat ratio function to the database |
513514
| `heat_ratio_wrt` | Logical | Add the specific heat ratio to the database |

src/common/m_checker_common.fpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,12 @@ contains
161161
!> Checks constraints on the elasticity parameters.
162162
!! Called by s_check_inputs_common for all three stages
163163
subroutine s_check_inputs_elasticity
164-
@:PROHIBIT((hypoelasticity .or. hyperelasticity) .and. model_eqns == 1, &
165-
"Elasticity does not work for model_eqns = 1")
166-
@:PROHIBIT((hypoelasticity .or. hyperelasticity) .and. model_eqns > 3, &
167-
"Elasticity works only for model_eqns 2 and 3")
164+
@:PROHIBIT(elasticity .and. .not. (model_eqns == 2 .or. model_eqns == 3))
168165
#:for X in ['x', 'y', 'z']
169166
#:for BOUND in ['beg', 'end']
170-
@:PROHIBIT(hyperelasticity .and. ((bc_${X}$%${BOUND}$ .lt. -3)), &
171-
"bc_${X}$%${BOUND}$ is not supported")
167+
@:PROHIBIT(hyperelasticity .and. bc_${X}$%${BOUND}$ /= dflt_int .and. (bc_${X}$%${BOUND}$ < -3))
172168
#:endfor
173169
#:endfor
174-
175-
#ifdef MFC_SIMULATION
176-
@:PROHIBIT(elasticity .and. fd_order /= 4)
177-
@:PROHIBIT(hyperelasticity .and. hyper_model .le. 0, &
178-
"Set the hyper_model in the input file")
179-
#endif
180-
181170
end subroutine s_check_inputs_elasticity
182171

183172
!> Checks constraints on dimensionality and the number of cells for the grid.

src/post_process/m_checker.fpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ contains
3333
call s_check_inputs_volume_fraction
3434
call s_check_inputs_vorticity
3535
call s_check_inputs_schlieren
36+
call s_check_inputs_elasticity
3637
call s_check_inputs_surface_tension
3738
call s_check_inputs_no_flow_variables
3839

@@ -129,6 +130,14 @@ contains
129130
end do
130131
end subroutine s_check_inputs_schlieren
131132

133+
!> Checks constraints on elasticity parameters
134+
subroutine s_check_inputs_elasticity
135+
@:PROHIBIT(.not. (hypoelasticity .or. hyperelasticity) .and. tau_wrt)
136+
! Note: 'elasticity' variable isn't initialized yet; use (hypoelasticity .or. hyperelasticity) instead
137+
@:PROHIBIT(.not. hyperelasticity .and. kymograph)
138+
@:PROHIBIT(format == 2 .and. kymograph, 'Binary output format does not support kymograph')
139+
end subroutine
140+
132141
!> Checks constraints on surface tension parameters (cf_wrt and sigma)
133142
subroutine s_check_inputs_surface_tension
134143
@:PROHIBIT(cf_wrt .and. .not. surface_tension, &
@@ -138,7 +147,7 @@ contains
138147
!> Checks constraints on the absence of flow variables
139148
subroutine s_check_inputs_no_flow_variables
140149
@:PROHIBIT(.not. any([ &
141-
(/rho_wrt, E_wrt, pres_wrt, gamma_wrt, heat_ratio_wrt, pi_inf_wrt, &
150+
(/rho_wrt, E_wrt, pres_wrt, tau_wrt, gamma_wrt, heat_ratio_wrt, pi_inf_wrt, &
142151
pres_inf_wrt, cons_vars_wrt, prim_vars_wrt, c_wrt, schlieren_wrt/), &
143152
alpha_rho_wrt, mom_wrt, vel_wrt, flux_wrt, alpha_wrt, omega_wrt]), &
144153
"None of the flow variables have been selected for post-process. Exiting.")

src/post_process/m_data_output.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ contains
345345
if (pres_wrt .or. prim_vars_wrt) dbvars = dbvars + 1
346346
347347
! Elastic stresses
348-
if (hypoelasticity) dbvars = dbvars + (num_dims*(num_dims + 1))/2
348+
if (tau_wrt .or. prim_vars_wrt) dbvars = dbvars + (num_dims*(num_dims + 1))/2
349349
350350
! Volume fraction(s)
351351
if ((model_eqns == 2) .or. (model_eqns == 3)) then

src/post_process/m_global_parameters.fpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ module m_global_parameters
219219
logical, dimension(3) :: flux_wrt
220220
logical :: E_wrt
221221
logical :: pres_wrt
222+
logical :: tau_wrt
222223
logical, dimension(num_fluids_max) :: alpha_wrt
223224
logical :: gamma_wrt
224225
logical :: heat_ratio_wrt
@@ -385,6 +386,7 @@ contains
385386
file_per_process = .false.
386387
E_wrt = .false.
387388
pres_wrt = .false.
389+
tau_wrt = .false.
388390
alpha_wrt = .false.
389391
gamma_wrt = .false.
390392
heat_ratio_wrt = .false.
@@ -649,22 +651,23 @@ contains
649651
end if
650652
end if
651653

652-
if (hypoelasticity .or. hyperelasticity) elasticity = .true.
654+
elasticity = hypoelasticity .or. hyperelasticity
653655

654656
if (elasticity) then
655657
stress_idx%beg = sys_size + 1
656658
stress_idx%end = sys_size + (num_dims*(num_dims + 1))/2
657659
! number of distinct stresses is 1 in 1D, 3 in 2D, 6 in 3D
658660
sys_size = stress_idx%end
659-
if (hyperelasticity) then
660-
xi_idx%beg = sys_size + 1
661-
xi_idx%end = sys_size + num_dims
662-
! adding three more equations for the \xi field and the elastic energy
663-
sys_size = xi_idx%end + 1
664-
! number of entries in the symmetric btensor plus the jacobian
665-
b_size = (num_dims*(num_dims + 1))/2 + 1
666-
tensor_size = num_dims**2 + 1
667-
end if
661+
end if
662+
663+
if (hyperelasticity) then
664+
xi_idx%beg = sys_size + 1
665+
xi_idx%end = sys_size + num_dims
666+
! adding three more equations for the \xi field and the elastic energy
667+
sys_size = xi_idx%end + 1
668+
! number of entries in the symmetric btensor plus the jacobian
669+
b_size = (num_dims*(num_dims + 1))/2 + 1
670+
tensor_size = num_dims**2 + 1
668671
end if
669672

670673
if (chemistry) then

src/post_process/m_mpi_proxy.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ contains
163163
164164
#:for VAR in [ 'cyl_coord', 'mpp_lim', 'mixture_err', &
165165
& 'alt_soundspeed', 'hypoelasticity', 'parallel_io', 'rho_wrt', &
166-
& 'E_wrt', 'pres_wrt', 'gamma_wrt', 'sim_data', 'kymograph', &
166+
& 'E_wrt', 'pres_wrt', 'tau_wrt', 'gamma_wrt', 'sim_data', 'kymograph', &
167167
& 'heat_ratio_wrt', 'pi_inf_wrt', 'pres_inf_wrt', 'cons_vars_wrt', &
168168
& 'prim_vars_wrt', 'c_wrt', 'qm_wrt','schlieren_wrt', 'bubbles_euler', 'qbmm', &
169169
& 'polytropic', 'polydisperse', 'file_per_process', 'relax', 'cf_wrt', &

src/post_process/m_start_up.f90

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ subroutine s_read_input_file
7272
hypoelasticity, G, &
7373
chem_wrt_Y, chem_wrt_T, avg_state, &
7474
alpha_rho_wrt, rho_wrt, mom_wrt, vel_wrt, &
75-
E_wrt, pres_wrt, alpha_wrt, gamma_wrt, &
75+
E_wrt, pres_wrt, tau_wrt, alpha_wrt, gamma_wrt, &
7676
heat_ratio_wrt, pi_inf_wrt, pres_inf_wrt, &
7777
cons_vars_wrt, prim_vars_wrt, c_wrt, &
7878
omega_wrt, qm_wrt, schlieren_wrt, schlieren_alpha, &
@@ -361,35 +361,30 @@ subroutine s_save_data(t_step, varname, pres, c, H)
361361
end if
362362

363363
! Adding the elastic shear stresses to the formatted database file
364-
if (elasticity) then
365-
if (prim_vars_wrt) then
366-
do i = 1, stress_idx%end - stress_idx%beg + 1
367-
q_sf = q_prim_vf(i - 1 + stress_idx%beg)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end)
368-
write (varname, '(A,I0)') 'tau', i
369-
call s_write_variable_to_formatted_database_file(varname, t_step)
364+
if (elasticity .and. (tau_wrt .or. prim_vars_wrt)) then
365+
do i = 1, stress_idx%end - stress_idx%beg + 1
366+
q_sf = q_prim_vf(i - 1 + stress_idx%beg)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end)
367+
write (varname, '(A,I0)') 'tau', i
368+
call s_write_variable_to_formatted_database_file(varname, t_step)
370369

371-
varname(:) = ' '
372-
end do
373-
end if
370+
varname(:) = ' '
371+
end do
374372
end if
375373

376-
if (hyperelasticity) then
377-
if (prim_vars_wrt) then
378-
do i = 1, xiend - xibeg + 1
379-
q_sf = q_prim_vf(i - 1 + xibeg)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end)
380-
write (varname, '(A,I0)') 'xi', i
381-
call s_write_variable_to_formatted_database_file(varname, t_step)
382-
383-
varname(:) = ' '
384-
end do
385-
386-
q_sf = q_prim_vf(xiend + 1)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end)
387-
388-
write (varname, '(A,I0)') 'vonMises'
374+
if (hyperelasticity .and. (tau_wrt .or. prim_vars_wrt)) then
375+
do i = 1, xiend - xibeg + 1
376+
q_sf = q_prim_vf(i - 1 + xibeg)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end)
377+
write (varname, '(A,I0)') 'xi', i
389378
call s_write_variable_to_formatted_database_file(varname, t_step)
379+
390380
varname(:) = ' '
381+
end do
391382

392-
end if
383+
q_sf = q_prim_vf(xiend + 1)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end)
384+
385+
write (varname, '(A,I0)') 'vonMises'
386+
call s_write_variable_to_formatted_database_file(varname, t_step)
387+
varname(:) = ' '
393388
end if
394389

395390
! Adding the pressure to the formatted database file

src/pre_process/m_global_parameters.fpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -720,22 +720,24 @@ contains
720720
end if
721721
end if
722722

723-
if (hypoelasticity .or. hyperelasticity) elasticity = .true.
723+
elasticity = hypoelasticity .or. hyperelasticity
724+
724725
if (elasticity) then
725726
! creates stress indices for both hypo and hyperelasticity
726727
stress_idx%beg = sys_size + 1
727728
stress_idx%end = sys_size + (num_dims*(num_dims + 1))/2
728729
! number of stresses is 1 in 1D, 3 in 2D, 6 in 3D
729730
sys_size = stress_idx%end
730-
if (hyperelasticity) then
731-
! number of entries in the symmetric btensor plus the jacobian
732-
b_size = (num_dims*(num_dims + 1))/2 + 1
733-
tensor_size = num_dims**2 + 1
734-
xi_idx%beg = sys_size + 1
735-
xi_idx%end = sys_size + num_dims
736-
! adding three more equations for the \xi field and the elastic energy
737-
sys_size = xi_idx%end + 1
738-
end if
731+
end if
732+
733+
if (hyperelasticity) then
734+
! number of entries in the symmetric btensor plus the jacobian
735+
b_size = (num_dims*(num_dims + 1))/2 + 1
736+
tensor_size = num_dims**2 + 1
737+
xi_idx%beg = sys_size + 1
738+
xi_idx%end = sys_size + num_dims
739+
! adding three more equations for the \xi field and the elastic energy
740+
sys_size = xi_idx%end + 1
739741
end if
740742

741743
if (chemistry) then

src/simulation/m_checker.fpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ contains
3030
call s_check_inputs_time_stepping
3131
call s_check_inputs_model_eqns
3232
call s_check_inputs_acoustic_src
33+
call s_check_inputs_elasticity
3334
call s_check_inputs_bubbles_euler
3435
call s_check_inputs_bubbles_lagrange
3536
call s_check_inputs_adapt_dt
@@ -256,6 +257,12 @@ contains
256257
257258
end subroutine s_check_inputs_acoustic_src
258259
260+
!> Checks constraints on elasticity parameters
261+
subroutine s_check_inputs_elasticity
262+
@:PROHIBIT(hyperelasticity .and. hyper_model == dflt_int)
263+
@:PROHIBIT(elasticity .and. fd_order /= 4)
264+
end subroutine
265+
259266
!> Checks constraints on bubble parameters
260267
subroutine s_check_inputs_bubbles_euler
261268
@:PROHIBIT(bubbles_euler .and. bubbles_lagrange, "Activate only one of the bubble subgrid models")

src/simulation/m_global_parameters.fpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,24 +1006,25 @@ contains
10061006
end if
10071007
! END: Volume Fraction Model
10081008
1009-
if (hypoelasticity .or. hyperelasticity) elasticity = .true.
1009+
elasticity = hypoelasticity .or. hyperelasticity
10101010
10111011
if (elasticity) then
10121012
! creates stress indices for both hypo and hyperelasticity
10131013
stress_idx%beg = sys_size + 1
10141014
stress_idx%end = sys_size + (num_dims*(num_dims + 1))/2
10151015
! number of distinct stresses is 1 in 1D, 3 in 2D, 6 in 3D
10161016
sys_size = stress_idx%end
1017-
if (hyperelasticity) then
1018-
! number of entries in the symmetric btensor plus the jacobian
1019-
b_size = (num_dims*(num_dims + 1))/2 + 1
1020-
! storing the jacobian in the last entry
1021-
tensor_size = num_dims**2 + 1
1022-
xi_idx%beg = sys_size + 1
1023-
xi_idx%end = sys_size + num_dims
1024-
! adding three more equations for the \xi field and the elastic energy
1025-
sys_size = xi_idx%end + 1
1026-
end if
1017+
end if
1018+
1019+
if (hyperelasticity) then
1020+
! number of entries in the symmetric btensor plus the jacobian
1021+
b_size = (num_dims*(num_dims + 1))/2 + 1
1022+
! storing the jacobian in the last entry
1023+
tensor_size = num_dims**2 + 1
1024+
xi_idx%beg = sys_size + 1
1025+
xi_idx%end = sys_size + num_dims
1026+
! adding three more equations for the \xi field and the elastic energy
1027+
sys_size = xi_idx%end + 1
10271028
end if
10281029
10291030
if (chemistry) then

0 commit comments

Comments
 (0)