Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wilfonba committed Feb 15, 2025
1 parent bad36bd commit c587b80
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 34 deletions.
16 changes: 8 additions & 8 deletions examples/2D_igr_advection/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

eps = 1e-6

mydt = 1e-6
mydt = 2e-6

# Configuration case dictionary
data = {
Expand All @@ -43,8 +43,8 @@
# "n_start": 0,
"dt": mydt,
"t_step_start": 0,
"t_step_stop": 2000,
"t_step_save": 5,
"t_step_stop": 5000,
"t_step_save": 50,
# Simulation Algorithm
"model_eqns": 2,
"alt_soundspeed": "F",
Expand Down Expand Up @@ -90,7 +90,7 @@
"patch_icpp(1)%length_y": 2,
"patch_icpp(1)%length_z": 2,
"patch_icpp(1)%vel(1)": 100.0,
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%vel(2)": 100.0,
"patch_icpp(1)%vel(3)": 0.0,
"patch_icpp(1)%pres": 101325,
"patch_icpp(1)%alpha_rho(1)": eps,
Expand All @@ -102,13 +102,13 @@
"patch_icpp(2)%alter_patch(1)": "T",
"patch_icpp(2)%smoothen": "T",
"patch_icpp(2)%smooth_patch_id": 1,
"patch_icpp(2)%smooth_coeff": 0.25,
"patch_icpp(2)%x_centroid": 0,
"patch_icpp(2)%y_centroid": 0,
"patch_icpp(2)%smooth_coeff": 0.5,
"patch_icpp(2)%x_centroid": -0.5,
"patch_icpp(2)%y_centroid": -0.5,
"patch_icpp(2)%z_centroid": 0,
"patch_icpp(2)%radius": r0,
"patch_icpp(2)%vel(1)": 100.0,
"patch_icpp(2)%vel(2)": 0.0,
"patch_icpp(2)%vel(2)": 100.0,
"patch_icpp(2)%vel(3)": 0.0,
"patch_icpp(2)%pres": 101325,
"patch_icpp(2)%alpha_rho(1)": 1 - eps,
Expand Down
17 changes: 6 additions & 11 deletions examples/3D_TaylorGreenVortex/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math
import json

N =299
N =199

Re = 1600
L = 1
Expand Down Expand Up @@ -40,16 +40,11 @@
"n": N,
"p": N,
"cyl_coord": "F",
# "dt": dt,
# "t_step_start": 0,
# "t_step_stop": Nt,
# "t_step_save": int(Nt / 100),
"cfl_adap_dt": "T",
"cfl_target": 0.5,
"t_stop": 20*tC,
"t_save": tC,
"n_start": 0,
# Simulation Algorithm Parameters
"dt": dt,
"t_step_start": 0,
"t_step_stop": Nt,
"t_step_save": int(Nt / 100),
# Simulation Algorithm Parameters
"num_patches": 1,
"model_eqns": 2,
"alt_soundspeed": "F",
Expand Down
6 changes: 3 additions & 3 deletions examples/3D_igr_2fluid/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"patch_icpp(2)%alter_patch(1)": "T",
"patch_icpp(2)%smoothen": "T",
"patch_icpp(2)%smooth_patch_id": 1,
"patch_icpp(2)%smooth_coeff": 0.1,
"patch_icpp(2)%smooth_coeff": 0.25,
"patch_icpp(2)%geometry": 8,
"patch_icpp(2)%x_centroid": 0,
"patch_icpp(2)%y_centroid": 0,
Expand All @@ -111,10 +111,10 @@
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%vel(2)": 0.0,
"patch_icpp(2)%vel(3)": 0.0,
"patch_icpp(2)%pres": 9.518,
"patch_icpp(2)%pres": 10,
"patch_icpp(2)%alpha_rho(1)": eps,
"patch_icpp(2)%alpha(1)": eps,
"patch_icpp(2)%alpha_rho(2)": (1 - eps)*5,
"patch_icpp(2)%alpha_rho(2)": (1 - eps),
"patch_icpp(2)%alpha(2)": 1 - eps,
}

Expand Down
129 changes: 129 additions & 0 deletions examples/3D_igr_advection/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#!/usr/bin/env python3
# This case file demonstrates the Laplace pressure jump of a water droplet in air. The laplace pressure jump
# in 2D is given by delta = sigma / r where delta is the pressure jump, sigma is the surface tension coefficient,
# and r is the radius of the droplet. The results of this simulation agree with theory to well within 1%
# relative error.

import math
import json

l = 1

# Numerical setup
r0 = l/4
x0 = -1
x1 = l
y0 = -1
y1 = l
z0 = -1
z1 = l


Nx = 200
Ny = Nx
Nz = Nx

eps = 1e-6

mydt = 2e-6

