Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/2D_backward_facing_step/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Backward Facing Step (2D)

## Final Condition (Density)
<img src="final.png"/>
88 changes: 88 additions & 0 deletions examples/2D_backward_facing_step/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import json
import math

h = 0.0093
Re = 5000

gam_a = 1.4
p0 = 101325
rho0 = 1
c0 = math.sqrt(gam_a * p0 / rho0)
v0 = 3 * c0
mu = v0 * h / Re

# Configuring case dictionary
print(
json.dumps(
{
# Logistics
"run_time_info": "T",
"x_domain%beg": 0,
"x_domain%end": 30 * h,
"y_domain%beg": 0,
"y_domain%end": 6 * h,
"cyl_coord": "F",
"m": 1999,
"n": 399,
"p": 0,
"cfl_adap_dt": "T",
"cfl_target": 0.5,
"n_start": 0,
"t_save": 100 * h / (100 * v0),
"t_stop": 100 * h / v0,
# Simulation Algorithm Parameters
"num_patches": 1,
"model_eqns": 2,
"alt_soundspeed": "F",
"num_fluids": 1,
"mpp_lim": "F",
"mixture_err": "F",
"time_stepper": 3,
"weno_order": 5,
"weno_eps": 1.0e-16,
"weno_avg": "T",
"weno_Re_flux": "T",
"avg_state": 2,
"mapped_weno": "T",
"null_weights": "F",
"mp_weno": "T",
"riemann_solver": 2,
"wave_speeds": 1,
"bc_x%beg": -11,
"bc_x%end": -3,
"bc_y%beg": -16,
"bc_y%end": -3,
"ib": "T",
"num_ibs": 1,
"viscous": "T",
# Formatted Database Files Structure Parameters
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "T",
# Fluid Patch: Background
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%x_centroid": 15 * h,
"patch_icpp(1)%y_centroid": 3.5 * h,
"patch_icpp(1)%length_x": 30 * h,
"patch_icpp(1)%length_y": 7 * h,
"patch_icpp(1)%vel(1)": v0,
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%pres": p0,
"patch_icpp(1)%alpha_rho(1)": rho0,
"patch_icpp(1)%alpha(1)": 1.0,
# IB Patch: Step
"patch_ib(1)%geometry": 3,
"patch_ib(1)%x_centroid": 4 * h,
"patch_ib(1)%y_centroid": 0 * h,
"patch_ib(1)%length_x": 12 * h,
"patch_ib(1)%length_y": 2 * h,
"patch_ib(1)%slip": "T",
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0 / (gam_a - 1.0),
"fluid_pp(1)%pi_inf": 0.0,
"fluid_pp(1)%Re(1)": 1 / mu,
},
indent=4,
)
)
Binary file added examples/2D_backward_facing_step/final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions examples/2D_forward_facing_step/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Forward Facing Step (2D)

Reference:
> Woodward, P. *(1984). The numerical simulation of two-dimensional fluid flow with strong shocks. Journal of Computational Physics, 54(1), 115–173. https://doi.org/10.1016/0021-9991(84)90140-2*

## Final Condition (Density)
<img src="final.png"/>
86 changes: 86 additions & 0 deletions examples/2D_forward_facing_step/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import json
import math

h = 0.2

gam_a = 1.4
p0 = 1
rho0 = 1.4
c0 = math.sqrt(gam_a * p0 / rho0)
v0 = 3 * c0
mu = rho0 * v0 * h / 2e5

