Skip to content

Commit 91ec8ef

Browse files
authored
Add first-generation smoothing/sharpening (#531)
* pde-based compression/sharpening, d/dt(alpha) + u_j d/dxj(alpha) + d/dxj(s_j) = 0.0 with s_j = ucj*alpha(1-alpha) activate via: volume_of_fluid: [vof, sucv_nso, sharpen] * explicit smoothing post-solve; dial in through input file. - VolumeOfFluid: name: myV max_iterations: 1 convergence_tolerance: 1.e-2 fourier_number: 0.25 compression_constant: 0.05 activate_smoothing: yes smoothing_iterations: 5 alphaSmoothed := alpha + Fo*dxMin*dxMin*d^2/dx^2(alpha) * clarify explicit sharpening output * add proper updates for overset; assembledRHS and interface normal for SCS smoothing approach * modify vof test to include new sharpening terms; diffs due to sharpening.. Notes: a) sharpening works great for sample driven cavity cases. b) advection limitation for stability when mesh spacing between overset and background are different. c) Core VOF transport scheme in... Time to modify the PPE
1 parent 6c03dfb commit 91ec8ef

File tree

12 files changed

+576
-84
lines changed

12 files changed

+576
-84
lines changed

include/NaluParsing.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct WallUserData : public UserData {
189189
TurbKinEnergy tke_;
190190
MixtureFraction mixFrac_;
191191
MassFraction massFraction_;
192+
VolumeOfFluid vof_;
192193
Emissivity emissivity_;
193194
Irradiation irradiation_;
194195
Transmissivity transmissivity_;

include/SolutionOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class SolutionOptions
137137
double mdotAlgAccumulation_;
138138
double mdotAlgInflow_;
139139
double mdotAlgOpen_;
140-
140+
141141
// turbulence model coeffs
142142
std::map<TurbulenceModelConstant, double> turbModelConstantMap_;
143143

include/VolumeOfFluidEquationSystem.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ class VolumeOfFluidEquationSystem : public EquationSystem {
3434
VolumeOfFluidEquationSystem(
3535
EquationSystems& equationSystems,
3636
const bool outputClippingDiag,
37-
const double deltaZClip);
37+
const double deltaVofClip,
38+
const double Fo,
39+
const double cAlpha,
40+
const bool smooth,
41+
const int smoothIter);
3842
virtual ~VolumeOfFluidEquationSystem();
3943

4044
void populate_derived_quantities();
@@ -86,22 +90,33 @@ class VolumeOfFluidEquationSystem : public EquationSystem {
8690

8791
void sharpen_interface_explicit();
8892
void smooth_vof();
93+
void smooth_vof_execute();
8994
void compute_interface_normal();
9095

9196
const bool managePNG_;
92-
const bool outputClippingDiag_;
93-
const double deltaVofClip_;
9497

9598
ScalarFieldType *vof_;
9699
ScalarFieldType *vofSmoothed_;
97-
ScalarFieldType *interfaceNormal_;
100+
ScalarFieldType *smoothedRhs_;
101+
VectorFieldType *interfaceNormal_;
98102
VectorFieldType *dvofdx_;
99103
ScalarFieldType *vofTmp_;
100104

101105
AssembleNodalGradAlgorithmDriver *assembleNodalGradAlgDriver_;
102106

103107
ProjectedNodalGradientEquationSystem *projectedNodalGradEqs_;
104108

109+
// clipping
110+
const bool outputClippingDiag_;
111+
const double deltaVofClip_;
112+
113+
// smoothing and sharepening params
114+
const double Fo_;
115+
const double cAlpha_;
116+
double dxMin_;
117+
const bool smooth_;
118+
const int smoothIter_;
119+
105120
bool isInit_;
106121
};
107122

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*------------------------------------------------------------------------*/
2+
/* Copyright 2014 Sandia Corporation. */
3+
/* This software is released under the license detailed */
4+
/* in the file, LICENSE, which is located in the top-level Nalu */
5+
/* directory structure */
6+
/*------------------------------------------------------------------------*/
7+
8+
#ifndef VolumeOfFluidSharpenElemKernel_H
9+
#define VolumeOfFluidSharpenElemKernel_H
10+
11+
#include "kernel/Kernel.h"
12+
#include "FieldTypeDef.h"
13+
14+
#include <stk_mesh/base/BulkData.hpp>
15+
#include <stk_mesh/base/Entity.hpp>
16+
17+
#include <Kokkos_Core.hpp>
18+
19+
namespace sierra {
20+
namespace nalu {
21+
22+
class TimeIntegrator;
23+
class SolutionOptions;
24+
class MasterElement;
25+
class ElemDataRequests;
26+
27+
template<typename AlgTraits>
28+
class VolumeOfFluidSharpenElemKernel: public Kernel
29+
{
30+
public:
31+
VolumeOfFluidSharpenElemKernel(
32+
const stk::mesh::BulkData&,
33+
const SolutionOptions&,
34+
ScalarFieldType*,
35+
const double,
36+
ElemDataRequests&);
37+
38+
virtual ~VolumeOfFluidSharpenElemKernel();
39+
40+
/** Execute the kernel within a Kokkos loop and populate the LHS and RHS for
41+
* the linear solve
42+
*/
43+
virtual void execute(
44+
SharedMemView<DoubleType**>&,
45+
SharedMemView<DoubleType*>&,
46+
ScratchViews<DoubleType>&);
47+
48+
private:
49+
VolumeOfFluidSharpenElemKernel() = delete;
50+
51+
VectorFieldType *coordinates_{nullptr};
52+
VectorFieldType *velocityRTM_{nullptr};
53+
VectorFieldType *interfaceNormal_{nullptr};
54+
ScalarFieldType *vofNp1_{nullptr};
55+
56+
/// Integration point to node mapping
57+
const double cAlpha_;
58+
const int* ipNodeMap_;
59+
60+
};
61+
62+
} // nalu
63+
} // sierra
64+
65+
#endif /* VolumeOfFluidSharpenElemKernel_H */

include/user_functions/RayleighTaylorMixFracAuxFunction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class RayleighTaylorMixFracAuxFunction : public AuxFunction
3939
double tX_;
4040
double yTr_;
4141
double dTr_;
42+
double surf_;
4243
const double pi_;
4344
};
4445

