Skip to content

Commit 58026df

Browse files
wjhornewhorne
andauthored
VOF BC changes to address sticking fluid (#1354)
* New VOF BC * Formatting --------- Co-authored-by: whorne <whorne@sandia.gov>
1 parent a530903 commit 58026df

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

src/LowMachEquationSystem.C

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,14 +1958,6 @@ MomentumEquationSystem::register_wall_bc(
19581958
stk::mesh::put_field_on_mesh(
19591959
*wallNormalDistanceBip, *part, numScsBip, nullptr);
19601960

1961-
if (realm_.solutionOptions_->use_balanced_buoyancy_force_) {
1962-
if (!buoyancySrcMask_) {
1963-
buoyancySrcMask_.reset(new NodalBuoyancyFuncUtil(realm_, part));
1964-
} else {
1965-
buoyancySrcMask_->partVec_.push_back(part);
1966-
}
1967-
}
1968-
19691961
// need wall friction velocity for TKE boundary condition
19701962
if (RANSAblBcApproach_) {
19711963
const AlgorithmType wfAlgType = WALL_FCN;
@@ -2105,6 +2097,14 @@ MomentumEquationSystem::register_wall_bc(
21052097
}
21062098
}
21072099

2100+
if (realm_.solutionOptions_->use_balanced_buoyancy_force_) {
2101+
if (!buoyancySrcMask_) {
2102+
buoyancySrcMask_.reset(new NodalBuoyancyFuncUtil(realm_, part));
2103+
} else {
2104+
buoyancySrcMask_->partVec_.push_back(part);
2105+
}
2106+
}
2107+
21082108
// Dirichlet wall boundary condition.
21092109
if (!anyWallFunctionActivated || userData.isNoSlip_) {
21102110
const AlgorithmType algType = WALL;

src/edge_kernels/VOFAdvectionEdgeAlg.C

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ VOFAdvectionEdgeAlg::execute()
118118
const auto velocity_rtm = fieldMgr.get_field<double>(
119119
get_field_ordinal(realm_.meta_data(), velocity_rtm_name));
120120

121+
const bool using_balanced_force =
122+
realm_.solutionOptions_->use_balanced_buoyancy_force_;
123+
const std::string wall_mask_name =
124+
using_balanced_force ? "buoyancy_source_mask" : "density";
125+
const auto wall_mask = fieldMgr.get_field<double>(
126+
get_field_ordinal(realm_.meta_data(), wall_mask_name));
127+
121128
run_algorithm(
122129
realm_.bulk_data(),
123130
KOKKOS_LAMBDA(
@@ -192,7 +199,6 @@ VOFAdvectionEdgeAlg::execute()
192199
smdata.lhs(0, 1) += alhsfac;
193200

194201
// Compression term
195-
196202
DblType dOmegadxMag = 0.0;
197203
DblType interface_gradient[3] = {0.0, 0.0, 0.0};
198204

@@ -207,9 +213,15 @@ VOFAdvectionEdgeAlg::execute()
207213

208214
dOmegadxMag = stk::math::sqrt(dOmegadxMag);
209215

216+
const DblType left_mask =
217+
using_balanced_force ? wall_mask.get(nodeL, 0) : 1.0;
218+
const DblType right_mask =
219+
using_balanced_force ? wall_mask.get(nodeR, 0) : 1.0;
220+
210221
// No gradient == no interface
211-
if (dOmegadxMag < gradient_eps)
222+
if (dOmegadxMag < gradient_eps) {
212223
return;
224+
}
213225

214226
for (int d = 0; d < ndim; ++d)
215227
interface_normal[d] = interface_gradient[d] / dOmegadxMag;
@@ -236,25 +248,28 @@ VOFAdvectionEdgeAlg::execute()
236248
local_velocity += vdot;
237249
local_velocity = stk::math::abs(local_velocity) / face_area;
238250

239-
const DblType velocity_scale = sharpening_scaling * local_velocity;
251+
const DblType velocity_scale =
252+
sharpening_scaling * local_velocity * left_mask * right_mask;
240253

241254
diffusion_coef = stk::math::sqrt(diffusion_coef) * diffusion_scaling;
242255

243256
const DblType inv_axdx = 1.0 / axdx;
244257

245258
const DblType dlhsfac = -velocity_scale * diffusion_coef * asq * inv_axdx;
246259

247-
smdata.rhs(0) -= dlhsfac * (qNp1R - qNp1L);
248-
smdata.rhs(1) += dlhsfac * (qNp1R - qNp1L);
260+
smdata.rhs(0) -= dlhsfac * (qNp1R - qNp1L) +
261+
inv_axdx * (1.0 - left_mask) * (qNp1R - qNp1L);
262+
smdata.rhs(1) += dlhsfac * (qNp1R - qNp1L) +
263+
inv_axdx * (1.0 - right_mask) * (qNp1R - qNp1L);
249264

250265
massVofBalancedFlowRate.get(edge, 0) =
251266
dlhsfac * (qNp1R - qNp1L) * (density_liquid - density_gas);
252267

253-
smdata.lhs(0, 0) -= dlhsfac;
254-
smdata.lhs(0, 1) += dlhsfac;
268+
smdata.lhs(0, 0) -= dlhsfac + inv_axdx * (1.0 - left_mask);
269+
smdata.lhs(0, 1) += dlhsfac + inv_axdx * (1.0 - left_mask);
255270

256-
smdata.lhs(1, 0) += dlhsfac;
257-
smdata.lhs(1, 1) -= dlhsfac;
271+
smdata.lhs(1, 0) += dlhsfac + inv_axdx * (1.0 - right_mask);
272+
smdata.lhs(1, 1) -= dlhsfac + inv_axdx * (1.0 - right_mask);
258273

259274
const DblType omegaL =
260275
diffusion_coef * stk::math::log((qNp1L + eps) / (1.0 - qNp1L + eps));
@@ -296,6 +311,8 @@ VOFAdvectionEdgeAlg::execute()
296311
stk::math::tanh(0.5 * omegaIp / diffusion_coef)) *
297312
interface_normal[d] * av[d];
298313

314+
compression = compression * left_mask * right_mask;
315+
299316
smdata.rhs(0) -= compression;
300317
smdata.rhs(1) += compression;
301318

0 commit comments

Comments
 (0)