Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2013-09-13 09:44:29 +01:00
21 changed files with 192 additions and 31 deletions

View File

@ -48,6 +48,7 @@ int main(int argc, char *argv[])
#include "createEngineMesh.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "createRhoUf.H"
#include "initContinuityErrs.H"
#include "readEngineTimeControls.H"
#include "compressibleCourantNo.H"

View File

@ -72,6 +72,7 @@ int main(int argc, char *argv[])
#include "readCombustionProperties.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "createRhoUf.H"
#include "initContinuityErrs.H"
#include "readEngineTimeControls.H"
#include "compressibleCourantNo.H"

View File

@ -15,12 +15,12 @@ if (pimple.transonic())
*(
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)/fvc::interpolate(rho)
- fvc::meshPhi(rho, U)
)
);
fvc::makeRelative(phid, psi, U);
fvOptions.makeRelative(fvc::interpolate(psi), phid);
while (pimple.correctNonOrthogonal())
@ -51,11 +51,11 @@ else
"phiHbyA",
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)
- fvc::interpolate(rho)*fvc::meshPhi(rho, U)
);
fvc::makeRelative(phiHbyA, rho, U);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
while (pimple.correctNonOrthogonal())
@ -88,6 +88,15 @@ U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U);
{
rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
rhoUf +=
mesh.Sf()
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
/sqr(mesh.magSf());
}
if (thermo.dpdt())
{
dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p);

View File

@ -26,6 +26,7 @@ if (pimple.transonic())
)/fvc::interpolate(rho)
);
fvc::makeRelative(phid, psi, U);
fvOptions.makeRelative(fvc::interpolate(psi), phid);
while (pimple.correctNonOrthogonal())
@ -58,6 +59,7 @@ else
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
);
fvc::makeRelative(phiHbyA, rho, U);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
while (pimple.correctNonOrthogonal())
@ -102,6 +104,15 @@ U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U);
{
rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
rhoUf +=
mesh.Sf()
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
/sqr(mesh.magSf());
}
if (thermo.dpdt())
{
dpdt = fvc::ddt(p);

View File

@ -76,6 +76,9 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
{
// Store momentum to set rhoUf for introduced faces.
volVectorField rhoU("rhoU", rho*U);
// Store divrhoU from the previous time-step/mesh for the correctPhi
volScalarField divrhoU(fvc::div(fvc::absolute(phi, rho, U)));

View File

@ -13,12 +13,13 @@ surfaceScalarField phid
*(
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)/fvc::interpolate(rho)
- fvc::meshPhi(rho, U)
)
);
fvc::makeRelative(phid, psi, U);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
@ -37,3 +38,12 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();
{
rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
rhoUf +=
mesh.Sf()
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
/sqr(mesh.magSf());
}

View File

@ -64,12 +64,6 @@ int main(int argc, char *argv[])
mesh.movePoints(motionPtr->newPoints());
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & rhoUf;
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, rho, U);
#include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop

View File

@ -15,12 +15,12 @@ if (pimple.transonic())
*(
(
(fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)/fvc::interpolate(rho)
- fvc::meshPhi(rho, U)
)
);
fvc::makeRelative(phid, psi, U);
fvOptions.makeRelative(fvc::interpolate(psi), phid);
while (pimple.correctNonOrthogonal())
@ -52,11 +52,11 @@ else
"phiHbyA",
(
(fvc::interpolate(HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)
- fvc::interpolate(rho)*fvc::meshPhi(rho, U)
);
fvc::makeRelative(phiHbyA, rho, U);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
while (pimple.correctNonOrthogonal())
@ -90,6 +90,15 @@ U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U);
{
rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
rhoUf +=
mesh.Sf()
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
/sqr(mesh.magSf());
}
if (thermo.dpdt())
{
dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p);

View File

@ -52,6 +52,7 @@ int main(int argc, char *argv[])
#include "readGravitationalAcceleration.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "createRhoUf.H"
#include "createClouds.H"
#include "createRadiationModel.H"
#include "initContinuityErrs.H"

View File

@ -9,7 +9,17 @@
if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum(0.0*rhoPhi);
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", rhoPhi.dimensions(), 0)
);
for
(

View File

@ -3,7 +3,17 @@
if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum(0.0*rhoPhi);
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", rhoPhi.dimensions(), 0)
);
for
(

View File

@ -3,7 +3,17 @@
if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum(0.0*rhoPhi);
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", rhoPhi.dimensions(), 0)
);
for
(

View File

@ -100,6 +100,8 @@ int main(int argc, char *argv[])
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
interface.correct();
}
if (mesh.changing() && checkMeshCourantNo)

