mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
sonicFoam family: updated
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
// Solve the Momentum equation
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
|
||||
@ -9,8 +9,8 @@ HbyA = rAU*UEqn.H();
|
||||
surfaceScalarField phid
|
||||
(
|
||||
"phid",
|
||||
fvc::interpolate(psi)*
|
||||
(
|
||||
fvc::interpolate(psi)
|
||||
*(
|
||||
(mesh.Sf() & fvc::interpolate(HbyA))
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
|
||||
)
|
||||
@ -30,8 +30,6 @@ while (pimple.correctNonOrthogonal())
|
||||
fvOptions(psi, p, rho.name())
|
||||
);
|
||||
|
||||
fvOptions.constrain(pEqn);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
EXE_INC = \
|
||||
-I.. \
|
||||
-I../../rhoPimpleFoam/rhoPimpleDyMFoam \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-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)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfluidThermophysicalModels \
|
||||
@ -15,8 +18,11 @@ EXE_LIBS = \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleLESModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-lfvOptions \
|
||||
-lfiniteVolume \
|
||||
-ldynamicMesh
|
||||
-ldynamicFvMesh \
|
||||
-ltopoChangerFvMesh \
|
||||
-ldynamicMesh \
|
||||
-lmeshTools
|
||||
|
||||
@ -11,17 +11,16 @@ surfaceScalarField phid
|
||||
"phid",
|
||||
fvc::interpolate(psi)
|
||||
*(
|
||||
(
|
||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
|
||||
)
|
||||
(mesh.Sf() & fvc::interpolate(HbyA))
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
|
||||
)
|
||||
);
|
||||
|
||||
fvc::makeRelative(phid, psi, U);
|
||||
fvOptions.makeRelative(fvc::interpolate(psi), phid);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
// Non-orthogonal pressure corrector loop
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
@ -32,13 +31,15 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
fvOptions(psi, p, rho.name())
|
||||
);
|
||||
|
||||
fvOptions.constrain(pEqn);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
phi = pEqn.flux();
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
U = HbyA - rAU*fvc::grad(p);
|
||||
|
||||
@ -24,6 +24,9 @@ License
|
||||
Application
|
||||
sonicDyMFoam
|
||||
|
||||
Group
|
||||
grpCompressibleSolvers grpMovingMeshSolvers
|
||||
|
||||
Description
|
||||
Transient solver for trans-sonic/supersonic, laminar or turbulent flow
|
||||
of a compressible gas with mesh motion..
|
||||
@ -31,9 +34,9 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "psiThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "motionSolver.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvIOoptionList.H"
|
||||
|
||||
@ -43,30 +46,68 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "createRhoUf.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
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;
|
||||
|
||||
autoPtr<motionSolver> motionPtr = motionSolver::New(mesh);
|
||||
|
||||
while (runTime.loop())
|
||||
while (runTime.run())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "readPISOControls.H"
|
||||
#include "readControls.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"
|
||||
Info<< "rhoEqn max/min : " << max(rho).value()
|
||||
<< " " << min(rho).value() << endl;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
@ -86,8 +127,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
|
||||
@ -24,6 +24,9 @@ License
|
||||
Application
|
||||
sonicFoam
|
||||
|
||||
Group
|
||||
grpCompressibleSolvers
|
||||
|
||||
Description
|
||||
Transient solver for trans-sonic/supersonic, laminar or turbulent flow
|
||||
of a compressible gas.
|
||||
@ -43,12 +46,13 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
{
|
||||
solve(fvm::ddt(rho) + fvc::div(phi));
|
||||
}
|
||||
{
|
||||
scalar sumLocalContErr =
|
||||
(sum(mag(rho - rho0 - psi*(p - p0)))/sum(rho)).value();
|
||||
|
||||
@ -40,13 +40,14 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "readThermodynamicProperties.H"
|
||||
#include "readTransportProperties.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
@ -108,6 +109,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
phi += pEqn.flux();
|
||||
|
||||
solve(fvm::ddt(rho) + fvc::div(phi));
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
|
||||
Reference in New Issue
Block a user