pimpleFoam, rhoPimpleFoam, interDyMFoam: Rationalized mesh-motion support

Added support for mesh-motion update within PIMPLE loop in pimpleFoam and rhoPimpleFoam.
This commit is contained in:
Henry Weller
2017-11-30 13:07:42 +00:00
parent 4aaf2da1de
commit 7d6b1be4b3
36 changed files with 237 additions and 321 deletions

View File

@ -1,10 +0,0 @@
#include "readTimeControls.H"
bool correctPhi = pimple.dict().lookupOrDefault<Switch>
(
"correctPhi",
!isA<staticFvMesh>(mesh)
);
bool checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);

View File

@ -54,12 +54,11 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "createControl.H" #include "createDyMControls.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createFields.H" #include "createFields.H"
#include "createFieldRefs.H" #include "createFieldRefs.H"
#include "createRhoUfIfPresent.H" #include "createRhoUfIfPresent.H"
#include "createTimeControls.H"
turbulence->validate(); turbulence->validate();
@ -75,9 +74,8 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H" #include "readDyMControls.H"
{
// Store divrhoU from the previous mesh so that it can be mapped // Store divrhoU from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the // and used in correctPhi to ensure the corrected phi has the
// same divergence // same divergence
@ -105,6 +103,11 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstIter() || moveMeshOuterCorrectors)
{
// Store momentum to set rhoUf for introduced faces. // Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU; autoPtr<volVectorField> rhoU;
if (rhoUf.valid()) if (rhoUf.valid())
@ -115,15 +118,14 @@ int main(int argc, char *argv[])
// Do any mesh changes // Do any mesh changes
mesh.update(); mesh.update();
#include "updateRhoUf.H"
if (mesh.changing()) if (mesh.changing())
{ {
MRF.update(); MRF.update();
if (correctPhi) if (correctPhi)
{ {
// Calculate absolute flux from the mapped surface velocity // Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf(); phi = mesh.Sf() & rhoUf();
#include "correctPhi.H" #include "correctPhi.H"
@ -144,9 +146,6 @@ int main(int argc, char *argv[])
#include "rhoEqn.H" #include "rhoEqn.H"
} }
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "UEqn.H" #include "UEqn.H"
#include "EEqn.H" #include "EEqn.H"

View File

@ -50,8 +50,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "createControl.H" #include "createDyMControls.H"
#include "createTimeControls.H"
#include "createFields.H" #include "createFields.H"
#include "createFieldRefs.H" #include "createFieldRefs.H"
#include "createRhoUf.H" #include "createRhoUf.H"
@ -67,7 +66,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H" #include "readDyMControls.H"
{ {
// Store divrhoU from the previous mesh so that it can be mapped // Store divrhoU from the previous mesh so that it can be mapped

View File

@ -50,7 +50,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createControls.H" #include "createDyMControls.H"
#include "createFields.H" #include "createFields.H"
#include "createUfIfPresent.H" #include "createUfIfPresent.H"
#include "CourantNo.H" #include "CourantNo.H"
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H" #include "readDyMControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setDeltaT.H" #include "setDeltaT.H"
@ -72,17 +72,21 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstIter() || moveMeshOuterCorrectors)
{
mesh.update(); mesh.update();
#include "updateUf.H"
if (mesh.changing()) if (mesh.changing())
{ {
MRF.update(); MRF.update();
if (correctPhi) if (correctPhi)
{ {
// Calculate absolute flux from the mapped surface velocity // Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf(); phi = mesh.Sf() & Uf();
#include "correctPhi.H" #include "correctPhi.H"
@ -96,10 +100,8 @@ int main(int argc, char *argv[])
#include "meshCourantNo.H" #include "meshCourantNo.H"
} }
} }
}
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "UEqn.H" #include "UEqn.H"
// --- Pressure corrector loop // --- Pressure corrector loop

View File

@ -1,5 +0,0 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault("correctPhi", false);
checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false);

View File

@ -60,7 +60,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "createControls.H" #include "createDyMControls.H"
#include "createFields.H" #include "createFields.H"
#include "createUcf.H" #include "createUcf.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
@ -69,7 +69,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H" #include "readDyMControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setDeltaT.H" #include "setDeltaT.H"

View File

@ -1,12 +0,0 @@
#include "createControl.H"
#include "createTimeControls.H"
bool correctPhi
(
pimple.dict().lookupOrDefault("correctPhi", false)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
);

View File

@ -1,5 +0,0 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault("correctPhi", false);
checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false);

View File

@ -50,8 +50,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "createControl.H" #include "createDyMControls.H"
#include "createTimeControls.H"
#include "createFields.H" #include "createFields.H"
#include "createFieldRefs.H" #include "createFieldRefs.H"
#include "createRhoUf.H" #include "createRhoUf.H"
@ -67,7 +66,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H" #include "readDyMControls.H"
{ {
// Store divrhoU from the previous time-step/mesh for the correctPhi // Store divrhoU from the previous time-step/mesh for the correctPhi

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,7 +50,6 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "createControl.H"
#include "createControls.H" #include "createControls.H"
#include "createFields.H" #include "createFields.H"
#include "createUf.H" #include "createUf.H"

View File

@ -1,11 +1,6 @@
#include "createTimeControls.H" #include "createDyMControls.H"
scalar maxAcousticCo scalar maxAcousticCo
( (
readScalar(runTime.controlDict().lookup("maxAcousticCo")) readScalar(runTime.controlDict().lookup("maxAcousticCo"))
); );
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
);

View File

@ -1,4 +1,3 @@
#include "readTimeControls.H" #include "readDyMControls.H"
maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo")); maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo"));
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);