# Configuration case dictionary
data = {
# Logistics
"run_time_info": "T",
# Computational Domain
"x_domain%beg": x0,
"x_domain%end": x1,
"y_domain%beg": y0,
"y_domain%end": y1,
"z_domain%beg": z0,
"z_domain%end": z1,
"m": Nx,
"n": Ny,
"p": Nz,
"cyl_coord": "F",
# "cfl_const_dt": "T",
# "cfl_target": 0.5,
# "t_stop": 2.5,
# "t_save": 0.025,
# "n_start": 0,
"dt": mydt,
"t_step_start": 0,
"t_step_stop": 5000,
"t_step_save": 50,
# Simulation Algorithm
"model_eqns": 2,
"alt_soundspeed": "F",
"mixture_err": "T",
"mpp_lim": "F",
"time_stepper": 3,
"weno_order": 5,
"avg_state": 2,
"weno_eps": 1e-16,
"mapped_weno": "T",
"null_weights": "F",
"mp_weno": "T",
"weno_Re_flux": "F",
"riemann_solver": 2,
"wave_speeds": 1,
"bc_x%beg": -3,
"bc_x%end": -3,
"bc_y%beg": -3,
"bc_y%end": -3,
"bc_z%beg": -3,
"bc_z%end": -3,
"num_patches": 2,
"num_fluids": 2,
"igr": "T",
"alf_factor": 10,
# Database Structure Parameters
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "T",
# Fluid Parameters (Gas)
"fluid_pp(1)%gamma": 1.0e00 / (1.4e00 - 1.0e00),
"fluid_pp(1)%pi_inf": 0.0e00,
"fluid_pp(2)%gamma": 1.0e00 / (1.4e00 - 1.0e00),
"fluid_pp(2)%pi_inf": 0.0e00,
"viscous": "T",
"fluid_pp(1)%Re(1)": 1e5,
"fluid_pp(2)%Re(1)": 1e5,
# Ambient pressure
"patch_icpp(1)%geometry": 9,
"patch_icpp(1)%x_centroid": 0,
"patch_icpp(1)%y_centroid": 0,
"patch_icpp(1)%z_centroid": 0,
"patch_icpp(1)%length_x": 2,
"patch_icpp(1)%length_y": 2,
"patch_icpp(1)%length_z": 2,
"patch_icpp(1)%vel(1)": 100.0,
"patch_icpp(1)%vel(2)": 100.0,
"patch_icpp(1)%vel(3)": 100.0,
"patch_icpp(1)%pres": 101325,
"patch_icpp(1)%alpha_rho(1)": eps,
"patch_icpp(1)%alpha(1)": eps,
"patch_icpp(1)%alpha_rho(2)": 1 - eps,
"patch_icpp(1)%alpha(2)": 1 - eps,

"patch_icpp(2)%geometry": 8,
"patch_icpp(2)%alter_patch(1)": "T",
"patch_icpp(2)%smoothen": "T",
"patch_icpp(2)%smooth_patch_id": 1,
"patch_icpp(2)%smooth_coeff": 0.5,
"patch_icpp(2)%x_centroid": -0.5,
"patch_icpp(2)%y_centroid": -0.5,
"patch_icpp(2)%z_centroid": -0.5,
"patch_icpp(2)%radius": r0,
"patch_icpp(2)%vel(1)": 100.0,
"patch_icpp(2)%vel(2)": 100.0,
"patch_icpp(2)%vel(3)": 100.0,
"patch_icpp(2)%pres": 101325,
"patch_icpp(2)%alpha_rho(1)": 1 - eps,
"patch_icpp(2)%alpha(1)": 1 - eps,
"patch_icpp(2)%alpha_rho(2)": eps,
"patch_icpp(2)%alpha(2)": eps,

}

print(json.dumps(data))
24 changes: 17 additions & 7 deletions src/simulation/m_igr.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,15 +597,17 @@ contains
pres_R = qR_rs_vf(j, k, l, E_idx)

call s_compute_mixture(rho_L, rho_R, gamma_L, gamma_R, &
pi_inf_L, pi_inf_R, Re_L, Re_r, cfl, j, k, l, idir, alpha_L, alpha_rho_L, alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)
pi_inf_L, pi_inf_R, Re_L, Re_r, &
cfl, j, k, l, idir, alpha_L, alpha_rho_L, &
alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)

do i = 1, num_fluids
flux_vf(advxb+i-1)%sf(j,k,l) = &
0.5_wp * (qL_rs_vf(j+1,k,l,advxb+i-1) * &
qL_rs_vf(j+1,k,l,momxb)) + &
0.5_wp * (qR_rs_vf(j,k,l,advxb+i-1) * &
qR_rs_vf(j,k,l,momxb)) + &
05_wp*cfl * (qR_rs_vf(j, k, l, advxb+i-1) - qL_rs_vf(j+1, k, l, advxb+i-1))
0.5_wp*cfl * (qR_rs_vf(j, k, l, advxb+i-1) - qL_rs_vf(j+1, k, l, advxb+i-1))
flux_vf(i)%sf(j,k,l) = &
0.5_wp * (qL_rs_vf(j+1,k,l,i) * &
qL_rs_vf(j+1,k,l, momxb)) + &
Expand Down Expand Up @@ -682,7 +684,9 @@ contains
pres_R = qR_rs_vf(j, k, l, E_idx)