# Configuring case dictionary
print(
json.dumps(
{
# Logistics
"run_time_info": "T",
"x_domain%beg": 0,
"x_domain%end": 15 * h,
"y_domain%beg": 0,
"y_domain%end": 5 * h,
"cyl_coord": "F",
"m": 1499,
"n": 499,
"p": 0,
"cfl_adap_dt": "T",
"cfl_target": 0.8,
"n_start": 0,
"t_save": 0.04,
"t_stop": 4,
# Simulation Algorithm Parameters
"num_patches": 1,
"model_eqns": 2,
"alt_soundspeed": "F",
"num_fluids": 1,
"mpp_lim": "F",
"mixture_err": "F",
"time_stepper": 3,
"weno_avg": "T",
"weno_order": 5,
"weno_eps": 1.0e-16,
"avg_state": 2,
"mapped_weno": "T",
"null_weights": "F",
"mp_weno": "T",
"riemann_solver": 2,
"wave_speeds": 1,
"bc_x%beg": -3,
"bc_x%end": -3,
"bc_y%beg": -2,
"bc_y%end": -2,
"ib": "T",
"num_ibs": 1,
# Formatted Database Files Structure Parameters
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "T",
# Patch 1 Background
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%x_centroid": 7.5 * h,
"patch_icpp(1)%y_centroid": 2.5 * h,
"patch_icpp(1)%length_x": 15 * h,
"patch_icpp(1)%length_y": 5 * h,
"patch_icpp(1)%vel(1)": v0,
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%pres": p0,
"patch_icpp(1)%alpha_rho(1)": rho0,
"patch_icpp(1)%alpha(1)": 1.0,
# Patch: No slip rectangle
"patch_ib(1)%geometry": 3,
"patch_ib(1)%x_centroid": 11.5 * h,
"patch_ib(1)%y_centroid": 0 * h,
"patch_ib(1)%length_x": 17 * h,
"patch_ib(1)%length_y": 2 * h,
"patch_ib(1)%slip": "T",
# Fluids Physical Parameters
"fluid_pp(1)%gamma": 1.0 / (gam_a - 1.0),
"fluid_pp(1)%pi_inf": 0.0,
"viscous": "T",
"fluid_pp(1)%Re(1)": 1 / mu,
},
indent=4,
)
)
Binary file added examples/2D_forward_facing_step/final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 19 additions & 10 deletions src/simulation/m_cbc.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,27 +1635,36 @@ contains
@:DEALLOCATE(vel_in, vel_out, pres_in, pres_out, Del_in, Del_out, alpha_rho_in, alpha_in)

! Deallocating CBC Coefficients in x-direction
if (any((/bc_x%beg, bc_x%end/) <= -5) .and. any((/bc_x%beg, bc_x%end/) >= -13)) then
if (all((/bc_x%beg, bc_x%end/) <= -5) .and. all((/bc_x%beg, bc_x%end/) >= -13) .or. &
bc_x%beg <= -5 .and. bc_x%beg >= -13 .or. &
bc_x%end <= -5 .and. bc_x%end >= -13) then
@:DEALLOCATE(fd_coef_x)
if (weno_order > 1 .or. muscl_order > 1) then
@:DEALLOCATE(pi_coef_x)
end if
end if

! Deallocating CBC Coefficients in y-direction
if (n > 0 .and. any((/bc_y%beg, bc_y%end/) <= -5) .and. &
any((/bc_y%beg, bc_y%end/) >= -13 .and. bc_y%beg /= -14)) then
@:DEALLOCATE(fd_coef_y)
if (weno_order > 1 .or. muscl_order > 1) then
@:DEALLOCATE(pi_coef_y)
if (n > 0) then
if (all((/bc_y%beg, bc_y%end/) <= -5) .and. all((/bc_y%beg, bc_y%end/) >= -13) .or. &
bc_y%beg <= -5 .and. bc_y%beg >= -13 .or. &
bc_y%end <= -5 .and. bc_y%end >= -13) then
@:DEALLOCATE(fd_coef_y)
if (weno_order > 1) then
@:DEALLOCATE(pi_coef_y)
end if
end if
end if

! Deallocating CBC Coefficients in z-direction
if (p > 0 .and. any((/bc_z%beg, bc_z%end/) <= -5) .and. any((/bc_z%beg, bc_z%end/) >= -13)) then
@:DEALLOCATE(fd_coef_z)
if (weno_order > 1 .or. muscl_order > 1) then
@:DEALLOCATE(pi_coef_z)
if (p > 0) then
if (all((/bc_z%beg, bc_z%end/) <= -5) .and. all((/bc_z%beg, bc_z%end/) >= -13) .or. &
bc_z%beg <= -5 .and. bc_z%beg >= -13 .or. &
bc_z%end <= -5 .and. bc_z%end >= -13) then
@:DEALLOCATE(fd_coef_z)
if (weno_order > 1) then
@:DEALLOCATE(pi_coef_z)
end if
end if
end if

Expand Down
Loading
Loading