Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Surface Tension #387

Merged
merged 63 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
a1a1410
add surface tension
wilfonba Apr 6, 2024
cab30bc
Merge remote-tracking branch 'upstream' into Surface-Tension
wilfonba Apr 6, 2024
8da4519
bug fixes
wilfonba Apr 6, 2024
a5b9227
builds on frontier + tool chain additions
Apr 6, 2024
e0249ed
working on CPUs + added example case
wilfonba Apr 6, 2024
a46be2f
documentation
wilfonba Apr 6, 2024
23285bc
refactor capilary BCs
Apr 8, 2024
927a3e0
remove erroneous files
wilfonba Apr 8, 2024
c7d6458
fix 3D and add post process checks
Apr 8, 2024
f2e7d22
Merge branch 'Surface-Tension' of github.com:wilfonba/MFC-Wilfong int…
Apr 8, 2024
5a8debb
patch smoothing for squares
Apr 11, 2024
91acd10
add cuboid smoothing
Apr 11, 2024
e1fb1e6
Revert "add cuboid smoothing"
wilfonba Apr 11, 2024
2c1e00c
Merge remote-tracking branch 'upstream/master' into Surface-Tension
wilfonba Apr 11, 2024
e08262f
small fix
Apr 11, 2024
82eb9f3
remove extra inline file
Apr 11, 2024
1074a20
fix riemann bug
Apr 13, 2024
728b581
Merge remote-tracking branch 'upstream/master' into Surface-Tension
wilfonba May 3, 2024
f707c0a
unbreak IBM
wilfonba May 5, 2024
f20a1ba
fix --no-mpi runs
May 5, 2024
a9f3dab
add missing comma
wilfonba May 5, 2024
3991906
add regression tests and update checks for surface tension
wilfonba May 5, 2024
d0e53a6
small refactor
May 5, 2024
2d0b4c4
update tests and debug small refactor
wilfonba May 5, 2024
342ac57
Merge branch 'MFlowCode:master' into Surface-Tension
wilfonba May 6, 2024
4eb0ef4
refactor reconstructions
May 6, 2024
8d38601
refactor reconstructions
May 6, 2024
ea7d5a9
format
May 6, 2024
60d0488
bug fix
May 7, 2024
e065f19
fixes for Frotnier
May 10, 2024
e960edd
remove workloads
May 10, 2024
4b059ef
actually remove all workloads
May 10, 2024
a6afd74
update profiler append so it works on Frontier
May 16, 2024
af2e7a9
Merge remote-tracking branch 'upstream/master' into Surface-Tension
wilfonba May 16, 2024
15115f1
refact MPI and fix test cases
wilfonba May 16, 2024
3741377
format
May 16, 2024
f454d6a
fix templates and add example file
wilfonba May 16, 2024
2ab0582
fix counter maybe?
wilfonba May 16, 2024
2980b8f
revert template changes
wilfonba May 16, 2024
39ac154
update examples
wilfonba May 16, 2024
deb1f04
Properply revert template changes
wilfonba May 16, 2024
9f1d7cc
revert count changes
wilfonba May 17, 2024
d95d0a7
Merge remote-tracking branch 'upstream/master' into Surface-Tension
wilfonba May 20, 2024
fc80160
Merge branch 'master' into Surface-Tension
wilfonba May 20, 2024
bfae861
Merge remote-tracking branch 'upstream/master' into Surface-Tension
wilfonba May 23, 2024
468c7a9
fix performance regression
May 23, 2024
87a3e00
fix 1st order reconstruction
May 24, 2024
f023994
Merge remote-tracking branch 'upstream/master' into Surface-Tension
wilfonba May 24, 2024
15cd735
Merge branch 'Surface-Tension' of github.com:wilfonba/MFC-Wilfong int…
wilfonba May 24, 2024
d8ffc61
format
May 24, 2024
ac39b72
Merge branch 'Surface-Tension' of github.com:wilfonba/MFC-Wilfong int…
May 24, 2024
745d4f8
revert unintentional changes to template files
May 24, 2024
d359ca3
remove extra file
May 24, 2024
34e51eb
fix frontier
May 25, 2024
c604fe9
Merge remote-tracking branch 'upstream/master' into Surface-Tension
wilfonba May 25, 2024
2efe8b7
fix macos debug build
wilfonba May 28, 2024
0092aeb
Fix ./mfc.sh count_diff
henryleberre May 29, 2024
40ac083
Revert examples/3D_weak_scaling/ changes
henryleberre May 29, 2024
e5da900
fix test suite on Phoenix
May 29, 2024
73e7515
format
May 29, 2024
c1e7496
fix frontier ci?
May 30, 2024
49ae739
Merge remote-tracking branch 'upstream/master' into Surface-Tension
wilfonba May 30, 2024
d28dfd9
format
wilfonba May 30, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ examples/*/*.err
examples/*/viz/
examples/*.jpg
examples/*.png
examples/*/workloads/
workloads/

