Updates to compressible SRF and MRF enthalpy equation

Conflicts:
	applications/solvers/compressible/steadyCompressibleFoam/hEqn.H
This commit is contained in:
Hrvoje Jasak 2014-08-15 16:39:30 +01:00 committed by Dominik Christ
parent dc6d3f61dc
commit 8e56da0041
33 changed files with 186 additions and 6838 deletions

View file

@ -9,11 +9,25 @@
// Create rotational velocity (= omega x r) // Create rotational velocity (= omega x r)
Urot = U - Urel; Urot = U - Urel;
// Calculate face velocity from absolute flux
surfaceScalarField rhof = fvc::interpolate(rho);
surfaceScalarField phiAbs
(
"phiAbs",
phi
);
mrfZones.absoluteFlux(rhof, phiAbs);
surfaceScalarField faceU("faceU", phiAbs/rhof);
fvScalarMatrix iEqn fvScalarMatrix iEqn
( (
fvm::ddt(rho, i) fvm::ddt(rho, i)
+ fvm::div(phi, i) + fvm::div(phi, i)
- fvm::laplacian(turbulence->alphaEff(), i) - fvm::laplacian(turbulence->alphaEff(), i)
// u & gradP term (steady-state formulation)
+ fvm::SuSp((fvc::div(faceU, p, "div(U,p)") - fvc::div(faceU)*p)/i, i)
== ==
// Viscous heating: note sign (devRhoReff has a minus in it) // Viscous heating: note sign (devRhoReff has a minus in it)
- (turbulence->devRhoReff() && fvc::grad(Urel)) - (turbulence->devRhoReff() && fvc::grad(Urel))

View file

@ -85,3 +85,18 @@
), ),
Urel + SRF->U() Urel + SRF->U()
); );
// Create rothalpy, in two steps to preserve boundary conditions
volScalarField i
(
IOobject
(
"i",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
h
);
i -= 0.5*magSqr(SRF->U());

View file

@ -1,33 +0,0 @@
{
// Solve the enthalpy equation
T.storePrevIter();
surfaceScalarField faceU = phi/fvc::interpolate(rho);
fvScalarMatrix hEqn
(
fvm::ddt(rho, h)
+ fvm::div(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
// ddt(p) term removed: steady-state. HJ, 27/Apr/2010
fvc::div(faceU, p, "div(U,p)")
- p*fvc::div(faceU)
// Viscous heating: note sign (devRhoReff has a minus in it)
- (turbulence->devRhoReff() && fvc::grad(Urel))
);
hEqn.relax();
eqnResidual = hEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);
// Bound the enthalpy using TMin and TMax
volScalarField Cp = thermo.Cp();
h = Foam::min(h, TMax*Cp);
h = Foam::max(h, TMin*Cp);
h.correctBoundaryConditions();
thermo.correct();
}

View file

@ -0,0 +1,47 @@
{
// Solve the enthalpy equation
T.storePrevIter();
// Calculate face velocity from flux
surfaceScalarField faceU
(
"faceU",
phi/fvc::interpolate(rho) + (SRF->faceU() & mesh.Sf())
);
fvScalarMatrix iEqn
(
fvm::ddt(rho, i)
+ fvm::div(phi, i)
- fvm::laplacian(turbulence->alphaEff(), i)
// u & gradP term (steady-state formulation)
+ fvm::SuSp((fvc::div(faceU, p, "div(U,p)") - p*fvc::div(faceU))/i, i)
==
// ddt(p) term removed: steady-state. HJ, 27/Apr/2010
// Viscous heating: note sign (devRhoReff has a minus in it)
- (turbulence->devRhoReff() && fvc::grad(Urel))
);
iEqn.relax();
eqnResidual = iEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);
// Calculate enthalpy out of rothalpy
volVectorField Urot("Urot", SRF->U());
h = i + 0.5*magSqr(Urot);
h.correctBoundaryConditions();
// Bound the enthalpy using TMin and TMax
volScalarField Cp = thermo.Cp();
h = Foam::min(h, TMax*Cp);
h = Foam::max(h, TMin*Cp);
h.correctBoundaryConditions();
// Re-initialise rothalpy based on limited enthalpy
i = h - 0.5*magSqr(Urot);
thermo.correct();
}

