Skip to content

Commit

Permalink
multi material
Browse files Browse the repository at this point in the history
  • Loading branch information
wilfonba committed Feb 10, 2025
1 parent 04450d4 commit 5fd73cf
Show file tree
Hide file tree
Showing 13 changed files with 390 additions and 208 deletions.
4 changes: 2 additions & 2 deletions examples/2D_advection/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"patch_icpp(1)%length_y": 1.0e00,
"patch_icpp(1)%vel(1)": 00.0e00,
"patch_icpp(1)%vel(2)": 100.0e00,
"patch_icpp(1)%pres": 1.0e05,
"patch_icpp(1)%pres": 1,
"patch_icpp(1)%alpha_rho(1)": 1.0e-12*1000,
"patch_icpp(1)%alpha_rho(2)": 1.0,
"patch_icpp(1)%alpha(1)": 1.0e-12,
Expand All @@ -75,7 +75,7 @@
"patch_icpp(2)%alter_patch(1)": "T",
"patch_icpp(2)%vel(1)": 00.0e00,
"patch_icpp(2)%vel(2)": 100.0e00,
"patch_icpp(2)%pres": 1.0e05,
"patch_icpp(2)%pres": 1,
"patch_icpp(2)%alpha_rho(1)": (1 - 1.0e-12)*1000,
"patch_icpp(2)%alpha_rho(2)": 1.0e-12,
"patch_icpp(2)%alpha(1)": 1 - 1.0e-12,
Expand Down
6 changes: 3 additions & 3 deletions examples/2D_igr/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Nx = 199
Ny = 199

dt = 1e-3
dt = 5e-4

