Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2009-06-12 16:34:48 +01:00
16 changed files with 139 additions and 152 deletions

View File

@ -15,12 +15,10 @@
( (
UEqn UEqn
== ==
-fvc::reconstruct fvc::reconstruct
( (
( fvc::interpolate(rho)*(g & mesh.Sf())
fvc::snGrad(pd) - fvc::snGrad(p)*mesh.magSf()
+ ghf*fvc::snGrad(rho)
) * mesh.magSf()
) )
); );
} }

View File

@ -59,27 +59,6 @@
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("ghf", g & mesh.Cf());
dimensionedScalar pRef("pRef", p.dimensions(), thermo->lookup("pRef"));
Info<< "Creating field pd\n" << endl;
volScalarField pd
(
IOobject
(
"pd",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
p = pd + rho*gh + pRef;
thermo->correct(); thermo->correct();
dimensionedScalar initialMass = fvc::domainIntegrate(rho); dimensionedScalar initialMass = fvc::domainIntegrate(rho);

View File

@ -1,5 +1,5 @@
{ {
bool closedVolume = pd.needReference(); bool closedVolume = p.needReference();
rho = thermo->rho(); rho = thermo->rho();
@ -17,38 +17,35 @@
) )
); );
phi = phiU - ghf*fvc::snGrad(rho)*rhorUAf*mesh.magSf(); phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pdEqn fvScalarMatrix pEqn
( (
fvm::ddt(psi, pd) fvm::ddt(psi, p)
+ fvc::ddt(psi)*pRef
+ fvc::ddt(psi, rho)*gh
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rhorUAf, pd) - fvm::laplacian(rhorUAf, p)
); );
if (corr == nCorr-1 && nonOrth == nNonOrthCorr) if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{ {
pdEqn.solve(mesh.solver(pd.name() + "Final")); pEqn.solve(mesh.solver(p.name() + "Final"));
} }
else else
{ {
pdEqn.solve(mesh.solver(pd.name())); pEqn.solve(mesh.solver(p.name()));
} }
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
phi += pdEqn.flux(); phi += pEqn.flux();
} }
} }
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf); U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
p == pd + rho*gh + pRef;
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
#include "rhoEqn.H" #include "rhoEqn.H"
@ -62,6 +59,4 @@
/fvc::domainIntegrate(thermo->psi()); /fvc::domainIntegrate(thermo->psi());
rho = thermo->rho(); rho = thermo->rho();
} }
pd == p - (rho*gh + pRef);
} }

View File

@ -13,14 +13,11 @@
( (
UEqn() UEqn()
== ==
-fvc::reconstruct fvc::reconstruct
( (
( fvc::interpolate(rho)*(g & mesh.Sf())
fvc::snGrad(pd) - fvc::snGrad(p)*mesh.magSf()
+ ghf*fvc::snGrad(rho)
) * mesh.magSf()
) )
).initialResidual(); ).initialResidual();
maxResidual = max(eqnResidual, maxResidual); maxResidual = max(eqnResidual, maxResidual);

View File

