Skip to content

Commit 3ada451

Browse files
Hyeoksu LeeHyeoksu Lee
authored andcommitted
Fix broken example 0D_bubblecollapse_adap
1 parent c933e72 commit 3ada451

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ 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+
5959
! Constants of the algorithm described by Heirer, E. Hairer S.P.Nørsett G. Wanner, Solving Ordinary Differential Equations I, Chapter II.4
6060
! to choose the initial time step size for the adaptive time stepping routine
6161
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
@@ -409,7 +409,8 @@ module m_global_parameters
409409
logical :: adv_n !< Solve the number density equation and compute alpha from number density
410410
logical :: adap_dt !< Adaptive step size control
411411
real(wp) :: adap_dt_tol !< Tolerance to control adaptive step size
412-
$:GPU_DECLARE(create='[adv_n,adap_dt,adap_dt_tol]')
412+
integer :: adap_dt_max_iters !< Maximum number of iterations
413+
$:GPU_DECLARE(create='[adv_n,adap_dt,adap_dt_tol,adap_dt_max_iters]')
413414

414415
integer :: bubble_model !< Gilmore or Keller--Miksis bubble model
415416
integer :: thermal !< Thermal behavior. 1 = adiabatic, 2 = isotherm, 3 = transfer
@@ -676,6 +677,7 @@ contains
676677
adv_n = .false.
677678
adap_dt = .false.
678679
adap_dt_tol = dflt_real
680+
adap_dt_max_iters = 100
679681
680682
pi_fac = 1._wp
681683
@@ -1254,7 +1256,7 @@ contains
12541256
$:GPU_UPDATE(device='[momxb,momxe,advxb,advxe,contxb,contxe, &
12551257
& bubxb,bubxe,intxb,intxe,sys_size,buff_size,E_idx, &
12561258
& alf_idx,n_idx,adv_n,adap_dt,pi_fac,strxb,strxe, &
1257-
& chemxb,chemxe,c_idx]')
1259+
& chemxb,chemxe,c_idx,adap_dt_tol,adap_dt_max_iters]')
12581260
$:GPU_UPDATE(device='[b_size,xibeg,xiend,tensor_size]')
12591261
12601262
$:GPU_UPDATE(device='[species_idx]')

src/simulation/m_mpi_proxy.fpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ contains
9999
& 'bc_y%beg', 'bc_y%end', 'bc_z%beg', 'bc_z%end', 'fd_order', &
100100
& 'num_probes', 'num_integrals', 'bubble_model', 'thermal', &
101101
& 'R0_type', 'num_source', 'relax_model', 'num_ibs', 'n_start', &
102-
& 'num_bc_patches', 'num_igr_iters', 'num_igr_warm_start_iters']
102+
& 'num_bc_patches', 'num_igr_iters', 'num_igr_warm_start_iters', &
103+
& 'adap_dt_max_iters' ]
103104
call MPI_BCAST(${VAR}$, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
104105
#:endfor
105106

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
R0_type, 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,V0, &
14161416
& bubbles_euler,polytropic,polydisperse,qbmm,R0_type, &
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
@@ -285,6 +285,7 @@ def analytic(self):
285285
'pi_fac': ParamType.REAL,
286286
'adap_dt': ParamType.LOG,
287287
'adap_dt_tol': ParamType.REAL,
288+
'adap_dt_max_iters': ParamType.INT,
288289
'ib': ParamType.LOG,
289290
'num_ibs': ParamType.INT,
290291
'n_start': ParamType.INT,

0 commit comments

Comments
 (0)