benchmarks/*batch/*/
benchmarks/*/D/*
Expand Down
3 changes: 2 additions & 1 deletion docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,9 @@ Additional details on this specification can be found in [The Naca Airfoil Serie
| `cv` ** | Real | Sffened-gas parameter $c_v$ of fluid. |
| `qv` ** | Real | Stiffened-gas parameter $q$ of fluid. |
| `qvp` ** | Real | Stiffened-gas parameter $q'$ of fluid. |
| `sigma` | Real | Surface tension coefficient |

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

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

Expand Down
144 changes: 144 additions & 0 deletions examples/2D_laplace_pressure_jump/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#!/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 = 0.375

# Numerical setup
r0 = 0.15
x0 = 0
x1 = l
y0 = 0
y1 = l

Nx = 49
Ny = 49

eps = 1e-9

mydt = 5e-6

#Configuration case dictionary
data = {
# Logistics =============================
#'case_dir' : '\'.\'',
'run_time_info' : 'T',
# =======================================

# Computational Domain ==================
'x_domain%beg' : x0,
'x_domain%end' : x1,
'y_domain%beg' : y0,
'y_domain%end' : y1,
'm' : Nx,
'n' : Ny,
'p' : 0,
'cyl_coord' : 'F',
'dt' : mydt,
't_step_start' : 0,
't_step_stop' : 100000,
't_step_save' : 1000,
#'t_step_stop' : 100,
#'t_step_save' : 100,
# =======================================

# Simulation Algorithm ==================
'model_eqns' : 3,
'alt_soundspeed' : 'F',
'adv_alphan' : 'T',
'mixture_err' : 'T',
'mpp_lim' : 'F',
'time_stepper' : 3,
#'recon_type' : 1,
#'muscl_order' : 2,
#'muscl_lim' : 2,
'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' : -2,
'bc_x%end' : -3,
'bc_y%beg' : -2,
'bc_y%end' : -3,
'num_patches' : 2,
'num_fluids' : 2,
'weno_avg' : 'T',
# =======================================

# Database Structure Parameters =========
'format' : 1,
'precision' : 2,
'prim_vars_wrt' : 'T',
'cons_vars_wrt' : 'T',
'cf_wrt' : 'T',
'parallel_io' : 'T',
# =======================================

'sigma' : 8,
#'flux_lim' : 2,
#'flux_wrt(1)' : 'T',
#'flux_wrt(2)' : 'T',
#'cf_grad_wrt' : 'T',

# Fluid Parameters (Water) ==============
'fluid_pp(1)%gamma' : 1.E+00/(2.1E+00-1.E+00),
'fluid_pp(1)%pi_inf' : 2.1E+00*1.E+06/(2.1E+00-1.E+00),
#'fluid_pp(1)%Re(1)' : 1.e3,
# =======================================

# Fluid Parameters (Gas) ================
'fluid_pp(2)%gamma' : 1.E+00/(1.4E+00-1.E+00),
'fluid_pp(2)%pi_inf' : 0.E+00,
#'fluid_pp(2)%Re(1)' : 1.81e5,
# =======================================

# Air Patch ==========================
'patch_icpp(1)%geometry' : 3,
'patch_icpp(1)%x_centroid' : 0,
'patch_icpp(1)%y_centroid' : 0,
'patch_icpp(1)%length_x' : 2,
'patch_icpp(1)%length_y' : 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' : 100000,
'patch_icpp(1)%alpha_rho(1)': eps*1000,
'patch_icpp(1)%alpha_rho(2)': (1-eps)*1,
'patch_icpp(1)%alpha(1)' : eps,
'patch_icpp(1)%alpha(2)' : 1-eps,
'patch_icpp(1)%cf_val' : 0,
# ======================================

# Water Patch ========================
'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.95,
'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.,
'patch_icpp(2)%vel(2)' : 0.,
'patch_icpp(2)%pres' : 100000,
'patch_icpp(2)%alpha_rho(1)': (1-eps)*1000,
'patch_icpp(2)%alpha_rho(2)': eps*1,
'patch_icpp(2)%alpha(1)' : (1-eps),
'patch_icpp(2)%alpha(2)' : eps,
'patch_icpp(2)%cf_val' : 1,
# ======================================

}

print(json.dumps(data))
146 changes: 146 additions & 0 deletions examples/3D_recovering_sphere/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#!/usr/bin/env python3

# This simulation shows the early stages of a cubic droplet recovering a spherical shape due to capillary
# forces. While the relaxation is not complete, it demonstrates the expecteed symmetric behavior.

import math
import json

l = 0.375

# Numerical setup
r0 = 0.15
x0 = 0
x1 = l
y0 = 0
y1 = l
z0 = 0
z1 = l


Nx = 199
Ny = 199
Nz = 199

eps = 1e-9

mydt = 1e-6

#Configuration case dictionary
data = {
# Logistics =============================
#'case_dir' : '\'.\'',
'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' : mydt,
't_step_start' : 400000,
't_step_stop' : 1000000,
't_step_save' : 2000,
#'t_step_stop' : 100,
#'t_step_save' : 100,
# =======================================

# Simulation Algorithm ==================
'model_eqns' : 3,
'alt_soundspeed' : 'F',
'adv_alphan' : 'T',
'mixture_err' : 'T',
'mpp_lim' : 'F',
'time_stepper' : 3,
'weno_order' : 3,
'avg_state' : 2,
'weno_eps' : 1e-16,
'mapped_weno' : 'T',
'null_weights' : 'F',
'mp_weno' : 'F',
'weno_Re_flux' : 'F',
'riemann_solver' : 2,
'wave_speeds' : 1,
'bc_x%beg' : -2,
'bc_x%end' : -3,
'bc_y%beg' : -2,
'bc_y%end' : -3,
'bc_z%beg' : -2,
'bc_z%end' : -3,
'num_patches' : 2,
'num_fluids' : 2,
'weno_avg' : 'T',
# =======================================

# Database Structure Parameters =========
'format' : 1,
'precision' : 2,
'alpha_wrt(1)' : 'T',
# 'prim_vars_wrt' : 'T',
'cf_wrt' : 'T',
'parallel_io' : 'T',
# =======================================

'sigma' : 8.0,

# Fluid Parameters (Water) ==============
'fluid_pp(1)%gamma' : 1.E+00/(2.1E+00-1.E+00),
'fluid_pp(1)%pi_inf' : 2.1E+00*1.E+06/(2.1E+00-1.E+00),
#'fluid_pp(1)%Re(1)' : 1.e3,
# =======================================

# Fluid Parameters (Gas) ================
'fluid_pp(2)%gamma' : 1.E+00/(1.4E+00-1.E+00),
'fluid_pp(2)%pi_inf' : 0.E+00,
#'fluid_pp(2)%Re(1)' : 1.81e5,
# =======================================

# Air Patch ==========================
'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' : 100000,
'patch_icpp(1)%alpha_rho(1)': eps*1000,
'patch_icpp(1)%alpha_rho(2)': (1-eps)*1,
'patch_icpp(1)%alpha(1)' : eps,
'patch_icpp(1)%alpha(2)' : 1-eps,
'patch_icpp(1)%cf_val' : 0,
# ======================================

# Water Patch ========================
'patch_icpp(2)%alter_patch(1)' : 'T',
'patch_icpp(2)%geometry' : 9,
'patch_icpp(2)%x_centroid' : 0,
'patch_icpp(2)%y_centroid' : 0,
'patch_icpp(2)%z_centroid' : 0,
'patch_icpp(2)%length_x' : r0,
'patch_icpp(2)%length_y' : r0,
'patch_icpp(2)%length_z' : r0,
'patch_icpp(2)%vel(1)' : 0.,
'patch_icpp(2)%vel(2)' : 0.,
'patch_icpp(2)%vel(3)' : 0.,
'patch_icpp(2)%pres' : 100000,
'patch_icpp(2)%alpha_rho(1)': (1-eps)*1000,
'patch_icpp(2)%alpha_rho(2)': eps*1,
'patch_icpp(2)%alpha(1)' : (1-eps),
'patch_icpp(2)%alpha(2)' : eps,
'patch_icpp(2)%cf_val' : 1,
# ======================================

}

print(json.dumps(data))
1 change: 1 addition & 0 deletions src/common/m_constants.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ module m_constants
integer, parameter :: num_patches_max = 10
integer, parameter :: pathlen_max = 400
integer, parameter :: nnode = 4 !< Number of QBMM nodes
real(kind(0d0)), parameter :: capillary_cutoff = 1e-6 !< color function gradient magnitude at which to apply the surface tension fluxes

end module m_constants
2 changes: 2 additions & 0 deletions src/common/m_derived_types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ module m_derived_types
integer :: hcid
!! id for hard coded initial condition

real(kind(0d0)) :: cf_val !! color function value

end type ic_patch_parameters

type ib_patch_parameters
Expand Down
9 changes: 9 additions & 0 deletions src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,10 @@ contains
qK_prim_vf(i)%sf(j, k, l) = qK_cons_vf(i)%sf(j, k, l)
end do

if (sigma /= dflt_real) then
qK_prim_vf(c_idx)%sf(j, k, l) = qK_cons_vf(c_idx)%sf(j, k, l)
end if

end do
end do
end do
Expand Down Expand Up @@ -1163,6 +1167,11 @@ contains
end if
end do
end if

if (sigma /= dflt_real) then
q_cons_vf(c_idx)%sf(j, k, l) = q_prim_vf(c_idx)%sf(j, k, l)
end if

end do
end do
end do
Expand Down
12 changes: 12 additions & 0 deletions src/post_process/m_checker.f90
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,18 @@ subroutine s_check_inputs()
end if
end if

! Constraints on the surface tension model
if (sigma /= dflt_real .and. sigma < 0d0) then
call s_mpi_abort('The surface tension coefficient must be'// &
'greater than or equal to zero. Exiting ...')
elseif (sigma /= dflt_real .and. model_eqns /= 3) then
call s_mpi_abort("The surface tension model requires"// &
'model_eqns=3. Exiting ...')
elseif (sigma == dflt_real .and. cf_wrt) then
call s_mpi_abort('cf_wrt can only be anabled if the surface'// &
'coefficient is set')
end if

end subroutine s_check_inputs

end module m_checker
Loading
Loading