reg_tests/test_files/vofSphereDrop/vofSphereDrop.i

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ realms:
5151
name: myV
5252
max_iterations: 1
5353
convergence_tolerance: 1.e-2
54+
activate_smoothing: yes
55+
fourier_number: 0.25
56+
compression_constant: 0.05
5457

5558
initial_conditions:
5659
- constant: ic_1
@@ -149,7 +152,7 @@ realms:
149152
- element_source_terms:
150153
momentum: [lumped_momentum_time_derivative, advection_diffusion, buoyancy]
151154
continuity: [advection]
152-
volume_of_fluid: [vof, sucv_nso]
155+
volume_of_fluid: [vof, sucv_nso, sharpen]
153156

154157
- user_constants:
155158
gravity: [0.0, -10.0]
@@ -169,6 +172,10 @@ realms:
169172
- intersected_element
170173
- mesh_velocity
171174
- density
175+
- volume_of_fluid
176+
- volume_of_fluid_smoothed
177+
- interface_normal
178+
- dvofdx
172179

173180
Time_Integrators:
174181
- StandardTimeIntegrator:
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
0.02432116329066863 1 0.005
2-
0.001966663692513982 2 0.01
3-
0.0003478067418379743 3 0.015
4-
0.000128807125321143 4 0.02
5-
0.0001186665578123386 5 0.025
6-
6.159589527807734e-05 6 0.03
7-
2.85084248670952e-05 7 0.035
8-
1.804536444197644e-05 8 0.04
9-
1.696814237987382e-05 9 0.045
10-
1.82415952817005e-05 10 0.05
11-
2.013158697076528e-05 11 0.055
12-
2.227717639712913e-05 12 0.06
13-
2.459260313863444e-05 13 0.065
14-
2.704331805762574e-05 14 0.07
15-
2.961771509211273e-05 15 0.075
16-
3.230282985030123e-05 16 0.08
17-
3.50955110186631e-05 17 0.085
18-
3.796971046972843e-05 18 0.09
19-
4.093875506528796e-05 19 0.095
20-
4.399335630296404e-05 20 0.1
1+
0.01447384532257732 1 0.005
2+
0.01216518334441016 2 0.01
3+
0.01073768042783061 3 0.015
4+
0.01051559281054295 4 0.02
5+
0.01048860402882239 5 0.025
6+
0.01041243777094482 6 0.03
7+
0.01035905603141019 7 0.035
8+
0.01032539481913046 8 0.04
9+
0.01029914072916844 9 0.045
10+
0.0102748391713822 10 0.05
11+
0.01025087973701757 11 0.055
12+
0.01022698076916539 12 0.06
13+
0.01020317723200227 13 0.065
14+
0.01017951831366472 14 0.07
15+
0.01015602635420198 15 0.075
16+
0.01013270865108439 16 0.08
17+
0.01010957223961167 17 0.085
18+
0.01008660623117398 18 0.09
19+
0.01006382646893597 19 0.095
20+
0.01004123400529326 20 0.1

src/EquationSystems.C

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,17 @@ void EquationSystems::load(const YAML::Node & y_node)
104104
get_if_present_no_default(y_eqsys, "output_clipping_diagnostic", outputClipDiag);
105105
double deltaVofClip = 0.0;
106106
get_if_present_no_default(y_eqsys, "clipping_delta", deltaVofClip);
107-
eqSys = new VolumeOfFluidEquationSystem(*this, outputClipDiag, deltaVofClip);
107+
// vof smoothing/sharpening; provide defaults...
108+
double fourierNumber = 0.25;
109+
double cAlpha = 0.05;
110+
bool smooth = true;
111+
int smoothIter = 5;
112+
get_if_present_no_default(y_eqsys, "fourier_number", fourierNumber);
113+
get_if_present_no_default(y_eqsys, "compression_constant", cAlpha);
114+
get_if_present_no_default(y_eqsys, "activate_smoothing", smooth);
115+
get_if_present_no_default(y_eqsys, "smoothing_iterations", smoothIter);
116+
eqSys = new VolumeOfFluidEquationSystem(*this, outputClipDiag, deltaVofClip,
117+
fourierNumber, cAlpha, smooth, smoothIter);
108118
}
109119
else if ( expect_map(y_system, "LowMachEOM", true) ) {
110120
y_eqsys = expect_map(y_system, "LowMachEOM", true);

src/NaluParsing.C

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,13 @@ namespace YAML
821821
wallData.bcDataSpecifiedMap_["mass_fraction"] = true;
822822
wallData.bcDataTypeMap_["mass_fraction"] = sierra::nalu::CONSTANT_UD;
823823
}
824+
if (node["volume_of_fluid"])
825+
{
826+
wallData.vof_ = node["volume_of_fluid"].as<
827+
sierra::nalu::VolumeOfFluid>();
828+
wallData.bcDataSpecifiedMap_["volume_of_fluid"] = true;
829+
wallData.bcDataTypeMap_["volume_of_fluid"] = sierra::nalu::CONSTANT_UD;
830+
}
824831
if (node["emissivity"])
825832
{
826833
wallData.emissivity_ = node["emissivity"].as<sierra::nalu::Emissivity>();

0 commit comments

Comments
 (0)