call s_compute_mixture(rho_L, rho_R, gamma_L, gamma_R, &
pi_inf_L, pi_inf_R, Re_L, Re_r, cfl, j, k, l, idir, alpha_L, alpha_rho_L, alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)
pi_inf_L, pi_inf_R, Re_L, Re_r, &
cfl, j, k, l, idir, alpha_L, alpha_rho_L, &
alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)

!$acc loop seq
do i = 1, num_fluids
Expand Down Expand Up @@ -780,7 +784,9 @@ contains
pres_R = qR_rs_vf(j, k, l, E_idx)

call s_compute_mixture(rho_L, rho_R, gamma_L, gamma_R, &
pi_inf_L, pi_inf_R, Re_L, Re_r, cfl, j, k, l, idir, alpha_L, alpha_rho_L, alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)
pi_inf_L, pi_inf_R, Re_L, Re_r, &
cfl, j, k, l, idir, alpha_L, alpha_rho_L, &
alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)

do i = 1, num_fluids
flux_vf(advxb+i-1)%sf(j,k,l) = &
Expand Down Expand Up @@ -863,7 +869,9 @@ contains
pres_R = qR_rs_vf(j, k, l, E_idx)

call s_compute_mixture(rho_L, rho_R, gamma_L, gamma_R, &
pi_inf_L, pi_inf_R, Re_L, Re_r, cfl, j, k, l, idir, alpha_L, alpha_rho_L, alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)
pi_inf_L, pi_inf_R, Re_L, Re_r, &
cfl, j, k, l, idir, alpha_L, alpha_rho_L, &
alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)

do i = 1, num_fluids
flux_vf(advxb+i-1)%sf(j,k,l) = &
Expand Down Expand Up @@ -958,7 +966,9 @@ contains
pres_R = qR_rs_vf(j, k, l, E_idx)

call s_compute_mixture(rho_L, rho_R, gamma_L, gamma_R, &
pi_inf_L, pi_inf_R, Re_L, Re_r, cfl, j, k, l, idir, alpha_L, alpha_rho_L, alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)
pi_inf_L, pi_inf_R, Re_L, Re_r, &
cfl, j, k, l, idir, alpha_L, alpha_rho_L, &
alpha_R, alpha_rho_R, vel_L, vel_R, pres_L, pres_R)


do i = 1, num_fluids
Expand Down Expand Up @@ -1052,7 +1062,7 @@ contains
do l = idwbuff(3)%beg, idwbuff(3)%end
do k = idwbuff(2)%beg, idwbuff(2)%end
do j = idwbuff(1)%beg, idwbuff(1)%end
rho_igr(j,k,l) = 0d0
rho_igr(j,k,l) = 0._wp
do i = 1, num_fluids
rho_igr(j,k,l) = rho_igr(j,k,l) + q_prim_vf(contxb + i - 1)%sf(j,k,l)
end do
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_mpi_proxy.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ contains
& 'bc_x%pres_in','bc_x%pres_out','bc_y%pres_in','bc_y%pres_out', 'bc_z%pres_in','bc_z%pres_out', &
& 'x_domain%beg', 'x_domain%end', 'y_domain%beg', 'y_domain%end', &
& 'z_domain%beg', 'z_domain%end', 'x_a', 'x_b', 'y_a', 'y_b', 'z_a', &
& 'z_b', 't_stop', 't_save', 'cfl_target', 'rkck_tolerance']
& 'z_b', 't_stop', 't_save', 'cfl_target', 'rkck_tolerance', 'alf_factor']
call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
#:endfor
Expand Down
8 changes: 4 additions & 4 deletions src/simulation/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1374,10 +1374,10 @@ contains
do l = 0, p
do k = 0, n
do j = 0, m
!if (ieee_is_nan(q_cons_ts(1)%vf(i)%sf(j, k, l))) then
!print *, "NaN(s) in timestep output.", j, k, l, i, proc_rank, t_step, m, n, p
!error stop "NaN(s) in timestep output."
!end if
if (ieee_is_nan(q_cons_ts(1)%vf(i)%sf(j, k, l))) then
print *, "NaN(s) in timestep output.", j, k, l, i, proc_rank, t_step, m, n, p
error stop "NaN(s) in timestep output."
end if
end do
end do
end do
Expand Down

0 comments on commit c587b80

Please sign in to comment.