Skip to content
Snippets Groups Projects
Commit 9ad02ff7 authored by Henry's avatar Henry
Browse files

fireFoam: Updated solver and tutorials from OpenFOAM-1.7.x

parent f343bafb
Branches
Tags
No related merge requests found
Showing
with 402 additions and 93 deletions
...@@ -13,7 +13,9 @@ solve ...@@ -13,7 +13,9 @@ solve
== ==
fvc::reconstruct fvc::reconstruct
( (
fvc::interpolate(rho)*(g & mesh.Sf()) (
- fvc::snGrad(p)*mesh.magSf() - ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
) )
); );
combustionModel/combustionModel.C combustionModel/combustionModel.C
combustionModel/combustionModelNew.C combustionModel/newCombustionModel.C
infinitelyFastChemistry/infinitelyFastChemistry.C infinitelyFastChemistry/infinitelyFastChemistry.C
......
...@@ -29,19 +29,22 @@ License ...@@ -29,19 +29,22 @@ License
Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
( (
const dictionary& propDict, const dictionary& combustionProperties,
const hsCombustionThermo& thermo, const hsCombustionThermo& thermo,
const compressible::turbulenceModel& turbulence, const compressible::turbulenceModel& turbulence,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const volScalarField& rho const volScalarField& rho
) )
{ {
const word modelType(propDict.lookup("combustionModel")); word combustionModelTypeName = combustionProperties.lookup
(
"combustionModel"
);
Info<< "Selecting combustion model " << modelType << endl; Info<< "Selecting combustion model " << combustionModelTypeName << endl;
dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType); dictionaryConstructorTablePtr_->find(combustionModelTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end()) if (cstrIter == dictionaryConstructorTablePtr_->end())
{ {
...@@ -49,14 +52,14 @@ Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New ...@@ -49,14 +52,14 @@ Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
( (
"combustionModel::New" "combustionModel::New"
) << "Unknown combustionModel type " ) << "Unknown combustionModel type "
<< modelType << nl << nl << combustionModelTypeName << endl << endl
<< "Valid combustionModels are : " << endl << "Valid combustionModels are : " << endl
<< dictionaryConstructorTablePtr_->toc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError); << exit(FatalError);
} }
return autoPtr<combustionModel> return autoPtr<combustionModel>
(cstrIter()(propDict, thermo, turbulence, phi, rho)); (cstrIter()(combustionProperties, thermo, turbulence, phi, rho));
} }
......
...@@ -88,8 +88,9 @@ public: ...@@ -88,8 +88,9 @@ public:
); );
//- Destructor // Destructor
virtual ~infinitelyFastChemistry();
virtual ~infinitelyFastChemistry();
// Member Functions // Member Functions
......
...@@ -83,8 +83,9 @@ public: ...@@ -83,8 +83,9 @@ public:
); );
//- Destructor // Destructor
virtual ~noCombustion();
virtual ~noCombustion();
// Member Functions // Member Functions
......
...@@ -35,6 +35,7 @@ const volScalarField& psi = thermo.psi(); ...@@ -35,6 +35,7 @@ const volScalarField& psi = thermo.psi();
volScalarField& ft = composition.Y("ft"); volScalarField& ft = composition.Y("ft");
volScalarField& fu = composition.Y("fu"); volScalarField& fu = composition.Y("fu");
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U volVectorField U
...@@ -73,7 +74,7 @@ IOdictionary combustionProperties ...@@ -73,7 +74,7 @@ IOdictionary combustionProperties
Info<< "Creating combustion model\n" << endl; Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModel> combustion autoPtr<combustionModel> combustion
( (
combustionModel::New combustionModel::combustionModel::New
( (
combustionProperties, combustionProperties,
thermo, thermo,
...@@ -83,6 +84,29 @@ autoPtr<combustionModel> combustion ...@@ -83,6 +84,29 @@ autoPtr<combustionModel> combustion
) )
); );
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("gh", g & mesh.Cf());
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
// Force p_rgh to be consistent with p
p_rgh = p - rho*gh;
volScalarField dQ volScalarField dQ
( (
IOobject IOobject
...@@ -103,15 +127,6 @@ volScalarField DpDt = ...@@ -103,15 +127,6 @@ volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("gh", g & mesh.Cf());
p += rho*gh;
thermo.correct();
dimensionedScalar initialMass = fvc::domainIntegrate(rho); dimensionedScalar initialMass = fvc::domainIntegrate(rho);
......
bool closedVolume = false;
rho = thermo.rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A(); volScalarField rUA = 1.0/UEqn.A();
...@@ -15,43 +13,41 @@ surfaceScalarField phiU ...@@ -15,43 +13,41 @@ surfaceScalarField phiU
) )
); );
phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf()); phi = phiU - rhorUAf*ghf*fvc::snGrad(rho)*mesh.magSf();
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
surfaceScalarField rhorUAf = fvc::interpolate(rho*rUA); surfaceScalarField rhorUAf = fvc::interpolate(rho*rUA);
fvScalarMatrix pEqn fvScalarMatrix p_rghEqn
( (
fvm::ddt(psi,p) fvm::ddt(psi, p_rgh) + fvc::ddt(psi, rho)*gh
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rhorUAf, p) - fvm::laplacian(rhorUAf, p_rgh)
); );
closedVolume = p.needReference(); p_rghEqn.solve
(
pEqn.solve mesh.solver
( (
mesh.solver p_rgh.select
( (
p.select
( (
( finalIter
finalIter && corr == nCorr-1
&& corr == nCorr-1 && nonOrth == nNonOrthCorr
&& nonOrth == nNonOrthCorr
)
) )
) )
); )
);
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
phi += pEqn.flux(); phi += p_rghEqn.flux();
} }
} }
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); p = p_rgh + rho*gh;
#include "rhoEqn.H" #include "rhoEqn.H"
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
...@@ -59,12 +55,4 @@ DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); ...@@ -59,12 +55,4 @@ DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf); U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
// For closed-volume cases adjust the pressure and density levels DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
// to obey overall mass continuity
if (closedVolume)
{
p +=
(initialMass - fvc::domainIntegrate(thermo.psi()*p))
/fvc::domainIntegrate(thermo.psi());
rho = thermo.rho();
}
...@@ -24,7 +24,7 @@ boundaryField ...@@ -24,7 +24,7 @@ boundaryField
{ {
type greyDiffusiveRadiation; type greyDiffusiveRadiation;
T T; T T;
emissivity 1.0 emissivity 1.0;
value uniform 0; value uniform 0;
} }
} }
......
...@@ -11,7 +11,7 @@ FoamFile ...@@ -11,7 +11,7 @@ FoamFile
format ascii; format ascii;
class volScalarField; class volScalarField;
location "0"; location "0";
object p; object p_rgh;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -23,26 +23,23 @@ boundaryField ...@@ -23,26 +23,23 @@ boundaryField
{ {
outlet outlet
{ {
type buoyantPressure; type calculated;
value uniform 101325; value $internalField;
} }
sides sides
{ {
type uniformDensityHydrostaticPressure; type calculated;
rho 1.2;
pRefValue 101325;
pRefPoint (0 0 0);
value $internalField; value $internalField;
} }
base base
{ {
type buoyantPressure; type calculated;
value $internalField; value $internalField;
} }
inlet inlet
{ {
type buoyantPressure; type calculated;
value $internalField; value $internalField;
} }
frontBack frontBack
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 101325;
boundaryField
{
outlet
{
type buoyantPressure;
value uniform 101325;
}
sides
{
type fixedValue;
value $internalField;
}
base
{
type buoyantPressure;
value $internalField;
}
inlet
{
type buoyantPressure;
value $internalField;
}
frontBack
{
type empty;
}
}
// ************************************************************************* //
...@@ -15,31 +15,37 @@ FoamFile ...@@ -15,31 +15,37 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
4 5
( (
base base
{ {
type patch; type patch;
nFaces 150; nFaces 134;
startFace 44700; startFace 44700;
} }
outlet outlet
{ {
type patch; type patch;
nFaces 150; nFaces 150;
startFace 44850; startFace 44834;
} }
sides sides
{ {
type patch; type patch;
nFaces 300; nFaces 300;
startFace 45000; startFace 44984;
} }
frontAndBack frontAndBack
{ {
type empty; type empty;
nFaces 45000; nFaces 45000;
startFace 45300; startFace 45284;
}
inlet
{
type patch;
nFaces 16;
startFace 90284;
} }
) )
......
...@@ -36,7 +36,7 @@ writeFormat ascii; ...@@ -36,7 +36,7 @@ writeFormat ascii;
writePrecision 6; writePrecision 6;
writeCompression off; writeCompression uncompressed;
timeFormat general; timeFormat general;
...@@ -44,7 +44,7 @@ timePrecision 6; ...@@ -44,7 +44,7 @@ timePrecision 6;
graphFormat raw; graphFormat raw;
runTimeModifiable true; runTimeModifiable yes;
adjustTimeStep yes; adjustTimeStep yes;
......
...@@ -44,16 +44,7 @@ divSchemes ...@@ -44,16 +44,7 @@ divSchemes
laplacianSchemes laplacianSchemes
{ {
default none; default Gauss linear uncorrected;
laplacian(muEff,U) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
laplacian(DBEff,B) Gauss linear corrected;
laplacian(alphaEff,hs) Gauss linear uncorrected;
laplacian(alphaEff,fu) Gauss linear uncorrected;
laplacian(alphaEff,ft) Gauss linear uncorrected;
laplacian((((rho*(1|A(U)))*rho)*gh)) Gauss linear uncorrected;
laplacian(interpolate((rho*(1|A(U)))),p) Gauss linear uncorrected;
laplacian(gammaRad,G) Gauss linear corrected;
} }
interpolationSchemes interpolationSchemes
...@@ -69,7 +60,7 @@ snGradSchemes ...@@ -69,7 +60,7 @@ snGradSchemes
fluxRequired fluxRequired
{ {
default no; default no;
p; p_rgh;
} }
......
...@@ -33,7 +33,7 @@ solvers ...@@ -33,7 +33,7 @@ solvers
relTol 0; relTol 0;
}; };
p p_rgh
{ {
solver GAMG; solver GAMG;
tolerance 1e-7; tolerance 1e-7;
...@@ -45,9 +45,9 @@ solvers ...@@ -45,9 +45,9 @@ solvers
mergeLevels 1; mergeLevels 1;
}; };
pFinal p_rghFinal
{ {
$p; $p_rgh;
tolerance 1e-7; tolerance 1e-7;
relTol 0; relTol 0;
}; };
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object G;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 0 -3 0 0 0 0];
internalField uniform 0;
boundaryField
{
".*"
{
type MarshakRadiation;
T T;
emissivity 1;
value uniform 0;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object IDefault;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 0 -3 0 0 0 0];
internalField uniform 0;
boundaryField
{
".*"
{
type greyDiffusiveRadiation;
T T;
emissivity 1.0;
value uniform 0;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 300;
boundaryField
{
outlet
{
type inletOutlet;
inletValue uniform 300;
value uniform 300;
}
sides
{
type inletOutlet;
inletValue uniform 300;
value uniform 300;
}
base
{
type zeroGradient;
}
inlet
{
type fixedValue;
value uniform 300;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value uniform (0 0 0);
}
sides
{
type pressureInletOutletVelocity;
outletValue uniform (0 0 0);
value uniform (0 0 0);
}
base
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type fixedValue;
value uniform (0 0.05 0);
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object alphaSgs;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
outlet
{
type zeroGradient;
}
sides
{
type zeroGradient;
}
base
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object b;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
outlet
{
type zeroGradient;
}
sides
{
type zeroGradient;
}
base
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
}
// ************************************************************************* //
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment