Skip to content

Commit 5b818eb

Browse files
wilfonbaBenjamin Wilfonghenryleberre
authored
Add Surface Tension (#387)
Co-authored-by: wilfonba <bwilfong3@gatech.edu> Co-authored-by: Benjamin Wilfong <bwilfong@dt-login01.delta.ncsa.illinois.edu> Co-authored-by: Henry LE BERRE <hberre3@gatech.edu>
1 parent 33984ea commit 5b818eb

35 files changed

+2280
-334
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ examples/*/*.err
5252
examples/*/viz/
5353
examples/*.jpg
5454
examples/*.png
55+
examples/*/workloads/
56+
workloads/
5557

5658
benchmarks/*batch/*/
5759
benchmarks/*/D/*

docs/documentation/case.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,9 @@ Additional details on this specification can be found in [The Naca Airfoil Serie
321321
| `cv` ** | Real | Sffened-gas parameter $c_v$ of fluid. |
322322
| `qv` ** | Real | Stiffened-gas parameter $q$ of fluid. |
323323
| `qvp` ** | Real | Stiffened-gas parameter $q'$ of fluid. |
324+
| `sigma` | Real | Surface tension coefficient |
324325

325-
Fluid material's parameters. All parameters should be prepended with `fluid_pp(i)` where $i$ is the fluid index.
326+
Fluid material's parameters. All parameters except for sigma should be prepended with `fluid_pp(i)` where $i$ is the fluid index.
326327

327328
*: Parameters that work only with `model_eqns`=2.
328329

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
#!/usr/bin/env python3
2+
3+
# This case file demonstrates the Laplace pressure jump of a water droplet in air. The laplace pressure jump
4+
# in 2D is given by delta = sigma / r where delta is the pressure jump, sigma is the surface tension coefficient,
5+
# and r is the radius of the droplet. The results of this simulation agree with theory to well within 1%
6+
# relative error.
7+
8+
import math
9+
import json
10+
11+
l = 0.375
12+
13+
# Numerical setup
14+
r0 = 0.15
15+
x0 = 0
16+
x1 = l
17+
y0 = 0
18+
y1 = l
19+
20+
Nx = 49
21+
Ny = 49
22+
23+
eps = 1e-9
24+
25+
mydt = 5e-6
26+
27+
#Configuration case dictionary
28+
data = {
29+
# Logistics =============================
30+
#'case_dir' : '\'.\'',
31+
'run_time_info' : 'T',
32+
# =======================================
33+
34+
# Computational Domain ==================
35+
'x_domain%beg' : x0,
36+
'x_domain%end' : x1,
37+
'y_domain%beg' : y0,
38+
'y_domain%end' : y1,
39+
'm' : Nx,
40+
'n' : Ny,
41+
'p' : 0,
42+
'cyl_coord' : 'F',
43+
'dt' : mydt,
44+
't_step_start' : 0,
45+
't_step_stop' : 100000,
46+
't_step_save' : 1000,
47+
#'t_step_stop' : 100,
48+
#'t_step_save' : 100,
49+
# =======================================
50+
51+
# Simulation Algorithm ==================
52+
'model_eqns' : 3,
53+
'alt_soundspeed' : 'F',
54+
'adv_alphan' : 'T',
55+
'mixture_err' : 'T',
56+
'mpp_lim' : 'F',
57+
'time_stepper' : 3,
58+
#'recon_type' : 1,
59+
#'muscl_order' : 2,
60+
#'muscl_lim' : 2,
61+
'weno_order' : 5,
62+
'avg_state' : 2,
63+
'weno_eps' : 1e-16,
64+
'mapped_weno' : 'T',
65+
'null_weights' : 'F',
66+
'mp_weno' : 'T',
67+
'weno_Re_flux' : 'F',
68+
'riemann_solver' : 2,
69+
'wave_speeds' : 1,
70+
'bc_x%beg' : -2,
71+
'bc_x%end' : -3,
72+
'bc_y%beg' : -2,
73+
'bc_y%end' : -3,
74+
'num_patches' : 2,
75+
'num_fluids' : 2,
76+
'weno_avg' : 'T',
77+
# =======================================
78+
79+
# Database Structure Parameters =========
80+
'format' : 1,
81+
'precision' : 2,
82+
'prim_vars_wrt' : 'T',
83+
'cons_vars_wrt' : 'T',
84+
'cf_wrt' : 'T',
85+
'parallel_io' : 'T',
86+
# =======================================
87+
88+
'sigma' : 8,
89+
#'flux_lim' : 2,
90+
#'flux_wrt(1)' : 'T',
91+
#'flux_wrt(2)' : 'T',
92+
#'cf_grad_wrt' : 'T',
93+
94+
# Fluid Parameters (Water) ==============
95+
'fluid_pp(1)%gamma' : 1.E+00/(2.1E+00-1.E+00),
96+
'fluid_pp(1)%pi_inf' : 2.1E+00*1.E+06/(2.1E+00-1.E+00),
97+
#'fluid_pp(1)%Re(1)' : 1.e3,
98+
# =======================================
99+
100+
# Fluid Parameters (Gas) ================
101+
'fluid_pp(2)%gamma' : 1.E+00/(1.4E+00-1.E+00),
102+
'fluid_pp(2)%pi_inf' : 0.E+00,
103+
#'fluid_pp(2)%Re(1)' : 1.81e5,
104+
# =======================================
105+
106+
# Air Patch ==========================
107+
'patch_icpp(1)%geometry' : 3,
108+
'patch_icpp(1)%x_centroid' : 0,
109+
'patch_icpp(1)%y_centroid' : 0,
110+
'patch_icpp(1)%length_x' : 2,
111+
'patch_icpp(1)%length_y' : 2,
112+
'patch_icpp(1)%vel(1)' : 0.0,
113+
'patch_icpp(1)%vel(2)' : 0.0,
114+
'patch_icpp(1)%vel(3)' : 0.0,
115+
'patch_icpp(1)%pres' : 100000,
116+
'patch_icpp(1)%alpha_rho(1)': eps*1000,
117+
'patch_icpp(1)%alpha_rho(2)': (1-eps)*1,
118+
'patch_icpp(1)%alpha(1)' : eps,
119+
'patch_icpp(1)%alpha(2)' : 1-eps,
120+
'patch_icpp(1)%cf_val' : 0,
121+
# ======================================
122+
123+
# Water Patch ========================
124+
'patch_icpp(2)%alter_patch(1)' : 'T',
125+
'patch_icpp(2)%smoothen' : 'T',
126+
'patch_icpp(2)%smooth_patch_id': 1,
127+
'patch_icpp(2)%smooth_coeff': 0.95,
128+
'patch_icpp(2)%geometry' : 2,
129+
'patch_icpp(2)%x_centroid' : 0,
130+
'patch_icpp(2)%y_centroid' : 0,
131+
'patch_icpp(2)%radius' : r0,
132+
'patch_icpp(2)%vel(1)' : 0.,
133+
'patch_icpp(2)%vel(2)' : 0.,
134+
'patch_icpp(2)%pres' : 100000,
135+
'patch_icpp(2)%alpha_rho(1)': (1-eps)*1000,
136+
'patch_icpp(2)%alpha_rho(2)': eps*1,
137+
'patch_icpp(2)%alpha(1)' : (1-eps),
138+
'patch_icpp(2)%alpha(2)' : eps,
139+
'patch_icpp(2)%cf_val' : 1,
140+
# ======================================
141+
142+
}
143+
144+
print(json.dumps(data))

examples/3D_recovering_sphere/case.py

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#!/usr/bin/env python3
2+
3+
# This simulation shows the early stages of a cubic droplet recovering a spherical shape due to capillary
4+
# forces. While the relaxation is not complete, it demonstrates the expecteed symmetric behavior.
5+
6+
import math
7+
import json
8+
9+
l = 0.375
10+
11+
# Numerical setup
12+
r0 = 0.15
13+
x0 = 0
14+
x1 = l
15+
y0 = 0
16+
y1 = l
17+
z0 = 0
18+
z1 = l
19+
20+
21+
Nx = 199
22+
Ny = 199
23+
Nz = 199
24+
25+
eps = 1e-9
26+
27+
mydt = 1e-6
28+
29+
#Configuration case dictionary
30+
data = {
31+
# Logistics =============================
32+
#'case_dir' : '\'.\'',
33+
'run_time_info' : 'T',
34+
# =======================================
35+
36+
# Computational Domain ==================
37+
'x_domain%beg' : x0,
38+
'x_domain%end' : x1,
39+
'y_domain%beg' : y0,
40+
'y_domain%end' : y1,
41+
'z_domain%beg' : z0,
42+
'z_domain%end' : z1,
43+
'm' : Nx,
44+
'n' : Ny,
45+
'p' : Nz,
46+
'cyl_coord' : 'F',
47+
'dt' : mydt,
48+
't_step_start' : 400000,
49+
't_step_stop' : 1000000,
50+
't_step_save' : 2000,
51+
#'t_step_stop' : 100,
52+
#'t_step_save' : 100,
53+
# =======================================
54+
55+
# Simulation Algorithm ==================
56+
'model_eqns' : 3,
57+
'alt_soundspeed' : 'F',
58+
'adv_alphan' : 'T',
59+
'mixture_err' : 'T',
60+
'mpp_lim' : 'F',
61+
'time_stepper' : 3,
62+
'weno_order' : 3,
63+
'avg_state' : 2,
64+
'weno_eps' : 1e-16,
65+
'mapped_weno' : 'T',
66+
'null_weights' : 'F',
67+
'mp_weno' : 'F',
68+
'weno_Re_flux' : 'F',
69+
'riemann_solver' : 2,
70+
'wave_speeds' : 1,
71+
'bc_x%beg' : -2,
72+
'bc_x%end' : -3,
73+
'bc_y%beg' : -2,
74+
'bc_y%end' : -3,
75+
'bc_z%beg' : -2,
76+
'bc_z%end' : -3,
77+
'num_patches' : 2,
78+
'num_fluids' : 2,
79+
'weno_avg' : 'T',
80+
# =======================================
81+
82+
# Database Structure Parameters =========
83+
'format' : 1,
84+
'precision' : 2,
85+
'alpha_wrt(1)' : 'T',
86+
# 'prim_vars_wrt' : 'T',
87+
'cf_wrt' : 'T',
88+
'parallel_io' : 'T',
89+
# =======================================
90+
91+
'sigma' : 8.0,
92+
93+
# Fluid Parameters (Water) ==============
94+
'fluid_pp(1)%gamma' : 1.E+00/(2.1E+00-1.E+00),
95+
'fluid_pp(1)%pi_inf' : 2.1E+00*1.E+06/(2.1E+00-1.E+00),
96+
#'fluid_pp(1)%Re(1)' : 1.e3,
97+
# =======================================
98+
99+
# Fluid Parameters (Gas) ================
100+
'fluid_pp(2)%gamma' : 1.E+00/(1.4E+00-1.E+00),
101+
'fluid_pp(2)%pi_inf' : 0.E+00,
102+
#'fluid_pp(2)%Re(1)' : 1.81e5,
103+
# =======================================
104+
105+
# Air Patch ==========================
106+
'patch_icpp(1)%geometry' : 9,
107+
'patch_icpp(1)%x_centroid' : 0,
108+
'patch_icpp(1)%y_centroid' : 0,
109+
'patch_icpp(1)%z_centroid' : 0,
110+
'patch_icpp(1)%length_x' : 2,
111+
'patch_icpp(1)%length_y' : 2,
112+
'patch_icpp(1)%length_z' : 2,
113+
'patch_icpp(1)%vel(1)' : 0.0,
114+
'patch_icpp(1)%vel(2)' : 0.0,
115+
'patch_icpp(1)%vel(3)' : 0.0,
116+
'patch_icpp(1)%pres' : 100000,
117+
'patch_icpp(1)%alpha_rho(1)': eps*1000,
118+
'patch_icpp(1)%alpha_rho(2)': (1-eps)*1,
119+
'patch_icpp(1)%alpha(1)' : eps,
120+
'patch_icpp(1)%alpha(2)' : 1-eps,
121+
'patch_icpp(1)%cf_val' : 0,
122+
# ======================================
123+
124+
# Water Patch ========================
125+
'patch_icpp(2)%alter_patch(1)' : 'T',
126+
'patch_icpp(2)%geometry' : 9,
127+
'patch_icpp(2)%x_centroid' : 0,
128+
'patch_icpp(2)%y_centroid' : 0,
129+
'patch_icpp(2)%z_centroid' : 0,
130+
'patch_icpp(2)%length_x' : r0,
131+
'patch_icpp(2)%length_y' : r0,
132+
'patch_icpp(2)%length_z' : r0,
133+
'patch_icpp(2)%vel(1)' : 0.,
134+
'patch_icpp(2)%vel(2)' : 0.,
135+
'patch_icpp(2)%vel(3)' : 0.,
136+
'patch_icpp(2)%pres' : 100000,
137+
'patch_icpp(2)%alpha_rho(1)': (1-eps)*1000,
138+
'patch_icpp(2)%alpha_rho(2)': eps*1,
139+
'patch_icpp(2)%alpha(1)' : (1-eps),
140+
'patch_icpp(2)%alpha(2)' : eps,
141+
'patch_icpp(2)%cf_val' : 1,
142+
# ======================================
143+
144+
}
145+
146+
print(json.dumps(data))

src/common/m_constants.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ module m_constants
2222
integer, parameter :: num_patches_max = 10
2323
integer, parameter :: pathlen_max = 400
2424
integer, parameter :: nnode = 4 !< Number of QBMM nodes
25+
real(kind(0d0)), parameter :: capillary_cutoff = 1e-6 !< color function gradient magnitude at which to apply the surface tension fluxes
2526

2627
end module m_constants

src/common/m_derived_types.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ module m_derived_types
191191
integer :: hcid
192192
!! id for hard coded initial condition
193193

194+
real(kind(0d0)) :: cf_val !! color function value
195+
194196
end type ic_patch_parameters
195197

196198
type ib_patch_parameters

src/common/m_variables_conversion.fpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,10 @@ contains
10141014
qK_prim_vf(i)%sf(j, k, l) = qK_cons_vf(i)%sf(j, k, l)
10151015
end do
10161016

1017+
if (sigma /= dflt_real) then
1018+
qK_prim_vf(c_idx)%sf(j, k, l) = qK_cons_vf(c_idx)%sf(j, k, l)
1019+
end if
1020+
10171021
end do
10181022
end do
10191023
end do
@@ -1163,6 +1167,11 @@ contains
11631167
end if
11641168
end do
11651169
end if
1170+
1171+
if (sigma /= dflt_real) then
1172+
q_cons_vf(c_idx)%sf(j, k, l) = q_prim_vf(c_idx)%sf(j, k, l)
1173+
end if
1174+
11661175
end do
11671176
end do
11681177
end do

src/post_process/m_checker.f90

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,18 @@ subroutine s_check_inputs()
473473
end if
474474
end if
475475

476+
! Constraints on the surface tension model
477+
if (sigma /= dflt_real .and. sigma < 0d0) then
478+
call s_mpi_abort('The surface tension coefficient must be'// &
479+
'greater than or equal to zero. Exiting ...')
480+
elseif (sigma /= dflt_real .and. model_eqns /= 3) then
481+
call s_mpi_abort("The surface tension model requires"// &
482+
'model_eqns=3. Exiting ...')
483+
elseif (sigma == dflt_real .and. cf_wrt) then
484+
call s_mpi_abort('cf_wrt can only be anabled if the surface'// &
485+
'coefficient is set')
486+
end if
487+
476488
end subroutine s_check_inputs
477489

478490
end module m_checker

0 commit comments

Comments
 (0)