mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -13,4 +13,5 @@
|
||||
{
|
||||
U = invA & (UEqn.H() - betav*fvc::grad(p));
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "compressibleCreatePhi.H"
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::RASModel> turbulence
|
||||
@ -58,12 +58,12 @@
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt
|
||||
(
|
||||
"DpDt",
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
|
||||
);
|
||||
|
||||
Info<< "Creating field dpdt\n" << endl;
|
||||
volScalarField dpdt("dpdt", fvc::ddt(p));
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
|
||||
Info<< "Creating the unstrained laminar flame speed\n" << endl;
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
+ mvConvection->fvmDiv(phi, h)
|
||||
- fvm::laplacian(Db, h)
|
||||
==
|
||||
betav*DpDt
|
||||
betav*dpdt
|
||||
- betav*(fvc::ddt(rho, K) + fvc::div(phi, K))
|
||||
);
|
||||
|
||||
thermo.correct();
|
||||
|
||||
@ -13,6 +13,6 @@ if (ign.ignited())
|
||||
//+ fvm::Sp(fvc::div(muEff*fvc::grad(b)/(b + 0.001)), hu)
|
||||
|
||||
==
|
||||
betav*DpDt*rho/thermo.rhou()
|
||||
betav*(dpdt - (fvc::ddt(rho, K) + fvc::div(phi, K)))*rho/thermo.rhou()
|
||||
);
|
||||
}
|
||||
|
||||
@ -64,5 +64,6 @@ else
|
||||
|
||||
U -= invA & (betav*fvc::grad(p));
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
dpdt = fvc::ddt(p);
|
||||
|
||||
@ -12,4 +12,5 @@
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
@ -60,12 +60,11 @@
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt
|
||||
(
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
|
||||
);
|
||||
Info<< "Creating field dpdt\n" << endl;
|
||||
volScalarField dpdt("dpdt", fvc::ddt(p));
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
Info<< "Creating field Xi\n" << endl;
|
||||
volScalarField Xi
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
+ mvConvection->fvmDiv(phi, h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
DpDt
|
||||
dpdt
|
||||
- (fvc::ddt(rho, K) + fvc::div(phi, K))
|
||||
);
|
||||
|
||||
hEqn.relax();
|
||||
|
||||
@ -12,7 +12,7 @@ if (ign.ignited())
|
||||
//- fvm::div(muEff*fvc::grad(b)/(b + 0.001), hu)
|
||||
//+ fvm::Sp(fvc::div(muEff*fvc::grad(b)/(b + 0.001)), hu)
|
||||
|
||||
==
|
||||
DpDt*rho/thermo.rhou()
|
||||
==
|
||||
(dpdt - (fvc::ddt(rho, K) + fvc::div(phi, K)))*rho/thermo.rhou()
|
||||
);
|
||||
}
|
||||
|
||||
@ -64,5 +64,6 @@ else
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
dpdt = fvc::ddt(p);
|
||||
|
||||
@ -54,8 +54,8 @@
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt
|
||||
(
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
|
||||
);
|
||||
Info<< "Creating field dpdt\n" << endl;
|
||||
volScalarField dpdt("dpdt", fvc::ddt(p));
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
+ fvm::div(phi, h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
DpDt
|
||||
- fvc::div(phi, 0.5*magSqr(U))
|
||||
);
|
||||
|
||||
thermo.correct();
|
||||
|
||||
@ -8,4 +8,5 @@
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
@ -57,5 +57,6 @@ else
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
dpdt = fvc::ddt(p);
|
||||
|
||||
@ -23,4 +23,6 @@
|
||||
)*mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
@ -53,7 +53,8 @@ tmp<fv::convectionScheme<scalar> > mvConvection
|
||||
+ mvConvection->fvmDiv(phi, hs)
|
||||
- fvm::laplacian(turbulence->alphaEff(), hs)
|
||||
==
|
||||
DpDt
|
||||
dpdt
|
||||
- (fvc::ddt(rho, K) + fvc::div(phi, K))
|
||||
+ combustion->Sh()
|
||||
+ radiation->Shs(thermo)
|
||||
+ parcels.Sh(hs)
|
||||
|
||||
@ -83,12 +83,12 @@
|
||||
dimensionedScalar("dQ", dimEnergy/dimTime, 0.0)
|
||||
);
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt
|
||||
(
|
||||
"DpDt",
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
|
||||
);
|
||||
|
||||
Info<< "Creating field dpdt\n" << endl;
|
||||
volScalarField dpdt("dpdt", fvc::ddt(p));
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
|
||||
Info<< "Calculating field g.h\n" << endl;
|
||||
|
||||
@ -43,5 +43,6 @@ p = p_rgh + rho*gh;
|
||||
|
||||
U += rAU*fvc::reconstruct((phi - phiU)/rhorAUf);
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
dpdt = fvc::ddt(p);
|
||||
|
||||
@ -12,4 +12,5 @@
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
@ -65,11 +65,13 @@ autoPtr<compressible::turbulenceModel> turbulence
|
||||
// Set the turbulence into the combustion model
|
||||
combustion->setTurbulence(turbulence());
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt
|
||||
(
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
|
||||
);
|
||||
|
||||
Info<< "Creating field dpdt\n" << endl;
|
||||
volScalarField dpdt("dpdt", fvc::ddt(p));
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
|
||||
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
|
||||
|
||||
|
||||
@ -6,7 +6,8 @@
|
||||
- fvm::laplacian(turbulence->alphaEff(), hs)
|
||||
// - fvm::laplacian(turbulence->muEff(), hs) // unit lewis no.
|
||||
==
|
||||
DpDt
|
||||
dpdt
|
||||
- (fvc::ddt(rho, K) + fvc::div(phi, K))
|
||||
+ combustion->Sh()
|
||||
);
|
||||
|
||||
|
||||
@ -64,5 +64,6 @@ else
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
dpdt = fvc::ddt(p);
|
||||
|
||||
@ -12,4 +12,5 @@
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
@ -67,11 +67,13 @@ autoPtr<compressible::turbulenceModel> turbulence
|
||||
// Set the turbulence into the combustion model
|
||||
combustion->setTurbulence(turbulence());
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt
|
||||
(
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
|
||||
);
|
||||
|
||||
Info<< "Creating field dpdt\n" << endl;
|
||||
volScalarField dpdt("dpdt", fvc::ddt(p));
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
|
||||
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
|
||||
|
||||
|
||||
@ -6,7 +6,8 @@
|
||||
- fvm::laplacian(turbulence->alphaEff(), hs)
|
||||
// - fvm::laplacian(turbulence->muEff(), hs) // unit lewis no.
|
||||
==
|
||||
DpDt
|
||||
dpdt
|
||||
- (fvc::ddt(rho, K) + fvc::div(phi, K))
|
||||
+ combustion->Sh()
|
||||
);
|
||||
|
||||
|
||||
@ -86,6 +86,7 @@
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
dpdt = fvc::ddt(p);
|
||||
}
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
- fvm::Sp(fvc::div(phi), h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
fvc::div(phi/fvc::interpolate(rho), rho/psi, "div(U,p)")
|
||||
- (rho/psi)*fvc::div(phi/fvc::interpolate(rho))
|
||||
- fvc::div(phi, 0.5*magSqr(U), "div(phi,K)")
|
||||
);
|
||||
|
||||
hEqn.relax();
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
- fvm::Sp(fvc::div(phi), h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p))
|
||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
||||
- fvc::div(phi, 0.5*magSqr(U), "div(phi,K)")
|
||||
);
|
||||
|
||||
hEqn.relax();
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
- fvm::Sp(fvc::div(phi), h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p))
|
||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
||||
- fvc::div(phi, 0.5*magSqr(U), "div(phi,K)")
|
||||
+ radiation->Sh(thermo)
|
||||
);
|
||||
|
||||
|
||||
@ -8,9 +8,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lbasicThermophysicalModels \
|
||||
@ -21,6 +19,4 @@ EXE_LIBS = \
|
||||
-lcompressibleLESModels \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-lradiationModels \
|
||||
-ldecompose \
|
||||
-lreconstruct
|
||||
-lradiationModels
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
|
||||
// Get mapped alpha (surfaceScalarField)
|
||||
tmp<surfaceScalarField> tallAlpha = procToAllMapper().reconstructFvSurfaceField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alpha",
|
||||
allMesh().time().timeName(),
|
||||
allMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
procAlpha
|
||||
);
|
||||
|
||||
// Get alpha from harmonic interpolation of vol quantities
|
||||
// (Note: really only needed at internal faces originating patches
|
||||
// inbetween regions)
|
||||
tmp<surfaceScalarField> allHarmonicAlpha
|
||||
(
|
||||
harmonic(allMesh()).interpolate(allVolAlpha())
|
||||
);
|
||||
|
||||
// Loop over all fluid and solid regions to transfer
|
||||
// allHarmonicAlpha to allAlpha
|
||||
surfaceScalarField& allAlpha = tallAlpha();
|
||||
forAll(boundaryProcAddressing, procI)
|
||||
{
|
||||
forAll(boundaryProcAddressing[procI], patchI)
|
||||
{
|
||||
if (boundaryProcAddressing[procI][patchI] == -1)
|
||||
{
|
||||
// Interface patch
|
||||
const labelList::subList cp =
|
||||
procMeshes[procI].boundary()[patchI].patchSlice
|
||||
(
|
||||
faceProcAddressing[procI]
|
||||
);
|
||||
|
||||
forAll(cp, faceI)
|
||||
{
|
||||
label curF = mag(cp[faceI])-1;
|
||||
if (curF < allMesh().nInternalFaces())
|
||||
{
|
||||
allAlpha[curF] = allHarmonicAlpha()[curF];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tmp<surfaceScalarField> allPhi
|
||||
(
|
||||
procToAllMapper().reconstructFvSurfaceField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
allMesh().time().timeName(),
|
||||
allMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
procPhi
|
||||
)
|
||||
);
|
||||
|
||||
// So we have nNonOrthCorr
|
||||
//#include "readSolidMultiRegionPIMPLEControls.H"
|
||||
//for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix hEqn
|
||||
(
|
||||
fvm::ddt(allRho(), allh())
|
||||
+ fvm::div(allPhi(), allh())
|
||||
- fvm::laplacian(allAlpha, allh())
|
||||
==
|
||||
allSource()
|
||||
);
|
||||
|
||||
hEqn.relax();
|
||||
hEqn.solve(allMesh().solver(allh().select(finalIter)));
|
||||
}
|
||||
@ -39,11 +39,6 @@ Description
|
||||
#include "solidRegionDiffNo.H"
|
||||
#include "basicSolidThermo.H"
|
||||
#include "radiationModel.H"
|
||||
#include "fvFieldReconstructor.H"
|
||||
#include "mixedFvPatchFields.H"
|
||||
#include "fvFieldDecomposer.H"
|
||||
#include "harmonic.H"
|
||||
#include "rmap.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,40 +49,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
regionProperties rp(runTime);
|
||||
|
||||
const label nAllRegions =
|
||||
rp.fluidRegionNames().size()
|
||||
+ rp.solidRegionNames().size();
|
||||
PtrList<labelIOList> cellProcAddressing(nAllRegions);
|
||||
PtrList<labelIOList> faceProcAddressing(nAllRegions);
|
||||
PtrList<labelIOList> boundaryProcAddressing(nAllRegions);
|
||||
PtrList<fvMesh> procMeshes(nAllRegions);
|
||||
|
||||
// Load meshes, fluid first
|
||||
labelList fluidToProc(identity(rp.fluidRegionNames().size()));
|
||||
labelList solidToProc(rp.solidRegionNames().size());
|
||||
forAll(solidToProc, i)
|
||||
{
|
||||
solidToProc[i] = fluidToProc.size()+i;
|
||||
}
|
||||
|
||||
// Get the coupled solution flag
|
||||
#include "readPIMPLEControls.H"
|
||||
|
||||
if (temperatureCoupled)
|
||||
{
|
||||
Info<< "Solving single enthalpy for all equations" << nl << endl;
|
||||
}
|
||||
|
||||
#include "createFluidMeshes.H"
|
||||
#include "createSolidMeshes.H"
|
||||
|
||||
#include "createFluidFields.H"
|
||||
#include "createSolidFields.H"
|
||||
|
||||
// Temperature solved on single mesh
|
||||
#include "createAllMesh.H"
|
||||
#include "createAllFields.H"
|
||||
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
#include "readTimeControls.H"
|
||||
@ -114,10 +81,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
|
||||
if (nOuterCorr != 1)
|
||||
{
|
||||
forAll(fluidToProc, i)
|
||||
forAll(fluidRegions, i)
|
||||
{
|
||||
#include "setRegionFluidFields.H"
|
||||
#include "storeOldFluidFields.H"
|
||||
@ -130,133 +96,22 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
bool finalIter = oCorr == nOuterCorr-1;
|
||||
|
||||
if (finalIter)
|
||||
forAll(fluidRegions, i)
|
||||
{
|
||||
forAll(procMeshes, procI)
|
||||
{
|
||||
procMeshes[procI].data::add("finalIteration", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PtrList<surfaceScalarField> procPhi(nAllRegions);
|
||||
PtrList<surfaceScalarField> procAlpha(nAllRegions);
|
||||
|
||||
|
||||
// Solve (uncoupled) or set up (coupled) the temperature equation
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
forAll(solidToProc, i)
|
||||
{
|
||||
label procI = solidToProc[i];
|
||||
|
||||
Info<< "\nSolving temperature for solid region "
|
||||
<< procMeshes[procI].name() << endl;
|
||||
#include "setRegionSolidFields.H"
|
||||
#include "readSolidMultiRegionPIMPLEControls.H"
|
||||
|
||||
if (temperatureCoupled)
|
||||
{
|
||||
// Map my properties to overall h equation
|
||||
#include "rmapSolid.H"
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "solveSolid.H"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
forAll(fluidToProc, i)
|
||||
{
|
||||
label procI = fluidToProc[i];
|
||||
|
||||
Info<< "\nSolving temperature for fluid region "
|
||||
<< procMeshes[procI].name() << endl;
|
||||
Info<< "\nSolving for fluid region "
|
||||
<< fluidRegions[i].name() << endl;
|
||||
#include "setRegionFluidFields.H"
|
||||
#include "readFluidMultiRegionPIMPLEControls.H"
|
||||
|
||||
if (oCorr == 0)
|
||||
{
|
||||
#include "rhoEqn.H"
|
||||
}
|
||||
|
||||
if (temperatureCoupled)
|
||||
{
|
||||
// Map my properties to overall h equation
|
||||
#include "rmapFluid.H"
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "hEqn.H"
|
||||
}
|
||||
#include "solveFluid.H"
|
||||
}
|
||||
|
||||
|
||||
// Solve combined h equation
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (temperatureCoupled)
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
Info<< "\nSolving single enthalpy for all regions"
|
||||
<< endl;
|
||||
|
||||
// Solve combined h
|
||||
#include "allhEqn.H"
|
||||
|
||||
forAll(solidToProc, i)
|
||||
{
|
||||
label procI = solidToProc[i];
|
||||
#include "setRegionSolidFields.H"
|
||||
#include "readSolidMultiRegionPIMPLEControls.H"
|
||||
|
||||
#include "mapSolid.H"
|
||||
}
|
||||
|
||||
forAll(fluidToProc, i)
|
||||
{
|
||||
label procI = fluidToProc[i];
|
||||
#include "setRegionFluidFields.H"
|
||||
#include "readFluidMultiRegionPIMPLEControls.H"
|
||||
|
||||
#include "mapFluid.H"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update thermos
|
||||
// ~~~~~~~~~~~~~~
|
||||
|
||||
forAll(fluidToProc, i)
|
||||
{
|
||||
Info<< "\nUpdating thermo for fluid region "
|
||||
<< procMeshes[fluidToProc[i]].name() << endl;
|
||||
|
||||
#include "setRegionFluidFields.H"
|
||||
#include "readFluidMultiRegionPIMPLEControls.H"
|
||||
|
||||
thermo.correct();
|
||||
rad.correct();
|
||||
#include "solvePressureVelocityFluid.H"
|
||||
}
|
||||
|
||||
forAll(solidToProc, i)
|
||||
{
|
||||
Info<< "\nUpdating thermo for solid region "
|
||||
<< procMeshes[solidToProc[i]].name() << endl;
|
||||
Info<< "\nSolving for solid region "
|
||||
<< solidRegions[i].name() << endl;
|
||||
#include "setRegionSolidFields.H"
|
||||
#include "readSolidMultiRegionPIMPLEControls.H"
|
||||
|
||||
thermo.correct();
|
||||
}
|
||||
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
forAll(procMeshes, procI)
|
||||
{
|
||||
procMeshes[procI].data::remove("finalIteration");
|
||||
}
|
||||
#include "solveSolid.H"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
- fvm::Sp(fvc::div(phi), h)
|
||||
- fvm::laplacian(turb.alphaEff(), h)
|
||||
==
|
||||
fvc::div(phi/fvc::interpolate(rho), p, "div(U,p)")
|
||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
||||
- fvc::div(phi, 0.5*magSqr(U), "div(phi,K)")
|
||||
+ rad.Sh(thermo)
|
||||
);
|
||||
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
autoPtr<volScalarField> allRho;
|
||||
autoPtr<volScalarField> allh;
|
||||
autoPtr<volScalarField> allVolAlpha;
|
||||
autoPtr<fvScalarMatrix> allSource;
|
||||
|
||||
if (temperatureCoupled)
|
||||
{
|
||||
allRho.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
allMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
allMesh(),
|
||||
dimensionedScalar("rho", dimDensity, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
allh.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"h",
|
||||
runTime.timeName(),
|
||||
allMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
allMesh(),
|
||||
dimensionedScalar("h", dimEnergy/dimMass, 0.0),
|
||||
mixedFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
allVolAlpha.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"volAlpha",
|
||||
runTime.timeName(),
|
||||
allMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
allMesh(),
|
||||
dimensionedScalar("volAlpha", dimMass/dimLength/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
allSource.reset
|
||||
(
|
||||
new fvMatrix<scalar>(allh(), allh().dimensions()*dimMass/dimTime)
|
||||
);
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
//
|
||||
// createAllMesh.H
|
||||
// ~~~~~~~~~~~~~~~
|
||||
|
||||
autoPtr<fvMesh> allMesh;
|
||||
autoPtr<fvFieldReconstructor> procToAllMapper;
|
||||
PtrList<fvFieldDecomposer> allToProcMappers;
|
||||
|
||||
if (temperatureCoupled)
|
||||
{
|
||||
Foam::Info
|
||||
<< "Create mesh for time = "
|
||||
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||
|
||||
allMesh.reset
|
||||
(
|
||||
new Foam::fvMesh
|
||||
(
|
||||
Foam::IOobject
|
||||
(
|
||||
Foam::fvMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
Foam::IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
procToAllMapper.reset
|
||||
(
|
||||
new fvFieldReconstructor
|
||||
(
|
||||
allMesh(),
|
||||
procMeshes,
|
||||
faceProcAddressing,
|
||||
cellProcAddressing,
|
||||
boundaryProcAddressing
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
allToProcMappers.setSize
|
||||
(
|
||||
rp.fluidRegionNames().size()
|
||||
+ rp.solidRegionNames().size()
|
||||
);
|
||||
|
||||
forAll(allToProcMappers, i)
|
||||
{
|
||||
allToProcMappers.set
|
||||
(
|
||||
i,
|
||||
new fvFieldDecomposer
|
||||
(
|
||||
allMesh(),
|
||||
procMeshes[i],
|
||||
faceProcAddressing[i],
|
||||
cellProcAddressing[i],
|
||||
boundaryProcAddressing[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
scalar CoNum = -GREAT;
|
||||
|
||||
forAll(fluidToProc, regionI)
|
||||
forAll(fluidRegions, regionI)
|
||||
{
|
||||
CoNum = max
|
||||
(
|
||||
compressibleCourantNo
|
||||
(
|
||||
procMeshes[fluidToProc[regionI]],
|
||||
fluidRegions[regionI],
|
||||
runTime,
|
||||
rhoFluid[regionI],
|
||||
phiFluid[regionI]
|
||||
|
||||
@ -1,36 +1,30 @@
|
||||
// Initialise fluid field pointer lists
|
||||
PtrList<basicRhoThermo> thermoFluid(rp.fluidRegionNames().size());
|
||||
PtrList<volScalarField> rhoFluid(rp.fluidRegionNames().size());
|
||||
PtrList<volScalarField> KFluid(rp.fluidRegionNames().size());
|
||||
PtrList<volVectorField> UFluid(rp.fluidRegionNames().size());
|
||||
PtrList<surfaceScalarField> phiFluid(rp.fluidRegionNames().size());
|
||||
PtrList<uniformDimensionedVectorField> gFluid(rp.fluidRegionNames().size());
|
||||
PtrList<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
rp.fluidRegionNames().size()
|
||||
);
|
||||
PtrList<volScalarField> p_rghFluid(rp.fluidRegionNames().size());
|
||||
PtrList<volScalarField> ghFluid(rp.fluidRegionNames().size());
|
||||
PtrList<surfaceScalarField> ghfFluid(rp.fluidRegionNames().size());
|
||||
PtrList<radiation::radiationModel> radiation(rp.fluidRegionNames().size());
|
||||
PtrList<volScalarField> DpDtFluid(rp.fluidRegionNames().size());
|
||||
PtrList<basicRhoThermo> thermoFluid(fluidRegions.size());
|
||||
PtrList<volScalarField> rhoFluid(fluidRegions.size());
|
||||
PtrList<volScalarField> KFluid(fluidRegions.size());
|
||||
PtrList<volVectorField> UFluid(fluidRegions.size());
|
||||
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
|
||||
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
|
||||
PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
|
||||
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
|
||||
PtrList<volScalarField> ghFluid(fluidRegions.size());
|
||||
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
|
||||
PtrList<radiation::radiationModel> radiation(fluidRegions.size());
|
||||
PtrList<volScalarField> DpDtFluid(fluidRegions.size());
|
||||
|
||||
List<scalar> initialMassFluid(rp.fluidRegionNames().size());
|
||||
List<scalar> initialMassFluid(fluidRegions.size());
|
||||
|
||||
// Populate fluid field pointer lists
|
||||
forAll(rp.fluidRegionNames(), i)
|
||||
forAll(fluidRegions, i)
|
||||
{
|
||||
Info<< "*** Reading fluid mesh thermophysical properties for region "
|
||||
<< rp.fluidRegionNames()[i] << nl << endl;
|
||||
|
||||
label procI = fluidToProc[i];
|
||||
|
||||
<< fluidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to thermoFluid\n" << endl;
|
||||
thermoFluid.set
|
||||
(
|
||||
i,
|
||||
basicRhoThermo::New(procMeshes[procI]).ptr()
|
||||
basicRhoThermo::New(fluidRegions[i]).ptr()
|
||||
);
|
||||
|
||||
Info<< " Adding to rhoFluid\n" << endl;
|
||||
@ -43,7 +37,7 @@
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
procMeshes[procI],
|
||||
fluidRegions[i],
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
@ -61,7 +55,7 @@
|
||||
(
|
||||
"K",
|
||||
runTime.timeName(),
|
||||
procMeshes[procI],
|
||||
fluidRegions[i],
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
@ -79,11 +73,11 @@
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
procMeshes[procI],
|
||||
fluidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
procMeshes[procI]
|
||||
fluidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
@ -97,12 +91,12 @@
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
procMeshes[procI],
|
||||
fluidRegions[i],
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rhoFluid[i]*UFluid[i])
|
||||
& procMeshes[procI].Sf()
|
||||
& fluidRegions[i].Sf()
|
||||
)
|
||||
);
|
||||
|
||||
@ -116,7 +110,7 @@
|
||||
(
|
||||
"g",
|
||||
runTime.constant(),
|
||||
procMeshes[procI],
|
||||
fluidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
@ -143,14 +137,14 @@
|
||||
ghFluid.set
|
||||
(
|
||||
i,
|
||||
new volScalarField("gh", gFluid[i] & procMeshes[procI].C())
|
||||
new volScalarField("gh", gFluid[i] & fluidRegions[i].C())
|
||||
);
|
||||
|
||||
Info<< " Adding to ghfFluid\n" << endl;
|
||||
ghfFluid.set
|
||||
(
|
||||
i,
|
||||
new surfaceScalarField("ghf", gFluid[i] & procMeshes[procI].Cf())
|
||||
new surfaceScalarField("ghf", gFluid[i] & fluidRegions[i].Cf())
|
||||
);
|
||||
|
||||
p_rghFluid.set
|
||||
@ -162,11 +156,11 @@
|
||||
(
|
||||
"p_rgh",
|
||||
runTime.timeName(),
|
||||
procMeshes[procI],
|
||||
fluidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
procMeshes[procI]
|
||||
fluidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
PtrList<fvMesh> fluidRegions(rp.fluidRegionNames().size());
|
||||
|
||||
forAll(rp.fluidRegionNames(), i)
|
||||
{
|
||||
Info<< "Create fluid mesh for region " << rp.fluidRegionNames()[i]
|
||||
<< " for time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
label procI = fluidToProc[i];
|
||||
|
||||
procMeshes.set
|
||||
fluidRegions.set
|
||||
(
|
||||
procI,
|
||||
i,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
@ -19,58 +19,4 @@
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (temperatureCoupled)
|
||||
{
|
||||
cellProcAddressing.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cellRegionAddressing",
|
||||
procMeshes[procI].facesInstance(),
|
||||
procMeshes[procI].meshSubDir,
|
||||
procMeshes[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
faceProcAddressing.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faceRegionAddressing",
|
||||
procMeshes[procI].facesInstance(),
|
||||
procMeshes[procI].meshSubDir,
|
||||
procMeshes[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
boundaryProcAddressing.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"boundaryRegionAddressing",
|
||||
procMeshes[procI].facesInstance(),
|
||||
procMeshes[procI].meshSubDir,
|
||||
procMeshes[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
List<scalar> cumulativeContErr(fluidToProc.size(), 0.0);
|
||||
List<scalar> cumulativeContErr(fluidRegions.size(), 0.0);
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
h = allToProcMappers[procI].decomposeField(allh(), true);
|
||||
h.oldTime().timeIndex() = allh().oldTime().timeIndex();
|
||||
h.correctBoundaryConditions();
|
||||
@ -1,56 +0,0 @@
|
||||
// Note:Map rho and rho.oldTime() since fluid rho assigned to at
|
||||
// end of iteration.
|
||||
rmap
|
||||
(
|
||||
allRho(),
|
||||
rho,
|
||||
faceProcAddressing[procI],
|
||||
cellProcAddressing[procI],
|
||||
boundaryProcAddressing[procI]
|
||||
);
|
||||
rmap
|
||||
(
|
||||
allRho().oldTime(),
|
||||
rho.oldTime(),
|
||||
faceProcAddressing[procI],
|
||||
cellProcAddressing[procI],
|
||||
boundaryProcAddressing[procI]
|
||||
);
|
||||
|
||||
// Necessary? Probably only for boundary values since bcs on
|
||||
// h are not the same as those on allh
|
||||
|
||||
rmap
|
||||
(
|
||||
allh(),
|
||||
h,
|
||||
faceProcAddressing[procI],
|
||||
cellProcAddressing[procI],
|
||||
boundaryProcAddressing[procI]
|
||||
);
|
||||
|
||||
procAlpha.set(procI, fvc::interpolate(turb.alphaEff()));
|
||||
|
||||
rmap
|
||||
(
|
||||
allVolAlpha(),
|
||||
turb.alphaEff()(),
|
||||
faceProcAddressing[procI],
|
||||
cellProcAddressing[procI],
|
||||
boundaryProcAddressing[procI]
|
||||
);
|
||||
|
||||
rmap
|
||||
(
|
||||
allSource(),
|
||||
(DpDt + rad.Sh(thermo))(),
|
||||
faceProcAddressing[procI],
|
||||
cellProcAddressing[procI],
|
||||
boundaryProcAddressing[procI]
|
||||
);
|
||||
|
||||
procPhi.set
|
||||
(
|
||||
procI,
|
||||
new surfaceScalarField(phi)
|
||||
);
|
||||
@ -1,4 +1,4 @@
|
||||
fvMesh& mesh = procMeshes[fluidToProc[i]];
|
||||
fvMesh& mesh = fluidRegions[i];
|
||||
|
||||
basicRhoThermo& thermo = thermoFluid[i];
|
||||
volScalarField& rho = rhoFluid[i];
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
turb.correct();
|
||||
|
||||
rho = thermo.rho();
|
||||
@ -6,6 +6,3 @@
|
||||
|
||||
const int nOuterCorr =
|
||||
pimple.lookupOrDefault<int>("nOuterCorrectors", 1);
|
||||
|
||||
const Switch temperatureCoupled =
|
||||
pimple.lookupOrDefault<Switch>("temperatureCoupled", false);
|
||||
|
||||
@ -1,96 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Global
|
||||
rmap
|
||||
|
||||
Description
|
||||
map field on subset of mesh onto overall field. Rewrites boundary
|
||||
conditions to be mixed.
|
||||
|
||||
The source fields can have different patch types for the same destination
|
||||
patch. To work around this it attempts to convert all patch fields into
|
||||
mixed type since this can accomodate anything from fixedValue to
|
||||
fixedGradient.
|
||||
|
||||
SourceFiles
|
||||
rmap.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef rmap_H
|
||||
#define rmap_H
|
||||
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Map patchField
|
||||
template<class Type>
|
||||
static void rmap
|
||||
(
|
||||
fvPatchField<Type>& destBC,
|
||||
const labelList& reverseAddressing,
|
||||
const fvPatchField<Type>& sourceBC
|
||||
);
|
||||
|
||||
//- Map volField
|
||||
template<class Type>
|
||||
static void rmap
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& dest,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& source,
|
||||
const labelList& faceProcAddressing,
|
||||
const labelList& cellProcAddressing,
|
||||
const labelList& boundaryProcAddressing
|
||||
);
|
||||
|
||||
//- Map fvMatrix
|
||||
template<class Type>
|
||||
static void rmap
|
||||
(
|
||||
fvMatrix<Type>& dest,
|
||||
const fvMatrix<Type>& source,
|
||||
const labelList& faceProcAddressing,
|
||||
const labelList& cellProcAddressing,
|
||||
const labelList& boundaryProcAddressing
|
||||
);
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "rmapTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,309 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "rmap.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::rmap
|
||||
(
|
||||
fvPatchField<Type>& destBC,
|
||||
const labelList& reverseAddressing,
|
||||
const fvPatchField<Type>& sourceBC
|
||||
)
|
||||
{
|
||||
// Assign value
|
||||
destBC.Field<Type>::rmap(sourceBC, reverseAddressing);
|
||||
|
||||
// Assign other properties
|
||||
if (isA<mixedFvPatchField<Type> >(destBC))
|
||||
{
|
||||
mixedFvPatchField<Type>& mp =
|
||||
refCast<mixedFvPatchField<Type> >(destBC);
|
||||
|
||||
if (isA<mixedFvPatchField<Type> >(sourceBC))
|
||||
{
|
||||
const mixedFvPatchField<Type>& Tp =
|
||||
refCast<const mixedFvPatchField<Type> >(sourceBC);
|
||||
|
||||
mp.refValue().rmap(Tp.refValue(), reverseAddressing);
|
||||
mp.refGrad().rmap(Tp.refGrad(), reverseAddressing);
|
||||
mp.valueFraction().rmap(Tp.valueFraction(), reverseAddressing);
|
||||
}
|
||||
else if (isA<fixedGradientFvPatchField<Type> >(sourceBC))
|
||||
{
|
||||
const fixedGradientFvPatchField<Type>& Tp =
|
||||
refCast<const fixedGradientFvPatchField<Type> >
|
||||
(
|
||||
sourceBC
|
||||
);
|
||||
// Make pure fixedGradient
|
||||
mp.refValue().rmap(Tp, reverseAddressing); // unused
|
||||
mp.refGrad().rmap(Tp.gradient(), reverseAddressing);
|
||||
mp.valueFraction().rmap
|
||||
(
|
||||
Field<Type>(reverseAddressing.size(), 0.0),
|
||||
reverseAddressing
|
||||
);
|
||||
}
|
||||
else if (isA<zeroGradientFvPatchField<Type> >(sourceBC))
|
||||
{
|
||||
// Make pure fixedGradient with gradient = 0
|
||||
mp.refValue().rmap(sourceBC, reverseAddressing); // unused
|
||||
mp.refGrad().rmap
|
||||
(
|
||||
Field<Type>(reverseAddressing.size(), 0.0),
|
||||
reverseAddressing
|
||||
);
|
||||
mp.valueFraction().rmap
|
||||
(
|
||||
Field<Type>(reverseAddressing.size(), 0.0),
|
||||
reverseAddressing
|
||||
);
|
||||
}
|
||||
else if (isA<fixedValueFvPatchField<Type> >(sourceBC))
|
||||
{
|
||||
// Make pure fixedValue
|
||||
mp.refValue().rmap(sourceBC, reverseAddressing);
|
||||
mp.refGrad().rmap
|
||||
(
|
||||
Field<Type>(reverseAddressing.size(), 0.0),
|
||||
reverseAddressing
|
||||
); // unused
|
||||
mp.valueFraction().rmap
|
||||
(
|
||||
Field<Type>(reverseAddressing.size(), 1.0),
|
||||
reverseAddressing
|
||||
);
|
||||
}
|
||||
else if (isA<calculatedFvPatchField<Type> >(sourceBC))
|
||||
{
|
||||
// Make pure fixedValue
|
||||
mp.refValue().rmap(sourceBC, reverseAddressing);
|
||||
mp.refGrad().rmap
|
||||
(
|
||||
Field<Type>(reverseAddressing.size(), 0.0),
|
||||
reverseAddressing
|
||||
); // unused
|
||||
mp.valueFraction().rmap
|
||||
(
|
||||
Field<Type>(reverseAddressing.size(), 1.0),
|
||||
reverseAddressing
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("rmap(..)")
|
||||
<< "Don't know how to map source bc "
|
||||
<< sourceBC.type()
|
||||
<< " into a mixed boundary condition at "
|
||||
<< destBC.patch().name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else if (isA<fixedGradientFvPatchField<Type> >(destBC))
|
||||
{
|
||||
fixedGradientFvPatchField<Type>& mp =
|
||||
refCast<fixedGradientFvPatchField<Type> >(destBC);
|
||||
|
||||
if (isA<fixedGradientFvPatchField<Type> >(sourceBC))
|
||||
{
|
||||
const fixedGradientFvPatchField<Type>& Tp =
|
||||
refCast<const fixedGradientFvPatchField<Type> >
|
||||
(
|
||||
sourceBC
|
||||
);
|
||||
mp.gradient().rmap(Tp.gradient(), reverseAddressing);
|
||||
}
|
||||
else if (isA<mixedFvPatchField<Type> >(sourceBC))
|
||||
{
|
||||
const mixedFvPatchField<Type>& Tp =
|
||||
refCast<const mixedFvPatchField<Type> >(sourceBC);
|
||||
mp.gradient().rmap(Tp.snGrad(), reverseAddressing);
|
||||
}
|
||||
else if (isA<zeroGradientFvPatchField<Type> >(sourceBC))
|
||||
{
|
||||
mp.gradient().rmap
|
||||
(
|
||||
Field<Type>(reverseAddressing.size(), 0.0),
|
||||
reverseAddressing
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("rmap(..)")
|
||||
<< "Don't know how to map source bc "
|
||||
<< sourceBC.type()
|
||||
<< " into a fixedGradient boundary condition at "
|
||||
<< destBC.patch().name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::rmap
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& dest,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& source,
|
||||
const labelList& faceProcAddressing,
|
||||
const labelList& cellProcAddressing,
|
||||
const labelList& boundaryProcAddressing
|
||||
)
|
||||
{
|
||||
if (dest.dimensions() != source.dimensions())
|
||||
{
|
||||
FatalErrorIn("rmap(..)")
|
||||
<< "Different dimensions for = for fields " << dest.name()
|
||||
<< " and " << source.name() << endl
|
||||
<< " dimensions : " << dest.dimensions()
|
||||
<< " = " << source.dimensions() << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Copy internal field
|
||||
dest.internalField().rmap(source.internalField(), cellProcAddressing);
|
||||
|
||||
// Copy boundary properties as mixed
|
||||
forAll(source.boundaryField(), patchI)
|
||||
{
|
||||
label curBPatch = boundaryProcAddressing[patchI];
|
||||
|
||||
if (curBPatch == -1)
|
||||
{
|
||||
// Unknown patch. Do not change any values.
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get addressing slice for this patch
|
||||
const labelList::subList cp =
|
||||
source.mesh().boundary()[patchI].patchSlice
|
||||
(
|
||||
faceProcAddressing
|
||||
);
|
||||
|
||||
const label curPatchStart =
|
||||
dest.mesh().boundaryMesh()[curBPatch].start();
|
||||
|
||||
labelList reverseAddressing(cp.size());
|
||||
|
||||
forAll(cp, faceI)
|
||||
{
|
||||
// Subtract one to take into account offsets for
|
||||
// face direction.
|
||||
if (cp[faceI] <= 0)
|
||||
{
|
||||
FatalErrorIn("rmap(..)")
|
||||
<< "Problem:"
|
||||
<< " patch:" << source.mesh().boundary()[patchI].name()
|
||||
<< " field:" << source.name()
|
||||
<< " local face:" << faceI
|
||||
<< " mapped to:" << cp[faceI] << exit(FatalError);
|
||||
}
|
||||
|
||||
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
||||
}
|
||||
|
||||
// Map curBPatch from source patch. Is like rmap but also
|
||||
// copies non-value properties from alike patchFields.
|
||||
rmap
|
||||
(
|
||||
dest.boundaryField()[curBPatch],
|
||||
reverseAddressing,
|
||||
source.boundaryField()[patchI]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy timeIndex
|
||||
dest.timeIndex() = source.timeIndex();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::rmap
|
||||
(
|
||||
fvMatrix<Type>& dest,
|
||||
const fvMatrix<Type>& source,
|
||||
const labelList& faceProcAddressing,
|
||||
const labelList& cellProcAddressing,
|
||||
const labelList& boundaryProcAddressing
|
||||
)
|
||||
{
|
||||
dest.source().rmap(source.source(), cellProcAddressing);
|
||||
|
||||
FieldField<Field, Type>& sourceInternal =
|
||||
const_cast<fvMatrix<Type>&>(source).internalCoeffs();
|
||||
FieldField<Field, Type>& sourceBoundary =
|
||||
const_cast<fvMatrix<Type>&>(source).boundaryCoeffs();
|
||||
|
||||
forAll(sourceInternal, patchI)
|
||||
{
|
||||
label curBPatch = boundaryProcAddressing[patchI];
|
||||
|
||||
if (curBPatch == -1)
|
||||
{
|
||||
// Unknown patch. Do not change any values.
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get addressing slice for this patch
|
||||
const fvMesh& sourceMesh = source.psi().mesh();
|
||||
|
||||
const labelList::subList cp =
|
||||
sourceMesh.boundary()[patchI].patchSlice
|
||||
(
|
||||
faceProcAddressing
|
||||
);
|
||||
|
||||
const label curPatchStart =
|
||||
dest.psi().mesh().boundaryMesh()[curBPatch].start();
|
||||
|
||||
labelList reverseAddressing(cp.size());
|
||||
|
||||
forAll(cp, faceI)
|
||||
{
|
||||
// Subtract one to take into account offsets for
|
||||
// face direction.
|
||||
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
||||
}
|
||||
dest.internalCoeffs()[curBPatch].rmap
|
||||
(
|
||||
sourceInternal[patchI],
|
||||
reverseAddressing
|
||||
);
|
||||
dest.boundaryCoeffs()[curBPatch].rmap
|
||||
(
|
||||
sourceBoundary[patchI],
|
||||
reverseAddressing
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,36 +1,12 @@
|
||||
// Initialise solid field pointer lists
|
||||
PtrList<basicSolidThermo> thermoSolid(rp.solidRegionNames().size());
|
||||
PtrList<volScalarField> hSolid(rp.solidRegionNames().size());
|
||||
PtrList<basicSolidThermo> thermos(solidRegions.size());
|
||||
|
||||
// Populate solid field pointer lists
|
||||
forAll(rp.solidRegionNames(), i)
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
Info<< "*** Reading solid mesh thermophysical properties for region "
|
||||
<< rp.solidRegionNames()[i] << nl << endl;
|
||||
<< solidRegions[i].name() << nl << endl;
|
||||
|
||||
label procI = solidToProc[i];
|
||||
|
||||
Info<< " Adding to thermoSolid\n" << endl;
|
||||
thermoSolid.set(i, basicSolidThermo::New(procMeshes[procI]));
|
||||
|
||||
if (temperatureCoupled)
|
||||
{
|
||||
Info<< " Adding to hSolid\n" << endl;
|
||||
hSolid.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"h",
|
||||
runTime.timeName(),
|
||||
procMeshes[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
procMeshes[procI]
|
||||
)
|
||||
);
|
||||
}
|
||||
Info<< " Adding to thermos\n" << endl;
|
||||
thermos.set(i, basicSolidThermo::New(solidRegions[i]));
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
PtrList<fvMesh> solidRegions(rp.solidRegionNames().size());
|
||||
|
||||
forAll(rp.solidRegionNames(), i)
|
||||
{
|
||||
Info<< "Create solid mesh for region " << rp.solidRegionNames()[i]
|
||||
<< " for time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
label procI = solidToProc[i];
|
||||
|
||||
procMeshes.set
|
||||
solidRegions.set
|
||||
(
|
||||
procI,
|
||||
i,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
@ -20,57 +20,8 @@
|
||||
)
|
||||
);
|
||||
|
||||
if (temperatureCoupled)
|
||||
{
|
||||
cellProcAddressing.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cellRegionAddressing",
|
||||
procMeshes[procI].facesInstance(),
|
||||
procMeshes[procI].meshSubDir,
|
||||
procMeshes[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
faceProcAddressing.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faceRegionAddressing",
|
||||
procMeshes[procI].facesInstance(),
|
||||
procMeshes[procI].meshSubDir,
|
||||
procMeshes[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
boundaryProcAddressing.set
|
||||
(
|
||||
procI,
|
||||
new labelIOList
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"boundaryRegionAddressing",
|
||||
procMeshes[procI].facesInstance(),
|
||||
procMeshes[procI].meshSubDir,
|
||||
procMeshes[procI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
// Force calculation of geometric properties to prevent it being done
|
||||
// later in e.g. some boundary evaluation
|
||||
//(void)solidRegions[i].weights();
|
||||
//(void)solidRegions[i].deltaCoeffs();
|
||||
}
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
{
|
||||
volScalarField& h = hSolid[i];
|
||||
|
||||
h = allToProcMappers[procI].decomposeField(allh(), true);
|
||||
h.oldTime().timeIndex() = allh().oldTime().timeIndex();
|
||||
|
||||
T += (h-h.oldTime())/cp;
|
||||
// Correct T boundary conditions and update h boundary
|
||||
// conditions accordingly.
|
||||
volScalarField::GeometricBoundaryField Told = T.boundaryField();
|
||||
T.correctBoundaryConditions();
|
||||
h.boundaryField() +=
|
||||
cp.boundaryField()
|
||||
* (T.boundaryField()-Told);
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
{
|
||||
volScalarField& h = hSolid[i];
|
||||
|
||||
procPhi.setSize(nAllRegions);
|
||||
procAlpha.setSize(nAllRegions);
|
||||
|
||||
rmap
|
||||
(
|
||||
allRho(),
|
||||
rho,
|
||||
faceProcAddressing[procI],
|
||||
cellProcAddressing[procI],
|
||||
boundaryProcAddressing[procI]
|
||||
);
|
||||
|
||||
// Necessary? Probably only for boundary values since bcs on
|
||||
// h are not the same as those on allh
|
||||
rmap
|
||||
(
|
||||
allh(),
|
||||
h,
|
||||
faceProcAddressing[procI],
|
||||
cellProcAddressing[procI],
|
||||
boundaryProcAddressing[procI]
|
||||
);
|
||||
|
||||
|
||||
tmp<volScalarField> Kcp(K/cp);
|
||||
|
||||
rmap
|
||||
(
|
||||
allVolAlpha(),
|
||||
Kcp(),
|
||||
faceProcAddressing[procI],
|
||||
cellProcAddressing[procI],
|
||||
boundaryProcAddressing[procI]
|
||||
);
|
||||
|
||||
procAlpha.set(procI, fvc::interpolate(Kcp));
|
||||
|
||||
// allSource is initialised to zero already
|
||||
//rmap
|
||||
//(
|
||||
// allSource(),
|
||||
// volScalarField
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "procSource",
|
||||
// runTime.timeName(),
|
||||
// mesh,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// mesh,
|
||||
// dimensionedScalar
|
||||
// (
|
||||
// "procSource",
|
||||
// allh().dimensions()*dimDensity/dimTime,
|
||||
// 0.0
|
||||
// )
|
||||
// ),
|
||||
// faceProcAddressing[procI],
|
||||
// cellProcAddressing[procI],
|
||||
// boundaryProcAddressing[procI]
|
||||
//);
|
||||
|
||||
procPhi.set
|
||||
(
|
||||
procI,
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"phi",
|
||||
dimDensity*dimVelocity*dimArea,
|
||||
0.0
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
fvMesh& mesh = procMeshes[solidToProc[i]];
|
||||
basicSolidThermo& thermo = thermoSolid[i];
|
||||
fvMesh& mesh = solidRegions[i];
|
||||
basicSolidThermo& thermo = thermos[i];
|
||||
|
||||
tmp<volScalarField> trho = thermo.rho();
|
||||
const volScalarField& rho = trho();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
scalar DiNum = -GREAT;
|
||||
|
||||
forAll(solidToProc, i)
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
# include "setRegionSolidFields.H"
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
(
|
||||
solidRegionDiffNo
|
||||
(
|
||||
procMeshes[solidToProc[i]],
|
||||
solidRegions[i],
|
||||
runTime,
|
||||
rho*cp,
|
||||
K
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
{
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
@ -12,3 +17,10 @@
|
||||
|
||||
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
|
||||
}
|
||||
|
||||
thermo.correct();
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ if (solveSpecies)
|
||||
==
|
||||
parcels.SYi(i, Yi)
|
||||
+ combustion->R(Yi)
|
||||
+ sources(Yi)
|
||||
+ sources(rho, Yi)
|
||||
);
|
||||
|
||||
sources.constrain(YEqn);
|
||||
|
||||
@ -47,17 +47,10 @@
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
const volScalarField nu(laminarTransport.nu());
|
||||
|
||||
autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
volScalarField mu
|
||||
(
|
||||
IOobject
|
||||
|
||||
@ -33,11 +33,10 @@ Application
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
@ -67,9 +66,29 @@ int main(int argc, char *argv[])
|
||||
mesh
|
||||
);
|
||||
|
||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||
const pointBoundaryMesh& pbm = pMesh.boundary();
|
||||
|
||||
Info<< "pointMesh boundary" << nl;
|
||||
forAll(pbm, patchI)
|
||||
{
|
||||
Info<< "patch=" << pbm[patchI].name()
|
||||
<< ", type=" << pbm[patchI].type()
|
||||
<< ", coupled=" << pbm[patchI].coupled()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
const volPointInterpolation& pInterp = volPointInterpolation::New(mesh);
|
||||
|
||||
|
||||
pointScalarField pp(pInterp.interpolate(p));
|
||||
Info<< pp.name() << " boundary" << endl;
|
||||
forAll(pp.boundaryField(), patchI)
|
||||
{
|
||||
Info<< pbm[patchI].name() << " coupled="
|
||||
<< pp.boundaryField()[patchI].coupled()<< endl;
|
||||
}
|
||||
|
||||
pp.write();
|
||||
|
||||
pointVectorField pU(pInterp.interpolate(U));
|
||||
|
||||
@ -512,6 +512,36 @@ case SGIMPI:
|
||||
_foamAddLib $MPI_ARCH_PATH/lib
|
||||
breaksw
|
||||
|
||||
case INTELMPI:
|
||||
if ( ! $?MPI_ROOT) setenv MPI_ROOT /dummy
|
||||
|
||||
if ( ! -d "$MPI_ROOT" ) then
|
||||
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
|
||||
echo " MPI_ROOT not a valid mpt installation directory."
|
||||
echo " Please set MPI_ROOT to the mpt installation directory."
|
||||
echo " (usually done by loading the mpt module)"
|
||||
echo " MPI_ROOT currently set to '$MPI_ROOT'"
|
||||
endif
|
||||
|
||||
if ( "${MPI_ROOT:h}/" == $MPI_ROOT ) then
|
||||
setenv MPI_ROOT ${MPI_ROOT:h}
|
||||
endif
|
||||
|
||||
setenv FOAM_MPI ${MPI_ROOT:t}
|
||||
setenv MPI_ARCH_PATH $MPI_ROOT
|
||||
|
||||
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
echo "Using INTEL MPT:"
|
||||
echo " MPI_ROOT : $MPI_ROOT"
|
||||
echo " FOAM_MPI : $FOAM_MPI"
|
||||
endif
|
||||
|
||||
|
||||
_foamAddPath $MPI_ARCH_PATH/bin64
|
||||
_foamAddLib $MPI_ARCH_PATH/lib64
|
||||
breaksw
|
||||
|
||||
default:
|
||||
setenv FOAM_MPI dummy
|
||||
breaksw
|
||||
|
||||
@ -534,6 +534,34 @@ SGIMPI)
|
||||
_foamAddLib $MPI_ARCH_PATH/lib
|
||||
;;
|
||||
|
||||
INTELMPI)
|
||||
lastCharID=$(( ${#MPI_ROOT} - 1 ))
|
||||
if [ "${MPI_ROOT:$lastCharID:1}" == '/' ]
|
||||
then
|
||||
MPI_ROOT=${MPI_ROOT:0:$lastCharID}
|
||||
fi
|
||||
|
||||
export FOAM_MPI=${MPI_ROOT##*/}
|
||||
export MPI_ARCH_PATH=$MPI_ROOT
|
||||
|
||||
if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
|
||||
then
|
||||
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
|
||||
echo " MPI_ROOT not a valid mpt installation directory or ending in a '/'." 1>&2
|
||||
echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
|
||||
echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
|
||||
fi
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
echo "Using INTEL MPI:"
|
||||
echo " MPI_ROOT : $MPI_ROOT"
|
||||
echo " FOAM_MPI : $FOAM_MPI"
|
||||
fi
|
||||
|
||||
_foamAddPath $MPI_ARCH_PATH/bin64
|
||||
_foamAddLib $MPI_ARCH_PATH/lib64
|
||||
;;
|
||||
*)
|
||||
export FOAM_MPI=dummy
|
||||
;;
|
||||
|
||||
181
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C
Normal file
181
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C
Normal file
@ -0,0 +1,181 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CSV.H"
|
||||
#include "DynamicList.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// doesn't recognize specialization otherwise
|
||||
template<>
|
||||
scalar CSV<scalar>::readValue(const List<string>& splitted)
|
||||
{
|
||||
if (componentColumns_[0] >= splitted.size())
|
||||
{
|
||||
FatalErrorIn("CSV<scalar>::readValue(const List<string>&)")
|
||||
<< "No column " << componentColumns_[0] << " in "
|
||||
<< splitted << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return readScalar(IStringStream(splitted[componentColumns_[0]])());
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type CSV<Type>::readValue(const List<string>& splitted)
|
||||
{
|
||||
Type result;
|
||||
|
||||
for (label i = 0; i < pTraits<Type>::nComponents; i++)
|
||||
{
|
||||
if (componentColumns_[i] >= splitted.size())
|
||||
{
|
||||
FatalErrorIn("CSV<Type>::readValue(const List<string>&)")
|
||||
<< "No column " << componentColumns_[i] << " in "
|
||||
<< splitted << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
result[i] =
|
||||
readScalar(IStringStream(splitted[componentColumns_[i]])());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::CSV<Type>::read()
|
||||
{
|
||||
IFstream is(fName_.expand());
|
||||
|
||||
DynamicList<Tuple2<scalar, Type> > values;
|
||||
|
||||
// skip header
|
||||
if (headerLine_)
|
||||
{
|
||||
string line;
|
||||
is.getLine(line);
|
||||
}
|
||||
|
||||
// read data
|
||||
while (is.good())
|
||||
{
|
||||
string line;
|
||||
is.getLine(line);
|
||||
|
||||
DynamicList<string> splitted;
|
||||
|
||||
std::size_t pos = 0;
|
||||
while (pos != std::string::npos)
|
||||
{
|
||||
std::size_t nPos = line.find(separator_, pos);
|
||||
|
||||
if (nPos == std::string::npos)
|
||||
{
|
||||
splitted.append(line.substr(pos));
|
||||
pos = nPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
splitted.append(line.substr(pos, nPos - pos));
|
||||
pos = nPos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitted.size() <= 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
scalar x = readScalar(IStringStream(splitted[refColumn_])());
|
||||
Type value = readValue(splitted);
|
||||
|
||||
values.append(Tuple2<scalar,Type>(x, value));
|
||||
}
|
||||
|
||||
this->table_.transfer(values);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::CSV<Type>::CSV(const word& entryName, const dictionary& dict)
|
||||
:
|
||||
DataEntry<Type>(entryName),
|
||||
TableBase<Type>(entryName, dict.subDict(type() + "Coeffs")),
|
||||
coeffs_(dict.subDict(type() + "Coeffs")),
|
||||
headerLine_(readBool(coeffs_.lookup("hasHeaderLine"))),
|
||||
refColumn_(readLabel(coeffs_.lookup("refColumn"))),
|
||||
componentColumns_(coeffs_.lookup("componentColumns")),
|
||||
separator_(coeffs_.lookupOrDefault<string>("separator", string(","))[0]),
|
||||
fName_(coeffs_.lookup("fileName"))
|
||||
{
|
||||
if (componentColumns_.size() != pTraits<Type>::nComponents)
|
||||
{
|
||||
FatalErrorIn("Foam::CSV<Type>::CSV(const word&, Istream&)")
|
||||
<< componentColumns_ << " does not have the expected length of "
|
||||
<< pTraits<Type>::nComponents << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
read();
|
||||
|
||||
TableBase<Type>::check();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::CSV<Type>::CSV(const CSV<Type>& tbl)
|
||||
:
|
||||
DataEntry<Type>(tbl),
|
||||
TableBase<Type>(tbl),
|
||||
headerLine_(tbl.headerLine_),
|
||||
refColumn_(tbl.refColumn_),
|
||||
componentColumns_(tbl.componentColumns_),
|
||||
separator_(tbl.separator_),
|
||||
fName_(tbl.fName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::CSV<Type>::~CSV()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "CSVIO.C"
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
183
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H
Normal file
183
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H
Normal file
@ -0,0 +1,183 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::CSV
|
||||
|
||||
Description
|
||||
Templated CSV container data entry. Reference column is always a scalar,
|
||||
e.g. time
|
||||
|
||||
\verbatim
|
||||
<entryName> csvFile
|
||||
{
|
||||
hasHeaderLine true;
|
||||
refColumn 0; // reference column index
|
||||
componentColumns (0 1 2); // component column indices
|
||||
separator ","; // optional (defaults to ",")
|
||||
fileName fileXYZ; // name of csv data file
|
||||
outOfBounds clamp; // optional out-of-bounds handling
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
CSV.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CSV_H
|
||||
#define CSV_H
|
||||
|
||||
#include "DataEntry.H"
|
||||
#include "TableBase.H"
|
||||
#include "Tuple2.H"
|
||||
#include "labelList.H"
|
||||
#include "ISstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class Type>
|
||||
class CSV;
|
||||
|
||||
template<class Type>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const CSV<Type>&
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CSV Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class CSV
|
||||
:
|
||||
public DataEntry<Type>,
|
||||
public TableBase<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Coefficients dictionary (for convenience on reading)
|
||||
dictionary coeffs_;
|
||||
|
||||
//- Does the file have a header line?
|
||||
bool headerLine_;
|
||||
|
||||
//- Column of the time
|
||||
label refColumn_;
|
||||
|
||||
//- Labels of the components
|
||||
labelList componentColumns_;
|
||||
|
||||
//- Separator character
|
||||
char separator_;
|
||||
|
||||
//- File name for csv table (optional)
|
||||
fileName fName_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Read csv data table
|
||||
void read();
|
||||
|
||||
//- Read the next value from the splitted string
|
||||
Type readValue(const List<string>&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const CSV<Type>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("csvFile");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from entry name and Istream
|
||||
CSV(const word& entryName, const dictionary& dict);
|
||||
|
||||
//- Copy constructor
|
||||
CSV(const CSV<Type>& tbl);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<DataEntry<Type> > clone() const
|
||||
{
|
||||
return tmp<DataEntry<Type> >(new CSV<Type>(*this));
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~CSV();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return Table value
|
||||
virtual Type value(const scalar x) const
|
||||
{
|
||||
return TableBase<Type>::value(x);
|
||||
}
|
||||
|
||||
//- Integrate between two (scalar) values
|
||||
virtual Type integrate(const scalar x1, const scalar x2) const
|
||||
{
|
||||
return TableBase<Type>::integrate(x1, x2);
|
||||
}
|
||||
|
||||
|
||||
// I/O
|
||||
|
||||
//- Ostream Operator
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream& os,
|
||||
const CSV<Type>& cnst
|
||||
);
|
||||
|
||||
//- Write in dictionary format
|
||||
virtual void writeData(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "CSV.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
80
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C
Normal file
80
src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C
Normal file
@ -0,0 +1,80 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const CSV<Type>& tbl
|
||||
)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << static_cast<const DataEntry<Type>& >(tbl)
|
||||
<< token::SPACE << tbl.headerLine_
|
||||
<< token::SPACE << tbl.timeColumn_
|
||||
<< token::SPACE << tbl.componentColumns_
|
||||
<< token::SPACE << tbl.separator_
|
||||
<< token::SPACE << tbl.fileName_;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << static_cast<const DataEntry<Type>& >(tbl);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Ostream& operator<<(Ostream&, const CSV<Type>&)"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::CSV<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
DataEntry<Type>::writeData(os);
|
||||
|
||||
os << token::END_STATEMENT << nl;
|
||||
os << indent << word(type() + "Coeffs") << nl;
|
||||
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
os.writeKeyword("headerLine") << headerLine_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("refColumn") << refColumn_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("componentColumns") << componentColumns_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("separator") << string(separator_)
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("fileName") << fName_ << token::END_STATEMENT << nl;
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,11 +28,14 @@ License
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Constant<Type>::Constant(const word& entryName, Istream& is)
|
||||
Foam::Constant<Type>::Constant(const word& entryName, const dictionary& dict)
|
||||
:
|
||||
DataEntry<Type>(entryName),
|
||||
value_(pTraits<Type>::zero)
|
||||
{
|
||||
Istream& is(dict.lookup(entryName));
|
||||
word entryType(is);
|
||||
|
||||
is >> value_;
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from entry name and Istream
|
||||
Constant(const word& entryName, Istream& is);
|
||||
Constant(const word& entryName, const dictionary& dict);
|
||||
|
||||
//- Copy constructor
|
||||
Constant(const Constant<Type>& cnst);
|
||||
|
||||
@ -65,7 +65,6 @@ void Foam::Constant<Type>::writeData(Ostream& os) const
|
||||
DataEntry<Type>::writeData(os);
|
||||
|
||||
os << token::SPACE << value_ << token::END_STATEMENT << nl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -92,9 +92,9 @@ public:
|
||||
dictionary,
|
||||
(
|
||||
const word& entryName,
|
||||
Istream& is
|
||||
const dictionary& dict
|
||||
),
|
||||
(entryName, is)
|
||||
(entryName, dict)
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@ Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New
|
||||
)
|
||||
{
|
||||
Istream& is(dict.lookup(entryName));
|
||||
|
||||
word DataEntryType(is);
|
||||
|
||||
typename dictionaryConstructorTable::iterator cstrIter =
|
||||
@ -54,7 +53,7 @@ Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<DataEntry<Type> >(cstrIter()(entryName, is));
|
||||
return autoPtr<DataEntry<Type> >(cstrIter()(entryName, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -28,17 +28,17 @@ License
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Table<Type>::Table(const word& entryName, Istream& is)
|
||||
Foam::Table<Type>::Table(const word& entryName, const dictionary& dict)
|
||||
:
|
||||
DataEntry<Type>(entryName),
|
||||
table_(is)
|
||||
TableBase<Type>(entryName, dictionary::null)
|
||||
{
|
||||
if (!table_.size())
|
||||
{
|
||||
FatalErrorIn("Foam::Table<Type>::Table(const Istream&)")
|
||||
<< "Table for entry " << this->name_ << " is invalid (empty)"
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
Istream& is(dict.lookup(entryName));
|
||||
word entryType(is);
|
||||
|
||||
is >> this->table_;
|
||||
|
||||
TableBase<Type>::check();
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ template<class Type>
|
||||
Foam::Table<Type>::Table(const Table<Type>& tbl)
|
||||
:
|
||||
DataEntry<Type>(tbl),
|
||||
table_(tbl.table_)
|
||||
TableBase<Type>(tbl)
|
||||
{}
|
||||
|
||||
|
||||
@ -57,98 +57,6 @@ Foam::Table<Type>::~Table()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Type Foam::Table<Type>::value(const scalar x) const
|
||||
{
|
||||
// Return zero if out of bounds
|
||||
if (x < table_[0].first() || x > table_.last().first())
|
||||
{
|
||||
return pTraits<Type>::zero;
|
||||
}
|
||||
|
||||
// Find i such that x(i) < x < x(i+1)
|
||||
label i = 0;
|
||||
while ((table_[i+1].first() < x) && (i+1 < table_.size()))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
// Linear interpolation to find value. Note constructor needed for
|
||||
// Table<label> to convert intermediate scalar back to label.
|
||||
return Type
|
||||
(
|
||||
(x - table_[i].first())/(table_[i+1].first() - table_[i].first())
|
||||
* (table_[i+1].second() - table_[i].second())
|
||||
+ table_[i].second()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const
|
||||
{
|
||||
// Initialise return value
|
||||
Type sum = pTraits<Type>::zero;
|
||||
|
||||
// Return zero if out of bounds
|
||||
if ((x1 > table_.last().first()) || (x2 < table_[0].first()))
|
||||
{
|
||||
return sum;
|
||||
}
|
||||
|
||||
// Find next index greater than x1
|
||||
label id1 = 0;
|
||||
while ((table_[id1].first() < x1) && (id1 < table_.size()))
|
||||
{
|
||||
id1++;
|
||||
}
|
||||
|
||||
// Find next index less than x2
|
||||
label id2 = table_.size() - 1;
|
||||
while ((table_[id2].first() > x2) && (id2 >= 1))
|
||||
{
|
||||
id2--;
|
||||
}
|
||||
|
||||
if ((id1 - id2) == 1)
|
||||
{
|
||||
// x1 and x2 lie within 1 interval
|
||||
sum = 0.5*(value(x1) + value(x2))*(x2 - x1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// x1 and x2 cross multiple intervals
|
||||
|
||||
// Integrate table body
|
||||
for (label i=id1; i<id2; i++)
|
||||
{
|
||||
sum +=
|
||||
(table_[i].second() + table_[i+1].second())
|
||||
* (table_[i+1].first() - table_[i].first());
|
||||
}
|
||||
sum *= 0.5;
|
||||
|
||||
// Add table ends (partial segments)
|
||||
if (id1 > 0)
|
||||
{
|
||||
sum += 0.5
|
||||
* (value(x1) + table_[id1].second())
|
||||
* (table_[id1].first() - x1);
|
||||
}
|
||||
if (id2 < table_.size() - 1)
|
||||
{
|
||||
sum += 0.5
|
||||
* (table_[id2].second() + value(x2))
|
||||
* (x2 - table_[id2].first());
|
||||
}
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "TableIO.C"
|
||||
|
||||
@ -70,14 +70,9 @@ Ostream& operator<<
|
||||
template<class Type>
|
||||
class Table
|
||||
:
|
||||
public DataEntry<Type>
|
||||
public DataEntry<Type>,
|
||||
public TableBase<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Table data
|
||||
List<Tuple2<scalar, Type> > table_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
@ -93,7 +88,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from entry name and Istream
|
||||
Table(const word& entryName, Istream& is);
|
||||
Table(const word& entryName, const dictionary& dict);
|
||||
|
||||
//- Copy constructor
|
||||
Table(const Table<Type>& tbl);
|
||||
@ -112,10 +107,16 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return Table value
|
||||
Type value(const scalar x) const;
|
||||
virtual Type value(const scalar x) const
|
||||
{
|
||||
return TableBase<Type>::value(x);
|
||||
}
|
||||
|
||||
//- Integrate between two (scalar) values
|
||||
Type integrate(const scalar x1, const scalar x2) const;
|
||||
virtual Type integrate(const scalar x1, const scalar x2) const
|
||||
{
|
||||
return TableBase<Type>::integrate(x1, x2);
|
||||
}
|
||||
|
||||
|
||||
// I/O
|
||||
@ -124,7 +125,7 @@ public:
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream& os,
|
||||
const Table<Type>& cnst
|
||||
const Table<Type>& tbl
|
||||
);
|
||||
|
||||
//- Write in dictionary format
|
||||
|
||||
399
src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C
Normal file
399
src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C
Normal file
@ -0,0 +1,399 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "TableBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::TableBase<Type>::TableBase(const word& name, const dictionary& dict)
|
||||
:
|
||||
name_(name),
|
||||
boundsHandling_
|
||||
(
|
||||
wordToBoundsHandling
|
||||
(
|
||||
dict.lookupOrDefault<word>("outOfBounds", "clamp")
|
||||
)
|
||||
),
|
||||
table_()
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
|
||||
:
|
||||
name_(tbl.name_),
|
||||
boundsHandling_(tbl.boundsHandling_),
|
||||
table_(tbl.table_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::TableBase<Type>::~TableBase()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::word Foam::TableBase<Type>::boundsHandlingToWord
|
||||
(
|
||||
const boundsHandling& bound
|
||||
) const
|
||||
{
|
||||
word enumName("warn");
|
||||
|
||||
switch (bound)
|
||||
{
|
||||
case ERROR:
|
||||
{
|
||||
enumName = "error";
|
||||
break;
|
||||
}
|
||||
case WARN:
|
||||
{
|
||||
enumName = "warn";
|
||||
break;
|
||||
}
|
||||
case CLAMP:
|
||||
{
|
||||
enumName = "clamp";
|
||||
break;
|
||||
}
|
||||
case REPEAT:
|
||||
{
|
||||
enumName = "repeat";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return enumName;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::TableBase<Type>::boundsHandling
|
||||
Foam::TableBase<Type>::wordToBoundsHandling
|
||||
(
|
||||
const word& bound
|
||||
) const
|
||||
{
|
||||
if (bound == "error")
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
else if (bound == "warn")
|
||||
{
|
||||
return WARN;
|
||||
}
|
||||
else if (bound == "clamp")
|
||||
{
|
||||
return CLAMP;
|
||||
}
|
||||
else if (bound == "repeat")
|
||||
{
|
||||
return REPEAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn("Foam::TableBase<Type>::wordToBoundsHandling(const word&)")
|
||||
<< "bad outOfBounds specifier " << bound << " using 'warn'"
|
||||
<< endl;
|
||||
|
||||
return WARN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::TableBase<Type>::boundsHandling
|
||||
Foam::TableBase<Type>::outOfBounds
|
||||
(
|
||||
const boundsHandling& bound
|
||||
)
|
||||
{
|
||||
boundsHandling prev = boundsHandling_;
|
||||
boundsHandling_ = bound;
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::TableBase<Type>::check() const
|
||||
{
|
||||
if (!table_.size())
|
||||
{
|
||||
FatalErrorIn("Foam::TableBase<Type>::check() const")
|
||||
<< "Table for entry " << this->name_ << " is invalid (empty)"
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
label n = table_.size();
|
||||
scalar prevValue = table_[0].first();
|
||||
|
||||
for (label i = 1; i < n; ++i)
|
||||
{
|
||||
const scalar currValue = table_[i].first();
|
||||
|
||||
// avoid duplicate values (divide-by-zero error)
|
||||
if (currValue <= prevValue)
|
||||
{
|
||||
FatalErrorIn("Foam::TableBase<Type>::check() const")
|
||||
<< "out-of-order value: " << currValue << " at index " << i
|
||||
<< exit(FatalError);
|
||||
}
|
||||
prevValue = currValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::TableBase<Type>::checkMinBounds
|
||||
(
|
||||
const scalar x,
|
||||
scalar& xDash
|
||||
) const
|
||||
{
|
||||
if (x < table_[0].first())
|
||||
{
|
||||
switch (boundsHandling_)
|
||||
{
|
||||
case ERROR:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"bool Foam::TableBase<Type>::checkMinBounds"
|
||||
"("
|
||||
"const scalar, "
|
||||
"scalar&"
|
||||
") const"
|
||||
) << "value (" << x << ") underflow"
|
||||
<< exit(FatalError);
|
||||
break;
|
||||
}
|
||||
case WARN:
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::TableBase<Type>::checkMinBounds"
|
||||
"("
|
||||
"const scalar, "
|
||||
"scalar&"
|
||||
") const"
|
||||
) << "value (" << x << ") underflow" << nl
|
||||
<< endl;
|
||||
|
||||
// fall-through to 'CLAMP'
|
||||
}
|
||||
case CLAMP:
|
||||
{
|
||||
xDash = table_[0].first();
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case REPEAT:
|
||||
{
|
||||
// adjust x to >= minX
|
||||
scalar span = table_.last().first() - table_[0].first();
|
||||
xDash = fmod(x - table_[0].first(), span) + table_[0].first();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xDash = x;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::TableBase<Type>::checkMaxBounds
|
||||
(
|
||||
const scalar x,
|
||||
scalar& xDash
|
||||
) const
|
||||
{
|
||||
if (x > table_.last().first())
|
||||
{
|
||||
switch (boundsHandling_)
|
||||
{
|
||||
case ERROR:
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"bool Foam::TableBase<Type>::checkMaxBounds"
|
||||
"("
|
||||
"const scalar, "
|
||||
"scalar&"
|
||||
") const"
|
||||
) << "value (" << x << ") overflow"
|
||||
<< exit(FatalError);
|
||||
break;
|
||||
}
|
||||
case WARN:
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"bool Foam::TableBase<Type>::checkMaxBounds"
|
||||
"("
|
||||
"const scalar, "
|
||||
"scalar&"
|
||||
") const"
|
||||
) << "value (" << x << ") overflow" << nl
|
||||
<< endl;
|
||||
|
||||
// fall-through to 'CLAMP'
|
||||
}
|
||||
case CLAMP:
|
||||
{
|
||||
xDash = table_.last().first();
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case REPEAT:
|
||||
{
|
||||
// adjust x to >= minX
|
||||
scalar span = table_.last().first() - table_[0].first();
|
||||
xDash = fmod(x - table_[0].first(), span) + table_[0].first();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xDash = x;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::TableBase<Type>::value(const scalar x) const
|
||||
{
|
||||
scalar xDash = x;
|
||||
|
||||
if (checkMinBounds(x, xDash))
|
||||
{
|
||||
return table_[0].second();
|
||||
}
|
||||
|
||||
if (checkMaxBounds(xDash, xDash))
|
||||
{
|
||||
return table_.last().second();
|
||||
}
|
||||
|
||||
// Find i such that x(i) < xDash < x(i+1)
|
||||
label i = 0;
|
||||
while ((table_[i+1].first() < xDash) && (i+1 < table_.size()))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
// Linear interpolation to find value
|
||||
return Type
|
||||
(
|
||||
(xDash - table_[i].first())/(table_[i+1].first() - table_[i].first())
|
||||
* (table_[i+1].second() - table_[i].second())
|
||||
+ table_[i].second()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::TableBase<Type>::integrate(const scalar x1, const scalar x2) const
|
||||
{
|
||||
// Initialise return value
|
||||
Type sum = pTraits<Type>::zero;
|
||||
|
||||
// Return zero if out of bounds
|
||||
if ((x1 > table_.last().first()) || (x2 < table_[0].first()))
|
||||
{
|
||||
return sum;
|
||||
}
|
||||
|
||||
// Find next index greater than x1
|
||||
label id1 = 0;
|
||||
while ((table_[id1].first() < x1) && (id1 < table_.size()))
|
||||
{
|
||||
id1++;
|
||||
}
|
||||
|
||||
// Find next index less than x2
|
||||
label id2 = table_.size() - 1;
|
||||
while ((table_[id2].first() > x2) && (id2 >= 1))
|
||||
{
|
||||
id2--;
|
||||
}
|
||||
|
||||
if ((id1 - id2) == 1)
|
||||
{
|
||||
// x1 and x2 lie within 1 interval
|
||||
sum = 0.5*(value(x1) + value(x2))*(x2 - x1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// x1 and x2 cross multiple intervals
|
||||
|
||||
// Integrate table body
|
||||
for (label i=id1; i<id2; i++)
|
||||
{
|
||||
sum +=
|
||||
(table_[i].second() + table_[i+1].second())
|
||||
* (table_[i+1].first() - table_[i].first());
|
||||
}
|
||||
sum *= 0.5;
|
||||
|
||||
// Add table ends (partial segments)
|
||||
if (id1 > 0)
|
||||
{
|
||||
sum += 0.5
|
||||
* (value(x1) + table_[id1].second())
|
||||
* (table_[id1].first() - x1);
|
||||
}
|
||||
if (id2 < table_.size() - 1)
|
||||
{
|
||||
sum += 0.5
|
||||
* (table_[id2].second() + value(x2))
|
||||
* (x2 - table_[id2].first());
|
||||
}
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "TableBaseIO.C"
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
167
src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H
Normal file
167
src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H
Normal file
@ -0,0 +1,167 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::TableBase
|
||||
|
||||
Description
|
||||
Base class for table with bounds handling, interpolation and integration
|
||||
|
||||
SourceFiles
|
||||
TableBase.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TableBase_H
|
||||
#define TableBase_H
|
||||
|
||||
#include "DataEntry.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class Type>
|
||||
class TableBase;
|
||||
|
||||
template<class Type>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const TableBase<Type>&
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class TableBase Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class TableBase
|
||||
{
|
||||
public:
|
||||
|
||||
// Public data types
|
||||
|
||||
//- Enumeration for handling out-of-bound values
|
||||
enum boundsHandling
|
||||
{
|
||||
ERROR, /*!< Exit with a FatalError */
|
||||
WARN, /*!< Issue warning and clamp value (default) */
|
||||
CLAMP, /*!< Clamp value to the start/end value */
|
||||
REPEAT /*!< Treat as a repeating list */
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Table name
|
||||
word name_;
|
||||
|
||||
//- Enumeration for handling out-of-bound values
|
||||
boundsHandling boundsHandling_;
|
||||
|
||||
//- Table data
|
||||
List<Tuple2<scalar, Type> > table_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const TableBase<Type>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary - note table is not populated
|
||||
TableBase(const word& name, const dictionary& dict);
|
||||
|
||||
//- Copy constructor
|
||||
TableBase(const TableBase<Type>& tbl);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~TableBase();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the out-of-bounds handling as a word
|
||||
word boundsHandlingToWord(const boundsHandling& bound) const;
|
||||
|
||||
//- Return the out-of-bounds handling as an enumeration
|
||||
boundsHandling wordToBoundsHandling(const word& bound) const;
|
||||
|
||||
//- Set the out-of-bounds handling from enum, return previous setting
|
||||
boundsHandling outOfBounds(const boundsHandling& bound);
|
||||
|
||||
//- Check the table for size and consistency
|
||||
void check() const;
|
||||
|
||||
//- Check minimum table bounds
|
||||
bool checkMinBounds(const scalar x, scalar& xDash) const;
|
||||
|
||||
//- Check maximum table bounds
|
||||
bool checkMaxBounds(const scalar x, scalar& xDash) const;
|
||||
|
||||
//- Return Table value
|
||||
virtual Type value(const scalar x) const;
|
||||
|
||||
//- Integrate between two (scalar) values
|
||||
virtual Type integrate(const scalar x1, const scalar x2) const;
|
||||
|
||||
|
||||
// I/O
|
||||
|
||||
//- Ostream Operator
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream& os,
|
||||
const TableBase<Type>& tbl
|
||||
);
|
||||
|
||||
//- Write in dictionary format
|
||||
virtual void writeData(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "TableBase.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -23,27 +23,45 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef timeVaryingUniformFixedValueFvPatchFields_H
|
||||
#define timeVaryingUniformFixedValueFvPatchFields_H
|
||||
#include "DataEntry.H"
|
||||
|
||||
#include "timeVaryingUniformFixedValueFvPatchField.H"
|
||||
#include "fieldTypes.H"
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
template<class Type>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const TableBase<Type>& tbl
|
||||
)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << token::SPACE << tbl.table_;
|
||||
}
|
||||
else
|
||||
{
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&tbl.table_),
|
||||
sizeof(tbl.table_)
|
||||
);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Ostream& operator<<(Ostream&, const TableBase<Type>&, const bool)"
|
||||
);
|
||||
|
||||
makePatchTypeFieldTypedefs(timeVaryingUniformFixedValue);
|
||||
return os;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
template<class Type>
|
||||
void Foam::TableBase<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
os << nl << indent << table_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -34,20 +34,8 @@ Foam::Ostream& Foam::operator<<
|
||||
const Table<Type>& tbl
|
||||
)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << static_cast<const DataEntry<Type>& >(tbl)
|
||||
<< token::SPACE << tbl.table_;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << static_cast<const DataEntry<Type>& >(tbl);
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&tbl.table_),
|
||||
sizeof(tbl.table_)
|
||||
);
|
||||
}
|
||||
os << static_cast<const DataEntry<Type>&>(tbl)
|
||||
<< static_cast<const TableBase<Type>&>(tbl);
|
||||
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
@ -63,8 +51,7 @@ template<class Type>
|
||||
void Foam::Table<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
DataEntry<Type>::writeData(os);
|
||||
|
||||
os << nl << indent << table_ << token::END_STATEMENT << nl;
|
||||
TableBase<Type>::writeData(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -23,21 +23,47 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "timeVaryingUniformFixedValueFvPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
#include "TableFile.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
template<class Type>
|
||||
Foam::TableFile<Type>::TableFile(const word& entryName, const dictionary& dict)
|
||||
:
|
||||
DataEntry<Type>(entryName),
|
||||
TableBase<Type>(entryName, dict.subDict(type() + "Coeffs")),
|
||||
fName_("none")
|
||||
{
|
||||
const dictionary coeffs(dict.subDict(type() + "Coeffs"));
|
||||
coeffs.lookup("fileName") >> fName_;
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
IFstream is(fName_.expand());
|
||||
|
||||
makePatchFields(timeVaryingUniformFixedValue);
|
||||
is >> this->table_;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
TableBase<Type>::check();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::TableFile<Type>::TableFile(const TableFile<Type>& tbl)
|
||||
:
|
||||
DataEntry<Type>(tbl),
|
||||
TableBase<Type>(tbl),
|
||||
fName_(tbl.fName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::TableFile<Type>::~TableFile()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "TableFileIO.C"
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,166 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::TableFile
|
||||
|
||||
Description
|
||||
Templated table container data entry where data is read from file.
|
||||
|
||||
\verbatim
|
||||
<entryName> tableFile;
|
||||
tableCoeffs
|
||||
{
|
||||
fileName dataFile; // name of data file
|
||||
outOfBounds clamp; // optional out-of-bounds handling
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Items are stored in a list of Tuple2's. First column is always stored as
|
||||
scalar entries. Data is read in the form, e.g. for an entry \<entryName\>
|
||||
that is (scalar, vector):
|
||||
\verbatim
|
||||
(
|
||||
0.0 (1 2 3)
|
||||
1.0 (4 5 6)
|
||||
);
|
||||
\endverbatim
|
||||
|
||||
|
||||
SourceFiles
|
||||
TableFile.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TableFile_H
|
||||
#define TableFile_H
|
||||
|
||||
#include "DataEntry.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class Type>
|
||||
class TableFile;
|
||||
|
||||
template<class Type>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const TableFile<Type>&
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class TableFile Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class TableFile
|
||||
:
|
||||
public DataEntry<Type>,
|
||||
public TableBase<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- File name for csv table (optional)
|
||||
fileName fName_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const TableFile<Type>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("tableFile");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from entry name and Istream
|
||||
TableFile(const word& entryName, const dictionary& dict);
|
||||
|
||||
//- Copy constructor
|
||||
TableFile(const TableFile<Type>& tbl);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<DataEntry<Type> > clone() const
|
||||
{
|
||||
return tmp<DataEntry<Type> >(new TableFile<Type>(*this));
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~TableFile();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return TableFile value
|
||||
virtual Type value(const scalar x) const
|
||||
{
|
||||
return TableBase<Type>::value(x);
|
||||
}
|
||||
|
||||
//- Integrate between two (scalar) values
|
||||
virtual Type integrate(const scalar x1, const scalar x2) const
|
||||
{
|
||||
return TableBase<Type>::integrate(x1, x2);
|
||||
}
|
||||
|
||||
|
||||
// I/O
|
||||
|
||||
//- Ostream Operator
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream& os,
|
||||
const TableFile<Type>& tbl
|
||||
);
|
||||
|
||||
//- Write in dictionary format
|
||||
virtual void writeData(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "TableFile.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -23,28 +23,41 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef timeVaryingUniformFixedValueFvPatchFieldsFwd_H
|
||||
#define timeVaryingUniformFixedValueFvPatchFieldsFwd_H
|
||||
#include "DataEntry.H"
|
||||
|
||||
#include "fieldTypes.H"
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
template<class Type>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const TableFile<Type>& tbl
|
||||
)
|
||||
{
|
||||
os << static_cast<const DataEntry<Type>&>(tbl)
|
||||
<< static_cast<const TableBase<Type>&>(tbl);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Check state of Ostream
|
||||
os.check
|
||||
(
|
||||
"Ostream& operator<<(Ostream&, const TableFile<Type>&)"
|
||||
);
|
||||
|
||||
template<class Type> class timeVaryingUniformFixedValueFvPatchField;
|
||||
return os;
|
||||
}
|
||||
|
||||
makePatchTypeFieldTypedefs(timeVaryingUniformFixedValue);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
template<class Type>
|
||||
void Foam::TableFile<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
DataEntry<Type>::writeData(os);
|
||||
|
||||
} // End namespace Foam
|
||||
os << token::END_STATEMENT << nl
|
||||
<< indent << word(type() + "Coeffs") << nl
|
||||
<< indent << token::BEGIN_BLOCK << nl << incrIndent;
|
||||
os.writeKeyword("fileName")<< fName_ << token::END_STATEMENT << nl;
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -23,27 +23,56 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "DataEntry.H"
|
||||
#include "Constant.H"
|
||||
#include "CSV.H"
|
||||
#include "DataEntry.H"
|
||||
#include "Table.H"
|
||||
#include "TableFile.H"
|
||||
|
||||
#include "label.H"
|
||||
#include "scalar.H"
|
||||
#include "vector.H"
|
||||
#include "sphericalTensor.H"
|
||||
#include "symmTensor.H"
|
||||
#include "tensor.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeDataEntry(label);
|
||||
makeDataEntryType(Constant, label);
|
||||
// makeDataEntryType(CSV, label);
|
||||
makeDataEntryType(Table, label);
|
||||
makeDataEntryType(TableFile, label);
|
||||
|
||||
makeDataEntry(scalar);
|
||||
makeDataEntryType(Constant, scalar);
|
||||
makeDataEntryType(CSV, scalar);
|
||||
makeDataEntryType(Table, scalar);
|
||||
makeDataEntryType(TableFile, scalar);
|
||||
|
||||
makeDataEntry(vector);
|
||||
makeDataEntryType(Constant, vector);
|
||||
makeDataEntryType(CSV, vector);
|
||||
makeDataEntryType(Table, vector);
|
||||
makeDataEntryType(TableFile, vector);
|
||||
|
||||
makeDataEntry(sphericalTensor);
|
||||
makeDataEntryType(Constant, sphericalTensor);
|
||||
makeDataEntryType(CSV, sphericalTensor);
|
||||
makeDataEntryType(Table, sphericalTensor);
|
||||
makeDataEntryType(TableFile, sphericalTensor);
|
||||
|
||||
makeDataEntry(symmTensor);
|
||||
makeDataEntryType(Constant, symmTensor);
|
||||
makeDataEntryType(CSV, symmTensor);
|
||||
makeDataEntryType(Table, symmTensor);
|
||||
makeDataEntryType(TableFile, symmTensor);
|
||||
|
||||
makeDataEntry(tensor);
|
||||
makeDataEntryType(Constant, tensor);
|
||||
makeDataEntryType(CSV, tensor);
|
||||
makeDataEntryType(Table, tensor);
|
||||
makeDataEntryType(TableFile, tensor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -34,12 +34,17 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::polynomial::polynomial(const word& entryName, Istream& is)
|
||||
Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
|
||||
:
|
||||
DataEntry<scalar>(entryName),
|
||||
coeffs_(is),
|
||||
coeffs_(),
|
||||
canIntegrate_(true)
|
||||
{
|
||||
Istream& is(dict.lookup(entryName));
|
||||
word entryType(is);
|
||||
|
||||
is >> coeffs_;
|
||||
|
||||
if (!coeffs_.size())
|
||||
{
|
||||
FatalErrorIn("Foam::polynomial::polynomial(const word&, Istream&)")
|
||||
|
||||
@ -94,7 +94,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
polynomial(const word& entryName, Istream& is);
|
||||
polynomial(const word& entryName, const dictionary& dict);
|
||||
|
||||
//- Copy constructor
|
||||
polynomial(const polynomial& poly);
|
||||
|
||||
@ -80,17 +80,12 @@ singleStepCombustion<CombThermoType, ThermoType>::R
|
||||
{
|
||||
const label specieI = this->thermo_->composition().species()[Y.name()];
|
||||
|
||||
const label fNorm = singleMixture_.specieProd()[specieI];
|
||||
|
||||
const volScalarField fres(singleMixture_.fres(specieI));
|
||||
|
||||
const volScalarField wSpecie
|
||||
(
|
||||
wFuel_*singleMixture_.specieStoichCoeffs()[specieI]
|
||||
/ max(fNorm*(Y - fres), scalar(0.001))
|
||||
);
|
||||
|
||||
return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y);
|
||||
return wSpecie + fvm::Sp(0.0*wSpecie, Y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -158,8 +158,6 @@ $(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVe
|
||||
$(derivedFvPatchFields)/syringePressure/syringePressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/AverageIOFields.C
|
||||
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/totalTemperature/totalTemperatureFvPatchScalarField.C
|
||||
|
||||
@ -31,8 +31,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
flowRateInletVelocityFvPatchVectorField::
|
||||
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||
flowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
@ -40,14 +39,13 @@ flowRateInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
flowRate_(0),
|
||||
flowRate_(),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho")
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
flowRateInletVelocityFvPatchVectorField::
|
||||
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||
flowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const flowRateInletVelocityFvPatchVectorField& ptf,
|
||||
@ -57,14 +55,13 @@ flowRateInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||
flowRate_(ptf.flowRate_),
|
||||
flowRate_(ptf.flowRate_().clone().ptr()),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
flowRateInletVelocityFvPatchVectorField::
|
||||
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||
flowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
@ -73,28 +70,26 @@ flowRateInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||
flowRate_(readScalar(dict.lookup("flowRate"))),
|
||||
flowRate_(DataEntry<scalar>::New("flowRate", dict)),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
flowRateInletVelocityFvPatchVectorField::
|
||||
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||
flowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const flowRateInletVelocityFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf),
|
||||
flowRate_(ptf.flowRate_),
|
||||
flowRate_(ptf.flowRate_().clone().ptr()),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
flowRateInletVelocityFvPatchVectorField::
|
||||
Foam::flowRateInletVelocityFvPatchVectorField::
|
||||
flowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const flowRateInletVelocityFvPatchVectorField& ptf,
|
||||
@ -102,7 +97,7 @@ flowRateInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, iF),
|
||||
flowRate_(ptf.flowRate_),
|
||||
flowRate_(ptf.flowRate_().clone().ptr()),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
@ -117,8 +112,10 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const scalar t = db().time().value();
|
||||
|
||||
// a simpler way of doing this would be nice
|
||||
const scalar avgU = -flowRate_/gSum(patch().magSf());
|
||||
const scalar avgU = -flowRate_->value(t)/gSum(patch().magSf());
|
||||
|
||||
tmp<vectorField> n = patch().nf();
|
||||
|
||||
@ -157,7 +154,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<vector>::write(os);
|
||||
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
|
||||
flowRate_->writeData(os);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntry("value", os);
|
||||
|
||||
@ -57,6 +57,7 @@ SourceFiles
|
||||
#define flowRateInletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -73,7 +74,7 @@ class flowRateInletVelocityFvPatchVectorField
|
||||
// Private data
|
||||
|
||||
//- Inlet integral flow rate
|
||||
scalar flowRate_;
|
||||
autoPtr<DataEntry<scalar> > flowRate_;
|
||||
|
||||
//- Name of the flux transporting the field
|
||||
word phiName_;
|
||||
@ -153,27 +154,11 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the flux
|
||||
scalar flowRate() const
|
||||
{
|
||||
return flowRate_;
|
||||
}
|
||||
|
||||
//- Return reference to the flux to allow adjustment
|
||||
scalar& flowRate()
|
||||
{
|
||||
return flowRate_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -33,10 +33,13 @@ License
|
||||
void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
||||
calcTangentialVelocity()
|
||||
{
|
||||
vector axisHat = omega_/mag(omega_);
|
||||
const scalar t = this->db().time().value();
|
||||
vector om = omega_->value(t);
|
||||
|
||||
vector axisHat = om/mag(om);
|
||||
const vectorField tangentialVelocity
|
||||
(
|
||||
(-omega_) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()))
|
||||
(-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()))
|
||||
);
|
||||
|
||||
const vectorField n(patch().nf());
|
||||
@ -54,7 +57,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
pressureInletOutletVelocityFvPatchVectorField(p, iF),
|
||||
omega_(vector::zero)
|
||||
omega_()
|
||||
{}
|
||||
|
||||
|
||||
@ -68,7 +71,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper),
|
||||
omega_(ptf.omega_)
|
||||
omega_(ptf.omega_().clone().ptr())
|
||||
{
|
||||
calcTangentialVelocity();
|
||||
}
|
||||
@ -83,7 +86,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
pressureInletOutletVelocityFvPatchVectorField(p, iF, dict),
|
||||
omega_(dict.lookup("omega"))
|
||||
omega_(DataEntry<vector>::New("omega", dict))
|
||||
{
|
||||
calcTangentialVelocity();
|
||||
}
|
||||
@ -92,11 +95,11 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
||||
rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf
|
||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& rppvf
|
||||
)
|
||||
:
|
||||
pressureInletOutletVelocityFvPatchVectorField(pivpvf),
|
||||
omega_(pivpvf.omega_)
|
||||
pressureInletOutletVelocityFvPatchVectorField(rppvf),
|
||||
omega_(rppvf.omega_().clone().ptr())
|
||||
{
|
||||
calcTangentialVelocity();
|
||||
}
|
||||
@ -105,12 +108,12 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
|
||||
rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
(
|
||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf,
|
||||
const rotatingPressureInletOutletVelocityFvPatchVectorField& rppvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
pressureInletOutletVelocityFvPatchVectorField(pivpvf, iF),
|
||||
omega_(pivpvf.omega_)
|
||||
pressureInletOutletVelocityFvPatchVectorField(rppvf, iF),
|
||||
omega_(rppvf.omega_().clone().ptr())
|
||||
{
|
||||
calcTangentialVelocity();
|
||||
}
|
||||
@ -125,7 +128,7 @@ void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::write
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
os.writeKeyword("phi") << phiName() << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("omega")<< omega_ << token::END_STATEMENT << nl;
|
||||
omega_->writeData(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ SourceFiles
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "pressureInletOutletVelocityFvPatchVectorField.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -47,7 +48,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class rotatingPressureInletOutletVelocityFvPatch Declaration
|
||||
Class rotatingPressureInletOutletVelocityFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
@ -57,7 +58,7 @@ class rotatingPressureInletOutletVelocityFvPatchVectorField
|
||||
// Private data
|
||||
|
||||
//- Angular velocity of the frame
|
||||
vector omega_;
|
||||
autoPtr<DataEntry<vector> > omega_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -141,23 +142,6 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the angular velocity of rotation
|
||||
const vector& omega() const
|
||||
{
|
||||
return omega_;
|
||||
}
|
||||
|
||||
//- Reset the angular velocity of rotation
|
||||
// and update the tangentialVelocity
|
||||
void setOmega(const vector& omega)
|
||||
{
|
||||
omega_ = omega;
|
||||
calcTangentialVelocity();
|
||||
}
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
@ -39,7 +39,7 @@ rotatingTotalPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
totalPressureFvPatchScalarField(p, iF),
|
||||
omega_(vector::zero)
|
||||
omega_()
|
||||
{}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ rotatingTotalPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
totalPressureFvPatchScalarField(ptf, p, iF, mapper),
|
||||
omega_(ptf.omega_)
|
||||
omega_(ptf.omega_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -66,30 +66,30 @@ rotatingTotalPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
totalPressureFvPatchScalarField(p, iF, dict),
|
||||
omega_(dict.lookup("omega"))
|
||||
omega_(DataEntry<vector>::New("omega", dict))
|
||||
{}
|
||||
|
||||
|
||||
Foam::rotatingTotalPressureFvPatchScalarField::
|
||||
rotatingTotalPressureFvPatchScalarField
|
||||
(
|
||||
const rotatingTotalPressureFvPatchScalarField& tppsf
|
||||
const rotatingTotalPressureFvPatchScalarField& rtppsf
|
||||
)
|
||||
:
|
||||
totalPressureFvPatchScalarField(tppsf),
|
||||
omega_(tppsf.omega_)
|
||||
totalPressureFvPatchScalarField(rtppsf),
|
||||
omega_(rtppsf.omega_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
Foam::rotatingTotalPressureFvPatchScalarField::
|
||||
rotatingTotalPressureFvPatchScalarField
|
||||
(
|
||||
const rotatingTotalPressureFvPatchScalarField& tppsf,
|
||||
const rotatingTotalPressureFvPatchScalarField& rtppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
totalPressureFvPatchScalarField(tppsf, iF),
|
||||
omega_(tppsf.omega_)
|
||||
totalPressureFvPatchScalarField(rtppsf, iF),
|
||||
omega_(rtppsf.omega_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -102,9 +102,12 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
vector axisHat = omega_/mag(omega_);
|
||||
const scalar t = this->db().time().value();
|
||||
const vector om = omega_->value(t);
|
||||
|
||||
vector axisHat = om/mag(om);
|
||||
tmp<vectorField> rotationVelocity =
|
||||
omega_ ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()));
|
||||
om ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()));
|
||||
|
||||
const vectorField Up
|
||||
(
|
||||
@ -119,7 +122,7 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
|
||||
void Foam::rotatingTotalPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
totalPressureFvPatchScalarField::write(os);
|
||||
os.writeKeyword("omega")<< omega_ << token::END_STATEMENT << nl;
|
||||
omega_->writeData(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ SourceFiles
|
||||
#define rotatingTotalPressureFvPatchScalarField_H
|
||||
|
||||
#include "totalPressureFvPatchScalarField.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -43,7 +44,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class rotatingTotalPressureFvPatch Declaration
|
||||
Class rotatingTotalPressureFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class rotatingTotalPressureFvPatchScalarField
|
||||
@ -53,7 +54,7 @@ class rotatingTotalPressureFvPatchScalarField
|
||||
// Private data
|
||||
|
||||
//- Angular velocity of the frame
|
||||
vector omega_;
|
||||
autoPtr<DataEntry<vector> > omega_;
|
||||
|
||||
|
||||
public:
|
||||
@ -126,21 +127,6 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the angular velocity of rotation
|
||||
const vector& omega() const
|
||||
{
|
||||
return omega_;
|
||||
}
|
||||
|
||||
//- Return the angular velocity of rotation
|
||||
vector& omega()
|
||||
{
|
||||
return omega_;
|
||||
}
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
|
||||
@ -38,7 +38,7 @@ rotatingWallVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
origin_(vector::zero),
|
||||
origin_(),
|
||||
axis_(vector::zero),
|
||||
omega_(0)
|
||||
{}
|
||||
@ -56,7 +56,7 @@ rotatingWallVelocityFvPatchVectorField
|
||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||
origin_(ptf.origin_),
|
||||
axis_(ptf.axis_),
|
||||
omega_(ptf.omega_)
|
||||
omega_(ptf.omega_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ rotatingWallVelocityFvPatchVectorField
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
origin_(dict.lookup("origin")),
|
||||
axis_(dict.lookup("axis")),
|
||||
omega_(readScalar(dict.lookup("omega")))
|
||||
omega_(DataEntry<scalar>::New("omega", dict))
|
||||
{
|
||||
// Evaluate the wall velocity
|
||||
updateCoeffs();
|
||||
@ -81,27 +81,27 @@ rotatingWallVelocityFvPatchVectorField
|
||||
Foam::rotatingWallVelocityFvPatchVectorField::
|
||||
rotatingWallVelocityFvPatchVectorField
|
||||
(
|
||||
const rotatingWallVelocityFvPatchVectorField& pivpvf
|
||||
const rotatingWallVelocityFvPatchVectorField& rwvpvf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(pivpvf),
|
||||
origin_(pivpvf.origin_),
|
||||
axis_(pivpvf.axis_),
|
||||
omega_(pivpvf.omega_)
|
||||
fixedValueFvPatchField<vector>(rwvpvf),
|
||||
origin_(rwvpvf.origin_),
|
||||
axis_(rwvpvf.axis_),
|
||||
omega_(rwvpvf.omega_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
Foam::rotatingWallVelocityFvPatchVectorField::
|
||||
rotatingWallVelocityFvPatchVectorField
|
||||
(
|
||||
const rotatingWallVelocityFvPatchVectorField& pivpvf,
|
||||
const rotatingWallVelocityFvPatchVectorField& rwvpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(pivpvf, iF),
|
||||
origin_(pivpvf.origin_),
|
||||
axis_(pivpvf.axis_),
|
||||
omega_(pivpvf.omega_)
|
||||
fixedValueFvPatchField<vector>(rwvpvf, iF),
|
||||
origin_(rwvpvf.origin_),
|
||||
axis_(rwvpvf.axis_),
|
||||
omega_(rwvpvf.omega_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -114,10 +114,13 @@ void Foam::rotatingWallVelocityFvPatchVectorField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const scalar t = this->db().time().value();
|
||||
scalar om = omega_->value(t);
|
||||
|
||||
// Calculate the rotating wall velocity from the specification of the motion
|
||||
const vectorField Up
|
||||
(
|
||||
(-omega_)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
|
||||
(-om)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
|
||||
);
|
||||
|
||||
// Remove the component of Up normal to the wall
|
||||
@ -134,7 +137,7 @@ void Foam::rotatingWallVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
fvPatchVectorField::write(os);
|
||||
os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("omega") << omega_ << token::END_STATEMENT << nl;
|
||||
omega_->writeData(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ SourceFiles
|
||||
#define rotatingWallVelocityFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -43,7 +44,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class rotatingWallVelocityFvPatch Declaration
|
||||
Class rotatingWallVelocityFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class rotatingWallVelocityFvPatchVectorField
|
||||
@ -59,7 +60,7 @@ class rotatingWallVelocityFvPatchVectorField
|
||||
vector axis_;
|
||||
|
||||
//- Rotational speed
|
||||
scalar omega_;
|
||||
autoPtr<DataEntry<scalar> > omega_;
|
||||
|
||||
|
||||
public:
|
||||
@ -147,12 +148,6 @@ public:
|
||||
return axis_;
|
||||
}
|
||||
|
||||
//- Return the rotational speed
|
||||
scalar omega() const
|
||||
{
|
||||
return omega_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the origin of the rotation
|
||||
vector& origin()
|
||||
{
|
||||
@ -165,12 +160,6 @@ public:
|
||||
return axis_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the rotational speed
|
||||
scalar& omega()
|
||||
{
|
||||
return omega_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
@ -1,132 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "timeVaryingFlowRateInletVelocityFvPatchVectorField.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
flowRateInletVelocityFvPatchVectorField(p, iF),
|
||||
timeSeries_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
flowRateInletVelocityFvPatchVectorField(ptf, p, iF, mapper),
|
||||
timeSeries_(ptf.timeSeries_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
flowRateInletVelocityFvPatchVectorField(p, iF, dict),
|
||||
timeSeries_(dict)
|
||||
{}
|
||||
|
||||
|
||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
flowRateInletVelocityFvPatchVectorField(ptf),
|
||||
timeSeries_(ptf.timeSeries_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
flowRateInletVelocityFvPatchVectorField(ptf, iF),
|
||||
timeSeries_(ptf.timeSeries_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
||||
updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
flowRate() = timeSeries_(this->db().time().timeOutputValue());
|
||||
flowRateInletVelocityFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField::
|
||||
write(Ostream& os) const
|
||||
{
|
||||
flowRateInletVelocityFvPatchVectorField::write(os);
|
||||
timeSeries_.write(os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,182 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
|
||||
Description
|
||||
A time-varying form of a flow normal vector boundary condition. The
|
||||
variation is specified as an interpolationTable (see
|
||||
Foam::interpolationTable).
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type timeVaryingFlowRateInletVelocity;
|
||||
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
|
||||
value uniform (0 0 0); // placeholder
|
||||
fileName "$FOAM_CASE/time-series";
|
||||
outOfBounds repeat; // (error|warn|clamp|repeat)
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
- The value is positive inwards
|
||||
- may not work correctly for transonic inlets!
|
||||
- strange behaviour with potentialFoam since the U equation is not solved
|
||||
|
||||
See Also
|
||||
Foam::interpolationTable and Foam::flowRateInletVelocityFvPatchVectorField
|
||||
|
||||
SourceFiles
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef timeVaryingFlowRateInletVelocityFvPatchVectorField_H
|
||||
#define timeVaryingFlowRateInletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "flowRateInletVelocityFvPatchVectorField.H"
|
||||
#include "interpolationTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class timeVaryingFlowRateInletVelocityFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
:
|
||||
public flowRateInletVelocityFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- the time series being used, including the bounding treatment
|
||||
interpolationTable<scalar> timeSeries_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("timeVaryingFlowRateInletVelocity");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patch field onto a new patch
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new timeVaryingFlowRateInletVelocityFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingFlowRateInletVelocityFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new timeVaryingFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the time series used
|
||||
const interpolationTable<scalar>& timeSeries() const
|
||||
{
|
||||
return timeSeries_;
|
||||
}
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,137 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "timeVaryingUniformFixedValueFvPatchField.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF),
|
||||
timeSeries_()
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF),
|
||||
timeSeries_(dict)
|
||||
{
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const timeVaryingUniformFixedValueFvPatchField<Type>& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
timeSeries_(ptf.timeSeries_)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const timeVaryingUniformFixedValueFvPatchField<Type>& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf),
|
||||
timeSeries_(ptf.timeSeries_)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const timeVaryingUniformFixedValueFvPatchField<Type>& ptf,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf, iF),
|
||||
timeSeries_(ptf.timeSeries_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fvPatchField<Type>::operator==
|
||||
(
|
||||
timeSeries_(this->db().time().timeOutputValue())
|
||||
);
|
||||
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchField<Type>::write(os);
|
||||
timeSeries_.write(os);
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,183 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::timeVaryingUniformFixedValueFvPatchField
|
||||
|
||||
Description
|
||||
A time-varying form of a uniform fixed value boundary condition. The
|
||||
variation is specified as an interpolationTable (see
|
||||
Foam::interpolationTable for read options).
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type timeVaryingUniformFixedValue;
|
||||
fileName "$FOAM_CASE/time-series";
|
||||
outOfBounds clamp; // (error|warn|clamp|repeat)
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
This class is derived directly from a fixedValue patch rather than from
|
||||
a uniformFixedValue patch.
|
||||
|
||||
See Also
|
||||
Foam::interpolationTable and Foam::fixedValueFvPatchField
|
||||
|
||||
SourceFiles
|
||||
timeVaryingUniformFixedValueFvPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef timeVaryingUniformFixedValueFvPatchField_H
|
||||
#define timeVaryingUniformFixedValueFvPatchField_H
|
||||
|
||||
#include "fixedValueFvPatchField.H"
|
||||
#include "interpolationTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class timeVaryingUniformFixedValueFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class timeVaryingUniformFixedValueFvPatchField
|
||||
:
|
||||
public fixedValueFvPatchField<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- The time series being used, including the bounding treatment
|
||||
interpolationTable<Type> timeSeries_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("timeVaryingUniformFixedValue");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patch field onto a new patch
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const timeVaryingUniformFixedValueFvPatchField<Type>&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const timeVaryingUniformFixedValueFvPatchField<Type>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchField<Type> > clone() const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new timeVaryingUniformFixedValueFvPatchField<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const timeVaryingUniformFixedValueFvPatchField<Type>&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchField<Type> > clone
|
||||
(
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new timeVaryingUniformFixedValueFvPatchField<Type>(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the time series used
|
||||
const interpolationTable<Type>& timeSeries() const
|
||||
{
|
||||
return timeSeries_;
|
||||
}
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "timeVaryingUniformFixedValueFvPatchField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -40,7 +40,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF),
|
||||
uniformValue_(pTraits<Type>::zero)
|
||||
uniformValue_()
|
||||
{}
|
||||
|
||||
|
||||
@ -54,9 +54,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF),
|
||||
uniformValue_(ptf.uniformValue_)
|
||||
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||
{
|
||||
fvPatchField<Type>::operator==(uniformValue_);
|
||||
const scalar t = this->db().time().value();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
|
||||
|
||||
@ -69,9 +70,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF),
|
||||
uniformValue_(pTraits<Type>(dict.lookup("uniformValue")))
|
||||
uniformValue_(DataEntry<Type>::New("uniformValue", dict))
|
||||
{
|
||||
fvPatchField<Type>::operator==(uniformValue_);
|
||||
const scalar t = this->db().time().value();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
|
||||
|
||||
@ -82,9 +84,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf),
|
||||
uniformValue_(ptf.uniformValue_)
|
||||
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||
{
|
||||
fvPatchField<Type>::operator==(uniformValue_);
|
||||
const scalar t = this->db().time().value();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
|
||||
|
||||
@ -96,9 +99,10 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf, iF),
|
||||
uniformValue_(ptf.uniformValue_)
|
||||
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||
{
|
||||
fvPatchField<Type>::operator==(uniformValue_);
|
||||
const scalar t = this->db().time().value();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +115,8 @@ void uniformFixedValueFvPatchField<Type>::autoMap
|
||||
)
|
||||
{
|
||||
this->setSize(m.size());
|
||||
fvPatchField<Type>::operator==(uniformValue_);
|
||||
const scalar t = this->db().time().value();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
|
||||
|
||||
@ -119,8 +124,7 @@ template<class Type>
|
||||
void uniformFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<Type>::write(os);
|
||||
os.writeKeyword("uniformValue")
|
||||
<< uniformValue_ << token::END_STATEMENT << nl;
|
||||
uniformValue_->writeData(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ SourceFiles
|
||||
|
||||
#include "Random.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,7 +45,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class uniformFixedValueFvPatch Declaration
|
||||
Class uniformFixedValueFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
@ -54,7 +55,7 @@ class uniformFixedValueFvPatchField
|
||||
{
|
||||
// Private data
|
||||
|
||||
Type uniformValue_;
|
||||
autoPtr<DataEntry<Type> > uniformValue_;
|
||||
|
||||
|
||||
public:
|
||||
@ -127,21 +128,6 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the fluctuation scale
|
||||
const Type& uniformValue() const
|
||||
{
|
||||
return uniformValue_;
|
||||
}
|
||||
|
||||
//- Return reference to the fluctuation scale to allow adjustment
|
||||
Type& uniformValue()
|
||||
{
|
||||
return uniformValue_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
|
||||
@ -31,9 +31,33 @@ License
|
||||
#include "Time.H"
|
||||
#include "OFstream.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "cyclicAMIPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class ParticleType>
|
||||
void Foam::Cloud<ParticleType>::checkPatches() const
|
||||
{
|
||||
const polyBoundaryMesh& pbm = polyMesh_.boundaryMesh();
|
||||
bool ok = true;
|
||||
forAll(pbm, patchI)
|
||||
{
|
||||
if (isA<cyclicAMIPolyPatch>(pbm[patchI]))
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
WarningIn("void Foam::Cloud<ParticleType>::initCloud(const bool)")
|
||||
<< "Particle tracking across AMI patches is not currently "
|
||||
<< "supported" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class ParticleType>
|
||||
void Foam::Cloud<ParticleType>::calcCellWallFaces() const
|
||||
{
|
||||
@ -76,6 +100,8 @@ Foam::Cloud<ParticleType>::Cloud
|
||||
nTrackingRescues_(),
|
||||
cellWallFacesPtr_()
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
// Ask for the tetBasePtIs to trigger all processors to build
|
||||
// them, otherwise, if some processors have no particles then
|
||||
// there is a comms mismatch.
|
||||
@ -100,6 +126,8 @@ Foam::Cloud<ParticleType>::Cloud
|
||||
nTrackingRescues_(),
|
||||
cellWallFacesPtr_()
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
// Ask for the tetBasePtIs to trigger all processors to build
|
||||
// them, otherwise, if some processors have no particles then
|
||||
// there is a comms mismatch.
|
||||
|
||||
@ -93,6 +93,9 @@ class Cloud
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Check patches
|
||||
void checkPatches() const;
|
||||
|
||||
//- Initialise cloud on IO constructor
|
||||
void initCloud(const bool checkClass);
|
||||
|
||||
|
||||
@ -162,6 +162,8 @@ Foam::Cloud<ParticleType>::Cloud
|
||||
nTrackingRescues_(),
|
||||
cellWallFacesPtr_()
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
initCloud(checkClass);
|
||||
}
|
||||
|
||||
@ -180,6 +182,8 @@ Foam::Cloud<ParticleType>::Cloud
|
||||
nTrackingRescues_(),
|
||||
cellWallFacesPtr_()
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
initCloud(checkClass);
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Foam
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::fieldValues::cellSource::operationType,
|
||||
7
|
||||
8
|
||||
>::names[] =
|
||||
{
|
||||
"none",
|
||||
@ -59,7 +59,8 @@ namespace Foam
|
||||
"volIntegrate",
|
||||
"weightedAverage",
|
||||
"min",
|
||||
"max"
|
||||
"max",
|
||||
"CoV"
|
||||
};
|
||||
}
|
||||
|
||||
@ -67,7 +68,7 @@ namespace Foam
|
||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 2>
|
||||
Foam::fieldValues::cellSource::sourceTypeNames_;
|
||||
|
||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 7>
|
||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 8>
|
||||
Foam::fieldValues::cellSource::operationTypeNames_;
|
||||
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ Description
|
||||
- volAverage
|
||||
- volIntegrate
|
||||
- weightedAverage
|
||||
- CoV (Coefficient of variation: standard deviation/mean)
|
||||
|
||||
SourceFiles
|
||||
cellSource.C
|
||||
@ -106,11 +107,12 @@ public:
|
||||
opVolIntegrate,
|
||||
opWeightedAverage,
|
||||
opMin,
|
||||
opMax
|
||||
opMax,
|
||||
opCoV
|
||||
};
|
||||
|
||||
//- Operation type names
|
||||
static const NamedEnum<operationType, 7> operationTypeNames_;
|
||||
static const NamedEnum<operationType, 8> operationTypeNames_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -115,6 +115,23 @@ Type Foam::fieldValues::cellSource::processValues
|
||||
result = max(values);
|
||||
break;
|
||||
}
|
||||
case opCoV:
|
||||
{
|
||||
Type meanValue = sum(values*V)/sum(V);
|
||||
|
||||
const label nComp = pTraits<Type>::nComponents;
|
||||
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
scalarField vals(values.component(d));
|
||||
scalar mean = component(meanValue, d);
|
||||
scalar& res = setComponent(result, d);
|
||||
|
||||
res = sqrt(sum(V*sqr(vals - mean))/(V.size()*sum(V)))/mean;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user