fvMesh: Separated fvMesh::move() and fvMesh::update()

fvMesh::update() now executes at the beginning of the time-step, before time is
incremented and handles topology change, mesh to mesh mapping and redistribution
without point motion.  Following each of these mesh changes fields are mapped
from the previous mesh state to new mesh state in a conservative manner.  These
mesh changes not occur at most once per time-step.

fvMesh::move() is executed after time is incremented and handles point motion
mesh morphing during the time-step in an Arbitrary Lagrangian Eulerian approach
requiring the mesh motion flux to match the cell volume change.  fvMesh::move()
can be called any number of times during the time-step to allow iterative update
of the coupling between the mesh motion and field solution.
This commit is contained in:
Henry Weller
2022-04-08 18:46:12 +01:00
parent d867d35a82
commit b8ce733e4b
32 changed files with 356 additions and 206 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -106,6 +106,18 @@ int main(int argc, char *argv[])
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
fvModels.preUpdateMesh();
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -117,17 +129,8 @@ int main(int argc, char *argv[])
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
fvModels.preUpdateMesh();
// Do any mesh changes
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{

View File

@ -103,6 +103,18 @@ int main(int argc, char *argv[])
#include "setDeltaT.H"
}
fvModels.preUpdateMesh();
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -127,17 +139,8 @@ int main(int argc, char *argv[])
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
fvModels.preUpdateMesh();
// Do any mesh changes
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -101,6 +101,18 @@ int main(int argc, char *argv[])
#include "setDeltaT.H"
}
fvModels.preUpdateMesh();
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -125,17 +137,8 @@ int main(int argc, char *argv[])
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
fvModels.preUpdateMesh();
// Do any mesh changes
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -74,10 +74,14 @@ int main(int argc, char *argv[])
if (!LTS)
{
#include "setDeltaT.H"
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
// Do any mesh changes
mesh.update();
// Move the mesh
mesh.move();
}
// --- Directed interpolation of primitive fields onto faces

View File

