Skip to content

Commit 16de11c

Browse files
hyeoksu-leeHyeoksu Lee
andauthored
Fix broken example 0D_bubblecollapse_adap (#969)
Co-authored-by: Hyeoksu Lee <[email protected]>
1 parent ada47da commit 16de11c

File tree

7 files changed

+15
-8
lines changed

7 files changed

+15
-8
lines changed

docs/documentation/case.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ Details of implementation of viscosity in MFC can be found in [Coralic (2015)](r
379379
| `mixture_err` | Logical | Mixture properties correction |
380380
| `time_stepper` | Integer | Runge--Kutta order [1-3] |
381381
| `adap_dt` | Logical | Strang splitting scheme with adaptive time stepping |
382+
| `adap_dt_tol` | Real | Tolerance for adaptive time stepping in Strang splitting scheme|
383+
| `adap_dt_max_iters` | Integer | Max iteration for adaptive time stepping in Strang splitting scheme |
382384
| `weno_order` | Integer | WENO order [1,3,5] |
383385
| `weno_eps` | Real | WENO perturbation (avoid division by zero) |
384386
| `mapped_weno` | Logical | WENO-M (WENO with mapping of nonlinear weights) |
@@ -453,7 +455,7 @@ The effect and use of the source term are assessed by [Schmidmayer et al., 2019]
453455
- `time_stepper` specifies the order of the Runge-Kutta (RK) time integration scheme that is used for temporal integration in simulation, from the 1st to 5th order by corresponding integer.
454456
Note that `time_stepper = 3` specifies the total variation diminishing (TVD), third order RK scheme ([Gottlieb and Shu, 1998](references.md)).
455457

456-
- `adap_dt` activates the Strang operator splitting scheme which splits flux and source terms in time marching, and an adaptive time stepping strategy is implemented for the source term. It requires ``bubbles_euler = 'T'``, ``polytropic = 'T'``, ``adv_n = 'T'`` and `time_stepper = 3`. Additionally, it can be used with ``bubbles_lagrange = 'T'`` and `time_stepper = 3`
458+
- `adap_dt` activates the Strang operator splitting scheme which splits flux and source terms in time marching, and an adaptive time stepping strategy is implemented for the source term. It requires ``bubbles_euler = 'T'``, ``polytropic = 'T'``, ``adv_n = 'T'`` and `time_stepper = 3`. Additionally, it can be used with ``bubbles_lagrange = 'T'`` and `time_stepper = 3`. `adap_dt_tol` and `adap_dt_max_iters` are 1e-4 and 100, respectively, by default.
457459

458460
- `weno_order` specifies the order of WENO scheme that is used for spatial reconstruction of variables by an integer of 1, 3, 5, and 7, that correspond to the 1st, 3rd, 5th, and 7th order, respectively.
459461

examples/0D_bubblecollapse_adap/case.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
"adv_n": "T",
119119
# adap_dt
120120
"adap_dt": "T",
121+
"adap_dt_max_iters": 200,
121122
# Gas compression model
122123
"polytropic": "T",
123124
"thermal": 1,

src/common/m_constants.fpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ module m_constants
5555

5656
! Strang Splitting constants
5757
real(wp), parameter :: dflt_adap_dt_tol = 1.e-4_wp !< Default tolerance for adaptive step size
58-
integer, parameter :: adap_dt_max_iters = 100 !< Maximum number of iterations
58+
integer, parameter :: dflt_adap_dt_max_iters = 100 !< Default max iteration for adaptive step size
59+
5960
! Constants of the algorithm described by Heirer, E. Hairer S.P.Nørsett G. Wanner, Solving Ordinary Differential Equations I, Chapter II.4
6061
! to choose the initial time step size for the adaptive time stepping routine
6162
real(wp), parameter :: threshold_first_guess = 1.e-5_wp

src/simulation/m_global_parameters.fpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ module m_global_parameters
408408
logical :: adv_n !< Solve the number density equation and compute alpha from number density
409409
logical :: adap_dt !< Adaptive step size control
410410
real(wp) :: adap_dt_tol !< Tolerance to control adaptive step size
411-
$:GPU_DECLARE(create='[adv_n,adap_dt,adap_dt_tol]')
411+
integer :: adap_dt_max_iters !< Maximum number of iterations
412+
$:GPU_DECLARE(create='[adv_n,adap_dt,adap_dt_tol,adap_dt_max_iters]')
412413

413414
integer :: bubble_model !< Gilmore or Keller--Miksis bubble model
414415
integer :: thermal !< Thermal behavior. 1 = adiabatic, 2 = isotherm, 3 = transfer
@@ -672,6 +673,7 @@ contains
672673
adv_n = .false.
673674
adap_dt = .false.
674675
adap_dt_tol = dflt_real
676+
adap_dt_max_iters = dflt_adap_dt_max_iters
675677
676678
pi_fac = 1._wp
677679
@@ -1243,7 +1245,7 @@ contains
12431245
$:GPU_UPDATE(device='[momxb,momxe,advxb,advxe,contxb,contxe, &
12441246
& bubxb,bubxe,intxb,intxe,sys_size,buff_size,E_idx, &
12451247
& alf_idx,n_idx,adv_n,adap_dt,pi_fac,strxb,strxe, &
1246-
& chemxb,chemxe,c_idx]')
1248+
& chemxb,chemxe,c_idx,adap_dt_tol,adap_dt_max_iters]')
12471249
$:GPU_UPDATE(device='[b_size,xibeg,xiend,tensor_size]')
12481250
12491251
$:GPU_UPDATE(device='[species_idx]')

src/simulation/m_mpi_proxy.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ contains
9898
& 'wave_speeds', 'avg_state', 'precision', 'bc_x%beg', 'bc_x%end', &
9999
& 'bc_y%beg', 'bc_y%end', 'bc_z%beg', 'bc_z%end', 'fd_order', &
100100
& 'num_probes', 'num_integrals', 'bubble_model', 'thermal', &
101-
& 'num_source', 'relax_model', 'num_ibs', 'n_start', &
102-
& 'num_bc_patches', 'num_igr_iters', 'num_igr_warm_start_iters']
101+
& 'num_source','relax_model','num_ibs','n_start','num_igr_iters', &
102+
& 'num_bc_patches','num_igr_warm_start_iters','adap_dt_max_iters' ]
103103
call MPI_BCAST(${VAR}$, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
104104
#:endfor
105105

src/simulation/m_start_up.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ contains
173173
relax, relax_model, &
174174
palpha_eps, ptgalpha_eps, &
175175
file_per_process, sigma, &
176-
pi_fac, adv_n, adap_dt, adap_dt_tol, &
176+
pi_fac, adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters, &
177177
bf_x, bf_y, bf_z, &
178178
k_x, k_y, k_z, w_x, w_y, w_z, p_x, p_y, p_z, &
179179
g_x, g_y, g_z, n_start, t_save, t_stop, &
@@ -1415,7 +1415,7 @@ contains
14151415
$:GPU_UPDATE(device='[nb,R0ref,Ca,Web,Re_inv,weight,R0, &
14161416
& bubbles_euler,polytropic,polydisperse,qbmm, &
14171417
& ptil,bubble_model,thermal,poly_sigma,adv_n,adap_dt, &
1418-
& adap_dt_tol,n_idx,pi_fac,low_Mach]')
1418+
& adap_dt_tol,adap_dt_max_iters,n_idx,pi_fac,low_Mach]')
14191419
$:GPU_UPDATE(device='[R_n,R_v,phi_vn,phi_nv,Pe_c,Tw,pv,M_n, &
14201420
& M_v,k_n,k_v,pb0,mass_n0,mass_v0,Pe_T,Re_trans_T, &
14211421
& Re_trans_c,Im_trans_T,Im_trans_c,omegaN,mul0,ss, &

toolchain/mfc/run/case_dicts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ def analytic(self):
283283
'pi_fac': ParamType.REAL,
284284
'adap_dt': ParamType.LOG,
285285
'adap_dt_tol': ParamType.REAL,
286+
'adap_dt_max_iters': ParamType.INT,
286287
'ib': ParamType.LOG,
287288
'num_ibs': ParamType.INT,
288289
'n_start': ParamType.INT,

0 commit comments

Comments
 (0)