View File

@ -2,8 +2,18 @@
if (nAlphaSubCycles > 1)
{
surfaceScalarField rhoPhiSum(0.0*rhoPhi);
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", rhoPhi.dimensions(), 0)
);
for
(

View File

@ -313,7 +313,18 @@ void Foam::multiphaseMixture::solve()
if (nAlphaSubCycles > 1)
{
surfaceScalarField rhoPhiSum(0.0*rhoPhi_);
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh_
),
mesh_,
dimensionedScalar("0", rhoPhi_.dimensions(), 0)
);
dimensionedScalar totalDeltaT = runTime.deltaT();
for

View File

@ -3,7 +3,17 @@
if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum(0.0*rhoPhi);
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", rhoPhi.dimensions(), 0)
);
for
(

View File

@ -2453,6 +2453,27 @@ int main(int argc, char *argv[])
meshMod
);
// Enforce actual point posititions according to extrudeModel (model)
// (extruder.setRefinement only does fixed expansionRatio)
// The regionPoints and nLayers are looped in the same way as in
// createShellMesh
DynamicList<point>& newPoints = const_cast<DynamicList<point>&>
(
meshMod.points()
);
label meshPointI = extrudePatch.localPoints().size();
forAll(localRegionPoints, regionI)
{
label pointI = localRegionPoints[regionI];
point pt = extrudePatch.localPoints()[pointI];
const vector& n = localRegionNormals[regionI];
for (label layerI = 1; layerI <= model().nLayers(); layerI++)
{
newPoints[meshPointI++] = model()(pt, n, layerI);
}
}
shellMap = meshMod.changeMesh
(
regionMesh, // mesh to change

View File

@ -62,7 +62,10 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
// Evaluate the value field from the gradient if the internal field is valid
if (&iF && iF.size())
{
evaluate();
scalarField::operator=
(
patchInternalField() + gradient()/patch().deltaCoeffs()
);
}
}

View File

@ -176,8 +176,7 @@ ddtCorr
(
U.mesh(),
U.mesh().ddtScheme("ddt(" + U.name() + ')')
)().fvcDdtPhiCorr(rho, U, U.mesh().Sf() & Uf);
//***HGW fvcDdtUfCorr(rho, U, Uf);
)().fvcDdtUfCorr(rho, U, Uf);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,9 @@ addToRunTimeSelectionTable(extrudeModel, linearNormal, dictionary);
linearNormal::linearNormal(const dictionary& dict)
:
extrudeModel(typeName, dict),
thickness_(readScalar(coeffDict_.lookup("thickness")))
thickness_(readScalar(coeffDict_.lookup("thickness"))),
firstCellThickness_(0),
layerPoints_(nLayers_)
{
if (thickness_ <= 0)
{
@ -53,6 +55,34 @@ linearNormal::linearNormal(const dictionary& dict)
<< "thickness should be positive : " << thickness_
<< exit(FatalError);
}
coeffDict_.readIfPresent("firstCellThickness", firstCellThickness_);
if (firstCellThickness_ >= thickness_)
{
FatalErrorIn("linearNormal(const dictionary&)")
<< "firstCellThickness is larger than thickness"
<< exit(FatalError);
}
if (firstCellThickness_ > 0)
{
layerPoints_[0] = firstCellThickness_;
for (label layerI = 1; layerI < nLayers_; layerI++)
{
layerPoints_[layerI] =
(thickness_ - layerPoints_[0])
*sumThickness(layerI) + layerPoints_[0];
}
}
else
{
for (label layerI = 0; layerI < nLayers_; layerI++)
{
layerPoints_[layerI] = thickness_*sumThickness(layerI + 1);
}
}
}
@ -71,9 +101,7 @@ point linearNormal::operator()
const label layer
) const
{
//scalar d = thickness_*layer/nLayers_;
scalar d = thickness_*sumThickness(layer);
return surfacePoint + d*surfaceNormal;
return surfacePoint + layerPoints_[layer - 1]*surfaceNormal;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,6 +34,7 @@ Description
#include "point.H"
#include "extrudeModel.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,6 +56,13 @@ class linearNormal
//- layer thickness
scalar thickness_;
//- first cell thickness
scalar firstCellThickness_;
//- layer cell distibution
scalarList layerPoints_;
public: