sonicFoam family: updated

This commit is contained in:
Henry
2014-07-29 15:17:50 +01:00
committed by Andrew Heather
parent c4a37b9832
commit 27bce3b0a1
8 changed files with 87 additions and 38 deletions

View File

@ -1,3 +1,5 @@
// Solve the Momentum equation
fvVectorMatrix UEqn fvVectorMatrix UEqn
( (
fvm::ddt(rho, U) fvm::ddt(rho, U)

View File

@ -9,8 +9,8 @@ HbyA = rAU*UEqn.H();
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
fvc::interpolate(psi)* fvc::interpolate(psi)
( *(
(mesh.Sf() & fvc::interpolate(HbyA)) (mesh.Sf() & fvc::interpolate(HbyA))
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho) + rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
) )
@ -30,8 +30,6 @@ while (pimple.correctNonOrthogonal())
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
fvOptions.constrain(pEqn);
pEqn.solve(); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())

View File

@ -1,13 +1,16 @@
EXE_INC = \ EXE_INC = \
-I.. \ -I.. \
-I../../rhoPimpleFoam/rhoPimpleDyMFoam \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
EXE_LIBS = \ EXE_LIBS = \
-lfluidThermophysicalModels \ -lfluidThermophysicalModels \
@ -15,8 +18,11 @@ EXE_LIBS = \
-lcompressibleTurbulenceModel \ -lcompressibleTurbulenceModel \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
-lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lsampling \ -lsampling \
-lfvOptions \ -lfvOptions \
-lfiniteVolume \ -ldynamicFvMesh \
-ldynamicMesh -ltopoChangerFvMesh \
-ldynamicMesh \
-lmeshTools

View File

@ -11,17 +11,16 @@ surfaceScalarField phid
"phid", "phid",
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
( (mesh.Sf() & fvc::interpolate(HbyA))
(fvc::interpolate(HbyA) & mesh.Sf())
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho) + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
) )
)
); );
fvc::makeRelative(phid, psi, U); fvc::makeRelative(phid, psi, U);
fvOptions.makeRelative(fvc::interpolate(psi), phid); fvOptions.makeRelative(fvc::interpolate(psi), phid);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) // Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
@ -32,13 +31,15 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
fvOptions.constrain(pEqn);
pEqn.solve(); pEqn.solve();
if (pimple.finalNonOrthogonalIter())
{
phi = pEqn.flux(); phi = pEqn.flux();
}
} }
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);

View File

@ -24,6 +24,9 @@ License
Application Application
sonicDyMFoam sonicDyMFoam
Group
grpCompressibleSolvers grpMovingMeshSolvers
Description Description
Transient solver for trans-sonic/supersonic, laminar or turbulent flow Transient solver for trans-sonic/supersonic, laminar or turbulent flow
of a compressible gas with mesh motion.. of a compressible gas with mesh motion..
@ -31,9 +34,9 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "psiThermo.H" #include "psiThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "motionSolver.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "fvIOoptionList.H" #include "fvIOoptionList.H"
@ -43,30 +46,68 @@ int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createDynamicFvMesh.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "createRhoUf.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
pimpleControl pimple(mesh); pimpleControl pimple(mesh);
#include "readControls.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "createPcorrTypes.H"
#include "createRhoUf.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
autoPtr<motionSolver> motionPtr = motionSolver::New(mesh); while (runTime.run())
while (runTime.loop())
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; #include "readControls.H"
#include "readPISOControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
mesh.movePoints(motionPtr->newPoints()); #include "setDeltaT.H"
{
// Store divrhoU from the previous time-step/mesh for the correctPhi
volScalarField divrhoU
(
"divrhoU",
fvc::div(fvc::absolute(phi, rho, U))
);
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// Store momentum to set rhoUf for introduced faces.
volVectorField rhoU("rhoU", rho*U);
// Do any mesh changes
mesh.update();
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & rhoUf;
#include "correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
}
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
#include "rhoEqn.H" #include "rhoEqn.H"
Info<< "rhoEqn max/min : " << max(rho).value()
<< " " << min(rho).value() << endl;
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
@ -86,8 +127,6 @@ int main(int argc, char *argv[])
} }
} }
rho = thermo.rho();
runTime.write(); runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -24,6 +24,9 @@ License
Application Application
sonicFoam sonicFoam
Group
grpCompressibleSolvers
Description Description
Transient solver for trans-sonic/supersonic, laminar or turbulent flow Transient solver for trans-sonic/supersonic, laminar or turbulent flow
of a compressible gas. of a compressible gas.
@ -43,12 +46,13 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
pimpleControl pimple(mesh);
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H" #include "createFvOptions.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;

View File

@ -1,6 +1,3 @@
{
solve(fvm::ddt(rho) + fvc::div(phi));
}
{ {
scalar sumLocalContErr = scalar sumLocalContErr =
(sum(mag(rho - rho0 - psi*(p - p0)))/sum(rho)).value(); (sum(mag(rho - rho0 - psi*(p - p0)))/sum(rho)).value();

View File

@ -40,13 +40,14 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
pimpleControl pimple(mesh);
#include "readThermodynamicProperties.H" #include "readThermodynamicProperties.H"
#include "readTransportProperties.H" #include "readTransportProperties.H"
#include "createFields.H" #include "createFields.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -108,6 +109,7 @@ int main(int argc, char *argv[])
phi += pEqn.flux(); phi += pEqn.flux();
solve(fvm::ddt(rho) + fvc::div(phi));
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);