mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -8,7 +8,9 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude
|
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||||
|
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
|
||||||
|
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lbasicThermophysicalModels \
|
-lbasicThermophysicalModels \
|
||||||
@ -19,4 +21,6 @@ EXE_LIBS = \
|
|||||||
-lcompressibleLESModels \
|
-lcompressibleLESModels \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lradiationModels
|
-lradiationModels \
|
||||||
|
-ldecompose \
|
||||||
|
-lreconstruct
|
||||||
|
|||||||
@ -0,0 +1,84 @@
|
|||||||
|
|
||||||
|
// 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,6 +39,11 @@ Description
|
|||||||
#include "solidRegionDiffNo.H"
|
#include "solidRegionDiffNo.H"
|
||||||
#include "basicSolidThermo.H"
|
#include "basicSolidThermo.H"
|
||||||
#include "radiationModel.H"
|
#include "radiationModel.H"
|
||||||
|
#include "fvFieldReconstructor.H"
|
||||||
|
#include "mixedFvPatchFields.H"
|
||||||
|
#include "fvFieldDecomposer.H"
|
||||||
|
#include "harmonic.H"
|
||||||
|
#include "rmap.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -49,12 +54,40 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
regionProperties rp(runTime);
|
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 "createFluidMeshes.H"
|
||||||
#include "createSolidMeshes.H"
|
#include "createSolidMeshes.H"
|
||||||
|
|
||||||
#include "createFluidFields.H"
|
#include "createFluidFields.H"
|
||||||
#include "createSolidFields.H"
|
#include "createSolidFields.H"
|
||||||
|
|
||||||
|
// Temperature solved on single mesh
|
||||||
|
#include "createAllMesh.H"
|
||||||
|
#include "createAllFields.H"
|
||||||
|
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
|
||||||
#include "readTimeControls.H"
|
#include "readTimeControls.H"
|
||||||
@ -81,9 +114,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
|
||||||
if (nOuterCorr != 1)
|
if (nOuterCorr != 1)
|
||||||
{
|
{
|
||||||
forAll(fluidRegions, i)
|
forAll(fluidToProc, i)
|
||||||
{
|
{
|
||||||
#include "setRegionFluidFields.H"
|
#include "setRegionFluidFields.H"
|
||||||
#include "storeOldFluidFields.H"
|
#include "storeOldFluidFields.H"
|
||||||
@ -96,22 +130,133 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
bool finalIter = oCorr == nOuterCorr-1;
|
bool finalIter = oCorr == nOuterCorr-1;
|
||||||
|
|
||||||
forAll(fluidRegions, i)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
Info<< "\nSolving for fluid region "
|
forAll(procMeshes, procI)
|
||||||
<< fluidRegions[i].name() << endl;
|
{
|
||||||
#include "setRegionFluidFields.H"
|
procMeshes[procI].data::add("finalIteration", true);
|
||||||
#include "readFluidMultiRegionPIMPLEControls.H"
|
}
|
||||||
#include "solveFluid.H"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(solidRegions, i)
|
|
||||||
|
PtrList<surfaceScalarField> procPhi(nAllRegions);
|
||||||
|
PtrList<surfaceScalarField> procAlpha(nAllRegions);
|
||||||
|
|
||||||
|
|
||||||
|
// Solve (uncoupled) or set up (coupled) the temperature equation
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
forAll(solidToProc, i)
|
||||||
{
|
{
|
||||||
Info<< "\nSolving for solid region "
|
label procI = solidToProc[i];
|
||||||
<< solidRegions[i].name() << endl;
|
|
||||||
|
Info<< "\nSolving temperature for solid region "
|
||||||
|
<< procMeshes[procI].name() << endl;
|
||||||
#include "setRegionSolidFields.H"
|
#include "setRegionSolidFields.H"
|
||||||
#include "readSolidMultiRegionPIMPLEControls.H"
|
#include "readSolidMultiRegionPIMPLEControls.H"
|
||||||
#include "solveSolid.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;
|
||||||
|
#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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Solve combined h equation
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
if (temperatureCoupled)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
#include "setRegionSolidFields.H"
|
||||||
|
#include "readSolidMultiRegionPIMPLEControls.H"
|
||||||
|
|
||||||
|
thermo.correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (finalIter)
|
||||||
|
{
|
||||||
|
forAll(procMeshes, procI)
|
||||||
|
{
|
||||||
|
procMeshes[procI].data::remove("finalIteration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,64 @@
|
|||||||
|
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)
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
//
|
||||||
|
// 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;
|
scalar CoNum = -GREAT;
|
||||||
|
|
||||||
forAll(fluidRegions, regionI)
|
forAll(fluidToProc, regionI)
|
||||||
{
|
{
|
||||||
CoNum = max
|
CoNum = max
|
||||||
(
|
(
|
||||||
compressibleCourantNo
|
compressibleCourantNo
|
||||||
(
|
(
|
||||||
fluidRegions[regionI],
|
procMeshes[fluidToProc[regionI]],
|
||||||
runTime,
|
runTime,
|
||||||
rhoFluid[regionI],
|
rhoFluid[regionI],
|
||||||
phiFluid[regionI]
|
phiFluid[regionI]
|
||||||
|
|||||||
@ -1,30 +1,36 @@
|
|||||||
// Initialise fluid field pointer lists
|
// Initialise fluid field pointer lists
|
||||||
PtrList<basicRhoThermo> thermoFluid(fluidRegions.size());
|
PtrList<basicRhoThermo> thermoFluid(rp.fluidRegionNames().size());
|
||||||
PtrList<volScalarField> rhoFluid(fluidRegions.size());
|
PtrList<volScalarField> rhoFluid(rp.fluidRegionNames().size());
|
||||||
PtrList<volScalarField> KFluid(fluidRegions.size());
|
PtrList<volScalarField> KFluid(rp.fluidRegionNames().size());
|
||||||
PtrList<volVectorField> UFluid(fluidRegions.size());
|
PtrList<volVectorField> UFluid(rp.fluidRegionNames().size());
|
||||||
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
|
PtrList<surfaceScalarField> phiFluid(rp.fluidRegionNames().size());
|
||||||
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
|
PtrList<uniformDimensionedVectorField> gFluid(rp.fluidRegionNames().size());
|
||||||
PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
|
PtrList<compressible::turbulenceModel> turbulence
|
||||||
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
|
(
|
||||||
PtrList<volScalarField> ghFluid(fluidRegions.size());
|
rp.fluidRegionNames().size()
|
||||||
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
|
);
|
||||||
PtrList<radiation::radiationModel> radiation(fluidRegions.size());
|
PtrList<volScalarField> p_rghFluid(rp.fluidRegionNames().size());
|
||||||
PtrList<volScalarField> DpDtFluid(fluidRegions.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());
|
||||||
|
|
||||||
List<scalar> initialMassFluid(fluidRegions.size());
|
List<scalar> initialMassFluid(rp.fluidRegionNames().size());
|
||||||
|
|
||||||
// Populate fluid field pointer lists
|
// Populate fluid field pointer lists
|
||||||
forAll(fluidRegions, i)
|
forAll(rp.fluidRegionNames(), i)
|
||||||
{
|
{
|
||||||
Info<< "*** Reading fluid mesh thermophysical properties for region "
|
Info<< "*** Reading fluid mesh thermophysical properties for region "
|
||||||
<< fluidRegions[i].name() << nl << endl;
|
<< rp.fluidRegionNames()[i] << nl << endl;
|
||||||
|
|
||||||
|
label procI = fluidToProc[i];
|
||||||
|
|
||||||
|
|
||||||
Info<< " Adding to thermoFluid\n" << endl;
|
Info<< " Adding to thermoFluid\n" << endl;
|
||||||
thermoFluid.set
|
thermoFluid.set
|
||||||
(
|
(
|
||||||
i,
|
i,
|
||||||
basicRhoThermo::New(fluidRegions[i]).ptr()
|
basicRhoThermo::New(procMeshes[procI]).ptr()
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Adding to rhoFluid\n" << endl;
|
Info<< " Adding to rhoFluid\n" << endl;
|
||||||
@ -37,7 +43,7 @@
|
|||||||
(
|
(
|
||||||
"rho",
|
"rho",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
fluidRegions[i],
|
procMeshes[procI],
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
@ -55,7 +61,7 @@
|
|||||||
(
|
(
|
||||||
"K",
|
"K",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
fluidRegions[i],
|
procMeshes[procI],
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
@ -73,11 +79,11 @@
|
|||||||
(
|
(
|
||||||
"U",
|
"U",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
fluidRegions[i],
|
procMeshes[procI],
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
fluidRegions[i]
|
procMeshes[procI]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -91,12 +97,12 @@
|
|||||||
(
|
(
|
||||||
"phi",
|
"phi",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
fluidRegions[i],
|
procMeshes[procI],
|
||||||
IOobject::READ_IF_PRESENT,
|
IOobject::READ_IF_PRESENT,
|
||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
linearInterpolate(rhoFluid[i]*UFluid[i])
|
linearInterpolate(rhoFluid[i]*UFluid[i])
|
||||||
& fluidRegions[i].Sf()
|
& procMeshes[procI].Sf()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -110,7 +116,7 @@
|
|||||||
(
|
(
|
||||||
"g",
|
"g",
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
fluidRegions[i],
|
procMeshes[procI],
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
)
|
||||||
@ -137,14 +143,14 @@
|
|||||||
ghFluid.set
|
ghFluid.set
|
||||||
(
|
(
|
||||||
i,
|
i,
|
||||||
new volScalarField("gh", gFluid[i] & fluidRegions[i].C())
|
new volScalarField("gh", gFluid[i] & procMeshes[procI].C())
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Adding to ghfFluid\n" << endl;
|
Info<< " Adding to ghfFluid\n" << endl;
|
||||||
ghfFluid.set
|
ghfFluid.set
|
||||||
(
|
(
|
||||||
i,
|
i,
|
||||||
new surfaceScalarField("ghf", gFluid[i] & fluidRegions[i].Cf())
|
new surfaceScalarField("ghf", gFluid[i] & procMeshes[procI].Cf())
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghFluid.set
|
p_rghFluid.set
|
||||||
@ -156,11 +162,11 @@
|
|||||||
(
|
(
|
||||||
"p_rgh",
|
"p_rgh",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
fluidRegions[i],
|
procMeshes[procI],
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
fluidRegions[i]
|
procMeshes[procI]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
PtrList<fvMesh> fluidRegions(rp.fluidRegionNames().size());
|
|
||||||
|
|
||||||
forAll(rp.fluidRegionNames(), i)
|
forAll(rp.fluidRegionNames(), i)
|
||||||
{
|
{
|
||||||
Info<< "Create fluid mesh for region " << rp.fluidRegionNames()[i]
|
Info<< "Create fluid mesh for region " << rp.fluidRegionNames()[i]
|
||||||
<< " for time = " << runTime.timeName() << nl << endl;
|
<< " for time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
fluidRegions.set
|
label procI = fluidToProc[i];
|
||||||
|
|
||||||
|
procMeshes.set
|
||||||
(
|
(
|
||||||
i,
|
procI,
|
||||||
new fvMesh
|
new fvMesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -19,4 +19,58 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
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(fluidRegions.size(), 0.0);
|
List<scalar> cumulativeContErr(fluidToProc.size(), 0.0);
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
h = allToProcMappers[procI].decomposeField(allh(), true);
|
||||||
|
h.oldTime().timeIndex() = allh().oldTime().timeIndex();
|
||||||
|
h.correctBoundaryConditions();
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
// 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 = fluidRegions[i];
|
fvMesh& mesh = procMeshes[fluidToProc[i]];
|
||||||
|
|
||||||
basicRhoThermo& thermo = thermoFluid[i];
|
basicRhoThermo& thermo = thermoFluid[i];
|
||||||
volScalarField& rho = rhoFluid[i];
|
volScalarField& rho = rhoFluid[i];
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
#include "UEqn.H"
|
||||||
|
|
||||||
|
// --- PISO loop
|
||||||
|
for (int corr=0; corr<nCorr; corr++)
|
||||||
|
{
|
||||||
|
#include "pEqn.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
turb.correct();
|
||||||
|
|
||||||
|
rho = thermo.rho();
|
||||||
@ -6,3 +6,6 @@
|
|||||||
|
|
||||||
const int nOuterCorr =
|
const int nOuterCorr =
|
||||||
pimple.lookupOrDefault<int>("nOuterCorrectors", 1);
|
pimple.lookupOrDefault<int>("nOuterCorrectors", 1);
|
||||||
|
|
||||||
|
const Switch temperatureCoupled =
|
||||||
|
pimple.lookupOrDefault<Switch>("temperatureCoupled", false);
|
||||||
|
|||||||
96
applications/solvers/heatTransfer/chtMultiRegionFoam/rmap.H
Normal file
96
applications/solvers/heatTransfer/chtMultiRegionFoam/rmap.H
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,309 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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,12 +1,36 @@
|
|||||||
// Initialise solid field pointer lists
|
// Initialise solid field pointer lists
|
||||||
PtrList<basicSolidThermo> thermos(solidRegions.size());
|
PtrList<basicSolidThermo> thermoSolid(rp.solidRegionNames().size());
|
||||||
|
PtrList<volScalarField> hSolid(rp.solidRegionNames().size());
|
||||||
|
|
||||||
// Populate solid field pointer lists
|
// Populate solid field pointer lists
|
||||||
forAll(solidRegions, i)
|
forAll(rp.solidRegionNames(), i)
|
||||||
{
|
{
|
||||||
Info<< "*** Reading solid mesh thermophysical properties for region "
|
Info<< "*** Reading solid mesh thermophysical properties for region "
|
||||||
<< solidRegions[i].name() << nl << endl;
|
<< rp.solidRegionNames()[i] << nl << endl;
|
||||||
|
|
||||||
Info<< " Adding to thermos\n" << endl;
|
label procI = solidToProc[i];
|
||||||
thermos.set(i, basicSolidThermo::New(solidRegions[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]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
PtrList<fvMesh> solidRegions(rp.solidRegionNames().size());
|
|
||||||
|
|
||||||
forAll(rp.solidRegionNames(), i)
|
forAll(rp.solidRegionNames(), i)
|
||||||
{
|
{
|
||||||
Info<< "Create solid mesh for region " << rp.solidRegionNames()[i]
|
Info<< "Create solid mesh for region " << rp.solidRegionNames()[i]
|
||||||
<< " for time = " << runTime.timeName() << nl << endl;
|
<< " for time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
solidRegions.set
|
label procI = solidToProc[i];
|
||||||
|
|
||||||
|
procMeshes.set
|
||||||
(
|
(
|
||||||
i,
|
procI,
|
||||||
new fvMesh
|
new fvMesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -20,8 +20,57 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Force calculation of geometric properties to prevent it being done
|
if (temperatureCoupled)
|
||||||
// later in e.g. some boundary evaluation
|
{
|
||||||
//(void)solidRegions[i].weights();
|
cellProcAddressing.set
|
||||||
//(void)solidRegions[i].deltaCoeffs();
|
(
|
||||||
|
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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
{
|
||||||
|
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 = solidRegions[i];
|
fvMesh& mesh = procMeshes[solidToProc[i]];
|
||||||
basicSolidThermo& thermo = thermos[i];
|
basicSolidThermo& thermo = thermoSolid[i];
|
||||||
|
|
||||||
tmp<volScalarField> trho = thermo.rho();
|
tmp<volScalarField> trho = thermo.rho();
|
||||||
const volScalarField& rho = trho();
|
const volScalarField& rho = trho();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
scalar DiNum = -GREAT;
|
scalar DiNum = -GREAT;
|
||||||
|
|
||||||
forAll(solidRegions, i)
|
forAll(solidToProc, i)
|
||||||
{
|
{
|
||||||
# include "setRegionSolidFields.H"
|
# include "setRegionSolidFields.H"
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
(
|
(
|
||||||
solidRegionDiffNo
|
solidRegionDiffNo
|
||||||
(
|
(
|
||||||
solidRegions[i],
|
procMeshes[solidToProc[i]],
|
||||||
runTime,
|
runTime,
|
||||||
rho*cp,
|
rho*cp,
|
||||||
K
|
K
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::add("finalIteration", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
{
|
{
|
||||||
@ -17,10 +12,3 @@ if (finalIter)
|
|||||||
|
|
||||||
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
|
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
thermo.correct();
|
|
||||||
|
|
||||||
if (finalIter)
|
|
||||||
{
|
|
||||||
mesh.data::remove("finalIteration");
|
|
||||||
}
|
|
||||||
|
|||||||
@ -936,12 +936,6 @@ int main(int argc, char *argv[])
|
|||||||
const word dictName
|
const word dictName
|
||||||
(args.optionLookupOrDefault<word>("dict", "extrudeToRegionMeshDict"));
|
(args.optionLookupOrDefault<word>("dict", "extrudeToRegionMeshDict"));
|
||||||
|
|
||||||
mappedPatchBase::sampleMode sampleMode = mappedPatchBase::NEARESTPATCHFACE;
|
|
||||||
if (args.optionFound("AMI"))
|
|
||||||
{
|
|
||||||
sampleMode = mappedPatchBase::NEARESTPATCHFACEAMI;
|
|
||||||
}
|
|
||||||
|
|
||||||
IOdictionary dict
|
IOdictionary dict
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -966,6 +960,9 @@ int main(int argc, char *argv[])
|
|||||||
dict.lookup("faceZonesShadow") >> zoneShadowNames;
|
dict.lookup("faceZonesShadow") >> zoneShadowNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mappedPatchBase::sampleMode sampleMode =
|
||||||
|
mappedPatchBase::sampleModeNames_[dict.lookup("sampleMode")];
|
||||||
|
|
||||||
const Switch oneD(dict.lookup("oneD"));
|
const Switch oneD(dict.lookup("oneD"));
|
||||||
const Switch adaptMesh(dict.lookup("adaptMesh"));
|
const Switch adaptMesh(dict.lookup("adaptMesh"));
|
||||||
|
|
||||||
|
|||||||
@ -15,10 +15,10 @@ FoamFile
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Name of region to create
|
// Name of region to create
|
||||||
region liquidFilm;
|
region liquidFilm;
|
||||||
|
|
||||||
// FaceZones to extrude
|
// FaceZones to extrude
|
||||||
faceZones (f0);
|
faceZones (f0);
|
||||||
|
|
||||||
// FaceZone shadow
|
// FaceZone shadow
|
||||||
//faceZonesShadow (fBaffleShadow);
|
//faceZonesShadow (fBaffleShadow);
|
||||||
@ -30,10 +30,13 @@ faceZones (f0);
|
|||||||
// - extruding boundary faces: repatched to be on mapped patches
|
// - extruding boundary faces: repatched to be on mapped patches
|
||||||
// If false: leave original mesh intact. Extruded mesh will still have
|
// If false: leave original mesh intact. Extruded mesh will still have
|
||||||
// mapped patch which might need to be adapted.
|
// mapped patch which might need to be adapted.
|
||||||
adaptMesh true;
|
adaptMesh true;
|
||||||
|
|
||||||
|
// Sample mode for inter-region communication
|
||||||
|
sampleMode nearestPatchFace;
|
||||||
|
|
||||||
// Extrude 1D-columns of cells?
|
// Extrude 1D-columns of cells?
|
||||||
oneD false;
|
oneD false;
|
||||||
|
|
||||||
// If oneD is true. Specify which boundary is wanted between the layers
|
// If oneD is true. Specify which boundary is wanted between the layers
|
||||||
//oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch
|
//oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch
|
||||||
@ -42,23 +45,23 @@ oneD false;
|
|||||||
//- Extrusion model to use. The only logical choice is linearNormal?
|
//- Extrusion model to use. The only logical choice is linearNormal?
|
||||||
|
|
||||||
//- Linear extrusion in normal direction
|
//- Linear extrusion in normal direction
|
||||||
extrudeModel linearNormal;
|
extrudeModel linearNormal;
|
||||||
|
|
||||||
//- Linear extrusion in specified direction
|
//- Linear extrusion in specified direction
|
||||||
//extrudeModel linearDirection;
|
// extrudeModel linearDirection;
|
||||||
|
|
||||||
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
|
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
|
||||||
// extrudeModel wedge;
|
// extrudeModel wedge;
|
||||||
|
|
||||||
//- Extrudes into sphere around (0 0 0)
|
//- Extrudes into sphere around (0 0 0)
|
||||||
//extrudeModel linearRadial;
|
// extrudeModel linearRadial;
|
||||||
|
|
||||||
//- Extrudes into sphere with grading according to pressure (atmospherics)
|
//- Extrudes into sphere with grading according to pressure (atmospherics)
|
||||||
//extrudeModel sigmaRadial;
|
// extrudeModel sigmaRadial;
|
||||||
|
|
||||||
nLayers 10;
|
nLayers 10;
|
||||||
|
|
||||||
expansionRatio 0.9;
|
expansionRatio 0.9;
|
||||||
|
|
||||||
linearNormalCoeffs
|
linearNormalCoeffs
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,6 @@ domainDecomposition.C
|
|||||||
domainDecompositionMesh.C
|
domainDecompositionMesh.C
|
||||||
domainDecompositionDistribute.C
|
domainDecompositionDistribute.C
|
||||||
dimFieldDecomposer.C
|
dimFieldDecomposer.C
|
||||||
fvFieldDecomposer.C
|
|
||||||
pointFieldDecomposer.C
|
pointFieldDecomposer.C
|
||||||
lagrangianFieldDecomposer.C
|
lagrangianFieldDecomposer.C
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
|
||||||
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
|
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
@ -6,6 +7,7 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
-ldecompose \
|
||||||
-lgenericPatchFields \
|
-lgenericPatchFields \
|
||||||
-ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \
|
-ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
|
|||||||
@ -487,9 +487,31 @@ case QSMPI:
|
|||||||
breaksw
|
breaksw
|
||||||
|
|
||||||
case SGIMPI:
|
case SGIMPI:
|
||||||
setenv FOAM_MPI ${MPI_ROOT##*/}
|
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
|
setenv MPI_ARCH_PATH $MPI_ROOT
|
||||||
|
|
||||||
|
|
||||||
|
if ($?FOAM_VERBOSE && $?prompt) then
|
||||||
|
echo "Using SGI MPT:"
|
||||||
|
echo " MPI_ROOT : $MPI_ROOT"
|
||||||
|
echo " FOAM_MPI : $FOAM_MPI"
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
_foamAddPath $MPI_ARCH_PATH/bin
|
_foamAddPath $MPI_ARCH_PATH/bin
|
||||||
_foamAddLib $MPI_ARCH_PATH/lib
|
_foamAddLib $MPI_ARCH_PATH/lib
|
||||||
breaksw
|
breaksw
|
||||||
|
|||||||
@ -511,9 +511,30 @@ QSMPI)
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
SGIMPI)
|
SGIMPI)
|
||||||
|
lastCharID=$(( ${#MPI_ROOT} - 1 ))
|
||||||
|
if [ "${MPI_ROOT:$lastCharID:1}" == '/' ]
|
||||||
|
then
|
||||||
|
MPI_ROOT=${MPI_ROOT:0:$lastCharID}
|
||||||
|
fi
|
||||||
|
|
||||||
export FOAM_MPI=${MPI_ROOT##*/}
|
export FOAM_MPI=${MPI_ROOT##*/}
|
||||||
export MPI_ARCH_PATH=$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 SGI MPT:"
|
||||||
|
echo " MPI_ROOT : $MPI_ROOT"
|
||||||
|
echo " FOAM_MPI : $FOAM_MPI"
|
||||||
|
fi
|
||||||
|
|
||||||
_foamAddPath $MPI_ARCH_PATH/bin
|
_foamAddPath $MPI_ARCH_PATH/bin
|
||||||
_foamAddLib $MPI_ARCH_PATH/lib
|
_foamAddLib $MPI_ARCH_PATH/lib
|
||||||
;;
|
;;
|
||||||
|
|||||||
@ -58,6 +58,11 @@ OptimisationSwitches
|
|||||||
commsType nonBlocking; //scheduled; //blocking;
|
commsType nonBlocking; //scheduled; //blocking;
|
||||||
floatTransfer 0;
|
floatTransfer 0;
|
||||||
nProcsSimpleSum 0;
|
nProcsSimpleSum 0;
|
||||||
|
|
||||||
|
// Force dumping (at next timestep) upon signal (-1 to disable)
|
||||||
|
writeNowSignal -1; //10;
|
||||||
|
// Force dumping (at next timestep) upon signal (-1 to disable) and exit
|
||||||
|
stopAtWriteNowSignal -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,8 @@ signals/sigFpe.C
|
|||||||
signals/sigSegv.C
|
signals/sigSegv.C
|
||||||
signals/sigInt.C
|
signals/sigInt.C
|
||||||
signals/sigQuit.C
|
signals/sigQuit.C
|
||||||
|
signals/sigStopAtWriteNow.C
|
||||||
|
signals/sigWriteNow.C
|
||||||
regExp.C
|
regExp.C
|
||||||
timer.C
|
timer.C
|
||||||
fileStat.C
|
fileStat.C
|
||||||
|
|||||||
@ -123,7 +123,7 @@ bool Foam::setEnv
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::word Foam::hostName(bool full)
|
Foam::string Foam::hostName(bool full)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
::gethostname(buf, sizeof(buf));
|
::gethostname(buf, sizeof(buf));
|
||||||
@ -142,7 +142,7 @@ Foam::word Foam::hostName(bool full)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::word Foam::domainName()
|
Foam::string Foam::domainName()
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
::gethostname(buf, sizeof(buf));
|
::gethostname(buf, sizeof(buf));
|
||||||
@ -159,11 +159,11 @@ Foam::word Foam::domainName()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return word::null;
|
return string::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::word Foam::userName()
|
Foam::string Foam::userName()
|
||||||
{
|
{
|
||||||
struct passwd* pw = ::getpwuid(::getuid());
|
struct passwd* pw = ::getpwuid(::getuid());
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ Foam::word Foam::userName()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return word::null;
|
return string::null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ Foam::fileName Foam::home()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::home(const word& userName)
|
Foam::fileName Foam::home(const string& userName)
|
||||||
{
|
{
|
||||||
struct passwd* pw;
|
struct passwd* pw;
|
||||||
|
|
||||||
@ -1069,7 +1069,7 @@ void Foam::fdClose(const int fd)
|
|||||||
|
|
||||||
bool Foam::ping
|
bool Foam::ping
|
||||||
(
|
(
|
||||||
const word& destName,
|
const string& destName,
|
||||||
const label destPort,
|
const label destPort,
|
||||||
const label timeOut
|
const label timeOut
|
||||||
)
|
)
|
||||||
@ -1083,7 +1083,7 @@ bool Foam::ping
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::ping(const word&, ...)"
|
"Foam::ping(const string&, ...)"
|
||||||
) << "gethostbyname error " << h_errno << " for host " << destName
|
) << "gethostbyname error " << h_errno << " for host " << destName
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
@ -1097,7 +1097,7 @@ bool Foam::ping
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::ping(const word&, const label)"
|
"Foam::ping(const string&, const label)"
|
||||||
) << "socket error"
|
) << "socket error"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
@ -1149,7 +1149,7 @@ bool Foam::ping
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::ping(const word& hostname, const label timeOut)
|
bool Foam::ping(const string& hostname, const label timeOut)
|
||||||
{
|
{
|
||||||
return ping(hostname, 222, timeOut) || ping(hostname, 22, timeOut);
|
return ping(hostname, 222, timeOut) || ping(hostname, 22, timeOut);
|
||||||
}
|
}
|
||||||
|
|||||||
140
src/OSspecific/POSIX/signals/sigStopAtWriteNow.C
Normal file
140
src/OSspecific/POSIX/signals/sigStopAtWriteNow.C
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "sigStopAtWriteNow.H"
|
||||||
|
#include "error.H"
|
||||||
|
#include "JobInfo.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Signal number to catch
|
||||||
|
int Foam::sigStopAtWriteNow::signal_
|
||||||
|
(
|
||||||
|
debug::optimisationSwitch("stopAtWriteNowSignal", -1)
|
||||||
|
);
|
||||||
|
|
||||||
|
static Foam::Time const* runTimePtr_ = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
struct sigaction Foam::sigStopAtWriteNow::oldAction_;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::sigStopAtWriteNow::sigHandler(int)
|
||||||
|
{
|
||||||
|
// Reset old handling
|
||||||
|
if (sigaction(signal_, &oldAction_, NULL) < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sigStopAtWriteNow::sigHandler(int)"
|
||||||
|
) << "Cannot reset " << signal_ << " trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update jobInfo file
|
||||||
|
jobInfo.signalEnd();
|
||||||
|
|
||||||
|
Info<< "sigStopAtWriteNow :"
|
||||||
|
<< " setting up write and stop at end of the next iteration"
|
||||||
|
<< nl << endl;
|
||||||
|
runTimePtr_->stopAt(Time::saWriteNow);
|
||||||
|
|
||||||
|
//// Throw signal (to old handler)
|
||||||
|
//raise(signal_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sigStopAtWriteNow::sigStopAtWriteNow(){}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
||||||
|
(
|
||||||
|
const bool verbose,
|
||||||
|
const Time& runTime
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (signal_ > 0)
|
||||||
|
{
|
||||||
|
// Store runTime
|
||||||
|
runTimePtr_ = &runTime;
|
||||||
|
|
||||||
|
struct sigaction newAction;
|
||||||
|
newAction.sa_handler = sigHandler;
|
||||||
|
newAction.sa_flags = SA_NODEFER;
|
||||||
|
sigemptyset(&newAction.sa_mask);
|
||||||
|
if (sigaction(signal_, &newAction, &oldAction_) < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sigStopAtWriteNow::sigStopAtWriteNow"
|
||||||
|
"(const bool, const Time&)"
|
||||||
|
) << "Cannot set " << signal_ << " trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "sigStopAtWriteNow :"
|
||||||
|
<< " Enabling writing and stopping upon signal " << signal_
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sigStopAtWriteNow::~sigStopAtWriteNow()
|
||||||
|
{
|
||||||
|
// Reset old handling
|
||||||
|
if (signal_ > 0)
|
||||||
|
{
|
||||||
|
if (sigaction(signal_, &oldAction_, NULL) < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sigStopAtWriteNow::~sigStopAtWriteNow()"
|
||||||
|
) << "Cannot reset " << signal_ << " trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::sigStopAtWriteNow::active() const
|
||||||
|
{
|
||||||
|
return signal_ > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
99
src/OSspecific/POSIX/signals/sigStopAtWriteNow.H
Normal file
99
src/OSspecific/POSIX/signals/sigStopAtWriteNow.H
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::sigStopAtWriteNow
|
||||||
|
|
||||||
|
Description
|
||||||
|
Signal handler for interupt defined by
|
||||||
|
OptimisationSwitches::stopAtWriteNowSignal
|
||||||
|
|
||||||
|
Write and stop the job.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
sigStopAtWriteNow.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef sigStopAtWriteNow_H
|
||||||
|
#define sigStopAtWriteNow_H
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class Time;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class sigStopAtWriteNow Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class sigStopAtWriteNow
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- number of signal to use
|
||||||
|
static int signal_;
|
||||||
|
|
||||||
|
//- Saved old signal trapping setting
|
||||||
|
static struct sigaction oldAction_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
static void sigHandler(int);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
sigStopAtWriteNow();
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
sigStopAtWriteNow(const bool verbose, const Time& runTime);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~sigStopAtWriteNow();
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Is active?
|
||||||
|
bool active() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
122
src/OSspecific/POSIX/signals/sigWriteNow.C
Normal file
122
src/OSspecific/POSIX/signals/sigWriteNow.C
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "sigWriteNow.H"
|
||||||
|
#include "error.H"
|
||||||
|
#include "JobInfo.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Signal number to catch
|
||||||
|
int Foam::sigWriteNow::signal_
|
||||||
|
(
|
||||||
|
debug::optimisationSwitch("writeNowSignal", -1)
|
||||||
|
);
|
||||||
|
|
||||||
|
static Foam::Time* runTimePtr_ = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
struct sigaction Foam::sigWriteNow::oldAction_;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::sigWriteNow::sigHandler(int)
|
||||||
|
{
|
||||||
|
Info<< "sigWriteNow :"
|
||||||
|
<< " setting up write at end of the next iteration" << nl << endl;
|
||||||
|
runTimePtr_->writeOnce();
|
||||||
|
|
||||||
|
//// Throw signal (to old handler)
|
||||||
|
//raise(signal_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sigWriteNow::sigWriteNow()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::sigWriteNow::sigWriteNow(const bool verbose, Time& runTime)
|
||||||
|
{
|
||||||
|
if (signal_ >= 0)
|
||||||
|
{
|
||||||
|
// Store runTime
|
||||||
|
runTimePtr_ = &runTime;
|
||||||
|
|
||||||
|
struct sigaction newAction;
|
||||||
|
newAction.sa_handler = sigHandler;
|
||||||
|
newAction.sa_flags = SA_NODEFER;
|
||||||
|
sigemptyset(&newAction.sa_mask);
|
||||||
|
if (sigaction(signal_, &newAction, &oldAction_) < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sigWriteNow::sigWriteNow(const bool, const Time&)"
|
||||||
|
) << "Cannot set " << signal_ << " trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "sigWriteNow :"
|
||||||
|
<< " Enabling writing upon signal " << signal_
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sigWriteNow::~sigWriteNow()
|
||||||
|
{
|
||||||
|
// Reset old handling
|
||||||
|
if (signal_ > 0)
|
||||||
|
{
|
||||||
|
if (sigaction(signal_, &oldAction_, NULL) < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sigWriteNow::~sigWriteNow()"
|
||||||
|
) << "Cannot reset " << signal_ << " trapping"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::sigWriteNow::active() const
|
||||||
|
{
|
||||||
|
return signal_ > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
99
src/OSspecific/POSIX/signals/sigWriteNow.H
Normal file
99
src/OSspecific/POSIX/signals/sigWriteNow.H
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::sigWriteNow
|
||||||
|
|
||||||
|
Description
|
||||||
|
Signal handler for interupt defined by OptimisationSwitches::writeNowSignal
|
||||||
|
|
||||||
|
Write once and continue.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
sigWriteNow.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef sigWriteNow_H
|
||||||
|
#define sigWriteNow_H
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class Time;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class sigWriteNow Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class sigWriteNow
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- number of signal to use
|
||||||
|
static int signal_;
|
||||||
|
|
||||||
|
//- Saved old signal trapping setting
|
||||||
|
static struct sigaction oldAction_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
static void sigHandler(int);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
sigWriteNow();
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
sigWriteNow(const bool verbose, Time& runTime);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~sigWriteNow();
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Is active?
|
||||||
|
bool active() const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -81,10 +81,17 @@ void Foam::Time::adjustDeltaT()
|
|||||||
{
|
{
|
||||||
if (writeControl_ == wcAdjustableRunTime)
|
if (writeControl_ == wcAdjustableRunTime)
|
||||||
{
|
{
|
||||||
|
scalar interval = writeInterval_;
|
||||||
|
if (secondaryWriteControl_ == wcAdjustableRunTime)
|
||||||
|
{
|
||||||
|
interval = min(interval, secondaryWriteInterval_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar timeToNextWrite = max
|
scalar timeToNextWrite = max
|
||||||
(
|
(
|
||||||
0.0,
|
0.0,
|
||||||
(outputTimeIndex_ + 1)*writeInterval_ - (value() - startTime_)
|
(outputTimeIndex_ + 1)*interval - (value() - startTime_)
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar nSteps = timeToNextWrite/deltaT_ - SMALL;
|
scalar nSteps = timeToNextWrite/deltaT_ - SMALL;
|
||||||
@ -252,8 +259,13 @@ Foam::Time::Time
|
|||||||
stopAt_(saEndTime),
|
stopAt_(saEndTime),
|
||||||
writeControl_(wcTimeStep),
|
writeControl_(wcTimeStep),
|
||||||
writeInterval_(GREAT),
|
writeInterval_(GREAT),
|
||||||
|
secondaryWriteControl_(wcTimeStep),
|
||||||
|
secondaryWriteInterval_(labelMax),
|
||||||
purgeWrite_(0),
|
purgeWrite_(0),
|
||||||
|
writeOnce_(false),
|
||||||
subCycling_(false),
|
subCycling_(false),
|
||||||
|
sigWriteNow_(true, *this),
|
||||||
|
sigStopAtWriteNow_(true, *this),
|
||||||
|
|
||||||
writeFormat_(IOstream::ASCII),
|
writeFormat_(IOstream::ASCII),
|
||||||
writeVersion_(IOstream::currentVersion),
|
writeVersion_(IOstream::currentVersion),
|
||||||
@ -339,8 +351,13 @@ Foam::Time::Time
|
|||||||
stopAt_(saEndTime),
|
stopAt_(saEndTime),
|
||||||
writeControl_(wcTimeStep),
|
writeControl_(wcTimeStep),
|
||||||
writeInterval_(GREAT),
|
writeInterval_(GREAT),
|
||||||
|
secondaryWriteControl_(wcTimeStep),
|
||||||
|
secondaryWriteInterval_(labelMax),
|
||||||
purgeWrite_(0),
|
purgeWrite_(0),
|
||||||
|
writeOnce_(false),
|
||||||
subCycling_(false),
|
subCycling_(false),
|
||||||
|
sigWriteNow_(true, *this),
|
||||||
|
sigStopAtWriteNow_(true, *this),
|
||||||
|
|
||||||
writeFormat_(IOstream::ASCII),
|
writeFormat_(IOstream::ASCII),
|
||||||
writeVersion_(IOstream::currentVersion),
|
writeVersion_(IOstream::currentVersion),
|
||||||
@ -429,8 +446,13 @@ Foam::Time::Time
|
|||||||
stopAt_(saEndTime),
|
stopAt_(saEndTime),
|
||||||
writeControl_(wcTimeStep),
|
writeControl_(wcTimeStep),
|
||||||
writeInterval_(GREAT),
|
writeInterval_(GREAT),
|
||||||
|
secondaryWriteControl_(wcTimeStep),
|
||||||
|
secondaryWriteInterval_(labelMax),
|
||||||
purgeWrite_(0),
|
purgeWrite_(0),
|
||||||
|
writeOnce_(false),
|
||||||
subCycling_(false),
|
subCycling_(false),
|
||||||
|
sigWriteNow_(true, *this),
|
||||||
|
sigStopAtWriteNow_(true, *this),
|
||||||
|
|
||||||
writeFormat_(IOstream::ASCII),
|
writeFormat_(IOstream::ASCII),
|
||||||
writeVersion_(IOstream::currentVersion),
|
writeVersion_(IOstream::currentVersion),
|
||||||
@ -521,7 +543,10 @@ Foam::Time::Time
|
|||||||
stopAt_(saEndTime),
|
stopAt_(saEndTime),
|
||||||
writeControl_(wcTimeStep),
|
writeControl_(wcTimeStep),
|
||||||
writeInterval_(GREAT),
|
writeInterval_(GREAT),
|
||||||
|
secondaryWriteControl_(wcTimeStep),
|
||||||
|
secondaryWriteInterval_(labelMax),
|
||||||
purgeWrite_(0),
|
purgeWrite_(0),
|
||||||
|
writeOnce_(false),
|
||||||
subCycling_(false),
|
subCycling_(false),
|
||||||
|
|
||||||
writeFormat_(IOstream::ASCII),
|
writeFormat_(IOstream::ASCII),
|
||||||
@ -944,6 +969,35 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
|
|
||||||
if (!subCycling_)
|
if (!subCycling_)
|
||||||
{
|
{
|
||||||
|
if (sigStopAtWriteNow_.active() || sigWriteNow_.active())
|
||||||
|
{
|
||||||
|
// A signal might have been sent on one processor only
|
||||||
|
// Reduce so all decide the same.
|
||||||
|
|
||||||
|
label flag = 0;
|
||||||
|
if (sigStopAtWriteNow_.active() && stopAt_ == saWriteNow)
|
||||||
|
{
|
||||||
|
flag += 1;
|
||||||
|
}
|
||||||
|
if (sigWriteNow_.active() && writeOnce_)
|
||||||
|
{
|
||||||
|
flag += 2;
|
||||||
|
}
|
||||||
|
reduce(flag, maxOp<label>());
|
||||||
|
|
||||||
|
if (flag & 1)
|
||||||
|
{
|
||||||
|
stopAt_ = saWriteNow;
|
||||||
|
}
|
||||||
|
if (flag & 2)
|
||||||
|
{
|
||||||
|
writeOnce_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
outputTime_ = false;
|
||||||
|
|
||||||
switch (writeControl_)
|
switch (writeControl_)
|
||||||
{
|
{
|
||||||
case wcTimeStep:
|
case wcTimeStep:
|
||||||
@ -964,10 +1018,6 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
outputTime_ = true;
|
outputTime_ = true;
|
||||||
outputTimeIndex_ = outputIndex;
|
outputTimeIndex_ = outputIndex;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
outputTime_ = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -983,10 +1033,6 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
outputTime_ = true;
|
outputTime_ = true;
|
||||||
outputTimeIndex_ = outputIndex;
|
outputTimeIndex_ = outputIndex;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
outputTime_ = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1002,14 +1048,69 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
outputTime_ = true;
|
outputTime_ = true;
|
||||||
outputTimeIndex_ = outputIndex;
|
outputTimeIndex_ = outputIndex;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Adapt for secondaryWrite controls
|
||||||
|
switch (secondaryWriteControl_)
|
||||||
|
{
|
||||||
|
case wcTimeStep:
|
||||||
|
outputTime_ =
|
||||||
|
outputTime_
|
||||||
|
|| !(timeIndex_ % label(secondaryWriteInterval_));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wcRunTime:
|
||||||
|
case wcAdjustableRunTime:
|
||||||
|
{
|
||||||
|
label outputIndex = label
|
||||||
|
(
|
||||||
|
((value() - startTime_) + 0.5*deltaT_)
|
||||||
|
/ secondaryWriteInterval_
|
||||||
|
);
|
||||||
|
|
||||||
|
if (outputIndex > outputTimeIndex_)
|
||||||
{
|
{
|
||||||
outputTime_ = false;
|
outputTime_ = true;
|
||||||
|
outputTimeIndex_ = outputIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wcCpuTime:
|
||||||
|
{
|
||||||
|
label outputIndex = label
|
||||||
|
(
|
||||||
|
returnReduce(elapsedCpuTime(), maxOp<double>())
|
||||||
|
/ secondaryWriteInterval_
|
||||||
|
);
|
||||||
|
if (outputIndex > outputTimeIndex_)
|
||||||
|
{
|
||||||
|
outputTime_ = true;
|
||||||
|
outputTimeIndex_ = outputIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wcClockTime:
|
||||||
|
{
|
||||||
|
label outputIndex = label
|
||||||
|
(
|
||||||
|
returnReduce(label(elapsedClockTime()), maxOp<label>())
|
||||||
|
/ secondaryWriteInterval_
|
||||||
|
);
|
||||||
|
if (outputIndex > outputTimeIndex_)
|
||||||
|
{
|
||||||
|
outputTime_ = true;
|
||||||
|
outputTimeIndex_ = outputIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// see if endTime needs adjustment to stop at the next run()/end() check
|
// see if endTime needs adjustment to stop at the next run()/end() check
|
||||||
if (!end())
|
if (!end())
|
||||||
{
|
{
|
||||||
@ -1027,6 +1128,14 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
endTime_ = value();
|
endTime_ = value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override outputTime if one-shot writing
|
||||||
|
if (writeOnce_)
|
||||||
|
{
|
||||||
|
outputTime_ = true;
|
||||||
|
writeOnce_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
@ -52,6 +52,8 @@ SourceFiles
|
|||||||
#include "dlLibraryTable.H"
|
#include "dlLibraryTable.H"
|
||||||
#include "functionObjectList.H"
|
#include "functionObjectList.H"
|
||||||
#include "fileMonitor.H"
|
#include "fileMonitor.H"
|
||||||
|
#include "sigWriteNow.H"
|
||||||
|
#include "sigStopAtWriteNow.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -130,15 +132,35 @@ protected:
|
|||||||
|
|
||||||
scalar writeInterval_;
|
scalar writeInterval_;
|
||||||
|
|
||||||
|
// Additional writing
|
||||||
|
|
||||||
|
writeControls secondaryWriteControl_;
|
||||||
|
|
||||||
|
scalar secondaryWriteInterval_;
|
||||||
|
|
||||||
|
|
||||||
label purgeWrite_;
|
label purgeWrite_;
|
||||||
mutable FIFOStack<word> previousOutputTimes_;
|
mutable FIFOStack<word> previousOutputTimes_;
|
||||||
|
|
||||||
|
// One-shot writing
|
||||||
|
bool writeOnce_;
|
||||||
|
|
||||||
//- Is the time currently being sub-cycled?
|
//- Is the time currently being sub-cycled?
|
||||||
bool subCycling_;
|
bool subCycling_;
|
||||||
|
|
||||||
//- If time is being sub-cycled this is the previous TimeState
|
//- If time is being sub-cycled this is the previous TimeState
|
||||||
autoPtr<TimeState> prevTimeState_;
|
autoPtr<TimeState> prevTimeState_;
|
||||||
|
|
||||||
|
|
||||||
|
// Signal handlers for secondary writing
|
||||||
|
|
||||||
|
//- Enable one-shot writing upon signal
|
||||||
|
sigWriteNow sigWriteNow_;
|
||||||
|
|
||||||
|
//- Enable write and clean exit upon signal
|
||||||
|
sigStopAtWriteNow sigStopAtWriteNow_;
|
||||||
|
|
||||||
|
|
||||||
//- Time directory name format
|
//- Time directory name format
|
||||||
static fmtflags format_;
|
static fmtflags format_;
|
||||||
|
|
||||||
@ -357,12 +379,16 @@ public:
|
|||||||
IOstream::compressionType
|
IOstream::compressionType
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write the objects now and continue the run
|
//- Write the objects now (not at end of iteration) and continue
|
||||||
|
// the run
|
||||||
bool writeNow();
|
bool writeNow();
|
||||||
|
|
||||||
//- Write the objects now and end the run
|
//- Write the objects now (not at end of iteration) and end the run
|
||||||
bool writeAndEnd();
|
bool writeAndEnd();
|
||||||
|
|
||||||
|
//- Write the objects once (one shot) and continue the run
|
||||||
|
void writeOnce();
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,45 @@ void Foam::Time::readDict()
|
|||||||
controlDict_.lookup("writeFrequency") >> writeInterval_;
|
controlDict_.lookup("writeFrequency") >> writeInterval_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Additional writing
|
||||||
|
if (controlDict_.found("secondaryWriteControl"))
|
||||||
|
{
|
||||||
|
secondaryWriteControl_ = writeControlNames_.read
|
||||||
|
(
|
||||||
|
controlDict_.lookup("secondaryWriteControl")
|
||||||
|
);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
controlDict_.readIfPresent
|
||||||
|
(
|
||||||
|
"secondaryWriteInterval",
|
||||||
|
secondaryWriteInterval_
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
secondaryWriteControl_
|
||||||
|
== wcTimeStep && label(secondaryWriteInterval_) < 1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalIOErrorIn("Time::readDict()", controlDict_)
|
||||||
|
<< "secondaryWriteInterval < 1"
|
||||||
|
<< " for secondaryWriteControl timeStep"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
controlDict_.lookup("secondaryWriteFrequency")
|
||||||
|
>> secondaryWriteInterval_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (oldWriteInterval != writeInterval_)
|
if (oldWriteInterval != writeInterval_)
|
||||||
{
|
{
|
||||||
switch (writeControl_)
|
switch (writeControl_)
|
||||||
@ -310,4 +349,10 @@ bool Foam::Time::writeAndEnd()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::Time::writeOnce()
|
||||||
|
{
|
||||||
|
writeOnce_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -726,7 +726,7 @@ Foam::argList::argList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wordList slaveProcs;
|
stringList slaveProcs;
|
||||||
|
|
||||||
// collect slave machine/pid
|
// collect slave machine/pid
|
||||||
if (parRunControl_.parRun())
|
if (parRunControl_.parRun())
|
||||||
@ -734,7 +734,7 @@ Foam::argList::argList
|
|||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
slaveProcs.setSize(Pstream::nProcs() - 1);
|
slaveProcs.setSize(Pstream::nProcs() - 1);
|
||||||
word slaveMachine;
|
string slaveMachine;
|
||||||
label slavePid;
|
label slavePid;
|
||||||
|
|
||||||
label procI = 0;
|
label procI = 0;
|
||||||
|
|||||||
@ -69,13 +69,13 @@ bool setEnv(const word& name, const std::string& value, const bool overwrite);
|
|||||||
|
|
||||||
//- Return the system's host name, as per hostname(1)
|
//- Return the system's host name, as per hostname(1)
|
||||||
// Optionally with the full name (as per the '-f' option)
|
// Optionally with the full name (as per the '-f' option)
|
||||||
word hostName(const bool full=false);
|
string hostName(const bool full=false);
|
||||||
|
|
||||||
//- Return the system's domain name, as per hostname(1) with the '-d' option
|
//- Return the system's domain name, as per hostname(1) with the '-d' option
|
||||||
word domainName();
|
string domainName();
|
||||||
|
|
||||||
//- Return the user's login name
|
//- Return the user's login name
|
||||||
word userName();
|
string userName();
|
||||||
|
|
||||||
//- Is user administrator
|
//- Is user administrator
|
||||||
bool isAdministrator();
|
bool isAdministrator();
|
||||||
@ -84,7 +84,7 @@ bool isAdministrator();
|
|||||||
fileName home();
|
fileName home();
|
||||||
|
|
||||||
//- Return home directory path name for a particular user
|
//- Return home directory path name for a particular user
|
||||||
fileName home(const word& userName);
|
fileName home(const string& userName);
|
||||||
|
|
||||||
//- Return current working directory path name
|
//- Return current working directory path name
|
||||||
fileName cwd();
|
fileName cwd();
|
||||||
@ -189,10 +189,10 @@ unsigned int sleep(const unsigned int);
|
|||||||
void fdClose(const int);
|
void fdClose(const int);
|
||||||
|
|
||||||
//- Check if machine is up by pinging given port
|
//- Check if machine is up by pinging given port
|
||||||
bool ping(const word&, const label port, const label timeOut);
|
bool ping(const string&, const label port, const label timeOut);
|
||||||
|
|
||||||
//- Check if machine is up by pinging port 22 (ssh) and 222 (rsh)
|
//- Check if machine is up by pinging port 22 (ssh) and 222 (rsh)
|
||||||
bool ping(const word&, const label timeOut=10);
|
bool ping(const string&, const label timeOut=10);
|
||||||
|
|
||||||
//- Execute the specified command
|
//- Execute the specified command
|
||||||
int system(const std::string& command);
|
int system(const std::string& command);
|
||||||
|
|||||||
@ -88,7 +88,7 @@ Foam::interpolationTable<Type>::interpolationTable(const fileName& fName)
|
|||||||
List<Tuple2<scalar, Type> >(),
|
List<Tuple2<scalar, Type> >(),
|
||||||
boundsHandling_(interpolationTable::WARN),
|
boundsHandling_(interpolationTable::WARN),
|
||||||
fileName_(fName),
|
fileName_(fName),
|
||||||
reader_(new openFoamTableReader<Type>())
|
reader_(new openFoamTableReader<Type>(dictionary()))
|
||||||
{
|
{
|
||||||
readTable();
|
readTable();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -548,7 +548,7 @@ Foam::string& Foam::stringOps::inplaceExpand
|
|||||||
// ~OpenFOAM => site/user OpenFOAM configuration directory
|
// ~OpenFOAM => site/user OpenFOAM configuration directory
|
||||||
// ~user => home directory for specified user
|
// ~user => home directory for specified user
|
||||||
|
|
||||||
word user;
|
string user;
|
||||||
fileName file;
|
fileName file;
|
||||||
|
|
||||||
if ((begVar = s.find('/')) != string::npos)
|
if ((begVar = s.find('/')) != string::npos)
|
||||||
|
|||||||
@ -53,15 +53,42 @@ Foam::UIPstream::UIPstream
|
|||||||
{
|
{
|
||||||
notImplemented
|
notImplemented
|
||||||
(
|
(
|
||||||
"UIPstream::UIPstream"
|
"UIPstream::UIPstream\n"
|
||||||
"("
|
"(\n"
|
||||||
"const commsTypes,"
|
"const commsTypes,\n"
|
||||||
"const int fromProcNo,"
|
"const int,\n"
|
||||||
"DynamicList<char>&,"
|
"DynamicList<char>&,\n"
|
||||||
"label&,"
|
"label&,\n"
|
||||||
"const int tag,"
|
"const int,\n"
|
||||||
"const bool,"
|
"const bool,\n"
|
||||||
"streamFormat, versionNumber"
|
"streamFormat,\n"
|
||||||
|
"versionNumber\n"
|
||||||
|
")"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::UIPstream::UIPstream
|
||||||
|
(
|
||||||
|
const int fromProcNo,
|
||||||
|
PstreamBuffers& buffers
|
||||||
|
)
|
||||||
|
:
|
||||||
|
UPstream(buffers.commsType_),
|
||||||
|
Istream(buffers.format_, buffers.version_),
|
||||||
|
fromProcNo_(fromProcNo),
|
||||||
|
externalBuf_(buffers.recvBuf_[fromProcNo]),
|
||||||
|
externalBufPosition_(buffers.recvBufPos_[fromProcNo]),
|
||||||
|
tag_(buffers.tag_),
|
||||||
|
clearAtEnd_(true),
|
||||||
|
messageSize_(0)
|
||||||
|
{
|
||||||
|
notImplemented
|
||||||
|
(
|
||||||
|
"UIPstream::UIPstream\n"
|
||||||
|
"(\n"
|
||||||
|
"const int,\n"
|
||||||
|
"PstreamBuffers&\n"
|
||||||
")"
|
")"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -388,6 +388,7 @@ $(basicSource)/basicSource/IObasicSourceList.C
|
|||||||
$(basicSource)/actuationDiskSource/actuationDiskSource.C
|
$(basicSource)/actuationDiskSource/actuationDiskSource.C
|
||||||
$(basicSource)/radialActuationDiskSource/radialActuationDiskSource.C
|
$(basicSource)/radialActuationDiskSource/radialActuationDiskSource.C
|
||||||
$(basicSource)/explicitSource/explicitSource.C
|
$(basicSource)/explicitSource/explicitSource.C
|
||||||
|
$(basicSource)/explicitSetValue/explicitSetValue.C
|
||||||
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfiniteVolume
|
LIB = $(FOAM_LIBBIN)/libfiniteVolume
|
||||||
|
|||||||
@ -48,14 +48,14 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
|
|||||||
E.xx() = uniDiskDir.x();
|
E.xx() = uniDiskDir.x();
|
||||||
E.yy() = uniDiskDir.y();
|
E.yy() = uniDiskDir.y();
|
||||||
E.zz() = uniDiskDir.z();
|
E.zz() = uniDiskDir.z();
|
||||||
const vectorField U1((1.0 - a)*U);
|
|
||||||
forAll(cells, i)
|
forAll(cells, i)
|
||||||
{
|
{
|
||||||
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
|
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U[cells[i]])*a/(1.0 - a);
|
||||||
}
|
}
|
||||||
forAll(cells, i)
|
forAll(cells, i)
|
||||||
{
|
{
|
||||||
Usource[cells[i]] += ((Vcells[cells[i]]/V())*T[i]*E) & U1[cells[i]];
|
Usource[cells[i]] += ((Vcells[cells[i]]/V())*T[i]*E) & U[cells[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -116,10 +116,15 @@ void Foam::basicSource::setCellSet()
|
|||||||
label globalCellI = returnReduce(cellI, maxOp<label>());
|
label globalCellI = returnReduce(cellI, maxOp<label>());
|
||||||
if (globalCellI < 0)
|
if (globalCellI < 0)
|
||||||
{
|
{
|
||||||
WarningIn("TimeActivatedExplicitSource<Type>::setCellIds()")
|
WarningIn
|
||||||
<< "Unable to find owner cell for point " << points_[i]
|
(
|
||||||
<< endl;
|
"TimeActivatedExplicitSource<Type>::setCellIds()"
|
||||||
|
)
|
||||||
|
<< "Unable to find owner cell for point " << points_[i]
|
||||||
|
<< endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cells_ = selectedCells.toc();
|
cells_ = selectedCells.toc();
|
||||||
@ -270,4 +275,30 @@ bool Foam::basicSource::isActive()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::addSu(Foam::fvMatrix<vector>& Eqn)
|
||||||
|
{
|
||||||
|
notImplemented
|
||||||
|
(
|
||||||
|
"Foam::basicSource addSu(Foam::fvMatrix<vector>& Eqn)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::addSu(Foam::fvMatrix<scalar>& Eqn)
|
||||||
|
{
|
||||||
|
notImplemented
|
||||||
|
(
|
||||||
|
"Foam::basicSource addSu(Foam::fvMatrix<scalar>& Eqn)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::setValue(Foam::fvMatrix<scalar>& Eqn)
|
||||||
|
{
|
||||||
|
notImplemented
|
||||||
|
(
|
||||||
|
"Foam::basicSource setValue(Foam::fvMatrix<scalar>& Eqn)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -56,13 +56,13 @@ Description
|
|||||||
selectionMode points;
|
selectionMode points;
|
||||||
cellSet c0;
|
cellSet c0;
|
||||||
|
|
||||||
|
points // list of points when selectionMode = points
|
||||||
|
(
|
||||||
|
(-0.088 0.007 -0.02)
|
||||||
|
(-0.028 0.007 -0.02)
|
||||||
|
);
|
||||||
explicitSourceCoeffs
|
explicitSourceCoeffs
|
||||||
{
|
{
|
||||||
points // list of points when selectionMode = points
|
|
||||||
(
|
|
||||||
(-0.088 0.007 -0.02)
|
|
||||||
(-0.028 0.007 -0.02)
|
|
||||||
);
|
|
||||||
volumeMode specific; //absolute
|
volumeMode specific; //absolute
|
||||||
fieldData //field data
|
fieldData //field data
|
||||||
{
|
{
|
||||||
@ -323,10 +323,14 @@ public:
|
|||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
//- Add source term to vector fvMatrix
|
//- Add source term to vector fvMatrix
|
||||||
virtual void addSu(fvMatrix<vector>& Eqn) = 0;
|
virtual void addSu(fvMatrix<vector>& Eqn);
|
||||||
|
|
||||||
//- Add source term to scalar fvMatrix
|
//- Add source term to scalar fvMatrix
|
||||||
virtual void addSu(fvMatrix<scalar>& Eqn) = 0;
|
virtual void addSu(fvMatrix<scalar>& Eqn);
|
||||||
|
|
||||||
|
//- Set constant value on field
|
||||||
|
virtual void setValue(fvMatrix<scalar>& Eq);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|||||||
@ -90,6 +90,19 @@ void Foam::basicSourceList::addSu(fvMatrix<vector>& Eqn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSourceList::setValue(fvMatrix<scalar>& Eqn)
|
||||||
|
{
|
||||||
|
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
if (this->operator[](i).isActive())
|
||||||
|
{
|
||||||
|
this->operator[](i).setValue(Eqn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::basicSourceList::read(const dictionary& dict)
|
bool Foam::basicSourceList::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
bool allOk = true;
|
bool allOk = true;
|
||||||
|
|||||||
@ -92,6 +92,9 @@ public:
|
|||||||
//- Add source terms to vector fvMatrix
|
//- Add source terms to vector fvMatrix
|
||||||
void addSu(fvMatrix<vector>& Eq);
|
void addSu(fvMatrix<vector>& Eq);
|
||||||
|
|
||||||
|
//- Set constant value on field
|
||||||
|
void setValue(fvMatrix<scalar>& Eq);
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,117 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "explicitSetValue.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(explicitSetValue, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
basicSource,
|
||||||
|
explicitSetValue,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::explicitSetValue::setFieldData(const dictionary& dict)
|
||||||
|
{
|
||||||
|
scalarFields_.clear();
|
||||||
|
vectorFields_.clear();
|
||||||
|
|
||||||
|
wordList fieldTypes(dict.toc().size());
|
||||||
|
wordList fieldNames(dict.toc().size());
|
||||||
|
|
||||||
|
forAll(dict.toc(), i)
|
||||||
|
{
|
||||||
|
const word& fieldName = dict.toc()[i];
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
this->mesh().time().timeName(),
|
||||||
|
this->mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
if (io.headerOk())
|
||||||
|
{
|
||||||
|
fieldTypes[i] = io.headerClassName();
|
||||||
|
fieldNames[i] = dict.toc()[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"explicitSetValue::setFieldData"
|
||||||
|
) << "header not OK " << io.name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addField(scalarFields_, fieldTypes, fieldNames, dict);
|
||||||
|
addField(vectorFields_, fieldTypes, fieldNames, dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::explicitSetValue::explicitSetValue
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
basicSource(name, modelType, dict, mesh),
|
||||||
|
dict_(dict.subDict(modelType + "Coeffs"))
|
||||||
|
{
|
||||||
|
setFieldData(dict_.subDict("fieldData"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::explicitSetValue::setValue(fvMatrix<scalar>& Eqn)
|
||||||
|
{
|
||||||
|
setFieldValue(Eqn, scalarFields_[Eqn.psi().name()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::explicitSetValue::setValue(fvMatrix<vector>& Eqn)
|
||||||
|
{
|
||||||
|
setFieldValue(Eqn, vectorFields_[Eqn.psi().name()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,184 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::explicitSetValue
|
||||||
|
|
||||||
|
Description
|
||||||
|
Explicit set values on fields.
|
||||||
|
|
||||||
|
Sources described by:
|
||||||
|
|
||||||
|
explicitSetValueCoeffs
|
||||||
|
{
|
||||||
|
fieldData // field data - usage for multiple fields
|
||||||
|
{
|
||||||
|
k 30.7;
|
||||||
|
epsilon 1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
explicitSetValue.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef explicitSetValue_H
|
||||||
|
#define explicitSetValue_H
|
||||||
|
|
||||||
|
#include "cellSet.H"
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "DimensionedField.H"
|
||||||
|
#include "basicSource.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class explicitSetValue Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class explicitSetValue
|
||||||
|
:
|
||||||
|
public basicSource
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- List of field types
|
||||||
|
HashTable<scalar> scalarFields_;
|
||||||
|
HashTable<vector> vectorFields_;
|
||||||
|
|
||||||
|
//- Set value to field
|
||||||
|
template<class Type>
|
||||||
|
void setFieldValue(fvMatrix<Type>&, const Type&) const;
|
||||||
|
|
||||||
|
//- Add field names and values to field table for types.
|
||||||
|
template<class Type>
|
||||||
|
void addField
|
||||||
|
(
|
||||||
|
HashTable<Type>& fields,
|
||||||
|
const wordList& fieldTypes,
|
||||||
|
const wordList& fieldNames,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Sub dictionary for time activated explicit sources
|
||||||
|
const dictionary& dict_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected functions
|
||||||
|
|
||||||
|
//- Set the local field data
|
||||||
|
void setFieldData(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("explicitSetValue");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
explicitSetValue
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return clone
|
||||||
|
autoPtr<explicitSetValue> clone() const
|
||||||
|
{
|
||||||
|
notImplemented
|
||||||
|
(
|
||||||
|
"autoPtr<explicitSetValue> clone() const"
|
||||||
|
);
|
||||||
|
return autoPtr<explicitSetValue>(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Return points
|
||||||
|
inline const List<point>& points() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
//- Set value on vector field
|
||||||
|
virtual void setValue(fvMatrix<vector>& UEqn);
|
||||||
|
|
||||||
|
//- Set value on scalar field
|
||||||
|
virtual void setValue(fvMatrix<scalar>& UEqn);
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write the source properties
|
||||||
|
virtual void writeData(Ostream&) const;
|
||||||
|
|
||||||
|
//- Read fieldData in sub-dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Ostream operator
|
||||||
|
friend Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const explicitSetValue& source
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "explicitSetValueIO.C"
|
||||||
|
#include "explicitSetValueI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "explicitSetValueTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "explicitSetValue.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline const Foam::List<Foam::point>&
|
||||||
|
Foam::explicitSetValue::points() const
|
||||||
|
{
|
||||||
|
return points_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "explicitSetValue.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::explicitSetValue::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << indent << name_ << nl
|
||||||
|
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
|
||||||
|
if (scalarFields_.size() > 0)
|
||||||
|
{
|
||||||
|
os.writeKeyword("scalarFields") << scalarFields_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vectorFields_.size() > 0)
|
||||||
|
{
|
||||||
|
os.writeKeyword("vectorFields") << vectorFields_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::explicitSetValue::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (basicSource::read(dict))
|
||||||
|
{
|
||||||
|
const dictionary& sourceDict = dict.subDict(name());
|
||||||
|
const dictionary& subDictCoeffs = sourceDict.subDict
|
||||||
|
(
|
||||||
|
typeName + "Coeffs"
|
||||||
|
);
|
||||||
|
setFieldData(subDictCoeffs.subDict("fieldData"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Ostream& Foam::operator<<(Ostream& os, const explicitSetValue& source)
|
||||||
|
{
|
||||||
|
source.writeData(os);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
void Foam::explicitSetValue::setFieldValue
|
||||||
|
(
|
||||||
|
fvMatrix<Type>& Eqn,
|
||||||
|
const Type& value
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
Type data = value;
|
||||||
|
|
||||||
|
DimensionedField<Type, volMesh> rhs
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhs",
|
||||||
|
Eqn.psi().mesh().time().timeName(),
|
||||||
|
Eqn.psi().mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
Eqn.psi().mesh(),
|
||||||
|
dimensioned<Type>
|
||||||
|
(
|
||||||
|
"zero",
|
||||||
|
dimless,
|
||||||
|
pTraits<Type>::zero
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
List<Type> values(this->cells().size());
|
||||||
|
|
||||||
|
forAll (values, i)
|
||||||
|
{
|
||||||
|
values[i] = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eqn.setValues(this->cells(), values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
void Foam::explicitSetValue::addField
|
||||||
|
(
|
||||||
|
HashTable<Type>& fields,
|
||||||
|
const wordList& fieldTypes,
|
||||||
|
const wordList& fieldNames,
|
||||||
|
const dictionary& fieldDataDict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> geometricField;
|
||||||
|
|
||||||
|
forAll (fieldTypes, fieldI)
|
||||||
|
{
|
||||||
|
word fieldName = fieldNames[fieldI];
|
||||||
|
word fieldType = fieldTypes[fieldI];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(
|
||||||
|
fieldType
|
||||||
|
== GeometricField<Type, fvPatchField, volMesh>::typeName
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this->mesh().foundObject<geometricField>(fieldName)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Type fieldValue = fieldDataDict.lookupOrDefault<Type>
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
pTraits<Type>::zero
|
||||||
|
);
|
||||||
|
|
||||||
|
fields.insert(fieldName, fieldValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -75,7 +75,7 @@ void Foam::explicitSource::setFieldData(const dictionary& dict)
|
|||||||
IOobject io
|
IOobject io
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
this->mesh().time().timeName(0),
|
this->mesh().time().timeName(),
|
||||||
this->mesh(),
|
this->mesh(),
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
|
|||||||
@ -53,7 +53,6 @@ addRadialActuationDiskAxialInertialResistance
|
|||||||
E.xx() = uniDiskDir.x();
|
E.xx() = uniDiskDir.x();
|
||||||
E.yy() = uniDiskDir.y();
|
E.yy() = uniDiskDir.y();
|
||||||
E.zz() = uniDiskDir.z();
|
E.zz() = uniDiskDir.z();
|
||||||
const vectorField U1((1.0 - a)*U);
|
|
||||||
|
|
||||||
const Field<vector> zoneCellCentres(mesh().cellCentres(), cells);
|
const Field<vector> zoneCellCentres(mesh().cellCentres(), cells);
|
||||||
const Field<scalar> zoneCellVolumes(mesh().cellVolumes(), cells);
|
const Field<scalar> zoneCellVolumes(mesh().cellVolumes(), cells);
|
||||||
@ -68,7 +67,7 @@ addRadialActuationDiskAxialInertialResistance
|
|||||||
|
|
||||||
forAll(cells, i)
|
forAll(cells, i)
|
||||||
{
|
{
|
||||||
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
|
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U[cells[i]])*a/(1.0 - a);
|
||||||
|
|
||||||
scalar r = mag(mesh().cellCentres()[cells[i]] - avgCentre);
|
scalar r = mag(mesh().cellCentres()[cells[i]] - avgCentre);
|
||||||
|
|
||||||
@ -79,7 +78,7 @@ addRadialActuationDiskAxialInertialResistance
|
|||||||
|
|
||||||
forAll(cells, i)
|
forAll(cells, i)
|
||||||
{
|
{
|
||||||
Usource[cells[i]] += ((Vcells[cells[i]]/V())*Tr[i]*E) & U1[cells[i]];
|
Usource[cells[i]] += ((Vcells[cells[i]]/V())*Tr[i]*E) & U[cells[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@ -114,20 +114,67 @@ void Foam::mappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
|
|||||||
const mappedPatchBase& mpp =
|
const mappedPatchBase& mpp =
|
||||||
refCast<const mappedPatchBase>(this->patch().patch());
|
refCast<const mappedPatchBase>(this->patch().patch());
|
||||||
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
|
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
|
||||||
const label samplePatchI = mpp.samplePolyPatch().index();
|
|
||||||
const fvPatch& nbrPatch = nbrMesh.boundary()[samplePatchI];
|
|
||||||
|
|
||||||
|
Field<Type> nbrIntFld;
|
||||||
|
|
||||||
// Retrieve the neighbour field
|
switch (mpp.mode())
|
||||||
const fvPatchField<Type>& nbrField =
|
{
|
||||||
nbrPatch.template lookupPatchField<FieldType, Type>
|
case mappedPatchBase::NEARESTCELL:
|
||||||
(
|
{
|
||||||
this->dimensionedInternalField().name()
|
FatalErrorIn
|
||||||
);
|
(
|
||||||
|
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
|
||||||
|
) << "Cannot apply "
|
||||||
|
<< mappedPatchBase::sampleModeNames_
|
||||||
|
[
|
||||||
|
mappedPatchBase::NEARESTCELL
|
||||||
|
]
|
||||||
|
<< " mapping mode for patch " << this->patch().name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
|
||||||
// Retrieve the neighbour patch internal field
|
break;
|
||||||
Field<Type> nbrIntFld(nbrField.patchInternalField());
|
}
|
||||||
mpp.distribute(nbrIntFld);
|
case mappedPatchBase::NEARESTPATCHFACE:
|
||||||
|
{
|
||||||
|
const label samplePatchI = mpp.samplePolyPatch().index();
|
||||||
|
const fvPatchField<Type>& nbrPatchField =
|
||||||
|
this->sampleField().boundaryField()[samplePatchI];
|
||||||
|
nbrIntFld = nbrPatchField.patchInternalField();
|
||||||
|
mpp.distribute(nbrIntFld);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mappedPatchBase::NEARESTFACE:
|
||||||
|
{
|
||||||
|
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
|
||||||
|
|
||||||
|
const FieldType& nbrField = this->sampleField();
|
||||||
|
|
||||||
|
forAll(nbrField.boundaryField(), patchI)
|
||||||
|
{
|
||||||
|
const fvPatchField<Type>& pf = nbrField.boundaryField()[patchI];
|
||||||
|
const Field<Type> pif(pf.patchInternalField());
|
||||||
|
|
||||||
|
label faceStart = pf.patch().start();
|
||||||
|
|
||||||
|
forAll(pf, faceI)
|
||||||
|
{
|
||||||
|
allValues[faceStart++] = pif[faceI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mpp.distribute(allValues);
|
||||||
|
nbrIntFld.transfer(allValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedFixedValueFvPatchField<Type>::updateCoeffs()")
|
||||||
|
<< "Unknown sampling mode: " << mpp.mode()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Restore tag
|
// Restore tag
|
||||||
UPstream::msgType() = oldTag;
|
UPstream::msgType() = oldTag;
|
||||||
|
|||||||
@ -71,7 +71,10 @@ class mappedFixedValueFvPatchField
|
|||||||
:
|
:
|
||||||
public fixedValueFvPatchField<Type>
|
public fixedValueFvPatchField<Type>
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
//- Name of field to sample - defaults to field associated with this
|
//- Name of field to sample - defaults to field associated with this
|
||||||
// patchField if not specified
|
// patchField if not specified
|
||||||
@ -90,7 +93,7 @@ class mappedFixedValueFvPatchField
|
|||||||
mutable autoPtr<interpolation<Type> > interpolator_;
|
mutable autoPtr<interpolation<Type> > interpolator_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Field to sample. Either on my or nbr mesh
|
//- Field to sample. Either on my or nbr mesh
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
|
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
|
||||||
|
|||||||
@ -33,5 +33,6 @@ pointPatchFields/derived/oscillatingDisplacement/oscillatingDisplacementPointPat
|
|||||||
pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
|
pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
|
||||||
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
|
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
|
||||||
pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C
|
pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C
|
||||||
|
pointPatchFields/derived/waveDisplacement/waveDisplacementPointPatchVectorField.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfvMotionSolvers
|
LIB = $(FOAM_LIBBIN)/libfvMotionSolvers
|
||||||
|
|||||||
@ -0,0 +1,151 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "waveDisplacementPointPatchVectorField.H"
|
||||||
|
#include "pointPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
waveDisplacementPointPatchVectorField::
|
||||||
|
waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValuePointPatchField<vector>(p, iF),
|
||||||
|
amplitude_(vector::zero),
|
||||||
|
omega_(0.0),
|
||||||
|
waveLength_(vector::zero)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
waveDisplacementPointPatchVectorField::
|
||||||
|
waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValuePointPatchField<vector>(p, iF, dict),
|
||||||
|
amplitude_(dict.lookup("amplitude")),
|
||||||
|
omega_(readScalar(dict.lookup("omega"))),
|
||||||
|
waveLength_(dict.lookupOrDefault<vector>("waveLength", vector::zero))
|
||||||
|
{
|
||||||
|
if (!dict.found("value"))
|
||||||
|
{
|
||||||
|
updateCoeffs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
waveDisplacementPointPatchVectorField::
|
||||||
|
waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const waveDisplacementPointPatchVectorField& ptf,
|
||||||
|
const pointPatch& p,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF,
|
||||||
|
const pointPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
|
||||||
|
amplitude_(ptf.amplitude_),
|
||||||
|
omega_(ptf.omega_),
|
||||||
|
waveLength_(ptf.waveLength_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
waveDisplacementPointPatchVectorField::
|
||||||
|
waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const waveDisplacementPointPatchVectorField& ptf,
|
||||||
|
const DimensionedField<vector, pointMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValuePointPatchField<vector>(ptf, iF),
|
||||||
|
amplitude_(ptf.amplitude_),
|
||||||
|
omega_(ptf.omega_),
|
||||||
|
waveLength_(ptf.waveLength_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void waveDisplacementPointPatchVectorField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const polyMesh& mesh = this->dimensionedInternalField().mesh()();
|
||||||
|
const Time& t = mesh.time();
|
||||||
|
|
||||||
|
const scalarField points( waveLength_ & patch().localPoints());
|
||||||
|
|
||||||
|
Field<vector>::operator=
|
||||||
|
(
|
||||||
|
amplitude_*cos(omega_*t.value() - points)
|
||||||
|
);
|
||||||
|
|
||||||
|
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void waveDisplacementPointPatchVectorField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
pointPatchField<vector>::write(os);
|
||||||
|
os.writeKeyword("amplitude")
|
||||||
|
<< amplitude_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("omega")
|
||||||
|
<< omega_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("waveLength")
|
||||||
|
<< waveLength_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePointPatchTypeField
|
||||||
|
(
|
||||||
|
pointPatchVectorField,
|
||||||
|
waveDisplacementPointPatchVectorField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,149 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::waveDisplacementPointPatchVectorField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::waveDisplacementPointPatchVectorField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
waveDisplacementPointPatchVectorField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef waveDisplacementPointPatchVectorField_H
|
||||||
|
#define waveDisplacementPointPatchVectorField_H
|
||||||
|
|
||||||
|
#include "fixedValuePointPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class waveDisplacementPointPatchVectorField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class waveDisplacementPointPatchVectorField
|
||||||
|
:
|
||||||
|
public fixedValuePointPatchField<vector>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
vector amplitude_;
|
||||||
|
scalar omega_;
|
||||||
|
vector waveLength_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("waveDisplacement");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch&,
|
||||||
|
const DimensionedField<vector, pointMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const pointPatch&,
|
||||||
|
const DimensionedField<vector, pointMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given patchField<vector> onto a new patch
|
||||||
|
waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const waveDisplacementPointPatchVectorField&,
|
||||||
|
const pointPatch&,
|
||||||
|
const DimensionedField<vector, pointMesh>&,
|
||||||
|
const pointPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual autoPtr<pointPatchField<vector> > clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<pointPatchField<vector> >
|
||||||
|
(
|
||||||
|
new waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
*this
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
const waveDisplacementPointPatchVectorField&,
|
||||||
|
const DimensionedField<vector, pointMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual autoPtr<pointPatchField<vector> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<vector, pointMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return autoPtr<pointPatchField<vector> >
|
||||||
|
(
|
||||||
|
new waveDisplacementPointPatchVectorField
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
iF
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -146,9 +146,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
// Private data
|
// Protected data
|
||||||
|
|
||||||
//- Patch to sample
|
//- Patch to sample
|
||||||
const polyPatch& patch_;
|
const polyPatch& patch_;
|
||||||
@ -199,7 +199,7 @@ private:
|
|||||||
dictionary surfDict_;
|
dictionary surfDict_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Collect single list of samples and originating processor+face.
|
//- Collect single list of samples and originating processor+face.
|
||||||
void collectSamples
|
void collectSamples
|
||||||
|
|||||||
@ -53,4 +53,6 @@ fi
|
|||||||
|
|
||||||
wmake $makeType decompositionMethods
|
wmake $makeType decompositionMethods
|
||||||
|
|
||||||
|
wmake $makeType decompose
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
3
src/parallel/decompose/decompose/Make/files
Normal file
3
src/parallel/decompose/decompose/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fvFieldDecomposer.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libdecompose
|
||||||
9
src/parallel/decompose/decompose/Make/options
Normal file
9
src/parallel/decompose/decompose/Make/options
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
||||||
|
|
||||||
|
LIB_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools \
|
||||||
|
-llagrangian
|
||||||
@ -241,7 +241,8 @@ public:
|
|||||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
decomposeField
|
decomposeField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
const GeometricField<Type, fvPatchField, volMesh>& field,
|
||||||
|
const bool allowUnknownPatchFields = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Decompose surface field
|
//- Decompose surface field
|
||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "processorFvsPatchField.H"
|
#include "processorFvsPatchField.H"
|
||||||
#include "processorCyclicFvPatchField.H"
|
#include "processorCyclicFvPatchField.H"
|
||||||
#include "processorCyclicFvsPatchField.H"
|
#include "processorCyclicFvsPatchField.H"
|
||||||
|
#include "emptyFvPatchFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -35,7 +36,8 @@ template<class Type>
|
|||||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
||||||
Foam::fvFieldDecomposer::decomposeField
|
Foam::fvFieldDecomposer::decomposeField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
const GeometricField<Type, fvPatchField, volMesh>& field,
|
||||||
|
const bool allowUnknownPatchFields
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Create and map the internal field values
|
// Create and map the internal field values
|
||||||
@ -94,6 +96,18 @@ Foam::fvFieldDecomposer::decomposeField
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else if (allowUnknownPatchFields)
|
||||||
|
{
|
||||||
|
patchFields.set
|
||||||
|
(
|
||||||
|
patchi,
|
||||||
|
new emptyFvPatchField<Type>
|
||||||
|
(
|
||||||
|
procMesh_.boundary()[patchi],
|
||||||
|
DimensionedField<Type, volMesh>::null()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn("fvFieldDecomposer::decomposeField()")
|
FatalErrorIn("fvFieldDecomposer::decomposeField()")
|
||||||
@ -42,7 +42,40 @@ Foam::fvFieldReconstructor::fvFieldReconstructor
|
|||||||
cellProcAddressing_(cellProcAddressing),
|
cellProcAddressing_(cellProcAddressing),
|
||||||
boundaryProcAddressing_(boundaryProcAddressing),
|
boundaryProcAddressing_(boundaryProcAddressing),
|
||||||
nReconstructed_(0)
|
nReconstructed_(0)
|
||||||
{}
|
{
|
||||||
|
forAll(procMeshes_, procI)
|
||||||
|
{
|
||||||
|
const fvMesh& procMesh = procMeshes_[procI];
|
||||||
|
if
|
||||||
|
(
|
||||||
|
faceProcAddressing[procI].size() != procMesh.nFaces()
|
||||||
|
|| cellProcAddressing[procI].size() != procMesh.nCells()
|
||||||
|
|| boundaryProcAddressing[procI].size() != procMesh.boundary().size()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"fvFieldReconstructor::fvFieldReconstructor\n"
|
||||||
|
"(\n"
|
||||||
|
" fvMesh&,\n"
|
||||||
|
" const PtrList<fvMesh>&,\n"
|
||||||
|
" const PtrList<labelIOList>&,\n"
|
||||||
|
" const PtrList<labelIOList>&,\n"
|
||||||
|
" const PtrList<labelIOList>&\n"
|
||||||
|
")"
|
||||||
|
) << "Size of maps does not correspond to size of mesh"
|
||||||
|
<< " for processor " << procI << endl
|
||||||
|
<< "faceProcAddressing : " << faceProcAddressing[procI].size()
|
||||||
|
<< " nFaces : " << procMesh.nFaces() << endl
|
||||||
|
<< "cellProcAddressing : " << cellProcAddressing[procI].size()
|
||||||
|
<< " nCell : " << procMesh.nCells() << endl
|
||||||
|
<< "boundaryProcAddressing : "
|
||||||
|
<< boundaryProcAddressing[procI].size()
|
||||||
|
<< " nFaces : " << procMesh.boundary().size()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -86,6 +86,7 @@ class fvFieldReconstructor
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Mapper for sizing only - does not do any actual mapping.
|
||||||
class fvPatchFieldReconstructor
|
class fvPatchFieldReconstructor
|
||||||
:
|
:
|
||||||
public fvPatchFieldMapper
|
public fvPatchFieldMapper
|
||||||
@ -146,19 +147,48 @@ public:
|
|||||||
//- Reconstruct volume internal field
|
//- Reconstruct volume internal field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<DimensionedField<Type, volMesh> >
|
tmp<DimensionedField<Type, volMesh> >
|
||||||
reconstructFvVolumeInternalField(const IOobject& fieldIoObject);
|
reconstructFvVolumeInternalField
|
||||||
|
(
|
||||||
|
const IOobject& fieldIoObject,
|
||||||
|
const PtrList<DimensionedField<Type, volMesh> >& procFields
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Read and reconstruct volume internal field
|
||||||
|
template<class Type>
|
||||||
|
tmp<DimensionedField<Type, volMesh> >
|
||||||
|
reconstructFvVolumeInternalField(const IOobject& fieldIoObject) const;
|
||||||
|
|
||||||
|
|
||||||
//- Reconstruct volume field
|
//- Reconstruct volume field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
reconstructFvVolumeField(const IOobject& fieldIoObject);
|
reconstructFvVolumeField
|
||||||
|
(
|
||||||
|
const IOobject& fieldIoObject,
|
||||||
|
const PtrList<GeometricField<Type, fvPatchField, volMesh> >&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Read and reconstruct volume field
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
reconstructFvVolumeField(const IOobject& fieldIoObject) const;
|
||||||
|
|
||||||
|
|
||||||
//- Reconstruct surface field
|
//- Reconstruct surface field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||||
reconstructFvSurfaceField(const IOobject& fieldIoObject);
|
reconstructFvSurfaceField
|
||||||
|
(
|
||||||
|
const IOobject& fieldIoObject,
|
||||||
|
const PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> >&
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Reconstruct and write all/selected volume internal fields
|
//- Read and reconstruct surface field
|
||||||
|
template<class Type>
|
||||||
|
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||||
|
reconstructFvSurfaceField(const IOobject& fieldIoObject) const;
|
||||||
|
|
||||||
|
//- Read, reconstruct and write all/selected volume internal fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void reconstructFvVolumeInternalFields
|
void reconstructFvVolumeInternalFields
|
||||||
(
|
(
|
||||||
@ -166,7 +196,7 @@ public:
|
|||||||
const HashSet<word>& selectedFields
|
const HashSet<word>& selectedFields
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Reconstruct and write all/selected volume fields
|
//- Read, reconstruct and write all/selected volume fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void reconstructFvVolumeFields
|
void reconstructFvVolumeFields
|
||||||
(
|
(
|
||||||
@ -174,7 +204,7 @@ public:
|
|||||||
const HashSet<word>& selectedFields
|
const HashSet<word>& selectedFields
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Reconstruct and write all/selected surface fields
|
//- Read, reconstruct and write all/selected surface fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void reconstructFvSurfaceFields
|
void reconstructFvSurfaceFields
|
||||||
(
|
(
|
||||||
|
|||||||
@ -33,12 +33,48 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
|
||||||
|
Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
|
||||||
|
(
|
||||||
|
const IOobject& fieldIoObject,
|
||||||
|
const PtrList<DimensionedField<Type, volMesh> >& procFields
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Create the internalField
|
||||||
|
Field<Type> internalField(mesh_.nCells());
|
||||||
|
|
||||||
|
forAll(procMeshes_, procI)
|
||||||
|
{
|
||||||
|
const DimensionedField<Type, volMesh>& procField = procFields[procI];
|
||||||
|
|
||||||
|
// Set the cell values in the reconstructed field
|
||||||
|
internalField.rmap
|
||||||
|
(
|
||||||
|
procField.field(),
|
||||||
|
cellProcAddressing_[procI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmp<DimensionedField<Type, volMesh> >
|
||||||
|
(
|
||||||
|
new DimensionedField<Type, volMesh>
|
||||||
|
(
|
||||||
|
fieldIoObject,
|
||||||
|
mesh_,
|
||||||
|
procFields[0].dimensions(),
|
||||||
|
internalField
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
|
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
|
||||||
Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
|
Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
|
||||||
(
|
(
|
||||||
const IOobject& fieldIoObject
|
const IOobject& fieldIoObject
|
||||||
)
|
) const
|
||||||
{
|
{
|
||||||
// Read the field for all the processors
|
// Read the field for all the processors
|
||||||
PtrList<DimensionedField<Type, volMesh> > procFields
|
PtrList<DimensionedField<Type, volMesh> > procFields
|
||||||
@ -67,37 +103,17 @@ Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create the internalField
|
return reconstructFvVolumeInternalField
|
||||||
Field<Type> internalField(mesh_.nCells());
|
|
||||||
|
|
||||||
forAll(procMeshes_, procI)
|
|
||||||
{
|
|
||||||
const DimensionedField<Type, volMesh>& procField = procFields[procI];
|
|
||||||
|
|
||||||
// Set the cell values in the reconstructed field
|
|
||||||
internalField.rmap
|
|
||||||
(
|
|
||||||
procField.field(),
|
|
||||||
cellProcAddressing_[procI]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp<DimensionedField<Type, volMesh> >
|
|
||||||
(
|
(
|
||||||
new DimensionedField<Type, volMesh>
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
fieldIoObject.name(),
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
fieldIoObject.name(),
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
procFields[0].dimensions(),
|
IOobject::NO_READ,
|
||||||
internalField
|
IOobject::NO_WRITE
|
||||||
)
|
),
|
||||||
|
procFields
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,44 +122,17 @@ template<class Type>
|
|||||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
||||||
Foam::fvFieldReconstructor::reconstructFvVolumeField
|
Foam::fvFieldReconstructor::reconstructFvVolumeField
|
||||||
(
|
(
|
||||||
const IOobject& fieldIoObject
|
const IOobject& fieldIoObject,
|
||||||
)
|
const PtrList<GeometricField<Type, fvPatchField, volMesh> >& procFields
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
// Read the field for all the processors
|
|
||||||
PtrList<GeometricField<Type, fvPatchField, volMesh> > procFields
|
|
||||||
(
|
|
||||||
procMeshes_.size()
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(procMeshes_, procI)
|
|
||||||
{
|
|
||||||
procFields.set
|
|
||||||
(
|
|
||||||
procI,
|
|
||||||
new GeometricField<Type, fvPatchField, volMesh>
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fieldIoObject.name(),
|
|
||||||
procMeshes_[procI].time().timeName(),
|
|
||||||
procMeshes_[procI],
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
procMeshes_[procI]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Create the internalField
|
// Create the internalField
|
||||||
Field<Type> internalField(mesh_.nCells());
|
Field<Type> internalField(mesh_.nCells());
|
||||||
|
|
||||||
// Create the patch fields
|
// Create the patch fields
|
||||||
PtrList<fvPatchField<Type> > patchFields(mesh_.boundary().size());
|
PtrList<fvPatchField<Type> > patchFields(mesh_.boundary().size());
|
||||||
|
|
||||||
|
forAll(procFields, procI)
|
||||||
forAll(procMeshes_, procI)
|
|
||||||
{
|
{
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& procField =
|
const GeometricField<Type, fvPatchField, volMesh>& procField =
|
||||||
procFields[procI];
|
procFields[procI];
|
||||||
@ -163,7 +152,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
|
|||||||
|
|
||||||
// Get addressing slice for this patch
|
// Get addressing slice for this patch
|
||||||
const labelList::subList cp =
|
const labelList::subList cp =
|
||||||
procMeshes_[procI].boundary()[patchI].patchSlice
|
procField.mesh().boundary()[patchI].patchSlice
|
||||||
(
|
(
|
||||||
faceProcAddressing_[procI]
|
faceProcAddressing_[procI]
|
||||||
);
|
);
|
||||||
@ -198,11 +187,32 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
|
|||||||
|
|
||||||
forAll(cp, faceI)
|
forAll(cp, faceI)
|
||||||
{
|
{
|
||||||
|
// Check
|
||||||
|
if (cp[faceI] <= 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"fvFieldReconstructor::reconstructFvVolumeField\n"
|
||||||
|
"(\n"
|
||||||
|
" const IOobject&,\n"
|
||||||
|
" const PtrList<GeometricField<Type,"
|
||||||
|
" fvPatchField, volMesh> >&\n"
|
||||||
|
") const\n"
|
||||||
|
) << "Processor " << procI
|
||||||
|
<< " patch "
|
||||||
|
<< procField.mesh().boundary()[patchI].name()
|
||||||
|
<< " face " << faceI
|
||||||
|
<< " originates from reversed face since "
|
||||||
|
<< cp[faceI]
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
// Subtract one to take into account offsets for
|
// Subtract one to take into account offsets for
|
||||||
// face direction.
|
// face direction.
|
||||||
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
patchFields[curBPatch].rmap
|
patchFields[curBPatch].rmap
|
||||||
(
|
(
|
||||||
procField.boundaryField()[patchI],
|
procField.boundaryField()[patchI],
|
||||||
@ -283,14 +293,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
|
|||||||
(
|
(
|
||||||
new GeometricField<Type, fvPatchField, volMesh>
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
(
|
(
|
||||||
IOobject
|
fieldIoObject,
|
||||||
(
|
|
||||||
fieldIoObject.name(),
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
procFields[0].dimensions(),
|
procFields[0].dimensions(),
|
||||||
internalField,
|
internalField,
|
||||||
@ -301,14 +304,14 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
||||||
Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
Foam::fvFieldReconstructor::reconstructFvVolumeField
|
||||||
(
|
(
|
||||||
const IOobject& fieldIoObject
|
const IOobject& fieldIoObject
|
||||||
)
|
) const
|
||||||
{
|
{
|
||||||
// Read the field for all the processors
|
// Read the field for all the processors
|
||||||
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> > procFields
|
PtrList<GeometricField<Type, fvPatchField, volMesh> > procFields
|
||||||
(
|
(
|
||||||
procMeshes_.size()
|
procMeshes_.size()
|
||||||
);
|
);
|
||||||
@ -318,7 +321,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
|||||||
procFields.set
|
procFields.set
|
||||||
(
|
(
|
||||||
procI,
|
procI,
|
||||||
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
new GeometricField<Type, fvPatchField, volMesh>
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -333,7 +336,29 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return reconstructFvVolumeField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fieldIoObject.name(),
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
procFields
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
|
||||||
|
Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
||||||
|
(
|
||||||
|
const IOobject& fieldIoObject,
|
||||||
|
const PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> >& procFields
|
||||||
|
) const
|
||||||
|
{
|
||||||
// Create the internalField
|
// Create the internalField
|
||||||
Field<Type> internalField(mesh_.nInternalFaces());
|
Field<Type> internalField(mesh_.nInternalFaces());
|
||||||
|
|
||||||
@ -503,14 +528,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
|||||||
(
|
(
|
||||||
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
||||||
(
|
(
|
||||||
IOobject
|
fieldIoObject,
|
||||||
(
|
|
||||||
fieldIoObject.name(),
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
procFields[0].dimensions(),
|
procFields[0].dimensions(),
|
||||||
internalField,
|
internalField,
|
||||||
@ -520,6 +538,54 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
|
||||||
|
Foam::fvFieldReconstructor::reconstructFvSurfaceField
|
||||||
|
(
|
||||||
|
const IOobject& fieldIoObject
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Read the field for all the processors
|
||||||
|
PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> > procFields
|
||||||
|
(
|
||||||
|
procMeshes_.size()
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(procMeshes_, procI)
|
||||||
|
{
|
||||||
|
procFields.set
|
||||||
|
(
|
||||||
|
procI,
|
||||||
|
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fieldIoObject.name(),
|
||||||
|
procMeshes_[procI].time().timeName(),
|
||||||
|
procMeshes_[procI],
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
procMeshes_[procI]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return reconstructFvSurfaceField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fieldIoObject.name(),
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
procFields
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fvFieldReconstructor::reconstructFvVolumeInternalFields
|
void Foam::fvFieldReconstructor::reconstructFvVolumeInternalFields
|
||||||
(
|
(
|
||||||
|
|||||||
@ -0,0 +1,99 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 2.0.0 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
application icoFoam;
|
||||||
|
|
||||||
|
startFrom startTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 0.5;
|
||||||
|
|
||||||
|
deltaT 0.005;
|
||||||
|
|
||||||
|
writeControl timeStep;
|
||||||
|
|
||||||
|
writeInterval 20;
|
||||||
|
|
||||||
|
purgeWrite 0;
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
|
writePrecision 6;
|
||||||
|
|
||||||
|
writeCompression off;
|
||||||
|
|
||||||
|
timeFormat general;
|
||||||
|
|
||||||
|
timePrecision 6;
|
||||||
|
|
||||||
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
streamLines
|
||||||
|
{
|
||||||
|
type streamLine;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
|
// Output every
|
||||||
|
outputControl outputTime;
|
||||||
|
// outputInterval 10;
|
||||||
|
|
||||||
|
setFormat vtk; //gnuplot; //xmgr; //raw; //jplot;
|
||||||
|
|
||||||
|
// Velocity field to use for tracking.
|
||||||
|
U U;
|
||||||
|
|
||||||
|
// Interpolation method. Default is cellPoint. See sampleDict.
|
||||||
|
//interpolationScheme pointMVC;
|
||||||
|
|
||||||
|
// Tracked forwards (+U) or backwards (-U)
|
||||||
|
trackForward true;
|
||||||
|
|
||||||
|
// Names of fields to sample. Should contain above velocity field!
|
||||||
|
fields (p U);
|
||||||
|
|
||||||
|
// Steps particles can travel before being removed
|
||||||
|
lifeTime 10000;
|
||||||
|
|
||||||
|
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
|
||||||
|
nSubCycle 5;
|
||||||
|
|
||||||
|
// Cloud name to use
|
||||||
|
cloudName particleTracks;
|
||||||
|
|
||||||
|
// Seeding method. See the sampleSets in sampleDict.
|
||||||
|
seedSampleSet uniform; //cloud;//triSurfaceMeshPointSet;
|
||||||
|
|
||||||
|
uniformCoeffs
|
||||||
|
{
|
||||||
|
type uniform;
|
||||||
|
axis x; //distance;
|
||||||
|
|
||||||
|
start (-0.0205 0.0001 0.00001);
|
||||||
|
end (-0.0205 0.0005 0.00001);
|
||||||
|
nPoints 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -33,6 +33,7 @@ License
|
|||||||
#include "sampledSet.H"
|
#include "sampledSet.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
#include "mapDistribute.H"
|
#include "mapDistribute.H"
|
||||||
|
#include "interpolationCellPoint.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -75,9 +76,9 @@ void Foam::streamLine::track()
|
|||||||
|
|
||||||
// Read or lookup fields
|
// Read or lookup fields
|
||||||
PtrList<volScalarField> vsFlds;
|
PtrList<volScalarField> vsFlds;
|
||||||
PtrList<interpolationCellPoint<scalar> > vsInterp;
|
PtrList<interpolation<scalar> > vsInterp;
|
||||||
PtrList<volVectorField> vvFlds;
|
PtrList<volVectorField> vvFlds;
|
||||||
PtrList<interpolationCellPoint<vector> > vvInterp;
|
PtrList<interpolation<vector> > vvInterp;
|
||||||
|
|
||||||
label UIndex = -1;
|
label UIndex = -1;
|
||||||
|
|
||||||
@ -95,13 +96,29 @@ void Foam::streamLine::track()
|
|||||||
vsInterp.setSize(vsFlds.size());
|
vsInterp.setSize(vsFlds.size());
|
||||||
forAll(vsFlds, i)
|
forAll(vsFlds, i)
|
||||||
{
|
{
|
||||||
vsInterp.set(i, new interpolationCellPoint<scalar>(vsFlds[i]));
|
vsInterp.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
interpolation<scalar>::New
|
||||||
|
(
|
||||||
|
interpolationScheme_,
|
||||||
|
vsFlds[i]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
ReadFields(mesh, objects, vvFlds);
|
ReadFields(mesh, objects, vvFlds);
|
||||||
vvInterp.setSize(vvFlds.size());
|
vvInterp.setSize(vvFlds.size());
|
||||||
forAll(vvFlds, i)
|
forAll(vvFlds, i)
|
||||||
{
|
{
|
||||||
vvInterp.set(i, new interpolationCellPoint<vector>(vvFlds[i]));
|
vvInterp.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
interpolation<vector>::New
|
||||||
|
(
|
||||||
|
interpolationScheme_,
|
||||||
|
vvFlds[i]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -146,7 +163,12 @@ void Foam::streamLine::track()
|
|||||||
vsInterp.set
|
vsInterp.set
|
||||||
(
|
(
|
||||||
nScalar++,
|
nScalar++,
|
||||||
new interpolationCellPoint<scalar>(f)
|
//new interpolationCellPoint<scalar>(f)
|
||||||
|
interpolation<scalar>::New
|
||||||
|
(
|
||||||
|
interpolationScheme_,
|
||||||
|
f
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||||
@ -164,7 +186,12 @@ void Foam::streamLine::track()
|
|||||||
vvInterp.set
|
vvInterp.set
|
||||||
(
|
(
|
||||||
nVector++,
|
nVector++,
|
||||||
new interpolationCellPoint<vector>(f)
|
//new interpolationCellPoint<vector>(f)
|
||||||
|
interpolation<vector>::New
|
||||||
|
(
|
||||||
|
interpolationScheme_,
|
||||||
|
f
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,6 +334,15 @@ void Foam::streamLine::read(const dictionary& dict)
|
|||||||
nSubCycle_ = 1;
|
nSubCycle_ = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interpolationScheme_ = dict.lookupOrDefault
|
||||||
|
(
|
||||||
|
"interpolationScheme",
|
||||||
|
interpolationCellPoint<scalar>::typeName
|
||||||
|
);
|
||||||
|
|
||||||
|
//Info<< typeName << " using interpolation " << interpolationScheme_
|
||||||
|
// << endl;
|
||||||
|
|
||||||
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
|
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
|
||||||
dict.lookup("seedSampleSet") >> seedSet_;
|
dict.lookup("seedSampleSet") >> seedSet_;
|
||||||
|
|
||||||
|
|||||||
@ -86,6 +86,9 @@ class streamLine
|
|||||||
//- Field to transport particle with
|
//- Field to transport particle with
|
||||||
word UName_;
|
word UName_;
|
||||||
|
|
||||||
|
//- Interpolation scheme to use
|
||||||
|
word interpolationScheme_;
|
||||||
|
|
||||||
//- Whether to use +u or -u
|
//- Whether to use +u or -u
|
||||||
bool trackForward_;
|
bool trackForward_;
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "particle.H"
|
#include "particle.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "interpolationCellPoint.H"
|
#include "interpolation.H"
|
||||||
#include "vectorList.H"
|
#include "vectorList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -68,8 +68,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
const PtrList<interpolationCellPoint<scalar> >& vsInterp_;
|
const PtrList<interpolation<scalar> >& vsInterp_;
|
||||||
const PtrList<interpolationCellPoint<vector> >& vvInterp_;
|
const PtrList<interpolation<vector> >& vvInterp_;
|
||||||
const label UIndex_;
|
const label UIndex_;
|
||||||
const bool trackForward_;
|
const bool trackForward_;
|
||||||
const label nSubCycle_;
|
const label nSubCycle_;
|
||||||
@ -84,8 +84,8 @@ public:
|
|||||||
trackingData
|
trackingData
|
||||||
(
|
(
|
||||||
Cloud<streamLineParticle>& cloud,
|
Cloud<streamLineParticle>& cloud,
|
||||||
const PtrList<interpolationCellPoint<scalar> >& vsInterp,
|
const PtrList<interpolation<scalar> >& vsInterp,
|
||||||
const PtrList<interpolationCellPoint<vector> >& vvInterp,
|
const PtrList<interpolation<vector> >& vvInterp,
|
||||||
const label UIndex,
|
const label UIndex,
|
||||||
const bool trackForward,
|
const bool trackForward,
|
||||||
const label nSubCycle,
|
const label nSubCycle,
|
||||||
|
|||||||
@ -428,36 +428,43 @@ void Foam::forces::write()
|
|||||||
Info<< "forces output:" << nl
|
Info<< "forces output:" << nl
|
||||||
<< " forces(pressure, viscous)" << fm.first() << nl
|
<< " forces(pressure, viscous)" << fm.first() << nl
|
||||||
<< " moment(pressure, viscous)" << fm.second() << nl;
|
<< " moment(pressure, viscous)" << fm.second() << nl;
|
||||||
|
}
|
||||||
|
|
||||||
forcesFilePtr_() << obr_.time().value() << tab << fm;
|
forcesFilePtr_() << obr_.time().value() << tab << fm;
|
||||||
|
|
||||||
if (localSystem_)
|
if (localSystem_)
|
||||||
|
{
|
||||||
|
forcesMoments fmLocal;
|
||||||
|
|
||||||
|
fmLocal.first().first() =
|
||||||
|
coordSys_.localVector(fm.first().first());
|
||||||
|
|
||||||
|
fmLocal.first().second() =
|
||||||
|
coordSys_.localVector(fm.first().second());
|
||||||
|
|
||||||
|
fmLocal.second().first() =
|
||||||
|
coordSys_.localVector(fm.second().first());
|
||||||
|
|
||||||
|
fmLocal.second().second() =
|
||||||
|
coordSys_.localVector(fm.second().second());
|
||||||
|
|
||||||
|
forcesFilePtr_() << tab << fmLocal;
|
||||||
|
|
||||||
|
if (log_)
|
||||||
{
|
{
|
||||||
forcesMoments fmLocal;
|
|
||||||
|
|
||||||
fmLocal.first().first() =
|
|
||||||
coordSys_.localVector(fm.first().first());
|
|
||||||
|
|
||||||
fmLocal.first().second() =
|
|
||||||
coordSys_.localVector(fm.first().second());
|
|
||||||
|
|
||||||
fmLocal.second().first() =
|
|
||||||
coordSys_.localVector(fm.second().first());
|
|
||||||
|
|
||||||
fmLocal.second().second() =
|
|
||||||
coordSys_.localVector(fm.second().second());
|
|
||||||
|
|
||||||
forcesFilePtr_() << tab << fmLocal;
|
|
||||||
|
|
||||||
|
|
||||||
Info<< " local:" << nl
|
Info<< " local:" << nl
|
||||||
<< " forces(pressure, viscous)" << fmLocal.first()
|
<< " forces(pressure, viscous)" << fmLocal.first()
|
||||||
<< nl
|
<< nl
|
||||||
<< " moment(pressure, viscous)" << fmLocal.second()
|
<< " moment(pressure, viscous)" << fmLocal.second()
|
||||||
<< nl;
|
<< nl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
forcesFilePtr_() << endl;
|
|
||||||
|
forcesFilePtr_() << endl;
|
||||||
|
|
||||||
|
if (log_)
|
||||||
|
{
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,8 @@ const ThermoType& Foam::multiComponentMixture<ThermoType>::constructSpeciesData
|
|||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
void Foam::multiComponentMixture<ThermoType>::correctMassFractions()
|
void Foam::multiComponentMixture<ThermoType>::correctMassFractions()
|
||||||
{
|
{
|
||||||
volScalarField Yt("Yt", Y_[0]);
|
// It changes Yt patches to "calculated"
|
||||||
|
volScalarField Yt("Yt", 1.0*Y_[0]);
|
||||||
|
|
||||||
for (label n=1; n<Y_.size(); n++)
|
for (label n=1; n<Y_.size(); n++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -21,32 +21,27 @@ boundaryField
|
|||||||
{
|
{
|
||||||
top
|
top
|
||||||
{
|
{
|
||||||
type inletOutlet;
|
type calculated;
|
||||||
inletValue $internalField;
|
|
||||||
value $internalField;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ground
|
ground
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
}
|
}
|
||||||
|
|
||||||
sides
|
sides
|
||||||
{
|
{
|
||||||
type inletOutlet;
|
type calculated;
|
||||||
inletValue $internalField;
|
|
||||||
value $internalField;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
burner
|
burner
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type calculated;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"(region0_to.*)"
|
"(region0_to.*)"
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,8 @@ faceZones (fRight_zone fLeft_zone);
|
|||||||
|
|
||||||
oneD true;
|
oneD true;
|
||||||
|
|
||||||
|
sampleMode nearestPatchFace;
|
||||||
|
|
||||||
oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch
|
oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch
|
||||||
|
|
||||||
extrudeModel linearNormal;
|
extrudeModel linearNormal;
|
||||||
|
|||||||
@ -23,24 +23,19 @@ boundaryField
|
|||||||
{
|
{
|
||||||
outlet
|
outlet
|
||||||
{
|
{
|
||||||
type inletOutlet;
|
type calculated;
|
||||||
inletValue $internalField;
|
|
||||||
value $internalField;
|
|
||||||
}
|
}
|
||||||
sides
|
sides
|
||||||
{
|
{
|
||||||
type inletOutlet;
|
type calculated;
|
||||||
inletValue $internalField;
|
|
||||||
value $internalField;
|
|
||||||
}
|
}
|
||||||
base
|
base
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
}
|
}
|
||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type calculated;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
frontBack
|
frontBack
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,24 +23,19 @@ boundaryField
|
|||||||
{
|
{
|
||||||
outlet
|
outlet
|
||||||
{
|
{
|
||||||
type inletOutlet;
|
type calculated;
|
||||||
inletValue $internalField;
|
|
||||||
value $internalField;
|
|
||||||
}
|
}
|
||||||
sides
|
sides
|
||||||
{
|
{
|
||||||
type inletOutlet;
|
type calculated;
|
||||||
inletValue $internalField;
|
|
||||||
value $internalField;
|
|
||||||
}
|
}
|
||||||
base
|
base
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
}
|
}
|
||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type calculated;
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,20 +23,15 @@ boundaryField
|
|||||||
{
|
{
|
||||||
fuel
|
fuel
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type calculated;
|
||||||
value uniform 0.0;
|
|
||||||
}
|
}
|
||||||
air
|
air
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type calculated;
|
||||||
value uniform 0.77;
|
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
{
|
{
|
||||||
type inletOutlet;
|
type calculated;
|
||||||
inletValue uniform 0.77;
|
|
||||||
value uniform 0.77;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
frontAndBack
|
frontAndBack
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,6 +31,10 @@ writeControl timeStep;
|
|||||||
|
|
||||||
writeInterval 20;
|
writeInterval 20;
|
||||||
|
|
||||||
|
//- Additional dump every hour of cpuTime for e.g. restarts
|
||||||
|
//secondaryWriteControl cpuTime;
|
||||||
|
//secondaryWriteInterval 3600;
|
||||||
|
|
||||||
purgeWrite 0;
|
purgeWrite 0;
|
||||||
|
|
||||||
writeFormat ascii;
|
writeFormat ascii;
|
||||||
|
|||||||
@ -18,6 +18,8 @@ region wallFilmRegion;
|
|||||||
|
|
||||||
faceZones (wallFilmFaces);
|
faceZones (wallFilmFaces);
|
||||||
|
|
||||||
|
sampleMode nearestPatchFace;
|
||||||
|
|
||||||
oneD false;
|
oneD false;
|
||||||
|
|
||||||
extrudeModel linearNormal;
|
extrudeModel linearNormal;
|
||||||
|
|||||||
@ -24,6 +24,8 @@ faceZones
|
|||||||
|
|
||||||
oneD false;
|
oneD false;
|
||||||
|
|
||||||
|
sampleMode nearestPatchFace;
|
||||||
|
|
||||||
extrudeModel linearNormal;
|
extrudeModel linearNormal;
|
||||||
|
|
||||||
nLayers 1;
|
nLayers 1;
|
||||||
|
|||||||
@ -20,6 +20,8 @@ faceZones (wallFilmFaces);
|
|||||||
|
|
||||||
oneD false;
|
oneD false;
|
||||||
|
|
||||||
|
sampleMode nearestPatchFace;
|
||||||
|
|
||||||
extrudeModel linearNormal;
|
extrudeModel linearNormal;
|
||||||
|
|
||||||
nLayers 1;
|
nLayers 1;
|
||||||
|
|||||||
@ -20,6 +20,8 @@ faceZones (wallFilmFaces);
|
|||||||
|
|
||||||
oneD false;
|
oneD false;
|
||||||
|
|
||||||
|
sampleMode nearestPatchFace;
|
||||||
|
|
||||||
extrudeModel linearNormal;
|
extrudeModel linearNormal;
|
||||||
|
|
||||||
nLayers 1;
|
nLayers 1;
|
||||||
|
|||||||
@ -151,7 +151,8 @@ set -o pipefail
|
|||||||
#
|
#
|
||||||
colourPipe()
|
colourPipe()
|
||||||
{
|
{
|
||||||
if [ "$1" ]
|
|
||||||
|
if tty -s <&1 # [ "$1" ]
|
||||||
then
|
then
|
||||||
(
|
(
|
||||||
while read line
|
while read line
|
||||||
|
|||||||
Reference in New Issue
Block a user