Skip to content

Commit 8314d3c

Browse files
authored
Bug: Prevent spurious powder consolidation following mesh refinement (#108)
1 parent f1279b2 commit 8314d3c

2 files changed

Lines changed: 21 additions & 9 deletions

File tree

‎applications/solvers/additiveFoam/additiveFoam.C‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ int main(int argc, char *argv[])
9494

9595
while (runTime.run())
9696
{
97-
#include "updateProperties.H"
98-
9997
#include "readDyMControls.H"
10098
#include "CourantNo.H"
10199
#include "setDeltaT.H"
@@ -104,6 +102,22 @@ int main(int argc, char *argv[])
104102

105103
mesh.update();
106104

105+
if (mesh.topoChanged())
106+
{
107+
// Temperature is authoritative after topology changes. A
108+
// conservative scheme should consider enthalpy as authoritative.
109+
forAll(mesh.cells(), cellI)
110+
{
111+
scalar alpha1_ =
112+
interpolateXY(T[cellI], thermo.x(), thermo.y());
113+
alpha1[cellI] = min(max(alpha1_, 0.0), 1.0);
114+
}
115+
116+
alpha1.correctBoundaryConditions();
117+
118+
#include "updateProperties.H"
119+
}
120+
107121
runTime++;
108122

109123
Info<< "Time = " << runTime.name() << nl << endl;
@@ -123,6 +137,8 @@ int main(int argc, char *argv[])
123137

124138
#include "thermo/TEqn.H"
125139

140+
#include "updateProperties.H"
141+
126142
runTime.write();
127143

128144
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

‎applications/solvers/additiveFoam/updateProperties.H‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
alpha3 *= pos0(solidus - T);
2+
alpha3.correctBoundaryConditions();
3+
14
forAll(mesh.cells(), cellI)
25
{
3-
// update phase fractions
46
scalar alpha1_ = alpha1[cellI];
57
scalar alpha2_ = 1.0 - alpha1[cellI];
6-
7-
if (alpha1_ < 1.0)
8-
{
9-
alpha3[cellI] = 0.0;
10-
}
118
scalar alpha3_ = alpha3[cellI];
129

1310
// update temperature ranges for phase properties
@@ -24,6 +21,5 @@ forAll(mesh.cells(), cellI)
2421
+ alpha3_*Cp3.value(T1);
2522
}
2623

27-
alpha3.correctBoundaryConditions();
2824
Cp.correctBoundaryConditions();
2925
kappa.correctBoundaryConditions();

0 commit comments

Comments
 (0)