View File

@ -60,10 +60,9 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createControl.H" #include "createDyMControls.H"
#include "createFields.H" #include "createFields.H"
#include "createUf.H" #include "createUf.H"
#include "createControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
@ -77,7 +76,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H" #include "readDyMControls.H"
// Store divU from the previous mesh so that it can be mapped // Store divU from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the // and used in correctPhi to ensure the corrected phi has the

View File

@ -1,16 +0,0 @@
#include "createTimeControls.H"
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
);

View File

@ -1,9 +0,0 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
moveMeshOuterCorrectors =
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false);

View File

@ -3,7 +3,7 @@ CorrectPhi
U, U,
phi, phi,
p_rgh, p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU)), surfaceScalarField("rAUf", fvc::interpolate(rAU())),
geometricZeroField(), geometricZeroField(),
pimple pimple
); );

View File

@ -1,14 +0,0 @@
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
);

View File

@ -56,13 +56,15 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createDyMControls.H" #include "createDyMControls.H"
#include "createFields.H" #include "createFields.H"
#include "createAlphaFluxes.H" #include "createAlphaFluxes.H"
volScalarField rAU tmp<volScalarField> rAU;
if (correctPhi)
(
rAU = new volScalarField
( (
IOobject IOobject
( (
@ -73,11 +75,12 @@ int main(int argc, char *argv[])
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1.0) dimensionedScalar("rAU", dimTime/dimDensity, 1)
)
); );
#include "correctPhi.H" #include "correctPhi.H"
#include "createUf.H" #include "createUfIfPresent.H"
turbulence->validate(); turbulence->validate();
@ -92,7 +95,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H" #include "readDyMControls.H"
if (LTS) if (LTS)
{ {
@ -114,16 +117,10 @@ int main(int argc, char *argv[])
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstIter() || moveMeshOuterCorrectors)
{ {
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
mesh.update(); mesh.update();
if (mesh.changing()) if (mesh.changing())
{ {
Info<< "Execution time for mesh.update() = "
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
<< " s" << endl;
// Do not apply previous time-step mesh compression flux // Do not apply previous time-step mesh compression flux
// if the mesh topology changed // if the mesh topology changed
if (mesh.topoChanging()) if (mesh.topoChanging())
@ -140,7 +137,7 @@ int main(int argc, char *argv[])
{ {
// Calculate absolute flux // Calculate absolute flux
// from the mapped surface velocity // from the mapped surface velocity
phi = mesh.Sf() & Uf; phi = mesh.Sf() & Uf();
#include "correctPhi.H" #include "correctPhi.H"

View File

@ -1,12 +1,12 @@
{ {
rAU = 1.0/UEqn.A(); rAU = 1.0/UEqn.A();
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); volVectorField HbyA(constrainHbyA(rAU()*UEqn.H(), U, p_rgh));
surfaceScalarField phiHbyA surfaceScalarField phiHbyA
( (
"phiHbyA", "phiHbyA",
fvc::flux(HbyA) fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf) + fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf)
); );
MRF.makeRelative(phiHbyA); MRF.makeRelative(phiHbyA);
@ -47,7 +47,7 @@
p_rgh.relax(); p_rgh.relax();
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf); U = HbyA + rAU()*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
} }
@ -55,11 +55,8 @@
#include "continuityErrs.H" #include "continuityErrs.H"
{ // Correct Uf if the mesh is moving
Uf = fvc::interpolate(U); fvc::correctUf(Uf, U, phi);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
Uf += n*(phi/mesh.magSf() - (n & Uf));
}
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U); fvc::makeRelative(phi, U);
@ -76,4 +73,9 @@
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }
if (!correctPhi)
{
rAU.clear();
}
} }

