Commit cb13393b authored by Sergio Ferraris's avatar Sergio Ferraris
Browse files

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

parents 8ede7fdd 34695f58
......@@ -39,15 +39,8 @@
#include "compressibleCreatePhi.H"
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("PIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("PIMPLE").lookup("rhoMin")
);
dimensionedScalar rhoMax(pimple.dict().lookup("rhoMax"));
dimensionedScalar rhoMin(pimple.dict().lookup("rhoMin"));
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
......
......@@ -46,10 +46,13 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
pimpleControl pimple(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
......
......@@ -48,12 +48,13 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
pimpleControl pimple(mesh);
#include "createFields.H"
#include "createZones.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
......
......@@ -42,17 +42,10 @@
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
setRefCell(p, simple.dict(), pRefCell, pRefValue);
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMin")
);
dimensionedScalar rhoMax(simple.dict().lookup("rhoMax"));
dimensionedScalar rhoMin(simple.dict().lookup("rhoMin"));
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
......
......@@ -9,13 +9,7 @@
if (pZones.size())
{
// nUCorrectors for pressureImplicitPorosity
if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
{
nUCorr = readInt
(
mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
);
}
simple.dict().readIfPresent("nUCorrectors", nUCorr);
if (nUCorr > 0)
{
......
......@@ -45,12 +45,13 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
simpleControl simple(mesh);
#include "createFields.H"
#include "createZones.H"
#include "initContinuityErrs.H"
simpleControl simple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
......
......@@ -42,11 +42,12 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"
simpleControl simple(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
......
......@@ -41,17 +41,10 @@
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
setRefCell(p, simple.dict(), pRefCell, pRefValue);
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMin")
);
dimensionedScalar rhoMax(simple.dict().lookup("rhoMax"));
dimensionedScalar rhoMin(simple.dict().lookup("rhoMin"));
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
......
......@@ -44,11 +44,12 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"
simpleControl simple(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
......
......@@ -8,7 +8,9 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
EXE_LIBS = \
-lbasicThermophysicalModels \
......@@ -19,4 +21,6 @@ EXE_LIBS = \
-lcompressibleLESModels \
-lmeshTools \
-lfiniteVolume \
-lradiationModels
-lradiationModels \
-ldecompose \
-lreconstruct
// 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 "basicSolidThermo.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);
const label nAllRegions =
rp.fluidRegionNames().size()
+ rp.solidRegionNames().size();
PtrList<labelIOList> cellProcAddressing(nAllRegions);
PtrList<labelIOList> faceProcAddressing(nAllRegions);
PtrList<labelIOList> boundaryProcAddressing(nAllRegions);
PtrList<fvMesh> procMeshes(nAllRegions);
// Load meshes, fluid first
labelList fluidToProc(identity(rp.fluidRegionNames().size()));
labelList solidToProc(rp.solidRegionNames().size());
forAll(solidToProc, i)
{
solidToProc[i] = fluidToProc.size()+i;
}
// Get the coupled solution flag
#include "readPIMPLEControls.H"
if (temperatureCoupled)
{
Info<< "Solving single enthalpy for all equations" << nl << endl;
}
#include "createFluidMeshes.H"
#include "createSolidMeshes.H"
#include "createFluidFields.H"
#include "createSolidFields.H"
// Temperature solved on single mesh
#include "createAllMesh.H"
#include "createAllFields.H"
#include "initContinuityErrs.H"
#include "readTimeControls.H"
......@@ -81,9 +114,10 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
if (nOuterCorr != 1)
{
forAll(fluidRegions, i)
forAll(fluidToProc, i)
{
#include "setRegionFluidFields.H"
#include "storeOldFluidFields.H"
......@@ -96,22 +130,133 @@ int main(int argc, char *argv[])
{
bool finalIter = oCorr == nOuterCorr-1;
forAll(fluidRegions, i)
if (finalIter)
{
forAll(procMeshes, procI)
{
procMeshes[procI].data::add("finalIteration", true);
}
}
PtrList<surfaceScalarField> procPhi(nAllRegions);
PtrList<surfaceScalarField> procAlpha(nAllRegions);
// Solve (uncoupled) or set up (coupled) the temperature equation
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
forAll(solidToProc, i)
{
label procI = solidToProc[i];
Info<< "\nSolving temperature for solid region "
<< procMeshes[procI].name() << endl;
#include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
if (temperatureCoupled)
{
// Map my properties to overall h equation
#include "rmapSolid.H"
}
else
{
#include "solveSolid.H"
}
}
forAll(fluidToProc, i)
{
label procI = fluidToProc[i];
Info<< "\nSolving temperature for fluid region "
<< procMeshes[procI].name() << endl;
#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 for fluid region "
<< fluidRegions[i].name() << endl;
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"
#include "solveFluid.H"
thermo.correct();
rad.correct();
#include "solvePressureVelocityFluid.H"
}
forAll(solidRegions, i)
forAll(solidToProc, i)
{
Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl;
Info<< "\nUpdating thermo for solid region "
<< procMeshes[solidToProc[i]].name() << endl;
#include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
#include "solveSolid.H"
thermo.correct();
}
if (finalIter)
{
forAll(procMeshes, procI)
{
procMeshes[procI].data::remove("finalIteration");
}
}
}
......
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)
);
}
//
// 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],