diff --git a/applications/solvers/additiveFoam/additiveFoam.C b/applications/solvers/additiveFoam/additiveFoam.C index cfd0936..87e3a54 100644 --- a/applications/solvers/additiveFoam/additiveFoam.C +++ b/applications/solvers/additiveFoam/additiveFoam.C @@ -94,8 +94,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "updateProperties.H" - #include "readDyMControls.H" #include "CourantNo.H" #include "setDeltaT.H" @@ -104,6 +102,22 @@ int main(int argc, char *argv[]) mesh.update(); + if (mesh.topoChanged()) + { + // Temperature is authoritative after topology changes. A + // conservative scheme should consider enthalpy as authoritative. + forAll(mesh.cells(), cellI) + { + scalar alpha1_ = + interpolateXY(T[cellI], thermo.x(), thermo.y()); + alpha1[cellI] = min(max(alpha1_, 0.0), 1.0); + } + + alpha1.correctBoundaryConditions(); + + #include "updateProperties.H" + } + runTime++; Info<< "Time = " << runTime.name() << nl << endl; @@ -123,6 +137,8 @@ int main(int argc, char *argv[]) #include "thermo/TEqn.H" + #include "updateProperties.H" + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/additiveFoam/updateProperties.H b/applications/solvers/additiveFoam/updateProperties.H index 1ec69dd..353fb1f 100644 --- a/applications/solvers/additiveFoam/updateProperties.H +++ b/applications/solvers/additiveFoam/updateProperties.H @@ -1,13 +1,10 @@ +alpha3 *= pos0(solidus - T); +alpha3.correctBoundaryConditions(); + forAll(mesh.cells(), cellI) { - // update phase fractions scalar alpha1_ = alpha1[cellI]; scalar alpha2_ = 1.0 - alpha1[cellI]; - - if (alpha1_ < 1.0) - { - alpha3[cellI] = 0.0; - } scalar alpha3_ = alpha3[cellI]; // update temperature ranges for phase properties @@ -24,6 +21,5 @@ forAll(mesh.cells(), cellI) + alpha3_*Cp3.value(T1); } -alpha3.correctBoundaryConditions(); Cp.correctBoundaryConditions(); kappa.correctBoundaryConditions();