View File

@ -1,9 +0,0 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
moveMeshOuterCorrectors =
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false);

View File

@ -61,9 +61,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "createControl.H" #include "createDyMControls.H"
#include "createTimeControls.H"
#include "../interFoam/interDyMFoam/createDyMControls.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createFields.H" #include "createFields.H"
@ -93,7 +91,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "../interFoam/interDyMFoam/readControls.H" #include "readDyMControls.H"
// Store divU from the previous mesh so that it can be mapped // Store divU from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the // and used in correctPhi to ensure the corrected phi has the

View File

@ -51,12 +51,14 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createDyMControls.H" #include "createDyMControls.H"
#include "createFields.H" #include "createFields.H"
volScalarField rAU tmp<volScalarField> rAU;
if (correctPhi)
(
rAU = new volScalarField
( (
IOobject IOobject
( (
@ -67,11 +69,13 @@ int main(int argc, char *argv[])
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1.0) dimensionedScalar("rAU", dimTime/dimDensity, 1)
)
); );
#include "correctPhi.H" #include "correctPhi.H"
#include "createUf.H" #include "createUfIfPresent.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
@ -85,7 +89,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H" #include "readDyMControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "alphaCourantNo.H" #include "alphaCourantNo.H"
@ -117,7 +121,7 @@ int main(int argc, char *argv[])
if (mesh.changing() && correctPhi) if (mesh.changing() && correctPhi)
{ {
// Calculate absolute flux from the mapped surface velocity // Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf; phi = mesh.Sf() & Uf();
#include "correctPhi.H" #include "correctPhi.H"

View File

@ -56,8 +56,6 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createDyMControls.H" #include "createDyMControls.H"
#include "createFields.H" #include "createFields.H"
@ -86,7 +84,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H" #include "readDyMControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setDeltaT.H" #include "setDeltaT.H"

View File

@ -493,6 +493,12 @@ public:
// Mesh motion // Mesh motion
//- Is mesh dynamic
virtual bool dynamic() const
{
return false;
}
//- Is mesh moving //- Is mesh moving
bool moving() const bool moving() const
{ {

View File

@ -121,6 +121,12 @@ public:
// Member Functions // Member Functions
//- Is mesh dynamic
virtual bool dynamic() const
{
return true;
}
//- Update the mesh for both mesh motion and topology change //- Update the mesh for both mesh motion and topology change
virtual bool update() = 0; virtual bool update() = 0;
}; };
@ -131,10 +137,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "staticFvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "dynamicFvMesh.H" #include "staticFvMesh.H"
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //

View File

@ -3,10 +3,15 @@
bool correctPhi bool correctPhi
( (
pimple.dict().lookupOrDefault("correctPhi", false) pimple.dict().lookupOrDefault("correctPhi", mesh.dynamic())
); );
bool checkMeshCourantNo bool checkMeshCourantNo
( (
pimple.dict().lookupOrDefault("checkMeshCourantNo", false) pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
); );
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false)
);

View File

@ -0,0 +1,19 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().lookupOrDefault
(
"correctPhi",
correctPhi
);
checkMeshCourantNo = pimple.dict().lookupOrDefault
(
"checkMeshCourantNo",
checkMeshCourantNo
);
moveMeshOuterCorrectors = pimple.dict().lookupOrDefault
(
"moveMeshOuterCorrectors",
moveMeshOuterCorrectors
);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -77,6 +77,12 @@ public:
// Member Functions // Member Functions
//- Is mesh dynamic
virtual bool dynamic() const
{
return false;
}
//- Dummy update function which does not change the mesh //- Dummy update function which does not change the mesh
virtual bool update(); virtual bool update();
}; };