@ -99,6 +99,18 @@ int main(int argc, char *argv[])
#include "setDeltaT.H"
}
fvModels.preUpdateMesh();
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -108,17 +120,8 @@ int main(int argc, char *argv[])
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
fvModels.preUpdateMesh();
// Do any mesh changes
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{

View File

@ -101,6 +101,18 @@ int main(int argc, char *argv[])
#include "setDeltaT.H"
}
fvModels.preUpdateMesh();
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -124,17 +136,8 @@ int main(int argc, char *argv[])
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU = new volVectorField("rhoU", rho*U);
}
fvModels.preUpdateMesh();
// Do any mesh changes
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -83,6 +83,11 @@ int main(int argc, char *argv[])
#include "setDeltaT.H"
}
fvModels.preUpdateMesh();
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -92,9 +97,8 @@ int main(int argc, char *argv[])
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
fvModels.preUpdateMesh();
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -107,6 +107,9 @@ int main(int argc, char *argv[])
#include "CourantNo.H"
#include "setDeltaT.H"
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -114,7 +117,8 @@ int main(int argc, char *argv[])
// Store the particle positions
clouds.storeGlobalPositions();
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -54,14 +54,20 @@ int main(int argc, char *argv[])
Info<< "\nStarting time loop\n" << endl;
while (runTime.loop())
while (runTime.run())
{
Info<< "Time = " << runTime.userTimeName() << nl << endl;
clouds.storeGlobalPositions();
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// Move the mesh
mesh.move();
if (mesh.changing())
{
U.correctBoundaryConditions();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,14 +53,19 @@ int main(int argc, char *argv[])
Info<< "\nStarting time loop\n" << endl;
while (runTime.loop())
while (runTime.run())
{
Info<< "Time = " << runTime.userTimeName() << nl << endl;
clouds.storeGlobalPositions();
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// Move the mesh
mesh.move();
if (mesh.changing())
{
U.correctBoundaryConditions();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,12 +70,15 @@ int main(int argc, char *argv[])
#include "CourantNo.H"
#include "setDeltaT.H"
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// Do any mesh changes
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing() && correctPhi)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -91,21 +91,14 @@ int main(int argc, char *argv[])
#include "setDeltaT.H"
}
runTime++;
fvModels.preUpdateMesh();
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Store divU from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the
// same divergence
tmp<volScalarField> divU;
if (correctPhi)
if (correctPhi && mesh.topoChanging())
{
// Construct and register divU for mapping
divU = new volScalarField
@ -115,10 +108,31 @@ int main(int argc, char *argv[])
);
}
fvModels.preUpdateMesh();
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
if (correctPhi && !divU.valid())
{
// Construct and register divU for correctPhi
divU = new volScalarField
(
"divU0",
fvc::div(fvc::absolute(phi, U))
);
}
// Move the mesh
mesh.move();
if (mesh.changing())
{
gh = (g & mesh.C()) - ghRef;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -89,15 +89,8 @@ int main(int argc, char *argv[])
#include "setDeltaT.H"
}
runTime++;
fvModels.preUpdateMesh();
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Store divU from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the
// same divergence
@ -107,9 +100,10 @@ int main(int argc, char *argv[])
(
correctPhi
&& !isType<twoPhaseChangeModels::noPhaseChange>(phaseChange)
&& mesh.topoChanging()
)
{
// Construct and register divU for mapping
// Construct and register divU for correctPhi
divU = new volScalarField
(
"divU0",
@ -117,19 +111,45 @@ int main(int argc, char *argv[])
);
}
fvModels.preUpdateMesh();
// Update the mesh for topology change, mesh to mesh mapping
bool topoChanged = mesh.update();
mesh.update();
if (mesh.changing())
{
// Do not apply previous time-step mesh compression flux
// if the mesh topology changed
if (mesh.topoChanging())
if (topoChanged)
{
talphaPhi1Corr0.clear();
}
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
if
(
correctPhi
&& !isType<twoPhaseChangeModels::noPhaseChange>(phaseChange)
&& !divU.valid()
)
{
// Construct and register divU for correctPhi
divU = new volScalarField
(
"divU0",
fvc::div(fvc::absolute(phi, U))
);
}
// Move the mesh
mesh.move();
if (mesh.changing())
{
gh = (g & mesh.C()) - ghRef;
ghf = (g & mesh.Cf()) - ghRef;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -88,6 +88,11 @@ int main(int argc, char *argv[])
#include "setDeltaT.H"
}
fvModels.preUpdateMesh();
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -97,9 +102,8 @@ int main(int argc, char *argv[])
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
fvModels.preUpdateMesh();
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{
@ -111,9 +115,9 @@ int main(int argc, char *argv[])
if (correctPhi)
{
#include "correctPhi.H"
}
mixture.correct();
}
if (checkMeshCourantNo)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -98,7 +98,30 @@ int main(int argc, char *argv[])
#include "setDeltaT.H"
}
fvModels.preUpdateMesh();
// Store divU from the previous mesh so that it can be
// mapped and used in correctPhi to ensure the corrected phi
// has the same divergence
tmp<volScalarField> divU;
if (correctPhi && mesh.topoChanging())
{
// Construct and register divU for mapping
divU = new volScalarField
(
"divU0",
fvc::div
(
fvc::absolute(phi, fluid.movingPhases()[0].U())
)
);
}
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
@ -131,15 +154,7 @@ int main(int argc, char *argv[])
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Store divU from the previous mesh so that it can be
// mapped and used in correctPhi to ensure the corrected phi
// has the same divergence
tmp<volScalarField> divU;
if
(
correctPhi
)
if (correctPhi && !divU.valid())
{
// Construct and register divU for mapping
divU = new volScalarField
@ -152,9 +167,8 @@ int main(int argc, char *argv[])
);
}
fvModels.preUpdateMesh();
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{
@ -179,6 +193,8 @@ int main(int argc, char *argv[])
#include "meshCourantNo.H"
}
}
divU.clear();
}
if (pimple.models())