# Configuration case dictionary
data = {
Expand All @@ -41,8 +41,8 @@
# "t_save": 2.5/100,
"dt": dt,
"t_step_start": 0,
"t_step_stop": 2500,
"t_step_save": 25,
"t_step_stop": 5000,
"t_step_save": 50,
# Simulation Algorithm
"model_eqns": 2,
"alt_soundspeed": "F",
Expand Down
31 changes: 16 additions & 15 deletions examples/2D_igr_2fluid/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
y0 = -l
y1 = l

Nx = 199
Ny = 199
Nx = 200
Ny = 200

dt = 1e-3
dt = 1e-4

# Configuration case dictionary
data = {
Expand All @@ -37,8 +37,8 @@
"cyl_coord": "F",
"dt": dt,
"t_step_start": 0,
"t_step_stop": 2500,
"t_step_save": 25,
"t_step_stop": 5000,
"t_step_save": 50,
# Simulation Algorithm
"model_eqns": 2,
"alt_soundspeed": "F",
Expand All @@ -54,14 +54,15 @@
"weno_Re_flux": "T",
"riemann_solver": 2,
"wave_speeds": 1,
"bc_x%beg": -1,
"bc_x%end": -1,
"bc_y%beg": -1,
"bc_y%end": -1,
"bc_x%beg": -3,
"bc_x%end": -3,
"bc_y%beg": -3,
"bc_y%end": -3,
"num_patches": 2,
"num_fluids": 2,
"igr": "T",
# "viscous": "T",
"alf_factor": 10,
"viscous": "T",
# Database Structure Parameters
"format": 1,
"precision": 2,
Expand All @@ -70,10 +71,10 @@
# Fluid Parameters (Gas)
"fluid_pp(1)%gamma": 1.0e00 / (1.4e00 - 1.0e00),
"fluid_pp(1)%pi_inf": 0.0e00,
# "fluid_pp(1)%Re(1)": 1e5,
"fluid_pp(1)%Re(1)": 1e5,
"fluid_pp(2)%gamma": 1.0e00 / (1.4e00 - 1.0e00),
"fluid_pp(2)%pi_inf": 0.0e00,
# "fluid_pp(2)%Re(1)": 1e5,
"fluid_pp(2)%Re(1)": 1e5,
# Ambient pressure
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%x_centroid": 0,
Expand All @@ -92,17 +93,17 @@
"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.2,
"patch_icpp(2)%smooth_coeff": 0.1,
"patch_icpp(2)%geometry": 2,
"patch_icpp(2)%x_centroid": 0,
"patch_icpp(2)%y_centroid": 0,
"patch_icpp(2)%radius": r0,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%vel(2)": 0.0,
"patch_icpp(2)%pres": 1.1,
"patch_icpp(2)%pres": 9.518,
"patch_icpp(2)%alpha_rho(1)": eps,
"patch_icpp(2)%alpha(1)": eps,
"patch_icpp(2)%alpha_rho(2)": (1 - eps)*1.1,
"patch_icpp(2)%alpha_rho(2)": (1 - eps)*5,
"patch_icpp(2)%alpha(2)": 1 - eps,
}

Expand Down
68 changes: 45 additions & 23 deletions examples/2D_igr_advection/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
Nx = 200
Ny = Nx

mydt = 5e-4
eps = 1e-6

mydt = 1e-6

# Configuration case dictionary
data = {
Expand All @@ -34,21 +36,21 @@
"n": Ny,
"p": 0,
"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": 250,
# "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": 2000,
"t_step_save": 5,
# Simulation Algorithm
"model_eqns": 2,
"alt_soundspeed": "F",
"mixture_err": "T",
"mpp_lim": "F",
"time_stepper": 3,
"time_stepper": 1,
"weno_order": 5,
"avg_state": 2,
"weno_eps": 1e-16,
Expand All @@ -58,13 +60,14 @@
"weno_Re_flux": "F",
"riemann_solver": 2,
"wave_speeds": 1,
"bc_x%beg": -1,
"bc_x%end": -1,
"bc_y%beg": -1,
"bc_y%end": -1,
"num_patches": 1,
"bc_x%beg": -3,
"bc_x%end": -3,
"bc_y%beg": -3,
"bc_y%end": -3,
"num_patches": 2,
"num_fluids": 2,
"igr": "T",
"alf_factor": 10,
# Database Structure Parameters
"format": 1,
"precision": 2,
Expand All @@ -75,8 +78,9 @@
"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,
"viscous": "T",
"fluid_pp(1)%Re(1)": 1e5,
"fluid_pp(2)%Re(1)": 1e5,
# Ambient pressure
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%x_centroid": 0,
Expand All @@ -88,11 +92,29 @@
"patch_icpp(1)%vel(1)": 100.0,
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%vel(3)": 0.0,
"patch_icpp(1)%pres": 1,
"patch_icpp(1)%alpha_rho(1)": "exp(-(x**2 + y**2) / (2* 0.2**2))",
"patch_icpp(1)%alpha(1)": "exp(-(x**2 + y**2) / (2* 0.2**2))",
"patch_icpp(1)%alpha_rho(2)": "1 - exp(-(x**2 + y**2) / (2* 0.2**2))",
"patch_icpp(1)%alpha(2)": "1 - exp(-(x**2 + y**2) / (2* 0.2**2))",
"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": 2,
"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)%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(3)": 0.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,

}

Expand Down
4 changes: 2 additions & 2 deletions examples/3D_igr/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
z0 = -l
z1 = l

Nx = 400
Nx = 200
Ny = Nx
Nz = Nx

mydt = 2.5e-4
mydt = 5e-4

# Configuration case dictionary
data = {
Expand Down
121 changes: 121 additions & 0 deletions examples/3D_igr_2fluid/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/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
eps = 1e-6

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

Nx = 200
Ny = Nx
Nz = Nx

dt = 1e-4

# 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",
"dt": dt,
"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": "T",
"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,
"viscous": "T",
# 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(1)%Re(1)": 1e5,
"fluid_pp(2)%gamma": 1.0e00 / (1.4e00 - 1.0e00),
"fluid_pp(2)%pi_inf": 0.0e00,
"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)": 0.0,
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%vel(3)": 0.0,
"patch_icpp(1)%pres": 1,
"patch_icpp(1)%alpha_rho(1)": 1 - eps,
"patch_icpp(1)%alpha(1)": 1 - eps,
"patch_icpp(1)%alpha_rho(2)": eps,
"patch_icpp(1)%alpha(2)": eps,
# High pressure
"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)%geometry": 8,
"patch_icpp(2)%x_centroid": 0,
"patch_icpp(2)%y_centroid": 0,
"patch_icpp(2)%z_centroid": 0,
"patch_icpp(2)%radius": r0,
"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)%alpha_rho(1)": eps,
"patch_icpp(2)%alpha(1)": eps,
"patch_icpp(2)%alpha_rho(2)": (1 - eps)*5,
"patch_icpp(2)%alpha(2)": 1 - eps,
}

print(json.dumps(data))
4 changes: 2 additions & 2 deletions src/common/m_constants.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module m_constants
integer, parameter :: num_patches_max = 10
integer, parameter :: pathlen_max = 400
integer, parameter :: nnode = 4 !< Number of QBMM nodes
integer, parameter :: num_igr_iters = 1
real(wp), parameter :: alf_factor = 10._wp
integer, parameter :: num_igr_iters = 2
real(wp), parameter :: dflt_alf_factor = 10._wp
integer, parameter :: gp_layers = 3 !< Number of ghost point layers for IBM
real(wp), parameter :: capillary_cutoff = 1e-6 !< color function gradient magnitude at which to apply the surface tension fluxes
real(wp), parameter :: acoustic_spatial_support_width = 2.5_wp !< Spatial support width of acoustic source, used in s_source_spatial
Expand Down
Loading

0 comments on commit 5fd73cf

Please sign in to comment.