@ -39,15 +39,14 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "readEnvironmentalProperties.H"
#include "createFields.H"
#include "initContinuityErrs.H"
# include "setRootCase.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "createTime.H"
# include "createMesh.H"
# include "readEnvironmentalProperties.H"
# include "createFields.H"
# include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -55,17 +54,17 @@ int main(int argc, char *argv[])
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
# include "initConvergenceCheck.H" #include "initConvergenceCheck.H"
pd.storePrevIter(); p.storePrevIter();
rho.storePrevIter(); rho.storePrevIter();
// Pressure-velocity SIMPLE corrector // Pressure-velocity SIMPLE corrector
{ {
# include "UEqn.H" #include "UEqn.H"
# include "hEqn.H" #include "hEqn.H"
# include "pEqn.H" #include "pEqn.H"
} }
turbulence->correct(); turbulence->correct();
@ -76,7 +75,7 @@ int main(int argc, char *argv[])
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
# include "convergenceCheck.H" #include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -51,38 +51,16 @@
) )
); );
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
dimensionedScalar pRef("pRef", p.dimensions(), thermo->lookup("pRef"));
Info<< "Creating field pd\n" << endl;
volScalarField pd
(
IOobject
(
"pd",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
p = pd + rho*gh + pRef;
thermo->correct(); thermo->correct();
label pRefCell = 0;
label pdRefCell = 0; scalar pRefValue = 0.0;
scalar pdRefValue = 0.0;
setRefCell setRefCell
( (
pd, p,
mesh.solutionDict().subDict("SIMPLE"), mesh.solutionDict().subDict("SIMPLE"),
pdRefCell, pRefCell,
pdRefValue pRefValue
); );

View File

@ -1,4 +1,6 @@
{ {
rho = thermo->rho();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rUA = 1.0/UEqn().A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
@ -7,48 +9,32 @@
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
bool closedVolume = adjustPhi(phi, U, p); bool closedVolume = adjustPhi(phi, U, p);
surfaceScalarField buoyancyPhi = ghf*fvc::snGrad(rho)*rhorUAf*mesh.magSf(); surfaceScalarField buoyancyPhi =
phi -= buoyancyPhi; rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
phi += buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pdEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rhorUAf, pd) == fvc::div(phi) fvm::laplacian(rhorUAf, p) == fvc::div(phi)
); );
pdEqn.setReference(pdRefCell, pdRefValue); pEqn.setReference(pRefCell, p[pRefCell]);
// retain the residual from the first iteration // retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pdEqn.solve().initialResidual(); eqnResidual = pEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual); maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {
pdEqn.solve(); pEqn.solve();
} }
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
// Calculate the conservative fluxes
phi -= pdEqn.flux();
// Explicitly relax pressure for momentum corrector
pd.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U -= rUA*fvc::reconstruct((buoyancyPhi + pdEqn.flux())/rhorUAf);
U.correctBoundaryConditions();
}
}
#include "continuityErrs.H"
p == pd + rho*gh + pRef;
// For closed-volume cases adjust the pressure and density levels // For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity // to obey overall mass continuity
if (closedVolume) if (closedVolume)
@ -57,10 +43,23 @@
/fvc::domainIntegrate(thermo->psi()); /fvc::domainIntegrate(thermo->psi());
} }
// Calculate the conservative fluxes
phi -= pEqn.flux();
// Explicitly relax pressure for momentum corrector
p.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorUAf);
U.correctBoundaryConditions();
}
}
#include "continuityErrs.H"
rho = thermo->rho(); rho = thermo->rho();
rho.relax(); rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
<< endl; << endl;
pd == p - (rho*gh + pRef);
} }

View File

