mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: 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:
committed by
Andrew Heather
parent
889791060c
commit
e50af751a4
@ -1,5 +1,3 @@
|
|||||||
InfoInFunction << "consistent" << endl;
|
|
||||||
|
|
||||||
if (!pimple.SIMPLErho())
|
if (!pimple.SIMPLErho())
|
||||||
{
|
{
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
|
|||||||
@ -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);
|
|
||||||
@ -57,12 +57,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();
|
||||||
|
|
||||||
@ -78,9 +77,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
|
||||||
@ -111,6 +109,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())
|
||||||
@ -121,15 +124,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"
|
||||||
@ -150,9 +152,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"
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
#include "createControl.H"
|
|
||||||
#include "createTimeControls.H"
|
|
||||||
|
|
||||||
bool correctPhi
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault("correctPhi", false)
|
|
||||||
);
|
|
||||||
|
|
||||||
bool checkMeshCourantNo
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
|
|
||||||
);
|
|
||||||
@ -85,7 +85,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"
|
||||||
@ -99,7 +99,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"
|
||||||
|
|
||||||
@ -107,17 +107,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"
|
||||||
@ -131,10 +135,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
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
#include "readTimeControls.H"
|
|
||||||
|
|
||||||
correctPhi = pimple.dict().lookupOrDefault("correctPhi", false);
|
|
||||||
|
|
||||||
checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
|
|
||||||
@ -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"
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
#include "createControl.H"
|
|
||||||
#include "createTimeControls.H"
|
|
||||||
|
|
||||||
bool correctPhi
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault("correctPhi", false)
|
|
||||||
);
|
|
||||||
|
|
||||||
bool checkMeshCourantNo
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
|
|
||||||
);
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
#include "readTimeControls.H"
|
|
||||||
|
|
||||||
correctPhi = pimple.dict().lookupOrDefault("correctPhi", false);
|
|
||||||
|
|
||||||
checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
|
|
||||||
@ -53,8 +53,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"
|
||||||
@ -70,7 +69,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
|
||||||
|
|||||||
@ -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
|
||||||
@ -53,7 +53,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"
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
#include "createTimeControls.H"
|
#include "createDyMControls.H"
|
||||||
|
|
||||||
bool correctPhi
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault("correctPhi", true)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalar maxAcousticCo
|
scalar maxAcousticCo
|
||||||
(
|
(
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#include "readTimeControls.H"
|
#include "readDyMControls.H"
|
||||||
|
|
||||||
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
|
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
|
||||||
maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo"));
|
maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo"));
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
#include "readTimeControls.H"
|
|
||||||
|
|
||||||
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
|
|
||||||
|
|
||||||
checkMeshCourantNo =
|
|
||||||
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
|
|
||||||
|
|
||||||
moveMeshOuterCorrectors =
|
|
||||||
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false);
|
|
||||||
@ -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
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
bool correctPhi
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault("correctPhi", true)
|
|
||||||
);
|
|
||||||
|
|
||||||
bool checkMeshCourantNo
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
|
|
||||||
);
|
|
||||||
|
|
||||||
bool moveMeshOuterCorrectors
|
|
||||||
(
|
|
||||||
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false)
|
|
||||||
);
|
|
||||||
@ -59,13 +59,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
|
||||||
(
|
(
|
||||||
@ -76,11 +78,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();
|
||||||
|
|
||||||
@ -95,7 +98,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (runTime.run())
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
#include "readControls.H"
|
#include "readDyMControls.H"
|
||||||
|
|
||||||
if (LTS)
|
if (LTS)
|
||||||
{
|
{
|
||||||
@ -117,16 +120,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())
|
||||||
|
|||||||
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
#include "readTimeControls.H"
|
|
||||||
|
|
||||||
correctPhi = pimple.dict().lookupOrDefault("correctPhi", true);
|
|
||||||
|
|
||||||
checkMeshCourantNo =
|
|
||||||
pimple.dict().lookupOrDefault("checkMeshCourantNo", false);
|
|
||||||
|
|
||||||
moveMeshOuterCorrectors =
|
|
||||||
pimple.dict().lookupOrDefault("moveMeshOuterCorrectors", false);
|
|
||||||
@ -64,9 +64,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"
|
||||||
|
|
||||||
@ -96,7 +94,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
|
||||||
|
|||||||
@ -54,12 +54,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
|
||||||
(
|
(
|
||||||
@ -70,11 +72,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"
|
||||||
|
|
||||||
@ -88,7 +92,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"
|
||||||
|
|
||||||
@ -120,7 +124,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"
|
||||||
|
|
||||||
|
|||||||
@ -59,8 +59,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"
|
||||||
|
|
||||||
@ -89,7 +87,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"
|
||||||
|
|
||||||
|
|||||||
@ -497,6 +497,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
|
||||||
{
|
{
|
||||||
|
|||||||
@ -125,6 +125,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;
|
||||||
};
|
};
|
||||||
@ -135,10 +141,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "staticFvMesh.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "dynamicFvMesh.H"
|
#include "staticFvMesh.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
|
|
||||||
bool correctPhi
|
bool correctPhi
|
||||||
(
|
(
|
||||||
pimple.dict().lookupOrDefault("correctPhi", true)
|
pimple.dict().lookupOrDefault("correctPhi", mesh.dynamic())
|
||||||
);
|
);
|
||||||
|
|
||||||
bool checkMeshCourantNo
|
bool checkMeshCourantNo
|
||||||
19
src/dynamicFvMesh/include/readDyMControls.H
Normal file
19
src/dynamicFvMesh/include/readDyMControls.H
Normal 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
|
||||||
|
);
|
||||||
@ -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();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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,25 @@ Description
|
|||||||
|
|
||||||
autoPtr<surfaceVectorField> rhoUf;
|
autoPtr<surfaceVectorField> rhoUf;
|
||||||
|
|
||||||
IOobject rhoUfHeader
|
if (mesh.dynamic())
|
||||||
(
|
{
|
||||||
|
Info<< "Constructing face momentum rhoUf" << endl;
|
||||||
|
|
||||||
|
rhoUf.reset
|
||||||
|
(
|
||||||
|
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.reset(new surfaceVectorField(rhoUfHeader, mesh));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -31,28 +31,6 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
if (mesh.changing())
|
#error Remove rhoUpdateUf.H
|
||||||
{
|
|
||||||
if (!rhoUf.valid())
|
|
||||||
{
|
|
||||||
Info<< "Constructing face momentum rhoUf" << endl;
|
|
||||||
|
|
||||||
rhoUf.reset
|
|
||||||
(
|
|
||||||
new surfaceVectorField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rhoUf",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::READ_IF_PRESENT,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
fvc::interpolate(rho*U)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -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,25 @@ Description
|
|||||||
|
|
||||||
autoPtr<surfaceVectorField> Uf;
|
autoPtr<surfaceVectorField> Uf;
|
||||||
|
|
||||||
IOobject UfHeader
|
if (mesh.dynamic())
|
||||||
(
|
{
|
||||||
|
Info<< "Constructing face velocity Uf\n" << endl;
|
||||||
|
|
||||||
|
Uf.reset
|
||||||
|
(
|
||||||
|
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.reset(new surfaceVectorField(UfHeader, mesh));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -31,28 +31,6 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
if (mesh.changing())
|
#error Remove updateUf.H
|
||||||
{
|
|
||||||
if (!Uf.valid())
|
|
||||||
{
|
|
||||||
Info<< "Constructing face velocity Uf" << endl;
|
|
||||||
|
|
||||||
Uf.reset
|
|
||||||
(
|
|
||||||
new surfaceVectorField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"Uf",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::READ_IF_PRESENT,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
fvc::interpolate(U)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -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());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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());
|
||||||
|
|||||||
@ -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)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user