View File

@ -235,7 +235,7 @@ Foam::phaseSystem::phaseSystem
phaseModel::iNew(*this, referencePhaseName_)
),
phi_(calcPhi(phaseModels_)),
phi_("phi", calcPhi(phaseModels_)),
dpdt_
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -75,6 +75,11 @@ int main(int argc, char *argv[])
#include "alphaCourantNo.H"
#include "setDeltaT.H"
fvModels.preUpdateMesh();
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -86,9 +91,8 @@ int main(int argc, char *argv[])
{
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
fvModels.preUpdateMesh();
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -90,6 +90,20 @@ int main(int argc, char *argv[])
#include "CourantNo.H"
#include "setDeltaT.H"
fvModels.preUpdateMesh();
const scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
// Update the mesh for topology change, mesh to mesh mapping
const bool topoChanged = mesh.update();
if (topoChanged)
{
Info<< "Execution time for mesh.update() = "
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
<< " s" << endl;
}
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
@ -99,18 +113,11 @@ int main(int argc, char *argv[])
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
fvModels.preUpdateMesh();
mesh.update();
// Move the mesh
mesh.move();
if (mesh.changing())
{
Info<< "Execution time for mesh.update() = "
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
<< " s" << endl;
MRF.update();
if (correctPhi)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -382,9 +382,9 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io, const IOobject& dictIO)
new fvMesh
(
io,
move(newPoints),
move(newFaces),
move(newCells)
std::move(newPoints),
std::move(newFaces),
std::move(newCells)
)
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -95,15 +95,21 @@ int main(int argc, char *argv[])
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
);
while (runTime.loop())
while (runTime.run())
{
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << endl;
while (pimple.loop())
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
mesh.update();
// Move the mesh
mesh.move();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -61,7 +61,7 @@ int main(int argc, char *argv[])
runTime.setDeltaT(t0);
runTime++;
Info<< "CA = " << runTime.userTimeValue() << endl;
mesh.update();
mesh.move();
}
scalar Vmax = sum(mesh.V().field());
@ -72,7 +72,7 @@ int main(int argc, char *argv[])
runTime.setDeltaT(t1);
runTime++;
Info<< "CA = " << runTime.userTimeValue() << endl;
mesh.update();
mesh.move();
}
scalar Vmin = sum(mesh.V().field());

View File