@ -0,0 +1,42 @@
/*--------------------------------*- 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 alphat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
floor
{
type compressible::alphatWallFunction;
value uniform 0;
}
ceiling
{
type compressible::alphatWallFunction;
value uniform 0;
}
fixedWalls
{
type compressible::alphatWallFunction;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
@ -10,11 +10,12 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
object pd; location "0";
object mut;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -1 0 0 0 0];
internalField uniform 0; internalField uniform 0;
@ -22,21 +23,20 @@ boundaryField
{ {
floor floor
{ {
type fixedFluxBuoyantPressure; type mutWallFunction;
value uniform 0; value uniform 0;
} }
ceiling ceiling
{ {
type fixedFluxBuoyantPressure; type mutWallFunction;
value uniform 0; value uniform 0;
} }
fixedWalls fixedWalls
{ {
type fixedFluxBuoyantPressure; type mutWallFunction;
value uniform 0; value uniform 0;
} }
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -16,26 +16,26 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 100000; internalField uniform 1e5;
boundaryField boundaryField
{ {
floor floor
{ {
type calculated; type fixedFluxBuoyantPressure;
value uniform 100000; value uniform 1e5;
} }
ceiling ceiling
{ {
type calculated; type fixedFluxBuoyantPressure;
value uniform 100000; value uniform 1e5;
} }
fixedWalls fixedWalls
{ {
type calculated; type fixedFluxBuoyantPressure;
value uniform 100000; value uniform 1e5;
} }
} }

View File

@ -42,7 +42,7 @@ laplacianSchemes
{ {
default none; default none;
laplacian(muEff,U) Gauss linear corrected; laplacian(muEff,U) Gauss linear corrected;
laplacian((rho*(1|A(U))),pd) Gauss linear corrected; laplacian((rho*(1|A(U))),p) Gauss linear corrected;
laplacian(alphaEff,h) Gauss linear corrected; laplacian(alphaEff,h) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected; laplacian(DkEff,k) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DepsilonEff,epsilon) Gauss linear corrected;
@ -62,7 +62,7 @@ snGradSchemes
fluxRequired fluxRequired
{ {
default no; default no;
pd ; p ;
} }

View File

@ -25,7 +25,7 @@ solvers
relTol 0; relTol 0;
} }
pd p
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;
@ -33,7 +33,7 @@ solvers
relTol 0.1; relTol 0.1;
} }
pdFinal pFinal
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;

View File

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
@ -10,11 +10,12 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
object pd; location "0";
object mut;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -1 0 0 0 0];
internalField uniform 0; internalField uniform 0;
@ -22,21 +23,20 @@ boundaryField
{ {
floor floor
{ {
type fixedFluxBuoyantPressure; type mutWallFunction;
value uniform 0; value uniform 0;
} }
ceiling ceiling
{ {
type fixedFluxBuoyantPressure; type mutWallFunction;
value uniform 0; value uniform 0;
} }
fixedWalls fixedWalls
{ {
type fixedFluxBuoyantPressure; type mutWallFunction;
value uniform 0; value uniform 0;
} }
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -16,26 +16,26 @@ FoamFile
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];
internalField uniform 100000; internalField uniform 1e5;
boundaryField boundaryField
{ {
floor floor
{ {
type calculated; type fixedFluxBuoyantPressure;
value uniform 100000; value uniform 1e5;
} }
ceiling ceiling
{ {
type calculated; type fixedFluxBuoyantPressure;
value uniform 100000; value uniform 1e5;
} }
fixedWalls fixedWalls
{ {
type calculated; type fixedFluxBuoyantPressure;
value uniform 100000; value uniform 1e5;
} }
} }

View File

@ -41,7 +41,7 @@ laplacianSchemes
{ {
default none; default none;
laplacian(muEff,U) Gauss linear corrected; laplacian(muEff,U) Gauss linear corrected;
laplacian((rho*(1|A(U))),pd) Gauss linear corrected; laplacian((rho*(1|A(U))),p) Gauss linear corrected;
laplacian(alphaEff,h) Gauss linear corrected; laplacian(alphaEff,h) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected; laplacian(DkEff,k) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DepsilonEff,epsilon) Gauss linear corrected;
@ -61,7 +61,7 @@ snGradSchemes
fluxRequired fluxRequired
{ {
default no; default no;
pd ; p ;
} }

View File

@ -17,7 +17,7 @@ FoamFile
solvers solvers
{ {
pd p
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;
@ -69,16 +69,16 @@ solvers
SIMPLE SIMPLE
{ {
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
pdRefCell 0; pRefCell 0;
pdRefValue 0; pRefValue 1e5;
} }
relaxationFactors relaxationFactors
{ {
rho 1; rho 1;
pd 0.3; p 0.3;
U 0.7; U 0.7;
h 0.7; h 0.1;
k 0.7; k 0.7;
epsilon 0.7; epsilon 0.7;
R 0.7; R 0.7;