View file

@ -65,10 +65,9 @@ int main(int argc, char *argv[])
# include "initConvergenceCheck.H" # include "initConvergenceCheck.H"
# include "UEqn.H" # include "UEqn.H"
# include "iEqn.H"
# include "pEqn.H" # include "pEqn.H"
# include "hEqn.H"
# include "rhoFromP.H" # include "rhoFromP.H"
// Correct turbulence // Correct turbulence

View file

@ -208,6 +208,26 @@ Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::U() const
} }
Foam::tmp<Foam::surfaceVectorField> Foam::SRF::SRFModel::faceU() const
{
return tmp<surfaceVectorField>
(
new surfaceVectorField
(
IOobject
(
"faceUsrf",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
omega_ ^ (mesh_.Cf() - axis_*(axis_ & mesh_.Cf()))
)
);
}
Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::Uabs() const Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::Uabs() const
{ {
const volVectorField Usrf = U(); const volVectorField Usrf = U();

View file

@ -171,6 +171,9 @@ public:
//- Return velocity of SRF for complete mesh //- Return velocity of SRF for complete mesh
tmp<volVectorField> U() const; tmp<volVectorField> U() const;
//- Return face velocity of SRF for complete mesh
tmp<surfaceVectorField> faceU() const;
//- Return absolute velocity for complete mesh //- Return absolute velocity for complete mesh
tmp<volVectorField> Uabs() const; tmp<volVectorField> Uabs() const;
}; };

View file

@ -27,7 +27,7 @@ deltaT 1;
writeControl timeStep; writeControl timeStep;
writeInterval 50; writeInterval 200;
purgeWrite 0; purgeWrite 0;

View file

@ -42,10 +42,6 @@ divSchemes
div(phi,i) Gauss upwind; div(phi,i) Gauss upwind;
div(phid,p) Gauss upwind; div(phid,p) Gauss upwind;
// div(phi,U) Gauss vanLeerDC;
// div(phi,h) Gauss vanLeerDC;
// div(phid,p) Gauss vanLeerDC;
div(phi,k) Gauss upwind; div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind; div(phi,epsilon) Gauss upwind;
div((muEff*dev2(grad(U).T()))) Gauss linear; div((muEff*dev2(grad(U).T()))) Gauss linear;

View file

@ -24,8 +24,8 @@ solvers
minIter 0; minIter 0;
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.001; relTol 0.01;
}; }
U U
{ {
solver BiCGStab; solver BiCGStab;
@ -90,11 +90,6 @@ relaxationFactors
fieldBounds fieldBounds
{ {
// No bounding
// p 0 1e7;
// T 0 10000;
// U 1e6;
// With bounding // With bounding
p 2e4 1e6; p 2e4 1e6;
T 200 500; T 200 500;

View file

@ -22,24 +22,19 @@ boundaryField
{ {
inlet inlet
{ {
type fixedValue; type totalTemperature;
phi phi;
rho none;
psi psi;
U Uabs;
gamma 1.4;
T0 uniform 300;
value $internalField; value $internalField;
} }
outlet outlet
{ {
// type zeroGradient; type zeroGradient;
type waveTransmissive;
phi phi;
rho rho;
psi psi;
U Urel;
gamma 1.4;
inletOutlet true;
correctSupercritical false;
lInf 0.0;
fieldInf 300;
value $internalField; value $internalField;
} }

View file

@ -16,34 +16,20 @@ FoamFile
dimensions [0 1 -1 0 0 0 0]; dimensions [0 1 -1 0 0 0 0];
internalField uniform (234 0 0); internalField uniform (100 0 0);
boundaryField boundaryField
{ {
inlet inlet
{ {
type SRFVelocity; type pressureInletVelocity;
relative yes; value uniform (100 0 0);
inletValue uniform (234 0 0);
value uniform (234 0 0);
} }
outlet outlet
{ {
type inletOutlet; type inletOutlet;
inletValue uniform (0 0 0); inletValue uniform (0 0 0);
// type waveTransmissive;
// phi phi;
// rho rho;
// psi psi;
// U U;
// gamma 1.4;
// inletOutlet true;
// correctSupercritical false;
// lInf 0;
// fieldInf (0 0 0);
// value $internalField;
} }
blade blade

View file

@ -52,7 +52,6 @@ boundaryField
frontAndBack frontAndBack
{ {
type cyclic; type cyclic;
value uniform 0;
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -58,7 +58,6 @@ boundaryField
frontAndBack frontAndBack
{ {
type cyclic; type cyclic;
value uniform 0;
} }
} }

View file

@ -22,36 +22,20 @@ boundaryField
{ {
inlet inlet
{ {
type zeroGradient; type totalPressure;
phi phi;
// type waveTransmissiveInlet; rho none;
// phi phi; psi psi;
// rho rho; U Uabs;
// psi psi; gamma 1.4;
// U Urel; p0 uniform 1.4e5;
// gamma 1.4; value $internalField;
// inletOutlet false;
// correctSupercritical false;
// lInf 0.0;
// fieldInf 101325;
// value uniform 101325;
} }
outlet outlet
{ {
// type fixedValue; type fixedValue;
value $internalField;
type waveTransmissive;
phi phi;
rho rho;
psi psi;
U Urel;
gamma 1.4;
inletOutlet false;
correctSupercritical true;
lInf 0.1;
fieldInf 101325;
value uniform 101325;
} }
blade blade

View file

@ -17,12 +17,10 @@ FoamFile
SRFModel rpm; SRFModel rpm;
axis (1 0 0); axis (1 0 0);
// axis (-1 0 0);
rpmCoeffs rpmCoeffs
{ {
rpm 30000; rpm 30000;
// rpm 9600;
} }
// ************************************************************************* // // ************************************************************************* //

View file

@ -16,6 +16,7 @@ FoamFile
thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>; thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
// name, nMoles, mol weight, CP, Hf, mu, Pr;
mixture air 1 28.9 1007 0 1.48e-5 0.7; mixture air 1 28.9 1007 0 1.48e-5 0.7;
// ************************************************************************* // // ************************************************************************* //

View file

@ -20,13 +20,13 @@ startTime 0;
stopAt endTime; stopAt endTime;
endTime 1500; endTime 2000;
deltaT 1; deltaT 1;
writeControl timeStep; writeControl timeStep;
writeInterval 50; writeInterval 200;
purgeWrite 0; purgeWrite 0;

View file

@ -19,9 +19,8 @@ ddtSchemes
default none; default none;
ddt(rho,Urel) steadyState; ddt(rho,Urel) steadyState;
ddt(rho,h) steadyState; ddt(rho,i) steadyState;
// ddt(rho,h) steadyInertial phi rho 1; ddt(psi,p) steadyInertial phi rho 0.25;
ddt(psi,p) steadyInertial phi rho 0.7;
ddt(rho,k) steadyState; ddt(rho,k) steadyState;
ddt(rho,epsilon) steadyState; ddt(rho,epsilon) steadyState;
@ -39,13 +38,9 @@ gradSchemes
divSchemes divSchemes
{ {
default none; default none;
// div(phi,Urel) Gauss upwind; div(phi,Urel) Gauss upwind;
// div(phi,h) Gauss upwind; div(phi,i) Gauss upwind;
// div(phid,p) Gauss upwind; div(phid,p) Gauss upwind;
div(phi,Urel) Gauss vanLeerDC;
div(phi,h) Gauss vanLeerDC;
div(phid,p) Gauss vanLeerDC;
div(phi,k) Gauss upwind; div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind; div(phi,epsilon) Gauss upwind;

View file

@ -24,8 +24,8 @@ solvers
minIter 0; minIter 0;
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.001; relTol 0.01;
}; }
Urel Urel
{ {
solver BiCGStab; solver BiCGStab;
@ -35,8 +35,8 @@ solvers
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0.01;
}; }
h i
{ {
solver BiCGStab; solver BiCGStab;
preconditioner DILU; preconditioner DILU;
@ -45,7 +45,7 @@ solvers
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0.01;
}; }
k k
{ {
solver BiCGStab; solver BiCGStab;
@ -54,8 +54,8 @@ solvers
minIter 0; minIter 0;
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0.0;
}; }
epsilon epsilon
{ {
solver BiCGStab; solver BiCGStab;
@ -64,14 +64,14 @@ solvers
minIter 0; minIter 0;
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0.0;
}; }
} }
PIMPLE PIMPLE
{ {
nOuterCorrectors 1; nOuterCorrectors 1;
nCorrectors 3; nCorrectors 2;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }
@ -80,24 +80,19 @@ relaxationFactors
// Note: under-relaxation factors used in wave-transmissive schemes // Note: under-relaxation factors used in wave-transmissive schemes
Urel 0.5; Urel 0.5;
p 0.2; p 0.2;
h 0.5; i 0.1;
rho 0.5; rho 0.5;
k 0.3; k 0.2;
epsilon 0.3; epsilon 0.2;
} }
fieldBounds fieldBounds
{ {
// No bounding
// p 0 1e7;
// T 0 10000;
// Urel 1e6;
// With bounding // With bounding
p 50 1e6; p 2e4 1e6;
T 20 3000; T 200 500;
Urel 1000; Urel 500;
} }
// ************************************************************************* // // ************************************************************************* //

View file

@ -22,24 +22,19 @@ boundaryField
{ {
inlet inlet
{ {
type fixedValue; type totalTemperature;
phi phi;
rho none;
psi psi;
U Uabs;
gamma 1.4;
T0 uniform 300;
value $internalField; value $internalField;
} }
outlet outlet
{ {
// type zeroGradient; type zeroGradient;
type waveTransmissive;
phi phi;
rho rho;
psi psi;
U Urel;
gamma 1.4;
inletOutlet true;
correctSupercritical false;
lInf 0.0;
fieldInf 300;
value $internalField; value $internalField;
} }

View file

@ -16,34 +16,20 @@ FoamFile
dimensions [0 1 -1 0 0 0 0]; dimensions [0 1 -1 0 0 0 0];
internalField uniform (234 0 0); internalField uniform (100 0 0);
boundaryField boundaryField
{ {
inlet inlet
{ {
type SRFVelocity; type pressureInletVelocity;
relative yes; value uniform (100 0 0);
inletValue uniform (234 0 0);
value uniform (234 0 0);
} }
outlet outlet
{ {
type inletOutlet; type inletOutlet;
inletValue uniform (0 0 0); inletValue uniform (0 0 0);
// type waveTransmissive;
// phi phi;
// rho rho;
// psi psi;
// U U;
// gamma 1.4;
// inletOutlet true;
// correctSupercritical false;
// lInf 0;
// fieldInf (0 0 0);
// value $internalField;
} }
blade blade

View file

@ -52,7 +52,6 @@ boundaryField
frontAndBack frontAndBack
{ {
type cyclic; type cyclic;
value uniform 0;
} }
} }

View file

@ -65,7 +65,6 @@ boundaryField
frontAndBack frontAndBack
{ {
type cyclic; type cyclic;
value uniform 100;
} }
} }

View file

@ -58,7 +58,6 @@ boundaryField
frontAndBack frontAndBack
{ {
type cyclic; type cyclic;
value uniform 0;
} }
} }

View file

@ -22,36 +22,20 @@ boundaryField
{ {
inlet inlet
{ {
type zeroGradient; type totalPressure;
phi phi;
// type waveTransmissiveInlet; rho none;
// phi phi; psi psi;
// rho rho; U Uabs;
// psi psi; gamma 1.4;
// U Urel; p0 uniform 1.4e5;
// gamma 1.4; value $internalField;
// inletOutlet false;
// correctSupercritical false;
// lInf 0.0;
// fieldInf 101325;
// value uniform 101325;
} }
outlet outlet
{ {
// type fixedValue; type fixedValue;
value $internalField;
type waveTransmissive;
phi phi;
rho rho;
psi psi;
U Urel;
gamma 1.4;
inletOutlet false;
correctSupercritical true;
lInf 0.1;
fieldInf 101325;
value uniform 101325;
} }
blade blade

View file

@ -20,7 +20,6 @@ axis (-1 0 0);
rpmCoeffs rpmCoeffs
{ {
// rpm 15000;
rpm 20000; rpm 20000;
} }

View file

@ -26,7 +26,7 @@ deltaT 1;
writeControl timeStep; writeControl timeStep;
writeInterval 50; writeInterval 200;
purgeWrite 0; purgeWrite 0;

View file

@ -19,9 +19,8 @@ ddtSchemes
default none; default none;
ddt(rho,Urel) steadyState; ddt(rho,Urel) steadyState;
ddt(rho,h) steadyState; ddt(rho,i) steadyState;
// ddt(rho,h) steadyInertial phi rho 1; ddt(psi,p) steadyInertial phi rho 0.25;
ddt(psi,p) steadyInertial phi rho 0.8;
ddt(rho,k) steadyState; ddt(rho,k) steadyState;
ddt(rho,epsilon) steadyState; ddt(rho,epsilon) steadyState;
@ -40,7 +39,7 @@ divSchemes
{ {
default none; default none;
div(phi,Urel) Gauss upwind; div(phi,Urel) Gauss upwind;
div(phi,h) Gauss upwind; div(phi,i) Gauss upwind;
div(phid,p) Gauss upwind; div(phid,p) Gauss upwind;
div(phi,k) Gauss upwind; div(phi,k) Gauss upwind;

View file

@ -25,7 +25,7 @@ solvers
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0.01;
}; }
Urel Urel
{ {
solver BiCGStab; solver BiCGStab;
@ -35,8 +35,8 @@ solvers
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0.01;
}; }
h i
{ {
solver BiCGStab; solver BiCGStab;
preconditioner DILU; preconditioner DILU;
@ -45,7 +45,7 @@ solvers
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.01; relTol 0.01;
}; }
k k
{ {
solver BiCGStab; solver BiCGStab;
@ -55,7 +55,7 @@ solvers
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.0; relTol 0.0;
}; }
epsilon epsilon
{ {
solver BiCGStab; solver BiCGStab;
@ -65,7 +65,7 @@ solvers
maxIter 1000; maxIter 1000;
tolerance 1e-8; tolerance 1e-8;
relTol 0.0; relTol 0.0;
}; }
} }
PIMPLE PIMPLE
@ -79,25 +79,20 @@ relaxationFactors
{ {
// Note: under-relaxation factors used in wave-transmissive schemes // Note: under-relaxation factors used in wave-transmissive schemes
Urel 0.5; Urel 0.5;
p 0.3; p 0.2;
h 0.5; i 0.1;
rho 0.5; rho 0.5;
k 0.5; k 0.2;
epsilon 0.5; epsilon 0.2;
} }
fieldBounds fieldBounds
{ {
// No bounding
// p 0 1e7;
// T 0 10000;
// Urel 1e6;
// With bounding // With bounding
p 50 1e6; p 2e4 1e6;
T 20 3000; T 200 500;
Urel 1000; Urel 500;
} }
// ************************************************************************* // // ************************************************************************* //