View File

@ -25,7 +25,7 @@ Global
createRhoUf createRhoUf
Description Description
Creates and initialises the velocity field rhoUf if present. Creates and initialises the velocity field rhoUf if required.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -33,19 +33,22 @@ Description
autoPtr<surfaceVectorField> rhoUf; autoPtr<surfaceVectorField> rhoUf;
IOobject rhoUfHeader if (mesh.dynamic())
{
Info<< "Constructing face momentum rhoUf" << endl;
rhoUf = new surfaceVectorField
(
IOobject
( (
"rhoUf", "rhoUf",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
),
fvc::interpolate(rho*U)
); );
if (rhoUfHeader.typeHeaderOk<surfaceVectorField>(true))
{
Info<< "Reading face momentum rhoUf\n" << endl;
rhoUf = new surfaceVectorField(rhoUfHeader, mesh);
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -31,25 +31,6 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
if (mesh.changing()) #error Remove rhoUpdateUf.H
{
if (!rhoUf.valid())
{
Info<< "Constructing face momentum rhoUf" << endl;
rhoUf = new surfaceVectorField
(
IOobject
(
"rhoUf",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvc::interpolate(rho*U)
);
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -25,7 +25,7 @@ Global
createUf createUf
Description Description
Creates and initialises the velocity field Uf if present. Creates and initialises the velocity field Uf if required.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -33,19 +33,22 @@ Description
autoPtr<surfaceVectorField> Uf; autoPtr<surfaceVectorField> Uf;
IOobject UfHeader if (mesh.dynamic())
{
Info<< "Constructing face velocity Uf\n" << endl;
Uf = new surfaceVectorField
(
IOobject
( (
"Uf", "Uf",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
),
fvc::interpolate(U)
); );
if (UfHeader.typeHeaderOk<surfaceVectorField>(true))
{
Info<< "Reading face velocity Uf\n" << endl;
Uf = new surfaceVectorField(UfHeader, mesh);
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -31,25 +31,6 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
if (mesh.changing()) #error Remove updateUf.H
{
if (!Uf.valid())
{
Info<< "Constructing face velocity Uf" << endl;
Uf = new surfaceVectorField
(
IOobject
(
"Uf",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvc::interpolate(U)
);
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -215,7 +215,7 @@ ddtCorr
const autoPtr<GeometricField<Type, fvsPatchField, surfaceMesh>>& Uf const autoPtr<GeometricField<Type, fvsPatchField, surfaceMesh>>& Uf
) )
{ {
if (U.mesh().changing()) if (U.mesh().dynamic())
{ {
return ddtCorr(U, Uf()); return ddtCorr(U, Uf());
} }
@ -280,7 +280,7 @@ ddtCorr
const autoPtr<GeometricField<Type, fvsPatchField, surfaceMesh>>& Uf const autoPtr<GeometricField<Type, fvsPatchField, surfaceMesh>>& Uf
) )
{ {
if (U.mesh().changing()) if (U.mesh().dynamic())
{ {
return ddtCorr(rho, U, Uf()); return ddtCorr(rho, U, Uf());
} }

View File

@ -228,7 +228,7 @@ void Foam::fvc::correctUf
{ {
const fvMesh& mesh = U.mesh(); const fvMesh& mesh = U.mesh();
if (mesh.changing()) if (mesh.dynamic())
{ {
Uf() = fvc::interpolate(U); Uf() = fvc::interpolate(U);
surfaceVectorField n(mesh.Sf()/mesh.magSf()); surfaceVectorField n(mesh.Sf()/mesh.magSf());
@ -247,7 +247,7 @@ void Foam::fvc::correctRhoUf
{ {
const fvMesh& mesh = U.mesh(); const fvMesh& mesh = U.mesh();
if (mesh.changing()) if (mesh.dynamic())
{ {
rhoUf() = fvc::interpolate(rho*U); rhoUf() = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf()); surfaceVectorField n(mesh.Sf()/mesh.magSf());

View File

@ -47,7 +47,7 @@ correctFluxes
(phi none) (phi none)
(nHatf none) (nHatf none)
(rhoPhi none) (rhoPhi none)
(alphaPhi none) (alphaPhi0.water none)
(ghf none) (ghf none)
); );