@ -220,6 +220,9 @@ void mixtureKEpsilon<BasicMomentumTransportModel>::correctInletOutlet
(bf[patchi]).refValue() =
refCast<const inletOutletFvPatchScalarField>
(refBf[patchi]).refValue();
refCast<inletOutletFvPatchScalarField>
(bf[patchi]).phiName() = "phim";
}
}
}
@ -311,6 +314,7 @@ void mixtureKEpsilon<BasicMomentumTransportModel>::initMixtureFields()
epsilonBoundaryTypes(epsilonl)
)
);
correctInletOutlet(epsilonm_(), epsilonl);
}
@ -703,7 +707,6 @@ void mixtureKEpsilon<BasicMomentumTransportModel>::correct()
fvConstraints.constrain(epsilonm);
bound(epsilonm, this->epsilonMin_);
// Turbulent kinetic energy equation
tmp<fvScalarMatrix> kmEqn
(

View File

@ -171,4 +171,16 @@ void Foam::points0MotionSolver::distribute
{}
bool Foam::points0MotionSolver::write() const
{
if (mesh().topoChanging())
{
points0_.instance() = mesh().time().timeName();
points0_.write();
}
return motionSolver::write();
}
// ************************************************************************* //

View File

@ -115,6 +115,9 @@ public:
//- Update corresponding to the given distribution map
virtual void distribute(const polyDistributionMap&);
//- Write points0 if the mesh topology changed
virtual bool write() const;
// Member Operators

View File

@ -225,12 +225,6 @@ void Foam::solidBodyMotionSolver::topoChange(const polyTopoChangeMap& map)
twoDCorrectPoints(newPoints0);
points0_.transfer(newPoints0);
// points0 changed - set to write and check-in to database
points0_.rename("points0");
points0_.writeOpt() = IOobject::AUTO_WRITE;
points0_.instance() = mesh().time().timeName();
points0_.checkIn();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -157,6 +157,18 @@ public:
return true;
}
//- Return the flux-field name
const word& phiName() const
{
return phiName_;
}
//- Return access to the flux-field name
word& phiName()
{
return phiName_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();

View File

@ -345,7 +345,7 @@ Foam::fvMesh::fvMesh
polyMesh
(
io,
move(points),
std::move(points),
shapes,
boundaryFaces,
boundaryPatchNames,
@ -391,10 +391,10 @@ Foam::fvMesh::fvMesh
polyMesh
(
io,
move(points),
move(faces),
move(allOwner),
move(allNeighbour),
std::move(points),
std::move(faces),
std::move(allOwner),
std::move(allNeighbour),
syncPar
),
surfaceInterpolation(*this),
@ -430,7 +430,14 @@ Foam::fvMesh::fvMesh
const bool syncPar
)
:
polyMesh(io, move(points), move(faces), move(cells), syncPar),
polyMesh
(
io,
std::move(points),
std::move(faces),
std::move(cells),
syncPar
),
surfaceInterpolation(*this),
data(static_cast<const objectRegistry&>(*this)),
boundary_(*this),
@ -475,8 +482,6 @@ bool Foam::fvMesh::update()
{
bool updated = false;
if (curTimeIndex_ < time().timeIndex())
{
const bool hasV00 = V00Ptr_;
deleteDemandDrivenData(V00Ptr_);
@ -506,13 +511,18 @@ bool Foam::fvMesh::update()
// If V00 had been set reset to the mapped V0 prior to mesh-motion
V00();
}
return updated;
}
updated = mover_->update() || updated;
bool Foam::fvMesh::move()
{
const bool moved = mover_->update();
curTimeIndex_ = time().timeIndex();
return updated;
return moved;
}

View File

@ -374,9 +374,13 @@ public:
//- Is mesh dynamic
virtual bool dynamic() const;
//- Update the mesh for both mesh motion and topology change
//- Update the mesh for topology change, mesh to mesh mapping
// or redistribution
virtual bool update();
//- Move the mesh
virtual bool move();
//- Clear all geometry and addressing
void clearOut();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -276,10 +276,10 @@ void Foam::singleCellFvMesh::agglomerateMesh
// actually change the mesh
resetPrimitives
(
move(boundaryPoints),
move(patchFaces),
move(owner),
move(neighbour),
std::move(boundaryPoints),
std::move(patchFaces),
std::move(owner),
std::move(neighbour),
patchSizes,
patchStarts,
true // syncPar

View File

@ -159,13 +159,11 @@ bool Foam::fvMeshTopoChangers::meshToMesh::update()
bool hasChanged = false;
const scalar userTime0 =
mesh().time().userTimeValue()
- mesh().time().timeToUserTime(mesh().time().deltaTValue());
const scalar userTime = mesh().time().userTimeValue();
if (timeIndices_.found((userTime0 + timeDelta_/2)/timeDelta_))
if (timeIndices_.found((userTime + timeDelta_/2)/timeDelta_))
{
const word meshDir = "meshToMesh_" + mesh().time().timeName(userTime0);
const word meshDir = "meshToMesh_" + mesh().time().timeName(userTime);
Info << "Mapping to mesh " << meshDir << endl;

View File

@ -31,6 +31,7 @@ boundaryField
{
type prghTotalPressure;
U U.vapor;
phi phi.vapor;
rho thermo:rho.vapor;
p0 uniform 1e5;
value $internalField;

View File

@ -31,6 +31,7 @@ boundaryField
{
type prghTotalPressure;
U U.vapor;
phi phi.vapor;
rho thermo:rho.vapor;
p0 uniform 1e5;
value $internalField;