mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
8
applications/solvers/multiphase/MPPICInterFoam/Allwclean
Executable file
8
applications/solvers/multiphase/MPPICInterFoam/Allwclean
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wclean libso CompressibleTwoPhaseMixtureTurbulenceModels
|
||||
wclean
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
8
applications/solvers/multiphase/MPPICInterFoam/Allwmake
Executable file
8
applications/solvers/multiphase/MPPICInterFoam/Allwmake
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wmake libso CompressibleTwoPhaseMixtureTurbulenceModels
|
||||
wmake
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -0,0 +1,64 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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 "PhaseCompressibleTurbulenceModel.H"
|
||||
#include "immiscibleIncompressibleTwoPhaseMixture.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
#include "laminar.H"
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
makeBaseTurbulenceModel
|
||||
(
|
||||
volScalarField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
PhaseCompressibleTurbulenceModel,
|
||||
immiscibleIncompressibleTwoPhaseMixture
|
||||
);
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel, RAS, Type)
|
||||
|
||||
#define makeLESModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel, LES, Type)
|
||||
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
#include "Smagorinsky.H"
|
||||
makeLESModel(Smagorinsky);
|
||||
|
||||
#include "kEqn.H"
|
||||
makeLESModel(kEqn);
|
||||
|
||||
#include "kOmega.H"
|
||||
makeRASModel(kOmega);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
CompressibleTwoPhaseMixtureTurbulenceModels.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libCompressibleTwoPhaseMixtureTurbulenceModels
|
||||
@ -0,0 +1,15 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude
|
||||
167
applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C
Normal file
167
applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C
Normal file
@ -0,0 +1,167 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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/>.
|
||||
|
||||
Application
|
||||
MPPICInterFoam
|
||||
|
||||
Description
|
||||
Solver for 2 incompressible, isothermal immiscible fluids using a VOF
|
||||
(volume of fluid) phase-fraction based interface capturing approach.
|
||||
The momentum and other fluid properties are of the "mixture" and a single
|
||||
momentum equation is solved.
|
||||
|
||||
It includes MRF and MPPIC clouds
|
||||
|
||||
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "CMULES.H"
|
||||
#include "subCycle.H"
|
||||
|
||||
#include "immiscibleIncompressibleTwoPhaseMixture.H"
|
||||
#include "PhaseCompressibleTurbulenceModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "fixedFluxPressureFvPatchScalarField.H"
|
||||
|
||||
#include "basicKinematicMPPICCloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createTimeControls.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
#include "createMRF.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "correctPhi.H"
|
||||
|
||||
turbulence->validate();
|
||||
|
||||
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "alphaCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
Info<< "Evolving " << kinematicCloud.name() << endl;
|
||||
|
||||
kinematicCloud.evolve();
|
||||
|
||||
// Update continuous phase volume fraction field
|
||||
alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
|
||||
alphac.correctBoundaryConditions();
|
||||
|
||||
Info<< "Continous phase-1 volume fraction = "
|
||||
<< alphac.weightedAverage(mesh.Vsc()).value()
|
||||
<< " Min(alphac) = " << min(alphac).value()
|
||||
<< " Max(alphac) = " << max(alphac).value()
|
||||
<< endl;
|
||||
|
||||
alphacf = fvc::interpolate(alphac);
|
||||
alphaRhoPhic = alphacf*rhoPhi;
|
||||
alphaPhic = alphacf*phi;
|
||||
alphacRho = alphac*rho;
|
||||
|
||||
fvVectorMatrix cloudSU(kinematicCloud.SU(U));
|
||||
volVectorField cloudVolSUSu
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cloudVolSUSu",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector
|
||||
(
|
||||
"0",
|
||||
cloudSU.dimensions()/dimVolume,
|
||||
vector::zero
|
||||
),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
);
|
||||
|
||||
cloudVolSUSu.internalField() = -cloudSU.source()/mesh.V();
|
||||
cloudVolSUSu.correctBoundaryConditions();
|
||||
|
||||
cloudSU.source() = vector::zero;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
#include "alphaEqnSubCycle.H"
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
MPPICInterFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/MPPICInterFoam
|
||||
42
applications/solvers/multiphase/MPPICInterFoam/Make/options
Normal file
42
applications/solvers/multiphase/MPPICInterFoam/Make/options
Normal file
@ -0,0 +1,42 @@
|
||||
interFoamPath = $(FOAM_SOLVERS)/multiphase/interFoam
|
||||
|
||||
EXE_INC = \
|
||||
-I./IncompressibleTwoPhaseMixtureTurbulenceModels/lnInclude \
|
||||
-I$(interFoamPath) \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-llagrangian \
|
||||
-llagrangianIntermediate \
|
||||
-lthermophysicalFunctions \
|
||||
-lspecie \
|
||||
-lincompressibleTransportModels \
|
||||
-limmiscibleIncompressibleTwoPhaseMixture \
|
||||
-lturbulenceModels \
|
||||
-lsampling \
|
||||
-lregionModels \
|
||||
-lsurfaceFilmModels \
|
||||
-lfvOptions \
|
||||
-lCompressibleTwoPhaseMixtureTurbulenceModels
|
||||
50
applications/solvers/multiphase/MPPICInterFoam/UEqn.H
Normal file
50
applications/solvers/multiphase/MPPICInterFoam/UEqn.H
Normal file
@ -0,0 +1,50 @@
|
||||
MRF.correctBoundaryVelocity(U);
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(alphacRho, U)
|
||||
+ MRF.DDt(alphacRho, U)
|
||||
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
|
||||
+ fvm::div(rhoPhi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
==
|
||||
fvOptions(rho, U)
|
||||
+ cloudSU
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
fvOptions.constrain(UEqn);
|
||||
|
||||
volScalarField rAUc(1.0/UEqn.A());
|
||||
surfaceScalarField rAUcf(fvc::interpolate(rAUc));
|
||||
|
||||
|
||||
surfaceScalarField phicForces
|
||||
(
|
||||
(fvc::interpolate(rAUc*cloudVolSUSu) & mesh.Sf())
|
||||
);
|
||||
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
(
|
||||
UEqn
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
phicForces/rAUcf
|
||||
+
|
||||
(
|
||||
fvc::interpolate
|
||||
(
|
||||
mixture.sigmaK()
|
||||
)*fvc::snGrad(alpha1)
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
163
applications/solvers/multiphase/MPPICInterFoam/alphaEqn.H
Normal file
163
applications/solvers/multiphase/MPPICInterFoam/alphaEqn.H
Normal file
@ -0,0 +1,163 @@
|
||||
{
|
||||
word alphaScheme("div(phi,alpha)");
|
||||
word alpharScheme("div(phirb,alpha)");
|
||||
|
||||
// Standard face-flux compression coefficient
|
||||
surfaceScalarField phic
|
||||
(
|
||||
mixture.cAlpha()*mag(alphaPhic/mesh.magSf())
|
||||
);
|
||||
|
||||
// Add the optional isotropic compression contribution
|
||||
if (icAlpha > 0)
|
||||
{
|
||||
phic *= (1.0 - icAlpha);
|
||||
phic += (mixture.cAlpha()*icAlpha)*fvc::interpolate(mag(U));
|
||||
}
|
||||
|
||||
// Do not compress interface at non-coupled boundary faces
|
||||
// (inlets, outlets etc.)
|
||||
forAll(phic.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchScalarField& phicp = phic.boundaryField()[patchi];
|
||||
|
||||
if (!phicp.coupled())
|
||||
{
|
||||
phicp == 0;
|
||||
}
|
||||
}
|
||||
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
if (MULESCorr)
|
||||
{
|
||||
fvScalarMatrix alpha1Eqn
|
||||
(
|
||||
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alphac, alpha1)
|
||||
+ fv::gaussConvectionScheme<scalar>
|
||||
(
|
||||
mesh,
|
||||
alphaPhic,
|
||||
upwind<scalar>(mesh, alphaPhic)
|
||||
).fvmDiv(alphaPhic, alpha1)
|
||||
- fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), alpha1)
|
||||
);
|
||||
|
||||
alpha1Eqn.solve();
|
||||
|
||||
Info<< "Phase-1 volume fraction = "
|
||||
<< alpha1.weightedAverage(mesh.Vsc()).value()
|
||||
<< " Min(alpha1) = " << min(alpha1).value()
|
||||
<< " Max(alpha1) = " << max(alpha1).value()
|
||||
<< endl;
|
||||
|
||||
tmp<surfaceScalarField> tphiAlphaUD(alpha1Eqn.flux());
|
||||
alphaPhi = tphiAlphaUD();
|
||||
|
||||
if (alphaApplyPrevCorr && tphiAlphaCorr0.valid())
|
||||
{
|
||||
Info<< "Applying the previous iteration compression flux" << endl;
|
||||
|
||||
MULES::correct
|
||||
(
|
||||
alphac,
|
||||
alpha1,
|
||||
alphaPhi,
|
||||
tphiAlphaCorr0.ref(),
|
||||
zeroField(), zeroField(),
|
||||
1, 0
|
||||
);
|
||||
|
||||
alphaPhi += tphiAlphaCorr0();
|
||||
}
|
||||
|
||||
// Cache the upwind-flux
|
||||
tphiAlphaCorr0 = tphiAlphaUD;
|
||||
|
||||
alpha2 = 1.0 - alpha1;
|
||||
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
|
||||
{
|
||||
surfaceScalarField phir(phic*mixture.nHatf());
|
||||
|
||||
tmp<surfaceScalarField> tphiAlphaUn
|
||||
(
|
||||
fvc::flux
|
||||
(
|
||||
alphaPhic,
|
||||
alpha1,
|
||||
alphaScheme
|
||||
)
|
||||
+ fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, alpha2, alpharScheme),
|
||||
alpha1,
|
||||
alpharScheme
|
||||
)
|
||||
);
|
||||
|
||||
if (MULESCorr)
|
||||
{
|
||||
tmp<surfaceScalarField> tphiAlphaCorr(tphiAlphaUn() - alphaPhi);
|
||||
volScalarField alpha10("alpha10", alpha1);
|
||||
|
||||
//MULES::correct(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0);
|
||||
|
||||
MULES::correct
|
||||
(
|
||||
alphac,
|
||||
alpha1,
|
||||
tphiAlphaUn(),
|
||||
tphiAlphaCorr.ref(),
|
||||
zeroField(), zeroField(),
|
||||
1, 0
|
||||
);
|
||||
|
||||
// Under-relax the correction for all but the 1st corrector
|
||||
if (aCorr == 0)
|
||||
{
|
||||
alphaPhi += tphiAlphaCorr();
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha1 = 0.5*alpha1 + 0.5*alpha10;
|
||||
alphaPhi += 0.5*tphiAlphaCorr();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alphaPhi = tphiAlphaUn;
|
||||
|
||||
MULES::explicitSolve
|
||||
(
|
||||
alphac,
|
||||
alpha1,
|
||||
alphaPhic,
|
||||
alphaPhi,
|
||||
zeroField(), zeroField(),
|
||||
1, 0
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
alpha2 = 1.0 - alpha1;
|
||||
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
rhoPhi = alphaPhi*(rho1 - rho2) + alphaPhic*rho2;
|
||||
|
||||
if (alphaApplyPrevCorr && MULESCorr)
|
||||
{
|
||||
tphiAlphaCorr0 = alphaPhi - tphiAlphaCorr0;
|
||||
}
|
||||
|
||||
Info<< "Phase-1 volume fraction = "
|
||||
<< alpha1.weightedAverage(mesh.Vsc()).value()
|
||||
<< " Min(alpha1) = " << min(alpha1).value()
|
||||
<< " Max(alpha1) = " << max(alpha1).value()
|
||||
<< endl;
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
dimensionedScalar totalDeltaT = runTime.deltaT();
|
||||
surfaceScalarField rhoPhiSum
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhiSum",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", rhoPhi.dimensions(), 0)
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
#include "alphaEqn.H"
|
||||
rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi;
|
||||
}
|
||||
|
||||
rhoPhi = rhoPhiSum;
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "alphaEqn.H"
|
||||
}
|
||||
|
||||
rho == alpha1*rho1 + alpha2*rho2;
|
||||
mu = mixture.mu();
|
||||
@ -0,0 +1,48 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 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
|
||||
continuityErrs
|
||||
|
||||
Description
|
||||
Calculates and prints the continuity errors.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
{
|
||||
volScalarField contErr(fvc::ddt(alphac) + fvc::div(alphacf*phi));
|
||||
|
||||
scalar sumLocalContErr = runTime.deltaTValue()*
|
||||
mag(contErr)().weightedAverage(mesh.V()).value();
|
||||
|
||||
scalar globalContErr = runTime.deltaTValue()*
|
||||
contErr.weightedAverage(mesh.V()).value();
|
||||
cumulativeContErr += globalContErr;
|
||||
|
||||
Info<< "time step continuity errors : sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< ", cumulative = " << cumulativeContErr
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
11
applications/solvers/multiphase/MPPICInterFoam/correctPhi.H
Normal file
11
applications/solvers/multiphase/MPPICInterFoam/correctPhi.H
Normal file
@ -0,0 +1,11 @@
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
phi,
|
||||
p_rgh,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
||||
geometricZeroField(),
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
219
applications/solvers/multiphase/MPPICInterFoam/createFields.H
Normal file
219
applications/solvers/multiphase/MPPICInterFoam/createFields.H
Normal file
@ -0,0 +1,219 @@
|
||||
Info<< "Reading field p_rgh\n" << endl;
|
||||
volScalarField p_rgh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p_rgh",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
immiscibleIncompressibleTwoPhaseMixture mixture(U, phi);
|
||||
|
||||
volScalarField& alpha1(mixture.alpha1());
|
||||
volScalarField& alpha2(mixture.alpha2());
|
||||
|
||||
const dimensionedScalar& rho1 = mixture.rho1();
|
||||
const dimensionedScalar& rho2 = mixture.rho2();
|
||||
|
||||
// Need to store rho for ddt(rho, U)
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
alpha1*rho1 + alpha2*rho2
|
||||
);
|
||||
rho.oldTime();
|
||||
|
||||
// Need to store mu as incompressibleTwoPhaseMixture does not store it
|
||||
volScalarField mu
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"mu",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
mixture.mu(),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
|
||||
// Mass flux
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fvc::interpolate(rho)*phi
|
||||
);
|
||||
|
||||
|
||||
#include "readGravitationalAcceleration.H"
|
||||
|
||||
#include "readhRef.H"
|
||||
#include "gh.H"
|
||||
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
p_rgh + rho*gh
|
||||
);
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
p_rgh,
|
||||
mesh.solutionDict().subDict("PIMPLE"),
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
mesh.setFluxRequired(p_rgh.name());
|
||||
mesh.setFluxRequired(alpha1.name());
|
||||
|
||||
// MULES flux from previous time-step
|
||||
surfaceScalarField alphaPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alphaPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
phi*fvc::interpolate(alpha1)
|
||||
);
|
||||
|
||||
|
||||
tmp<surfaceScalarField> tphiAlphaCorr0;
|
||||
|
||||
// alphac must be constructed before the cloud
|
||||
// so that the drag-models can find it
|
||||
volScalarField alphac
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alphac",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimless, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
alphac.oldTime();
|
||||
|
||||
volScalarField alphacRho(alphac*rho);
|
||||
alphacRho.oldTime();
|
||||
|
||||
Info<< "Constructing kinematicCloud " << endl;
|
||||
basicKinematicMPPICCloud kinematicCloud
|
||||
(
|
||||
"kinematicCloud",
|
||||
rho,
|
||||
U,
|
||||
mu,
|
||||
g
|
||||
);
|
||||
|
||||
// Particle fraction upper limit
|
||||
scalar alphacMin
|
||||
(
|
||||
1.0
|
||||
- readScalar
|
||||
(
|
||||
kinematicCloud.particleProperties().subDict("constantProperties")
|
||||
.lookup("alphaMax")
|
||||
)
|
||||
);
|
||||
|
||||
// Update alphac from the particle locations
|
||||
alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
|
||||
alphac.correctBoundaryConditions();
|
||||
|
||||
surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));
|
||||
|
||||
// Phase mass flux
|
||||
surfaceScalarField alphaRhoPhic("alphaRhoPhic", alphacf*rhoPhi);
|
||||
|
||||
// Volumetric phase flux
|
||||
surfaceScalarField alphaPhic("alphaPhic", alphacf*phi);
|
||||
|
||||
autoPtr
|
||||
<
|
||||
PhaseCompressibleTurbulenceModel
|
||||
<
|
||||
immiscibleIncompressibleTwoPhaseMixture
|
||||
>
|
||||
>turbulence
|
||||
(
|
||||
PhaseCompressibleTurbulenceModel
|
||||
<
|
||||
immiscibleIncompressibleTwoPhaseMixture
|
||||
>::New
|
||||
(
|
||||
alphac,
|
||||
rho,
|
||||
U,
|
||||
alphaRhoPhic,
|
||||
rhoPhi,
|
||||
mixture
|
||||
)
|
||||
);
|
||||
73
applications/solvers/multiphase/MPPICInterFoam/pEqn.H
Normal file
73
applications/solvers/multiphase/MPPICInterFoam/pEqn.H
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
volVectorField HbyA(constrainHbyA(rAUc*UEqn.H(), U, p_rgh));
|
||||
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
fvc::flux(HbyA)
|
||||
+ alphacf*fvc::interpolate(rho*rAUc)*fvc::ddtCorr(U, phi)
|
||||
);
|
||||
|
||||
MRF.makeRelative(phiHbyA);
|
||||
adjustPhi(phiHbyA, U, p_rgh);
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
phicForces +
|
||||
(
|
||||
fvc::interpolate(mixture.sigmaK())*fvc::snGrad(alpha1)
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUcf*mesh.magSf()
|
||||
);
|
||||
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUcf, MRF);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
surfaceScalarField Dp("Dp", alphacf*rAUcf);
|
||||
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
fvm::laplacian(Dp, p_rgh)
|
||||
==
|
||||
fvc::ddt(alphac) + fvc::div(alphacf*phiHbyA)
|
||||
);
|
||||
|
||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||
|
||||
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA - p_rghEqn.flux()/alphacf;
|
||||
|
||||
p_rgh.relax();
|
||||
|
||||
U =
|
||||
HbyA
|
||||
+ rAUc*fvc::reconstruct((phig - p_rghEqn.flux()/alphacf)/rAUcf);
|
||||
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
p == p_rgh + rho*gh;
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
}
|
||||
8
applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwclean
Executable file
8
applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwclean
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
set -x
|
||||
|
||||
wclean libso temperaturePhaseChangeTwoPhaseMixtures
|
||||
wclean
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
12
applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake
Executable file
12
applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Parse arguments for library compilation
|
||||
targetType=libso
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
set -x
|
||||
|
||||
wmake $targetType temperaturePhaseChangeTwoPhaseMixtures
|
||||
wmake
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -0,0 +1,3 @@
|
||||
interCondensatingEvaporatingFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/interCondensatingEvaporatingFoam
|
||||
@ -0,0 +1,30 @@
|
||||
interPhaseChangePath = $(FOAM_SOLVERS)/multiphase/interPhaseChangeFoam
|
||||
|
||||
EXE_INC = \
|
||||
-ItemperaturePhaseChangeTwoPhaseMixtures/lnInclude \
|
||||
-I$(interPhaseChangePath) \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude\
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lphaseTemperatureChangeTwoPhaseMixtures \
|
||||
-ltwoPhaseMixture \
|
||||
-linterfaceProperties \
|
||||
-ltwoPhaseProperties \
|
||||
-lincompressibleTransportModels \
|
||||
-lturbulenceModels \
|
||||
-lincompressibleTurbulenceModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lfvOptions \
|
||||
-lsampling \
|
||||
-lfluidThermophysicalModels
|
||||
@ -0,0 +1,26 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(rhoPhi, U)
|
||||
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
|
||||
+ turbulence->divDevRhoReff(rho, U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
(
|
||||
UEqn
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
interface.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
volScalarField contErr(fvc::ddt(rho) + fvc::div(rhoPhi));
|
||||
|
||||
scalar sumLocalContErr = runTime.deltaTValue()*
|
||||
mag(contErr)().weightedAverage(mesh.V()).value();
|
||||
|
||||
scalar globalContErr = runTime.deltaTValue()*
|
||||
contErr.weightedAverage(mesh.V()).value();
|
||||
|
||||
Info<< "time step continuity errors : sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< endl;
|
||||
|
||||
@ -0,0 +1,158 @@
|
||||
Info<< "Reading field p_rgh\n" << endl;
|
||||
volScalarField p_rgh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p_rgh",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
// Create p before the thermo
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
p_rgh
|
||||
);
|
||||
|
||||
// Creating e based thermo
|
||||
autoPtr<twoPhaseMixtureEThermo> thermo;
|
||||
thermo.set(new twoPhaseMixtureEThermo(U, phi));
|
||||
|
||||
// Create mixture and
|
||||
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n" << endl;
|
||||
autoPtr<temperaturePhaseChangeTwoPhaseMixture> mixture =
|
||||
temperaturePhaseChangeTwoPhaseMixture::New(thermo(), mesh);
|
||||
|
||||
|
||||
volScalarField& T = thermo->T();
|
||||
volScalarField& e = thermo->he();
|
||||
|
||||
// Correct e from T and alpha
|
||||
thermo->correct();
|
||||
|
||||
volScalarField& alpha1(thermo->alpha1());
|
||||
volScalarField& alpha2(thermo->alpha2());
|
||||
|
||||
const dimensionedScalar& rho1 = thermo->rho1();
|
||||
const dimensionedScalar& rho2 = thermo->rho2();
|
||||
|
||||
// Need to store rho for ddt(rho, U)
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
alpha1*rho1 + alpha2*rho2,
|
||||
alpha1.boundaryField().types()
|
||||
);
|
||||
rho.oldTime();
|
||||
|
||||
|
||||
// Construct interface from alpha1 distribution
|
||||
interfaceProperties interface
|
||||
(
|
||||
alpha1,
|
||||
U,
|
||||
thermo->transportPropertiesDict()
|
||||
);
|
||||
|
||||
// Construct incompressible turbulence model
|
||||
autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::turbulenceModel::New(U, phi, thermo())
|
||||
);
|
||||
|
||||
|
||||
Info<< "Calculating field g.h\n" << endl;
|
||||
volScalarField gh("gh", g & mesh.C());
|
||||
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||
|
||||
//Update p with rho
|
||||
p = p_rgh + rho*gh;
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
p_rgh,
|
||||
pimple.dict(),
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
// Turbulent Prandtl number
|
||||
dimensionedScalar Prt("Prt", dimless, thermo->transportPropertiesDict());
|
||||
|
||||
volScalarField kappaEff
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"kappaEff",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
thermo->kappa()
|
||||
);
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
Info<< "Creating field pDivU\n" << endl;
|
||||
volScalarField pDivU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pDivU",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("pDivU", p.dimensions()/dimTime, 0)
|
||||
);
|
||||
@ -0,0 +1,31 @@
|
||||
{
|
||||
tmp<volScalarField> tcp(thermo->Cp());
|
||||
const volScalarField& cp = tcp();
|
||||
|
||||
kappaEff = thermo->kappa() + rho*cp*turbulence->nut()/Prt;
|
||||
|
||||
pDivU = dimensionedScalar("pDivU", p.dimensions()/dimTime, 0.0);
|
||||
|
||||
if (thermo->pDivU())
|
||||
{
|
||||
pDivU = (p*fvc::div(rhoPhi/fvc::interpolate(rho)));
|
||||
}
|
||||
|
||||
fvScalarMatrix eEqn
|
||||
(
|
||||
fvm::ddt(rho, e)
|
||||
+ fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
|
||||
+ fvm::div(rhoPhi, e)
|
||||
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), e)
|
||||
- fvm::laplacian(kappaEff/cp, e)
|
||||
+ pDivU
|
||||
);
|
||||
|
||||
eEqn.relax();
|
||||
eEqn.solve();
|
||||
|
||||
thermo->correct();
|
||||
|
||||
Info<< "min/max(T) = " << min(T).value() << ", "
|
||||
<< max(T).value() <<endl;
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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/>.
|
||||
|
||||
Application
|
||||
interCondensatingEvaporatingFoam
|
||||
|
||||
Group
|
||||
grpMultiphaseSolvers
|
||||
|
||||
Description
|
||||
Solver for 2 incompressible, non-isothermal immiscible fluids with
|
||||
phase-change (evaporation-condensation) between a fluid and its vapour.
|
||||
Uses a VOF (volume of fluid) phase-fraction based interface capturing
|
||||
approach.
|
||||
|
||||
The momentum, energy and other fluid properties are of the "mixture" and a
|
||||
single momentum equation is solved.
|
||||
|
||||
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "CMULES.H"
|
||||
#include "subCycle.H"
|
||||
#include "interfaceProperties.H"
|
||||
#include "twoPhaseMixtureEThermo.H"
|
||||
#include "temperaturePhaseChangeTwoPhaseMixture.H"
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "fixedFluxPressureFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "createTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/dimTime, 0)
|
||||
);
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
mixture->correct();
|
||||
|
||||
#include "UEqn.H"
|
||||
#include "eEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
#include "continuityError.H"
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,69 @@
|
||||
{
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
|
||||
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
|
||||
);
|
||||
adjustPhi(phiHbyA, U, p_rgh);
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
(
|
||||
interface.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUf*mesh.magSf()
|
||||
);
|
||||
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf);
|
||||
|
||||
Pair<tmp<volScalarField> > vDot = mixture->vDot();
|
||||
const volScalarField& vDotc = vDot[0]();
|
||||
const volScalarField& vDotv = vDot[1]();
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rAUf, p_rgh)
|
||||
- (vDotc - vDotv)
|
||||
);
|
||||
|
||||
p_rghEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA + p_rghEqn.flux();
|
||||
|
||||
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p == p_rgh + rho*gh;
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C
|
||||
temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C
|
||||
thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C
|
||||
twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C
|
||||
constant/constant.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libphaseTemperatureChangeTwoPhaseMixtures
|
||||
@ -0,0 +1,16 @@
|
||||
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-ltwoPhaseMixture \
|
||||
-linterfaceProperties \
|
||||
-ltwoPhaseProperties \
|
||||
-lincompressibleTransportModels \
|
||||
-lfiniteVolume \
|
||||
-lfluidThermophysicalModels
|
||||
@ -0,0 +1,174 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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 "constant.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "twoPhaseMixtureEThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace temperaturePhaseChangeTwoPhaseMixtures
|
||||
{
|
||||
defineTypeNameAndDebug(constant, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
temperaturePhaseChangeTwoPhaseMixture,
|
||||
constant,
|
||||
components
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::constant
|
||||
(
|
||||
const thermoIncompressibleTwoPhaseMixture& mixture,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
temperaturePhaseChangeTwoPhaseMixture(mixture, mesh),
|
||||
coeffC_(subDict(type() + "Coeffs").lookup("coeffC")),
|
||||
coeffE_(subDict(type() + "Coeffs").lookup("coeffE"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotAlphal() const
|
||||
{
|
||||
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
|
||||
|
||||
const twoPhaseMixtureEThermo& thermo =
|
||||
refCast<const twoPhaseMixtureEThermo>
|
||||
(
|
||||
mesh_.lookupObject<basicThermo>(basicThermo::dictName)
|
||||
);
|
||||
|
||||
const dimensionedScalar& TSat = thermo.TSat();
|
||||
|
||||
dimensionedScalar T0("0", dimTemperature, 0.0);
|
||||
|
||||
return Pair<tmp<volScalarField> >
|
||||
(
|
||||
coeffC_*mixture_.rho2()*max(TSat - T, T0),
|
||||
-coeffE_*mixture_.rho1()*max(T - TSat, T0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
|
||||
{
|
||||
|
||||
volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
volScalarField limitedAlpha2
|
||||
(
|
||||
min(max(mixture_.alpha2(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
|
||||
|
||||
const twoPhaseMixtureEThermo& thermo =
|
||||
refCast<const twoPhaseMixtureEThermo>
|
||||
(
|
||||
mesh_.lookupObject<basicThermo>(basicThermo::dictName)
|
||||
);
|
||||
|
||||
const dimensionedScalar& TSat = thermo.TSat();
|
||||
|
||||
dimensionedScalar T0("0", dimTemperature, 0.0);
|
||||
|
||||
return Pair<tmp<volScalarField> >
|
||||
(
|
||||
coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T, T0),
|
||||
coeffE_*mixture_.rho1()*limitedAlpha1*max(T - TSat, T0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotDeltaT() const
|
||||
{
|
||||
volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
volScalarField limitedAlpha2
|
||||
(
|
||||
min(max(mixture_.alpha2(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
|
||||
|
||||
const twoPhaseMixtureEThermo& thermo =
|
||||
refCast<const twoPhaseMixtureEThermo>
|
||||
(
|
||||
mesh_.lookupObject<basicThermo>(basicThermo::dictName)
|
||||
);
|
||||
|
||||
const dimensionedScalar& TSat = thermo.TSat();
|
||||
|
||||
|
||||
return Pair<tmp<volScalarField> >
|
||||
(
|
||||
coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T),
|
||||
coeffE_*mixture_.rho1()*limitedAlpha1*pos(T - TSat)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::correct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::read()
|
||||
{
|
||||
if (temperaturePhaseChangeTwoPhaseMixture::read())
|
||||
{
|
||||
subDict(type() + "Coeffs").lookup("coeffC") >> coeffC_;
|
||||
subDict(type() + "Coeffs").lookup("coeffE") >> coeffE_;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,118 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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::phaseChangeTwoPhaseMixtures::constant
|
||||
|
||||
Description
|
||||
constant condensation/saturation model.
|
||||
|
||||
|
||||
SourceFiles
|
||||
constant.C
|
||||
|
||||
\*--------------------------------------------------------------------*/
|
||||
|
||||
#ifndef constant_H
|
||||
#define constant_H
|
||||
|
||||
#include "temperaturePhaseChangeTwoPhaseMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace temperaturePhaseChangeTwoPhaseMixtures
|
||||
{
|
||||
|
||||
/*--------------------------------------------------------------------*\
|
||||
Class constant
|
||||
\*--------------------------------------------------------------------*/
|
||||
|
||||
class constant
|
||||
:
|
||||
public temperaturePhaseChangeTwoPhaseMixture
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Condensation coefficient [1/s/K]
|
||||
dimensionedScalar coeffC_;
|
||||
|
||||
//- Evaporation coefficient [1/s/K]
|
||||
dimensionedScalar coeffE_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("constant");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
constant
|
||||
(
|
||||
const thermoIncompressibleTwoPhaseMixture& mixture,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~constant()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the mass condensation and vaporisation rates as a
|
||||
// coefficient to multiply (1 - alphal) for the condensation rate
|
||||
// and a coefficient to multiply alphal for the vaporisation rate
|
||||
virtual Pair<tmp<volScalarField> > mDotAlphal() const;
|
||||
|
||||
//- Return the mass condensation and vaporisation rates as coefficients
|
||||
virtual Pair<tmp<volScalarField> > mDot() const;
|
||||
|
||||
//- Return the mass condensation and vaporisation rates as a
|
||||
// coefficient to multiply (Tsat - T) for the condensation rate
|
||||
// and a coefficient to multiply (T - Tsat) for the vaporisation rate
|
||||
virtual Pair<tmp<volScalarField> > mDotDeltaT() const;
|
||||
|
||||
//- Correct the constant phaseChange model
|
||||
virtual void correct();
|
||||
|
||||
//- Read the transportProperties dictionary and update
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace temperaturePhaseChangeTwoPhaseMixtures
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,81 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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 "temperaturePhaseChangeTwoPhaseMixture.H"
|
||||
#include "basicThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::temperaturePhaseChangeTwoPhaseMixture>
|
||||
Foam::temperaturePhaseChangeTwoPhaseMixture::New
|
||||
(
|
||||
const thermoIncompressibleTwoPhaseMixture& thermo,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
IOdictionary phaseChangePropertiesDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phaseChangeProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
word temperaturePhaseChangeTwoPhaseMixtureTypeName
|
||||
(
|
||||
phaseChangePropertiesDict.lookup
|
||||
(
|
||||
"phaseChangeTwoPhaseModel"
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Selecting phaseChange model "
|
||||
<< temperaturePhaseChangeTwoPhaseMixtureTypeName << endl;
|
||||
|
||||
componentsConstructorTable::iterator cstrIter =
|
||||
componentsConstructorTablePtr_
|
||||
->find(temperaturePhaseChangeTwoPhaseMixtureTypeName);
|
||||
|
||||
if (cstrIter == componentsConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown temperaturePhaseChangeTwoPhaseMixture type "
|
||||
<< temperaturePhaseChangeTwoPhaseMixtureTypeName << endl << endl
|
||||
<< "Valid temperaturePhaseChangeTwoPhaseMixtures are : " << endl
|
||||
<< componentsConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<temperaturePhaseChangeTwoPhaseMixture>
|
||||
(cstrIter()(thermo, mesh));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,109 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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 "temperaturePhaseChangeTwoPhaseMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(temperaturePhaseChangeTwoPhaseMixture, 0);
|
||||
defineRunTimeSelectionTable
|
||||
(
|
||||
temperaturePhaseChangeTwoPhaseMixture,
|
||||
components
|
||||
);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::temperaturePhaseChangeTwoPhaseMixture::
|
||||
temperaturePhaseChangeTwoPhaseMixture
|
||||
(
|
||||
const thermoIncompressibleTwoPhaseMixture& mixture,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phaseChangeProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
mixture_(mixture),
|
||||
mesh_(mesh)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||
Foam::temperaturePhaseChangeTwoPhaseMixture::vDotAlphal() const
|
||||
{
|
||||
volScalarField alphalCoeff
|
||||
(
|
||||
1.0/mixture_.rho1() - mixture_.alpha1()
|
||||
*(1.0/mixture_.rho1() - 1.0/mixture_.rho2())
|
||||
);
|
||||
|
||||
Pair<tmp<volScalarField> > mDotAlphal = this->mDotAlphal();
|
||||
|
||||
return Pair<tmp<volScalarField> >
|
||||
(
|
||||
alphalCoeff*mDotAlphal[0],
|
||||
alphalCoeff*mDotAlphal[1]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||
Foam::temperaturePhaseChangeTwoPhaseMixture::vDot() const
|
||||
{
|
||||
dimensionedScalar pCoeff(1.0/mixture_.rho1() - 1.0/mixture_.rho2());
|
||||
Pair<tmp<volScalarField> > mDot = this->mDot();
|
||||
|
||||
return Pair<tmp<volScalarField> >(pCoeff*mDot[0], pCoeff*mDot[1]);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::temperaturePhaseChangeTwoPhaseMixture::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,168 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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::temperaturePhaseChangeTwoPhaseMixture
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
temperaturePhaseChangeTwoPhaseMixture.C
|
||||
newtemperaturePhaseChangeTwoPhaseMixture.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef temperaturePhaseChangeTwoPhaseMixture_H
|
||||
#define temperaturePhaseChangeTwoPhaseMixture_H
|
||||
|
||||
#include "thermoIncompressibleTwoPhaseMixture.H"
|
||||
#include "typeInfo.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "volFields.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class temperaturePhaseChangeTwoPhaseMixture Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class temperaturePhaseChangeTwoPhaseMixture
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the thermoIncompressibleTwoPhaseMixture
|
||||
const thermoIncompressibleTwoPhaseMixture& mixture_;
|
||||
|
||||
//- Reference to fvMesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
temperaturePhaseChangeTwoPhaseMixture
|
||||
(
|
||||
const temperaturePhaseChangeTwoPhaseMixture&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const temperaturePhaseChangeTwoPhaseMixture&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("temperaturePhaseChangeTwoPhaseMixture");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
temperaturePhaseChangeTwoPhaseMixture,
|
||||
components,
|
||||
(
|
||||
const thermoIncompressibleTwoPhaseMixture& mixture,
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(mixture, mesh)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected phaseChange model
|
||||
static autoPtr<temperaturePhaseChangeTwoPhaseMixture> New
|
||||
(
|
||||
const thermoIncompressibleTwoPhaseMixture& mixture,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
temperaturePhaseChangeTwoPhaseMixture
|
||||
(
|
||||
const thermoIncompressibleTwoPhaseMixture& mixture,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~temperaturePhaseChangeTwoPhaseMixture()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
//- Return the mass condensation and vaporisation rates as a
|
||||
// coefficient to multiply (1 - alphal) for the condensation rate
|
||||
// and a coefficient to multiply alphal for the vaporisation rate
|
||||
virtual Pair<tmp<volScalarField> > mDotAlphal() const = 0;
|
||||
|
||||
//- Return the mass condensation and vaporisation rates as coefficients
|
||||
virtual Pair<tmp<volScalarField> > mDot() const = 0;
|
||||
|
||||
//- Return the mass condensation and vaporisation rates as a
|
||||
// coefficient to multiply (Tsat - T) for the condensation rate
|
||||
// and a coefficient to multiply (T - Tsat) for the vaporisation rate
|
||||
virtual Pair<tmp<volScalarField> > mDotDeltaT() const = 0;
|
||||
|
||||
//- Return the volumetric condensation and vaporisation rates as a
|
||||
// coefficient to multiply (1 - alphal) for the condensation rate
|
||||
// and a coefficient to multiply alphal for the vaporisation rate
|
||||
Pair<tmp<volScalarField> > vDotAlphal() const;
|
||||
|
||||
//- Return the volumetric condensation and vaporisation rates as
|
||||
// coefficients
|
||||
Pair<tmp<volScalarField> > vDot() const;
|
||||
|
||||
//- Correct the phaseChange model
|
||||
virtual void correct() = 0;
|
||||
|
||||
//- Read the transportProperties dictionary and update
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,133 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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 "thermoIncompressibleTwoPhaseMixture.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(thermoIncompressibleTwoPhaseMixture, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::thermoIncompressibleTwoPhaseMixture::thermoIncompressibleTwoPhaseMixture
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
incompressibleTwoPhaseMixture(U, phi),
|
||||
|
||||
kappa1_
|
||||
(
|
||||
"kappa1",
|
||||
dimEnergy/dimTime/dimLength/dimTemperature,
|
||||
subDict(phase1Name_).lookup("kappa")
|
||||
),
|
||||
kappa2_
|
||||
(
|
||||
"kappa2",
|
||||
kappa1_.dimensions(),
|
||||
subDict(phase2Name_).lookup("kappa")
|
||||
),
|
||||
|
||||
Cp1_
|
||||
(
|
||||
"Cp1",
|
||||
dimEnergy/dimTemperature/dimMass,
|
||||
subDict(phase1Name_).lookup("Cp")
|
||||
),
|
||||
Cp2_
|
||||
(
|
||||
"Cp2",
|
||||
dimEnergy/dimTemperature/dimMass,
|
||||
subDict(phase2Name_).lookup("Cp")
|
||||
),
|
||||
|
||||
Cv1_
|
||||
(
|
||||
"Cv1",
|
||||
dimEnergy/dimTemperature/dimMass,
|
||||
subDict(phase1Name_).lookup("Cv")
|
||||
),
|
||||
|
||||
Cv2_
|
||||
(
|
||||
"Cv2",
|
||||
dimEnergy/dimTemperature/dimMass,
|
||||
subDict(phase2Name_).lookup("Cv")
|
||||
),
|
||||
|
||||
Hf1_
|
||||
(
|
||||
"Hf1",
|
||||
dimEnergy/dimMass,
|
||||
subDict(phase1Name_).lookup("hf")
|
||||
),
|
||||
|
||||
Hf2_
|
||||
(
|
||||
"Hf2",
|
||||
dimEnergy/dimMass,
|
||||
subDict(phase2Name_).lookup("hf")
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
bool Foam::thermoIncompressibleTwoPhaseMixture::read()
|
||||
{
|
||||
if (incompressibleTwoPhaseMixture::read())
|
||||
{
|
||||
subDict(phase1Name_).lookup("kappa") >> kappa1_;
|
||||
subDict(phase2Name_).lookup("kappa") >> kappa2_;
|
||||
|
||||
subDict(phase1Name_).lookup("Cp") >> Cp1_;
|
||||
subDict(phase2Name_).lookup("Cp") >> Cp2_;
|
||||
|
||||
subDict(phase1Name_).lookup("Cv") >> Cv1_;
|
||||
subDict(phase2Name_).lookup("Cv") >> Cv2_;
|
||||
|
||||
subDict(phase1Name_).lookup("hf") >> Hf1_;
|
||||
subDict(phase2Name_).lookup("hf") >> Hf2_;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,156 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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::thermoIncompressibleTwoPhaseMixture
|
||||
|
||||
Description
|
||||
A two-phase incompressible transportModel
|
||||
|
||||
SourceFiles
|
||||
thermoIncompressibleTwoPhaseMixture.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef thermoIncompressibleTwoPhaseMixture_H
|
||||
#define thermoIncompressibleTwoPhaseMixture_H
|
||||
|
||||
#include "incompressibleTwoPhaseMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class thermoIncompressibleTwoPhaseMixture Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class thermoIncompressibleTwoPhaseMixture
|
||||
:
|
||||
public incompressibleTwoPhaseMixture
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
|
||||
//- Thermal variables
|
||||
dimensionedScalar kappa1_;
|
||||
dimensionedScalar kappa2_;
|
||||
|
||||
dimensionedScalar Cp1_;
|
||||
dimensionedScalar Cp2_;
|
||||
|
||||
dimensionedScalar Cv1_;
|
||||
dimensionedScalar Cv2_;
|
||||
|
||||
dimensionedScalar Hf1_;
|
||||
dimensionedScalar Hf2_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
TypeName("thermoIncompressibleTwoPhaseMixture");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from U and phi
|
||||
thermoIncompressibleTwoPhaseMixture
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~thermoIncompressibleTwoPhaseMixture()
|
||||
{}
|
||||
|
||||
|
||||
// Access function
|
||||
|
||||
//- Return const-access to phase2 kappa
|
||||
const dimensionedScalar& kappa2() const
|
||||
{
|
||||
return kappa2_;
|
||||
};
|
||||
|
||||
//- Return const-access to phase1 kappa
|
||||
const dimensionedScalar& kappa1() const
|
||||
{
|
||||
return kappa1_;
|
||||
};
|
||||
|
||||
//- Return const-access to phase1 Cp
|
||||
const dimensionedScalar& Cp1() const
|
||||
{
|
||||
return Cp1_;
|
||||
};
|
||||
|
||||
//- Return const-access to phase1 Cp
|
||||
const dimensionedScalar& Cp2() const
|
||||
{
|
||||
return Cp2_;
|
||||
};
|
||||
|
||||
//- Return const-access to phase1 Cv
|
||||
const dimensionedScalar& Cv1() const
|
||||
{
|
||||
return Cv1_;
|
||||
};
|
||||
|
||||
//- Return const-access to phase1 Cv
|
||||
const dimensionedScalar& Cv2() const
|
||||
{
|
||||
return Cv2_;
|
||||
};
|
||||
|
||||
//- Return latent heat for phase 1
|
||||
const dimensionedScalar& Hf1() const
|
||||
{
|
||||
return Hf1_;
|
||||
};
|
||||
|
||||
//- Return latent heat for phase 2
|
||||
const dimensionedScalar& Hf2() const
|
||||
{
|
||||
return Hf2_;
|
||||
};
|
||||
|
||||
//- Read base transportProperties dictionary
|
||||
virtual bool read();
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,592 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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 "twoPhaseMixtureEThermo.H"
|
||||
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fixedEnergyFvPatchScalarField.H"
|
||||
#include "gradientEnergyFvPatchScalarField.H"
|
||||
#include "mixedEnergyFvPatchScalarField.H"
|
||||
#include "twoPhaseMixtureEThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(twoPhaseMixtureEThermo, 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::twoPhaseMixtureEThermo::eBoundaryCorrection(volScalarField& h)
|
||||
{
|
||||
volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
|
||||
|
||||
forAll(hbf, patchi)
|
||||
{
|
||||
if (isA<gradientEnergyFvPatchScalarField>(hbf[patchi]))
|
||||
{
|
||||
refCast<gradientEnergyFvPatchScalarField>(hbf[patchi]).gradient()
|
||||
= hbf[patchi].fvPatchField::snGrad();
|
||||
}
|
||||
else if (isA<mixedEnergyFvPatchScalarField>(hbf[patchi]))
|
||||
{
|
||||
refCast<mixedEnergyFvPatchScalarField>(hbf[patchi]).refGrad()
|
||||
= hbf[patchi].fvPatchField::snGrad();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Foam::twoPhaseMixtureEThermo::init()
|
||||
{
|
||||
const volScalarField alpha1Rho1(alpha1()*rho1());
|
||||
const volScalarField alpha2Rho2(alpha2()*rho2());
|
||||
|
||||
e_ =
|
||||
(
|
||||
(T_ - TSat_)*(alpha1Rho1*Cv1() + alpha2Rho2*Cv2())
|
||||
+ (alpha1Rho1*Hf1() + alpha2Rho2*Hf2())
|
||||
)
|
||||
/(alpha1Rho1 + alpha2Rho2);
|
||||
|
||||
e_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::twoPhaseMixtureEThermo::twoPhaseMixtureEThermo
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
basicThermo(U.mesh(), word::null),
|
||||
thermoIncompressibleTwoPhaseMixture(U, phi),
|
||||
|
||||
e_
|
||||
(
|
||||
volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"e",
|
||||
U.mesh().time().timeName(),
|
||||
U.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
U.mesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimMass, 0.0),
|
||||
heBoundaryTypes()
|
||||
)
|
||||
),
|
||||
|
||||
TSat_
|
||||
(
|
||||
"TSat",
|
||||
dimTemperature,
|
||||
basicThermo::lookup("TSat")
|
||||
),
|
||||
|
||||
pDivU_(basicThermo::lookupOrDefault<Switch>("pDivU", true))
|
||||
|
||||
{
|
||||
// Initialise e
|
||||
init();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::twoPhaseMixtureEThermo::~twoPhaseMixtureEThermo()
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::twoPhaseMixtureEThermo::correct()
|
||||
{
|
||||
incompressibleTwoPhaseMixture::correct();
|
||||
|
||||
const volScalarField alpha1Rho1(alpha1()*rho1());
|
||||
const volScalarField alpha2Rho2(alpha2()*rho2());
|
||||
|
||||
T_ =
|
||||
(
|
||||
(e_*(alpha1Rho1 + alpha2Rho2))
|
||||
- (alpha1Rho1*Hf1() + alpha2Rho2*Hf2())
|
||||
)
|
||||
/(alpha1Rho1*Cv1() + alpha2Rho2*Cv2())
|
||||
+ TSat_;
|
||||
|
||||
T().correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::he
|
||||
(
|
||||
const volScalarField& p,
|
||||
const volScalarField& T
|
||||
) const
|
||||
{
|
||||
const volScalarField alpha1Rho1(alpha1()*rho1());
|
||||
const volScalarField alpha2Rho2(alpha2()*rho2());
|
||||
|
||||
return
|
||||
(
|
||||
(T - TSat_)*(alpha1Rho1*Cv1() + alpha2Rho2*Cv2())
|
||||
+ (alpha1Rho1*Hf1() + alpha2Rho2*Hf2())
|
||||
)
|
||||
/ (alpha1Rho1 + alpha2Rho2);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::he
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
) const
|
||||
{
|
||||
tmp<scalarField> the(new scalarField(T.size()));
|
||||
scalarField& he = the.ref();
|
||||
|
||||
const volScalarField alpha1Rho1(alpha1()*rho1());
|
||||
const volScalarField alpha2Rho2(alpha2()*rho2());
|
||||
|
||||
forAll(T, i)
|
||||
{
|
||||
label celli = cells[i];
|
||||
he[i] =
|
||||
(
|
||||
(T[i] - TSat_.value())
|
||||
*(
|
||||
alpha1Rho1[celli]*Cv1().value()
|
||||
+ alpha2Rho2[celli]*Cv2().value()
|
||||
)
|
||||
+ (
|
||||
alpha1Rho1[celli]*Hf1().value()
|
||||
+ alpha2Rho2[celli]*Hf2().value()
|
||||
)
|
||||
)
|
||||
/ (alpha1Rho1[celli] + alpha2Rho2[celli]);
|
||||
}
|
||||
|
||||
return the;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::he
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
const scalarField& alpha1p = alpha1().boundaryField()[patchI];
|
||||
const scalarField& alpha2p = alpha2().boundaryField()[patchI];
|
||||
|
||||
const scalarField& Tp = T_.boundaryField()[patchI];
|
||||
|
||||
return
|
||||
(
|
||||
(
|
||||
(Tp - TSat_.value())
|
||||
*(
|
||||
alpha1p*rho1().value()*Cv1().value()
|
||||
+ alpha2p*rho2().value()*Cv2().value()
|
||||
)
|
||||
+ (
|
||||
alpha1p*rho1().value()*Hf1().value()
|
||||
+ alpha2p*rho2().value()*Hf2().value()
|
||||
)
|
||||
)
|
||||
/ (alpha1p*rho1().value() + alpha2p*rho2().value())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::hc() const
|
||||
{
|
||||
|
||||
const fvMesh& mesh = this->T_.mesh();
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"hc",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("hc",Hf2() - Hf1())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::THE
|
||||
(
|
||||
const scalarField& h,
|
||||
const scalarField& p,
|
||||
const scalarField& T0, // starting temperature
|
||||
const labelList& cells
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<Foam::scalarField>();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::THE
|
||||
(
|
||||
const scalarField& h,
|
||||
const scalarField& p,
|
||||
const scalarField& T0, // starting temperature
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<Foam::scalarField>();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::Cp() const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
"cp",
|
||||
limitedAlpha1*Cp1() + (scalar(1) - limitedAlpha1)*Cp2()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cp
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return
|
||||
(
|
||||
alpha1p*Cp1().value() + (scalar(1) - alpha1p)*Cp2().value()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::rho() const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
"rho",
|
||||
limitedAlpha1*rho1().value()
|
||||
+ (scalar(1) - limitedAlpha1)*rho2().value()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::twoPhaseMixtureEThermo::rho
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return
|
||||
(
|
||||
alpha1p*rho1().value() + (scalar(1.0) - alpha1p)*rho2().value()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::Cv() const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
"cv",
|
||||
limitedAlpha1*Cv1() + (scalar(1) - limitedAlpha1)*Cv2()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::twoPhaseMixtureEThermo::Cv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return
|
||||
(
|
||||
alpha1p*Cv1().value() + (scalar(1) - alpha1p)*Cv2().value()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::gamma() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
(alpha1_*Cp1() + alpha2_*Cp2()) / (alpha1_*Cv1() + alpha2_*Cv2())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::gamma
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
gamma()().boundaryField()[patchi]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::Cpv() const
|
||||
{
|
||||
// This is an e thermo (Cpv = Cv)
|
||||
return Cv();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
// This is a e thermo (Cpv = Cv)
|
||||
return Cv(p, T, patchI);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::CpByCpv() const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<Foam::volScalarField>();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::twoPhaseMixtureEThermo::CpByCpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<Foam::scalarField>();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::kappa() const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
"kappa",
|
||||
limitedAlpha1*kappa1() + (scalar(1) - limitedAlpha1)*kappa2()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::twoPhaseMixtureEThermo::kappa(const label patchi) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value());
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::kappaEff
|
||||
(
|
||||
const volScalarField& kappat
|
||||
) const
|
||||
{
|
||||
tmp<Foam::volScalarField> kappaEff(kappa() + kappat);
|
||||
kappaEff.ref().rename("kappaEff");
|
||||
return kappaEff;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::twoPhaseMixtureEThermo::kappaEff
|
||||
(
|
||||
const scalarField& kappat,
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return
|
||||
(alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value()) + kappat;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::twoPhaseMixtureEThermo::alphaEff
|
||||
(
|
||||
const volScalarField& alphat
|
||||
) const
|
||||
{
|
||||
const volScalarField rho
|
||||
(
|
||||
alpha1_*rho1() + (1.0 - alpha1_)*rho2()
|
||||
);
|
||||
|
||||
|
||||
return (kappa()/Cp()/rho + alphat);
|
||||
}
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::twoPhaseMixtureEThermo::alphaEff
|
||||
(
|
||||
const scalarField& alphat,
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
const scalarField rho
|
||||
(
|
||||
alpha1p*rho1().value() + (1.0 - alpha1p)*rho2().value()
|
||||
);
|
||||
|
||||
const scalarField kappa
|
||||
(
|
||||
alpha1p*kappa1().value() + (1.0 - alpha1p)*kappa2().value()
|
||||
);
|
||||
|
||||
const scalarField Cp
|
||||
(
|
||||
alpha1p*Cp1().value() + (1.0 - alpha1p)*Cp2().value()
|
||||
);
|
||||
|
||||
return kappa/Cp/rho + alphat;
|
||||
}
|
||||
|
||||
bool Foam::twoPhaseMixtureEThermo::read()
|
||||
{
|
||||
if (basicThermo::read() && thermoIncompressibleTwoPhaseMixture::read())
|
||||
{
|
||||
basicThermo::lookup("pDivU") >> pDivU_;
|
||||
basicThermo::lookup("TSat") >> TSat_;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -0,0 +1,313 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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::twoPhaseMixtureEThermo
|
||||
|
||||
Description
|
||||
Two phases thermo Internal energy mixture Defined as:
|
||||
e1 = Cv1(T - Tsat) + Hv1
|
||||
e2 = Cv2(T - Tsat) + Hv2
|
||||
e = (alpha1*rho1*e1 + alpha2*rho2*e2) / (alpha1*rho1 + alpha2*rho2)
|
||||
|
||||
SourceFiles
|
||||
twoPhaseMixtureEThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef flashThermo_H
|
||||
#define flashThermo_H
|
||||
|
||||
#include "volFields.H"
|
||||
|
||||
#include "basicThermo.H"
|
||||
#include "thermoIncompressibleTwoPhaseMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class twoPhaseMixtureEThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class twoPhaseMixtureEThermo
|
||||
:
|
||||
public basicThermo,
|
||||
public thermoIncompressibleTwoPhaseMixture
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Data
|
||||
|
||||
//- Internal energy field [J]
|
||||
volScalarField e_;
|
||||
|
||||
//- Saturation Temperature
|
||||
dimensionedScalar TSat_;
|
||||
|
||||
//- Should the p*div(U) term be included in the energy equation
|
||||
Switch pDivU_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Correct boundary for e
|
||||
void eBoundaryCorrection (volScalarField& h);
|
||||
|
||||
//- Initialize
|
||||
void init();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
TypeName("twoPhaseMixtureEThermo");
|
||||
|
||||
// Constructor
|
||||
twoPhaseMixtureEThermo
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~twoPhaseMixtureEThermo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
//- Return access to the inernal energy field [J/Kg]
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
return e_;
|
||||
}
|
||||
|
||||
//- Return access to the inernal energy field [J/Kg]
|
||||
virtual const volScalarField& he() const
|
||||
{
|
||||
return e_;
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy
|
||||
// for given pressure and temperature [J/kg]
|
||||
virtual tmp<volScalarField> he
|
||||
(
|
||||
const volScalarField& p,
|
||||
const volScalarField& T
|
||||
) const;
|
||||
|
||||
//- Enthalpy/Internal energy for cell-set [J/kg]
|
||||
virtual tmp<scalarField> he
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
) const;
|
||||
|
||||
//- Enthalpy/Internal energy for patch [J/kg]
|
||||
virtual tmp<scalarField> he
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Chemical enthalpy [J/kg]
|
||||
virtual tmp<volScalarField> hc() const;
|
||||
|
||||
//- Temperature from enthalpy/internal energy for cell-set
|
||||
virtual tmp<scalarField> THE
|
||||
(
|
||||
const scalarField& h,
|
||||
const scalarField& p,
|
||||
const scalarField& T0, // starting temperature
|
||||
const labelList& cells
|
||||
) const;
|
||||
|
||||
//- Temperature from enthalpy/internal energy for patch
|
||||
virtual tmp<scalarField> THE
|
||||
(
|
||||
const scalarField& h,
|
||||
const scalarField& p,
|
||||
const scalarField& T0, // starting temperature
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
|
||||
//- Return true if the equation of state is incompressible
|
||||
// i.e. rho != f(p)
|
||||
bool incompressible() const
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
//- Return true if the equation of state is isochoric
|
||||
// i.e. rho = const
|
||||
bool isochoric() const
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
//- Return rho of the mixture
|
||||
virtual tmp<volScalarField> rho() const;
|
||||
|
||||
//- Return rho for patch
|
||||
virtual tmp<scalarField> rho(const label patchi) const;
|
||||
|
||||
//- Return Cp of the mixture
|
||||
virtual tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Heat capacity at constant pressure for patch [J/kg/K]
|
||||
virtual tmp<scalarField> Cp
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Return Cv of the mixture
|
||||
virtual tmp<volScalarField> Cv() const;
|
||||
|
||||
//- Heat capacity at constant volume for patch [J/kg/K]
|
||||
virtual tmp<scalarField> Cv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const;
|
||||
|
||||
//- Gamma = Cp/Cv []
|
||||
virtual tmp<volScalarField> gamma() const;
|
||||
|
||||
//- Gamma = Cp/Cv for patch []
|
||||
virtual tmp<scalarField> gamma
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity at constant pressure/volume [J/kg/K]
|
||||
virtual tmp<volScalarField> Cpv() const;
|
||||
|
||||
//- Heat capacity at constant pressure/volume for patch [J/kg/K]
|
||||
virtual tmp<scalarField> Cpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity ratio []
|
||||
virtual tmp<volScalarField> CpByCpv() const;
|
||||
|
||||
//- Heat capacity ratio for patch []
|
||||
virtual tmp<scalarField> CpByCpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Thermal diffusivity for temperature of mixture [J/m/s/K]
|
||||
virtual tmp<volScalarField> kappa() const;
|
||||
|
||||
//- Thermal diffusivity for temperature
|
||||
// of mixture for patch [J/m/s/K]
|
||||
virtual tmp<scalarField> kappa
|
||||
(
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity for temperature
|
||||
// of mixture [J/m/s/K]
|
||||
virtual tmp<volScalarField> kappaEff
|
||||
(
|
||||
const volScalarField&
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity for temperature
|
||||
// of mixture for patch [J/m/s/K]
|
||||
virtual tmp<scalarField> kappaEff
|
||||
(
|
||||
const scalarField& alphat,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity of mixture [kg/m/s]
|
||||
virtual tmp<volScalarField> alphaEff
|
||||
(
|
||||
const volScalarField& alphat
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity of mixture for patch [kg/m/s]
|
||||
virtual tmp<scalarField> alphaEff
|
||||
(
|
||||
const scalarField& alphat,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
|
||||
//- Correct the thermo fields
|
||||
virtual void correct();
|
||||
|
||||
//- Read properties
|
||||
virtual bool read();
|
||||
|
||||
|
||||
// Access to thermodynamic state variables
|
||||
|
||||
//- Return const-access to the saturation temperature
|
||||
const dimensionedScalar& TSat() const
|
||||
{
|
||||
return TSat_;
|
||||
}
|
||||
|
||||
//- Return transport properties dictionary
|
||||
const incompressibleTwoPhaseMixture& transportPropertiesDict()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
//- Should the dpdt term be included in the enthalpy equation
|
||||
Switch pDivU() const
|
||||
{
|
||||
return pDivU_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
3
applications/test/ensightFile/Make/files
Normal file
3
applications/test/ensightFile/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-ensightFile.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-ensightFile
|
||||
10
applications/test/ensightFile/Make/options
Normal file
10
applications/test/ensightFile/Make/options
Normal file
@ -0,0 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/conversion/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lconversion \
|
||||
-lfileFormats \
|
||||
-lmeshTools
|
||||
|
||||
77
applications/test/ensightFile/Test-ensightFile.C
Normal file
77
applications/test/ensightFile/Test-ensightFile.C
Normal file
@ -0,0 +1,77 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ 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/>.
|
||||
|
||||
Application
|
||||
Test-ensightFile
|
||||
|
||||
Description
|
||||
check cleanup of ensight file and variable names
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "ensightFileName.H"
|
||||
#include "ensightVarName.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
void printCleaning(const fileName& pathName)
|
||||
{
|
||||
Info<< "input = " << pathName << nl;
|
||||
Info<< "file = " << ensight::FileName(pathName) << nl;
|
||||
Info<< "var = " << ensight::VarName(pathName) << nl;
|
||||
Info<< nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noBanner();
|
||||
argList::noParallel();
|
||||
argList::validArgs.insert("fileName .. fileNameN");
|
||||
|
||||
argList args(argc, argv, false, true);
|
||||
|
||||
if (args.size() <= 1 && args.options().empty())
|
||||
{
|
||||
args.printUsage();
|
||||
}
|
||||
|
||||
fileName pathName;
|
||||
|
||||
for (label argI=1; argI < args.size(); ++argI)
|
||||
{
|
||||
pathName = args[argI];
|
||||
printCleaning(pathName);
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "helpSolver.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -63,6 +64,11 @@ void Foam::helpTypes::helpSolver::init()
|
||||
helpType::init();
|
||||
|
||||
argList::validArgs.append("solver");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"read",
|
||||
"read solver type from the system/controlDict"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -78,6 +84,11 @@ void Foam::helpTypes::helpSolver::execute
|
||||
{
|
||||
displayDoc(solver, ".*solvers/.*Foam/", true, "C");
|
||||
}
|
||||
else if (args.optionFound("read"))
|
||||
{
|
||||
mesh.time().controlDict().lookup("application") >> solver;
|
||||
displayDoc(solver, ".*solvers/.*Foam/", true, "C");
|
||||
}
|
||||
else
|
||||
{
|
||||
displayDocOptions(".*solvers/.*Foam/", true, "C");
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// check for "points" in all of the result directories
|
||||
// - could restrict to the selected times
|
||||
|
||||
bool hasMovingMesh = false;
|
||||
if (timeDirs.size() > 1)
|
||||
|
||||
@ -8,7 +8,7 @@ if (timeDirs[0].value() < 0)
|
||||
}
|
||||
|
||||
// the case file is always ASCII
|
||||
Info << "write case: " << caseFileName.c_str() << endl;
|
||||
Info<< "write case: " << caseFileName.c_str() << endl;
|
||||
|
||||
OFstream caseFile(ensightDir/caseFileName, IOstream::ASCII);
|
||||
caseFile.setf(ios_base::left);
|
||||
@ -20,7 +20,9 @@ caseFile
|
||||
<< "FORMAT" << nl
|
||||
<< setw(16) << "type:" << "ensight gold" << nl << nl;
|
||||
|
||||
if (hasMovingMesh)
|
||||
// time-set for geometries
|
||||
// TODO: split off into separate time-set, but need to verify ensight spec
|
||||
if (geometryTimesUsed.size())
|
||||
{
|
||||
caseFile
|
||||
<< "GEOMETRY" << nl
|
||||
@ -43,7 +45,7 @@ forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||
caseFile
|
||||
<< setw(16) << "measured: 2"
|
||||
<< fileName(dataMask/cloud::prefix/cloudName/"positions").c_str()
|
||||
<< nl;
|
||||
<< nl;
|
||||
}
|
||||
caseFile
|
||||
<< nl << "VARIABLE" << nl;
|
||||
@ -87,9 +89,8 @@ forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: allow similar/different time-steps for each cloud
|
||||
|
||||
|
||||
label cloudNo = 0;
|
||||
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||
{
|
||||
@ -135,7 +136,7 @@ forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||
// add time values
|
||||
caseFile << nl << "TIME" << nl;
|
||||
|
||||
// time set 1 - geometry and volume fields
|
||||
// time set 1 - volume fields
|
||||
if (fieldTimesUsed.size())
|
||||
{
|
||||
caseFile
|
||||
@ -161,9 +162,9 @@ if (fieldTimesUsed.size())
|
||||
count = 0;
|
||||
forAll(fieldTimesUsed, i)
|
||||
{
|
||||
const label& index = fieldTimesUsed[i];
|
||||
caseFile
|
||||
<< " " << setw(12)
|
||||
<< timeIndices[fieldTimesUsed[i]] + timeCorrection;
|
||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
@ -173,6 +174,49 @@ if (fieldTimesUsed.size())
|
||||
caseFile << nl << nl;
|
||||
}
|
||||
|
||||
|
||||
// time set 2 - geometry
|
||||
// THIS NEEDS MORE CHECKING
|
||||
#if 0
|
||||
if (geometryTimesUsed.size())
|
||||
{
|
||||
caseFile
|
||||
<< "time set: " << 2 << nl
|
||||
<< "number of steps: " << geometryTimesUsed.size() << nl
|
||||
<< "filename numbers:" << nl;
|
||||
|
||||
label count = 0;
|
||||
forAll(geometryTimesUsed, i)
|
||||
{
|
||||
caseFile
|
||||
<< " " << setw(12) << geometryTimesUsed[i];
|
||||
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
caseFile << nl;
|
||||
}
|
||||
}
|
||||
|
||||
caseFile
|
||||
<< nl << "time values:" << nl;
|
||||
|
||||
count = 0;
|
||||
forAll(geometryTimesUsed, i)
|
||||
{
|
||||
const label& index = geometryTimesUsed[i];
|
||||
caseFile
|
||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
caseFile << nl;
|
||||
}
|
||||
}
|
||||
caseFile << nl << nl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// time set - clouds
|
||||
// TODO: allow similar/different time-steps for each cloud
|
||||
cloudNo = 0;
|
||||
forAllConstIter(HashTable<DynamicList<label>>, cloudTimesUsed, cloudIter)
|
||||
@ -205,9 +249,9 @@ forAllConstIter(HashTable<DynamicList<label>>, cloudTimesUsed, cloudIter)
|
||||
count = 0;
|
||||
forAll(timesUsed, i)
|
||||
{
|
||||
const label& index = timesUsed[i];
|
||||
caseFile
|
||||
<< " " << setw(12)
|
||||
<< timeIndices[timesUsed[i]] + timeCorrection;
|
||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,6 +47,8 @@ void Foam::ensightCaseEntry
|
||||
const label timeSet
|
||||
)
|
||||
{
|
||||
const ensight::VarName varName(fieldName);
|
||||
|
||||
caseFile.setf(ios_base::left);
|
||||
|
||||
fileName dirName(dataMask);
|
||||
@ -68,9 +70,9 @@ void Foam::ensightCaseEntry
|
||||
<< ensightType.c_str()
|
||||
<< " per measured node: " << ts << " "
|
||||
<< setw(15)
|
||||
<< ("c" + Foam::name(cloudNo) + fieldName).c_str()
|
||||
<< ("c" + Foam::name(cloudNo) + varName).c_str()
|
||||
<< " "
|
||||
<< (dirName/fieldName).c_str()
|
||||
<< (dirName/varName).c_str()
|
||||
<< nl;
|
||||
}
|
||||
else
|
||||
@ -78,9 +80,9 @@ void Foam::ensightCaseEntry
|
||||
caseFile
|
||||
<< ensightType.c_str()
|
||||
<< " per element: "
|
||||
<< setw(15) << fieldName
|
||||
<< setw(15) << varName
|
||||
<< " "
|
||||
<< (dirName/fieldName).c_str()
|
||||
<< (dirName/varName).c_str()
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
@ -97,16 +99,16 @@ void Foam::ensightParticlePositions
|
||||
{
|
||||
Cloud<passiveParticle> parcels(mesh, cloudName, false);
|
||||
|
||||
fileName cloudDir = subDir/cloud::prefix/cloudName;
|
||||
fileName postFileName = cloudDir/"positions";
|
||||
const fileName postFileName =
|
||||
subDir/cloud::prefix/cloudName/"positions";
|
||||
|
||||
// the ITER/lagrangian subdirectory must exist
|
||||
mkDir(dataDir/cloudDir);
|
||||
ensightFile os(dataDir/postFileName, format);
|
||||
mkDir(dataDir/postFileName.path());
|
||||
ensightFile os(dataDir, postFileName, format);
|
||||
|
||||
// tag binary format (just like geometry files)
|
||||
os.writeBinaryHeader();
|
||||
os.write(postFileName);
|
||||
os.write(postFileName); // description
|
||||
os.newline();
|
||||
os.write("particle coordinates");
|
||||
os.newline();
|
||||
@ -161,14 +163,19 @@ void Foam::ensightLagrangianField
|
||||
{
|
||||
Info<< " " << fieldObject.name() << flush;
|
||||
|
||||
fileName cloudDir = subDir/cloud::prefix/cloudName;
|
||||
fileName postFileName = cloudDir/fieldObject.name();
|
||||
const fileName postFileName =
|
||||
subDir/cloud::prefix/cloudName
|
||||
/ensight::VarName(fieldObject.name());
|
||||
|
||||
string title =
|
||||
postFileName + " with " + pTraits<Type>::typeName + " values";
|
||||
// the ITER/lagrangian subdirectory was already created
|
||||
// when writing positions
|
||||
|
||||
ensightFile os(dataDir/postFileName, format);
|
||||
os.write(title);
|
||||
ensightFile os(dataDir, postFileName, format);
|
||||
os.write
|
||||
(
|
||||
// description
|
||||
string(postFileName + " with " + pTraits<Type>::typeName + " values")
|
||||
);
|
||||
os.newline();
|
||||
|
||||
IOField<Type> field(fieldObject);
|
||||
@ -219,10 +226,10 @@ void Foam::ensightVolField
|
||||
{
|
||||
Info<< " " << fieldObject.name() << flush;
|
||||
|
||||
fileName postFileName = subDir/fieldObject.name();
|
||||
const fileName postFileName = subDir/ensight::VarName(fieldObject.name());
|
||||
|
||||
ensightFile os(dataDir/postFileName, format);
|
||||
os.write(postFileName);
|
||||
ensightFile os(dataDir, postFileName, format);
|
||||
os.write(postFileName); // description
|
||||
os.newline();
|
||||
|
||||
// ie, volField<Type>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -166,9 +166,9 @@ int main(int argc, char *argv[])
|
||||
ensightDir = args.rootPath()/args.globalCaseName()/ensightDir;
|
||||
}
|
||||
|
||||
fileName dataDir = ensightDir/"data";
|
||||
fileName caseFileName = "Ensight.case";
|
||||
fileName dataMask = fileName("data")/ensightFile::mask();
|
||||
const fileName caseFileName = "Ensight.case";
|
||||
const fileName dataDir = ensightDir/"data";
|
||||
const fileName dataMask = dataDir.name()/ensightFile::mask();
|
||||
|
||||
// Ensight and Ensight/data directories must exist
|
||||
// do not remove old data - we might wish to convert new results
|
||||
@ -178,6 +178,8 @@ int main(int argc, char *argv[])
|
||||
Info<<"Warning: re-using existing directory" << nl
|
||||
<< " " << ensightDir << endl;
|
||||
}
|
||||
|
||||
// as per mkdir -p "Ensight/data"
|
||||
mkDir(ensightDir);
|
||||
mkDir(dataDir);
|
||||
|
||||
@ -216,6 +218,9 @@ int main(int argc, char *argv[])
|
||||
// map times used
|
||||
Map<scalar> timeIndices;
|
||||
|
||||
// TODO: Track the time indices used by the geometry
|
||||
DynamicList<label> geometryTimesUsed;
|
||||
|
||||
// Track the time indices used by the volume fields
|
||||
DynamicList<label> fieldTimesUsed;
|
||||
|
||||
@ -235,11 +240,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "getTimeIndex.H"
|
||||
|
||||
// remember the time index
|
||||
// remember the time index for the volume fields
|
||||
fieldTimesUsed.append(timeIndex);
|
||||
|
||||
// the data/ITER subdirectory must exist
|
||||
fileName subDir = ensightFile::subDir(timeIndex);
|
||||
// Note that data/ITER is indeed a valid ensight::FileName
|
||||
const fileName subDir = ensightFile::subDir(timeIndex);
|
||||
mkDir(dataDir/subDir);
|
||||
|
||||
// place a timestamp in the directory for future reference
|
||||
@ -261,15 +267,19 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (!optNoMesh)
|
||||
{
|
||||
fileName geomDir;
|
||||
if (hasMovingMesh)
|
||||
{
|
||||
geomDir = dataDir/subDir;
|
||||
// remember the time index for the geometry
|
||||
geometryTimesUsed.append(timeIndex);
|
||||
}
|
||||
|
||||
ensightGeoFile geoFile(ensightDir/geomDir/geometryName, format);
|
||||
ensightGeoFile geoFile
|
||||
(
|
||||
(hasMovingMesh ? dataDir/subDir : ensightDir),
|
||||
geometryName,
|
||||
format
|
||||
);
|
||||
partsList.writeGeometry(geoFile);
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,23 +24,20 @@ USAGE
|
||||
|
||||
defineURL() {
|
||||
|
||||
WEB_PATH="https://develop.openfoam.com"
|
||||
FOAM_REPO_VERSION="$WM_PROJECT-plus"
|
||||
|
||||
case "$WM_PROJECT_VERSION" in
|
||||
[0-9].[0-9].x)
|
||||
FOAM_BRANCH_NAME="master"
|
||||
FOAM_REPO_VERSION="$WM_PROJECT-$WM_PROJECT_VERSION"
|
||||
;;
|
||||
[0-9].[0-9].[0-9])
|
||||
FOAM_BRANCH_NAME="version-$WM_PROJECT_VERSION"
|
||||
FOAM_REPO_VERSION="$WM_PROJECT-${WM_PROJECT_VERSION%.*}.x"
|
||||
v[0-9].[0-9]+)
|
||||
FOAM_REPO_TAG="$WM_PROJECT-$WM_PROJECT_VERSION"
|
||||
;;
|
||||
*)
|
||||
FOAM_BRANCH_NAME="master"
|
||||
FOAM_REPO_VERSION="$WM_PROJECT-$WM_PROJECT_VERSION"
|
||||
FOAM_REPO_TAG="master"
|
||||
;;
|
||||
esac
|
||||
|
||||
export FOAM_BASE_REPO="https://github.com/$WM_PROJECT/$FOAM_REPO_VERSION"
|
||||
export FOAM_ONLINE_REPO="$FOAM_BASE_REPO/tree/$FOAM_BRANCH_NAME"
|
||||
export FOAM_BASE_REPO="$WEB_PATH/Development/$FOAM_REPO_VERSION"
|
||||
export FOAM_ONLINE_REPO="$FOAM_BASE_REPO/blob/${FOAM_REPO_TAG}"
|
||||
}
|
||||
|
||||
# parse options
|
||||
@ -61,7 +58,6 @@ do
|
||||
done
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
set -x
|
||||
|
||||
rm -rf latex man
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -110,13 +110,13 @@ public:
|
||||
inline fileName(const word&);
|
||||
|
||||
//- Construct as copy of string
|
||||
inline fileName(const string&);
|
||||
inline fileName(const string&, const bool doStripInvalid=true);
|
||||
|
||||
//- Construct as copy of std::string
|
||||
inline fileName(const std::string&);
|
||||
inline fileName(const std::string&, const bool doStripInvalid=true);
|
||||
|
||||
//- Construct as copy of character array
|
||||
inline fileName(const char*);
|
||||
inline fileName(const char*, const bool doStripInvalid=true);
|
||||
|
||||
//- Construct by concatenating elements of wordList separated by '/'
|
||||
explicit fileName(const wordList&);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,6 +27,8 @@ License
|
||||
|
||||
inline void Foam::fileName::stripInvalid()
|
||||
{
|
||||
// skip stripping unless debug is active to avoid
|
||||
// costly operations
|
||||
if (debug && string::stripInvalid<fileName>(*this))
|
||||
{
|
||||
std::cerr
|
||||
@ -54,38 +56,49 @@ inline Foam::fileName::fileName()
|
||||
string()
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const fileName& fn)
|
||||
:
|
||||
string(fn)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const word& w)
|
||||
:
|
||||
string(w)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const string& str)
|
||||
inline Foam::fileName::fileName(const string& s, const bool doStripInvalid)
|
||||
:
|
||||
string(str)
|
||||
string(s)
|
||||
{
|
||||
stripInvalid();
|
||||
if (doStripInvalid)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const std::string& str)
|
||||
inline Foam::fileName::fileName(const std::string& s, const bool doStripInvalid)
|
||||
:
|
||||
string(str)
|
||||
string(s)
|
||||
{
|
||||
stripInvalid();
|
||||
if (doStripInvalid)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName::fileName(const char* str)
|
||||
inline Foam::fileName::fileName(const char* s, const bool doStripInvalid)
|
||||
:
|
||||
string(str)
|
||||
string(s)
|
||||
{
|
||||
stripInvalid();
|
||||
if (doStripInvalid)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,18 +52,18 @@ inline void Foam::word::stripInvalid()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::word::word(const word& w)
|
||||
:
|
||||
string(w)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::word::word()
|
||||
:
|
||||
string()
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::word::word(const word& w)
|
||||
:
|
||||
string(w)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::word::word(const string& s, const bool doStripInvalid)
|
||||
:
|
||||
string(s)
|
||||
@ -96,6 +96,7 @@ inline Foam::word::word(const char* s, const bool doStripInvalid)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline Foam::word::word
|
||||
(
|
||||
const char* s,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -130,6 +130,13 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
|
||||
|
||||
return thermo.kappa(patchI);
|
||||
}
|
||||
else if (mesh.foundObject<basicThermo>(basicThermo::dictName))
|
||||
{
|
||||
const basicThermo& thermo =
|
||||
mesh.lookupObject<basicThermo>(basicThermo::dictName);
|
||||
|
||||
return thermo.kappa(patchI);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -59,7 +59,7 @@ Description
|
||||
QrNbr Qr; // or none. Name of Qr field on neighbour region
|
||||
Qr Qr; // or none. Name of Qr field on local region
|
||||
thicknessLayers (0.1 0.2 0.3 0.4);
|
||||
kappaLayers (1 2 3 4)
|
||||
kappaLayers (1 2 3 4);
|
||||
value uniform 300;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -27,9 +27,13 @@ Class
|
||||
|
||||
Description
|
||||
Hybrid convection scheme of Travin et al. for hybrid RAS/LES calculations.
|
||||
The scheme blends between a low-dissipative convection scheme within the
|
||||
LES region (e.g. linear) and a numerically more robust convection scheme in
|
||||
the RAS region (e.g. upwind-biased schemes).
|
||||
|
||||
The scheme provides a blend between two convection schemes, based on local
|
||||
properties including the wall distance, velocity gradient and eddy
|
||||
viscosity. The scheme was originally developed for DES calculations to
|
||||
blend a low-dissipative scheme, e.g. linear, in the vorticity-dominated,
|
||||
finely-resolved regions and a numerically more robust, e.g. upwind-biased,
|
||||
convection scheme in irrotational or coarsely-resolved regions.
|
||||
|
||||
The routine calculates the blending factor denoted as "sigma" in the
|
||||
literature reference, where 0 <= sigma <= sigmaMax, which is then employed
|
||||
|
||||
@ -187,7 +187,7 @@ tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::psi
|
||||
(
|
||||
scalar(100),
|
||||
(1 - Cb1_/(Cw1_*sqr(kappa_)*fwStar_)*(ft2 + (1 - ft2)*fv2))
|
||||
/max(SMALL, (fv1*max(1e-10, 1 - ft2)))
|
||||
/max(SMALL, (fv1*max(scalar(1e-10), 1 - ft2)))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,6 +48,11 @@ Description
|
||||
Theor. Comput. Fluid Dyn., 20, 181-195.
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The default value of the DES constant implemented was calibrated for
|
||||
OpenFOAM using decaying isotropic turbulence and agrees with the value
|
||||
suggested in the reference publication.
|
||||
|
||||
SourceFiles
|
||||
SpalartAllmarasDES.C
|
||||
|
||||
|
||||
@ -37,8 +37,11 @@ Description
|
||||
39th AIAA Aerospace Sciences Meeting and Exhibit, Reno, NV
|
||||
\endverbatim
|
||||
|
||||
Note: DES constants CDES_kom and CDES_keps have been re-calibrated to
|
||||
OpenFOAM numerics via decaying isotropic turbulence test case
|
||||
Note
|
||||
The default values of the DES constants implemented are code-specific
|
||||
values calibrated for OpenFOAM using decaying isotropic turbulence, and
|
||||
hence deviate slightly from the values suggested in the reference
|
||||
publication.
|
||||
|
||||
SourceFiles
|
||||
kOmegaSSTDES.C
|
||||
|
||||
@ -276,7 +276,7 @@ public:
|
||||
//- Return the turbulence kinetic energy dissipation rate
|
||||
virtual tmp<volScalarField> epsilon() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,6 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightFile.H"
|
||||
#include "error.H"
|
||||
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -33,8 +36,7 @@ bool Foam::ensightFile::allowUndef_ = false;
|
||||
Foam::scalar Foam::ensightFile::undefValue_ = Foam::floatScalarVGREAT;
|
||||
|
||||
// default is width 8
|
||||
Foam::string Foam::ensightFile::mask_ = "********";
|
||||
|
||||
Foam::string Foam::ensightFile::mask_ = "********";
|
||||
Foam::string Foam::ensightFile::dirFmt_ = "%08d";
|
||||
|
||||
|
||||
@ -79,15 +81,9 @@ Foam::label Foam::ensightFile::subDirWidth()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightFile::ensightFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstream::streamFormat format
|
||||
)
|
||||
:
|
||||
OFstream(pathname, format)
|
||||
void Foam::ensightFile::initialize()
|
||||
{
|
||||
// ascii formatting specs
|
||||
setf
|
||||
@ -99,6 +95,33 @@ Foam::ensightFile::ensightFile
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightFile::ensightFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstream::streamFormat format
|
||||
)
|
||||
:
|
||||
OFstream(ensight::FileName(pathname), format)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
||||
Foam::ensightFile::ensightFile
|
||||
(
|
||||
const fileName& path,
|
||||
const fileName& name,
|
||||
IOstream::streamFormat format
|
||||
)
|
||||
:
|
||||
OFstream(path/ensight::FileName(name), format)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightFile::~ensightFile()
|
||||
@ -145,44 +168,27 @@ Foam::Ostream& Foam::ensightFile::write
|
||||
|
||||
Foam::Ostream& Foam::ensightFile::write(const char* value)
|
||||
{
|
||||
return write(string(value));
|
||||
char buf[80];
|
||||
strncpy(buf, value, 80); // max 80 chars or padded with nul if smaller
|
||||
|
||||
if (format() == IOstream::BINARY)
|
||||
{
|
||||
write(buf, sizeof(buf));
|
||||
}
|
||||
else
|
||||
{
|
||||
buf[79] = 0; // max 79 in ASCII, ensure it is indeed nul-terminated
|
||||
stdStream() << buf;
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::ensightFile::write(const string& value)
|
||||
{
|
||||
char buf[80];
|
||||
|
||||
for (string::size_type i = 0; i < 80; ++i)
|
||||
{
|
||||
buf[i] = 0;
|
||||
}
|
||||
|
||||
string::size_type n = value.size();
|
||||
if (n >= 80)
|
||||
{
|
||||
n = 79;
|
||||
}
|
||||
|
||||
for (string::size_type i = 0; i < n; ++i)
|
||||
{
|
||||
buf[i] = value[i];
|
||||
}
|
||||
|
||||
if (format() == IOstream::BINARY)
|
||||
{
|
||||
write
|
||||
(
|
||||
reinterpret_cast<char const *>(buf),
|
||||
sizeof(buf)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
stdStream() << buf;
|
||||
}
|
||||
|
||||
return *this;
|
||||
return write(value.c_str());
|
||||
}
|
||||
|
||||
|
||||
@ -194,7 +200,7 @@ Foam::Ostream& Foam::ensightFile::write(const label value)
|
||||
|
||||
write
|
||||
(
|
||||
reinterpret_cast<char const *>(&ivalue),
|
||||
reinterpret_cast<const char *>(&ivalue),
|
||||
sizeof(ivalue)
|
||||
);
|
||||
}
|
||||
@ -220,7 +226,7 @@ Foam::Ostream& Foam::ensightFile::write
|
||||
|
||||
write
|
||||
(
|
||||
reinterpret_cast<char const *>(&ivalue),
|
||||
reinterpret_cast<const char *>(&ivalue),
|
||||
sizeof(ivalue)
|
||||
);
|
||||
}
|
||||
@ -242,7 +248,7 @@ Foam::Ostream& Foam::ensightFile::write(const scalar value)
|
||||
{
|
||||
write
|
||||
(
|
||||
reinterpret_cast<char const *>(&fvalue),
|
||||
reinterpret_cast<const char *>(&fvalue),
|
||||
sizeof(fvalue)
|
||||
);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,13 +36,16 @@ Description
|
||||
#include "OFstream.H"
|
||||
#include "IOstream.H"
|
||||
|
||||
#include "ensightFileName.H"
|
||||
#include "ensightVarName.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ensightFile Declaration
|
||||
Class ensightFile Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ensightFile
|
||||
@ -66,24 +69,41 @@ class ensightFile
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Initialize by setting the ASCII output formatting
|
||||
void initialize();
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ensightFile&);
|
||||
void operator=(const ensightFile&) = delete;
|
||||
|
||||
//- Disallow default copy constructor
|
||||
ensightFile(const ensightFile&);
|
||||
|
||||
ensightFile(const ensightFile&) = delete;
|
||||
|
||||
public:
|
||||
|
||||
// Forward declarations
|
||||
class FileName;
|
||||
class VarName;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from pathname
|
||||
//- Construct from pathname.
|
||||
// The entire pathname is checked for valid ensight naming.
|
||||
ensightFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstream::streamFormat format=IOstream::BINARY
|
||||
);
|
||||
|
||||
//- Construct from path and name.
|
||||
// Only the name portion is checked for valid ensight naming.
|
||||
ensightFile
|
||||
(
|
||||
const fileName& path,
|
||||
const fileName& name,
|
||||
IOstream::streamFormat format=IOstream::BINARY
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~ensightFile();
|
||||
@ -135,10 +155,10 @@ public:
|
||||
//- Write undef value
|
||||
Ostream& writeUndef();
|
||||
|
||||
//- Write C-string as "%80s" or as binary
|
||||
//- Write C-string as "%79s" or as binary (max 80 chars)
|
||||
Ostream& write(const char* value);
|
||||
|
||||
//- Write string as "%80s" or as binary
|
||||
//- Write string as "%79s" or as binary (max 80 chars)
|
||||
Ostream& write(const string& value);
|
||||
|
||||
//- Write integer as "%10d" or as binary
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,6 +25,18 @@ License
|
||||
|
||||
#include "ensightGeoFile.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightGeoFile::initialize()
|
||||
{
|
||||
writeBinaryHeader();
|
||||
write("Ensight Geometry File"); newline(); // description line 1
|
||||
write("====================="); newline(); // description line 2
|
||||
write("node id assign"); newline();
|
||||
write("element id assign"); newline();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightGeoFile::ensightGeoFile
|
||||
@ -35,13 +47,23 @@ Foam::ensightGeoFile::ensightGeoFile
|
||||
:
|
||||
ensightFile(pathname, format)
|
||||
{
|
||||
writeBinaryHeader();
|
||||
write("Ensight Geometry File"); newline();
|
||||
write("====================="); newline();
|
||||
write("node id assign"); newline();
|
||||
write("element id assign"); newline();
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
||||
Foam::ensightGeoFile::ensightGeoFile
|
||||
(
|
||||
const fileName& path,
|
||||
const fileName& name,
|
||||
IOstream::streamFormat format
|
||||
)
|
||||
:
|
||||
ensightFile(path, name, format)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightGeoFile::~ensightGeoFile()
|
||||
@ -52,8 +74,7 @@ Foam::ensightGeoFile::~ensightGeoFile()
|
||||
|
||||
Foam::Ostream& Foam::ensightGeoFile::writeKeyword(const string& key)
|
||||
{
|
||||
write(key);
|
||||
newline();
|
||||
write(key); newline();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,24 +49,37 @@ class ensightGeoFile
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Initialize by outputting header information
|
||||
void initialize();
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ensightGeoFile&);
|
||||
void operator=(const ensightGeoFile&) = delete;
|
||||
|
||||
//- Disallow default copy constructor
|
||||
ensightGeoFile(const ensightGeoFile&);
|
||||
ensightGeoFile(const ensightGeoFile&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from pathname
|
||||
//- Construct from pathname.
|
||||
// The entire pathname is checked for valid ensight naming.
|
||||
ensightGeoFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstream::streamFormat format=IOstream::BINARY
|
||||
);
|
||||
|
||||
//- Construct from path and name.
|
||||
// Only the name portion is checked for valid ensight naming.
|
||||
ensightGeoFile
|
||||
(
|
||||
const fileName& path,
|
||||
const fileName& name,
|
||||
IOstream::streamFormat format=IOstream::BINARY
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~ensightGeoFile();
|
||||
|
||||
106
src/conversion/ensight/name/ensightFileName.H
Normal file
106
src/conversion/ensight/name/ensightFileName.H
Normal file
@ -0,0 +1,106 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ 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::ensight::FileName
|
||||
|
||||
Description
|
||||
Specification of a valid Ensight file-name.
|
||||
|
||||
Spaces must be quoted,
|
||||
no '*' wildcards, not '%' (structured block continuation).
|
||||
|
||||
Overall line length within case file is limited to 1024, but this is not
|
||||
yet addresssed.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ensightFileName_H
|
||||
#define ensightFileName_H
|
||||
|
||||
#include "fileName.H"
|
||||
#include "word.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace ensight
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ensight::FileName Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class FileName
|
||||
:
|
||||
public fileName
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Strip invalid characters
|
||||
inline void stripInvalid();
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct as copy
|
||||
inline explicit FileName(const FileName&);
|
||||
|
||||
//- Construct as copy of character array
|
||||
inline explicit FileName(const char*);
|
||||
|
||||
//- Construct as copy of std::string
|
||||
inline explicit FileName(const std::string&);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Is this character valid for an ensight file-name
|
||||
inline static bool valid(char);
|
||||
|
||||
// Member operators
|
||||
|
||||
// Assignment
|
||||
|
||||
void operator=(const fileName&) = delete;
|
||||
void operator=(const word&) = delete;
|
||||
void operator=(const string&) = delete;
|
||||
void operator=(const std::string&) = delete;
|
||||
void operator=(const char*) = delete;
|
||||
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace ensight
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "ensightFileNameI.H"
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
83
src/conversion/ensight/name/ensightFileNameI.H
Normal file
83
src/conversion/ensight/name/ensightFileNameI.H
Normal file
@ -0,0 +1,83 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ 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 "error.H"
|
||||
#include <cctype>
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::ensight::FileName::FileName(const FileName& fn)
|
||||
:
|
||||
fileName(fn, false)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::ensight::FileName::FileName(const char* s)
|
||||
:
|
||||
fileName(s, false)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::ensight::FileName::FileName(const std::string& s)
|
||||
:
|
||||
fileName(s, false)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline void Foam::ensight::FileName::stripInvalid()
|
||||
{
|
||||
string::stripInvalid<FileName>(*this);
|
||||
|
||||
removeRepeated('/');
|
||||
removeTrailing('/');
|
||||
|
||||
if (empty())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "ensight::FileName empty after stripping" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::ensight::FileName::valid(char c)
|
||||
{
|
||||
return
|
||||
(
|
||||
fileName::valid(c) // includes space, quotes
|
||||
&& c != '*' // wild-card
|
||||
&& c != '%' // structured block continuation
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
111
src/conversion/ensight/name/ensightVarName.H
Normal file
111
src/conversion/ensight/name/ensightVarName.H
Normal file
@ -0,0 +1,111 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ 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::ensight::VarName
|
||||
|
||||
Description
|
||||
Specification of a valid Ensight variable-name.
|
||||
|
||||
\code
|
||||
space !#%()*+,-./;@[]^
|
||||
\endcode
|
||||
If spaces exist, they must be quoted
|
||||
|
||||
Variable names cannot start with a digit.
|
||||
The maximum part name length (in GUI: 49 chars) - not addresssed.
|
||||
The maximum variable length (in GUI: 49 chars) - not addresssed.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ensightVarName_H
|
||||
#define ensightVarName_H
|
||||
|
||||
#include "word.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace ensight
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ensight::VarName Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class VarName
|
||||
:
|
||||
public word
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Strip invalid characters
|
||||
inline void stripInvalid();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct as copy
|
||||
inline explicit VarName(const VarName&);
|
||||
|
||||
//- Construct as copy of character array
|
||||
inline explicit VarName(const char*);
|
||||
|
||||
//- Construct as copy of std::string
|
||||
inline explicit VarName(const std::string&);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Is this character valid for an ensight var-name
|
||||
inline static bool valid(char);
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
// Assignment
|
||||
|
||||
void operator=(const word&) = delete;
|
||||
void operator=(const string&) = delete;
|
||||
void operator=(const std::string&) = delete;
|
||||
void operator=(const char*) = delete;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace ensight
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "ensightVarNameI.H"
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
100
src/conversion/ensight/name/ensightVarNameI.H
Normal file
100
src/conversion/ensight/name/ensightVarNameI.H
Normal file
@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ 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 "error.H"
|
||||
#include <cctype>
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::ensight::VarName::VarName(const VarName& vn)
|
||||
:
|
||||
word(vn, false)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::ensight::VarName::VarName(const char* s)
|
||||
:
|
||||
word(s, false)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::ensight::VarName::VarName(const std::string& s)
|
||||
:
|
||||
word(s, false)
|
||||
{
|
||||
stripInvalid();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline void Foam::ensight::VarName::stripInvalid()
|
||||
{
|
||||
string::stripInvalid<VarName>(*this);
|
||||
|
||||
if (empty())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "ensight::VarName empty after stripping" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// prefix with '_' to avoid starting with leading digits
|
||||
std::string::iterator iter = begin();
|
||||
if (isdigit(*iter))
|
||||
{
|
||||
insert(iter, '_');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::ensight::VarName::valid(char c)
|
||||
{
|
||||
return
|
||||
(
|
||||
word::valid(c) // includes space, quotes, /\;{}
|
||||
&& c != '!'
|
||||
&& c != '#'
|
||||
&& c != '%'
|
||||
&& c != '('
|
||||
&& c != ')'
|
||||
&& c != '*'
|
||||
&& c != '+'
|
||||
&& c != ','
|
||||
&& c != '-'
|
||||
&& c != '.'
|
||||
&& c != '@'
|
||||
&& c != '['
|
||||
&& c != ']'
|
||||
&& c != '^'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -183,13 +183,14 @@ void Foam::ensightParts::renumber
|
||||
void Foam::ensightParts::writeGeometry(ensightGeoFile& os) const
|
||||
{
|
||||
// with some feedback
|
||||
Info<< "write geometry part:" << nl << flush;
|
||||
Info<< "write geometry part (" << flush;
|
||||
|
||||
forAll(partsList_, partI)
|
||||
{
|
||||
Info<< " " << partI << flush;
|
||||
partsList_[partI].writeGeometry(os);
|
||||
}
|
||||
Info<< " )" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,7 +42,6 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
pName_("p"),
|
||||
cyclicPatchName_(),
|
||||
cyclicPatchLabel_(-1),
|
||||
orientation_(1),
|
||||
initWallSf_(0),
|
||||
initCyclicSf_(0),
|
||||
nbrCyclicSf_(0),
|
||||
@ -52,7 +51,8 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
curTimeIndex_(-1),
|
||||
minThresholdValue_(0),
|
||||
fBased_(1),
|
||||
baffleActivated_(0)
|
||||
baffleActivated_(0),
|
||||
opening_(1)
|
||||
{}
|
||||
|
||||
|
||||
@ -69,7 +69,6 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
pName_(ptf.pName_),
|
||||
cyclicPatchName_(ptf.cyclicPatchName_),
|
||||
cyclicPatchLabel_(ptf.cyclicPatchLabel_),
|
||||
orientation_(ptf.orientation_),
|
||||
initWallSf_(ptf.initWallSf_),
|
||||
initCyclicSf_(ptf.initCyclicSf_),
|
||||
nbrCyclicSf_(ptf.nbrCyclicSf_),
|
||||
@ -79,7 +78,8 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
curTimeIndex_(-1),
|
||||
minThresholdValue_(ptf.minThresholdValue_),
|
||||
fBased_(ptf.fBased_),
|
||||
baffleActivated_(ptf.baffleActivated_)
|
||||
baffleActivated_(ptf.baffleActivated_),
|
||||
opening_(ptf.opening_)
|
||||
{}
|
||||
|
||||
|
||||
@ -95,7 +95,6 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
pName_(dict.lookupOrDefault<word>("p", "p")),
|
||||
cyclicPatchName_(dict.lookup("cyclicPatch")),
|
||||
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),
|
||||
orientation_(readLabel(dict.lookup("orientation"))),
|
||||
initWallSf_(0),
|
||||
initCyclicSf_(0),
|
||||
nbrCyclicSf_(0),
|
||||
@ -105,7 +104,8 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
curTimeIndex_(-1),
|
||||
minThresholdValue_(readScalar(dict.lookup("minThresholdValue"))),
|
||||
fBased_(readBool(dict.lookup("forceBased"))),
|
||||
baffleActivated_(0)
|
||||
baffleActivated_(0),
|
||||
opening_(readBool(dict.lookup("opening")))
|
||||
{
|
||||
fvPatchVectorField::operator=(Zero);
|
||||
|
||||
@ -136,7 +136,6 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
pName_(ptf.pName_),
|
||||
cyclicPatchName_(ptf.cyclicPatchName_),
|
||||
cyclicPatchLabel_(ptf.cyclicPatchLabel_),
|
||||
orientation_(ptf.orientation_),
|
||||
initWallSf_(ptf.initWallSf_),
|
||||
initCyclicSf_(ptf.initCyclicSf_),
|
||||
nbrCyclicSf_(ptf.nbrCyclicSf_),
|
||||
@ -146,7 +145,8 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
curTimeIndex_(-1),
|
||||
minThresholdValue_(ptf.minThresholdValue_),
|
||||
fBased_(ptf.fBased_),
|
||||
baffleActivated_(ptf.baffleActivated_)
|
||||
baffleActivated_(ptf.baffleActivated_),
|
||||
opening_(ptf.opening_)
|
||||
{}
|
||||
|
||||
|
||||
@ -161,7 +161,6 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
pName_(ptf.pName_),
|
||||
cyclicPatchName_(ptf.cyclicPatchName_),
|
||||
cyclicPatchLabel_(ptf.cyclicPatchLabel_),
|
||||
orientation_(ptf.orientation_),
|
||||
initWallSf_(ptf.initWallSf_),
|
||||
initCyclicSf_(ptf.initCyclicSf_),
|
||||
nbrCyclicSf_(ptf.nbrCyclicSf_),
|
||||
@ -171,7 +170,8 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
curTimeIndex_(-1),
|
||||
minThresholdValue_(ptf.minThresholdValue_),
|
||||
fBased_(ptf.fBased_),
|
||||
baffleActivated_(ptf.baffleActivated_)
|
||||
baffleActivated_(ptf.baffleActivated_),
|
||||
opening_(ptf.opening_)
|
||||
{}
|
||||
|
||||
|
||||
@ -197,14 +197,13 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::autoMap
|
||||
Info << "faceArea[active] "<< i << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (patch().size() > 0)
|
||||
{
|
||||
const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
|
||||
initWallSf_ = patch().patchSlice(areas);
|
||||
initCyclicSf_ = patch().boundaryMesh()
|
||||
[
|
||||
cyclicPatchLabel_
|
||||
].patchSlice(areas);
|
||||
initCyclicSf_ =
|
||||
patch().boundaryMesh()[cyclicPatchLabel_].patchSlice(areas);
|
||||
nbrCyclicSf_ = refCast<const cyclicFvPatch>
|
||||
(
|
||||
patch().boundaryMesh()
|
||||
@ -215,6 +214,7 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::autoMap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::activePressureForceBaffleVelocityFvPatchVectorField::rmap
|
||||
(
|
||||
const fvPatchVectorField& ptf,
|
||||
@ -226,10 +226,8 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::rmap
|
||||
// See autoMap.
|
||||
const vectorField& areas = patch().boundaryMesh().mesh().faceAreas();
|
||||
initWallSf_ = patch().patchSlice(areas);
|
||||
initCyclicSf_ = patch().boundaryMesh()
|
||||
[
|
||||
cyclicPatchLabel_
|
||||
].patchSlice(areas);
|
||||
initCyclicSf_ =
|
||||
patch().boundaryMesh()[cyclicPatchLabel_].patchSlice(areas);
|
||||
nbrCyclicSf_ = refCast<const cyclicFvPatch>
|
||||
(
|
||||
patch().boundaryMesh()
|
||||
@ -246,20 +244,17 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Execute the change to the openFraction only once per time-step
|
||||
if (curTimeIndex_ != this->db().time().timeIndex())
|
||||
{
|
||||
const volScalarField& p = db().lookupObject<volScalarField>
|
||||
(
|
||||
pName_
|
||||
);
|
||||
const volScalarField& p =
|
||||
db().lookupObject<volScalarField>(pName_);
|
||||
|
||||
const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_];
|
||||
const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
|
||||
const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
|
||||
(
|
||||
cyclicPatch
|
||||
).neighbFvPatch();
|
||||
const fvPatch& nbrPatch =
|
||||
refCast<const cyclicFvPatch>(cyclicPatch).neighbFvPatch();
|
||||
|
||||
const labelList& nbrFaceCells = nbrPatch.patch().faceCells();
|
||||
|
||||
@ -296,21 +291,23 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs()
|
||||
Info<< "Pressure difference = " << valueDiff << endl;
|
||||
}
|
||||
|
||||
if ((mag(valueDiff) > mag(minThresholdValue_)) || baffleActivated_)
|
||||
if (mag(valueDiff) > mag(minThresholdValue_) || baffleActivated_)
|
||||
{
|
||||
openFraction_ =
|
||||
max(
|
||||
min(
|
||||
max
|
||||
(
|
||||
min
|
||||
(
|
||||
openFraction_
|
||||
+ min
|
||||
(
|
||||
this->db().time().deltaT().value()/openingTime_,
|
||||
maxOpenFractionDelta_
|
||||
)*(orientation_),
|
||||
1 - 1e-6
|
||||
),
|
||||
1 - 1e-6
|
||||
),
|
||||
1e-6
|
||||
);
|
||||
);
|
||||
|
||||
baffleActivated_ = true;
|
||||
}
|
||||
@ -321,8 +318,20 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs()
|
||||
|
||||
Info<< "Open fraction = " << openFraction_ << endl;
|
||||
|
||||
scalar areaFraction = 0.0;
|
||||
|
||||
if (opening_)
|
||||
{
|
||||
areaFraction = openFraction_;
|
||||
}
|
||||
else
|
||||
{
|
||||
areaFraction = 1 - openFraction_;
|
||||
}
|
||||
|
||||
// Update this wall patch
|
||||
vectorField::subField Sfw = patch().patch().faceAreas();
|
||||
vectorField newSfw((1 - openFraction_)*initWallSf_);
|
||||
vectorField newSfw((1 - areaFraction)*initWallSf_);
|
||||
forAll(Sfw, facei)
|
||||
{
|
||||
Sfw[facei] = newSfw[facei];
|
||||
@ -330,18 +339,14 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs()
|
||||
const_cast<scalarField&>(patch().magSf()) = mag(patch().Sf());
|
||||
|
||||
// Update owner side of cyclic
|
||||
const_cast<vectorField&>(cyclicPatch.Sf()) =
|
||||
openFraction_*initCyclicSf_;
|
||||
const_cast<vectorField&>(cyclicPatch.Sf()) = areaFraction*initCyclicSf_;
|
||||
|
||||
const_cast<scalarField&>(cyclicPatch.magSf()) =
|
||||
mag(cyclicPatch.Sf());
|
||||
const_cast<scalarField&>(cyclicPatch.magSf()) = mag(cyclicPatch.Sf());
|
||||
|
||||
// Update neighbour side of cyclic
|
||||
const_cast<vectorField&>(nbrPatch.Sf()) =
|
||||
openFraction_*nbrCyclicSf_;
|
||||
const_cast<vectorField&>(nbrPatch.Sf()) = areaFraction*nbrCyclicSf_;
|
||||
|
||||
const_cast<scalarField&>(nbrPatch.magSf()) =
|
||||
mag(nbrPatch.Sf());
|
||||
const_cast<scalarField&>(nbrPatch.magSf()) = mag(nbrPatch.Sf());
|
||||
|
||||
curTimeIndex_ = this->db().time().timeIndex();
|
||||
}
|
||||
@ -357,8 +362,6 @@ write(Ostream& os) const
|
||||
writeEntryIfDifferent<word>(os, "p", "p", pName_);
|
||||
os.writeKeyword("cyclicPatch")
|
||||
<< cyclicPatchName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("orientation")
|
||||
<< orientation_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("openingTime")
|
||||
<< openingTime_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("maxOpenFractionDelta")
|
||||
@ -369,6 +372,8 @@ write(Ostream& os) const
|
||||
<< minThresholdValue_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("forceBased")
|
||||
<< fBased_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("opening")
|
||||
<< opening_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
@ -384,4 +389,5 @@ namespace Foam
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | OpenCFD Ltd 2016
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -38,6 +38,11 @@ Description
|
||||
used in an extra wall beyond an existing cyclic patch pair. See PDRMesh
|
||||
for more details.
|
||||
|
||||
The baffle is activated when the pressure difference between master and
|
||||
slave paches is positive and larger then minThresholdValue. The
|
||||
orientation flag is used to to calculate the pressure difference bwetween
|
||||
master-slave or slave-master.
|
||||
|
||||
Once the threshold is crossed, this condition activated and continues to
|
||||
open or close at a fixed rate using
|
||||
|
||||
@ -70,6 +75,7 @@ Description
|
||||
minThresholdValue | minimum absolute pressure or
|
||||
force difference for activation | yes |
|
||||
forceBased | force (true) or pressure-based (false) activation | yes |
|
||||
opening | Baffle is opening or closing (1 opening, 0 closing) | yes
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
@ -85,6 +91,7 @@ Description
|
||||
maxOpenFractionDelta 0.1;
|
||||
minThresholdValue 0.01;
|
||||
forceBased false;
|
||||
opening 1;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -124,10 +131,6 @@ class activePressureForceBaffleVelocityFvPatchVectorField
|
||||
//- Index of the cyclic patch used when the active baffle is open
|
||||
label cyclicPatchLabel_;
|
||||
|
||||
//- Orientation (1 or -1) of the active baffle mode
|
||||
// Used to change the direction of opening or closing the baffle
|
||||
label orientation_;
|
||||
|
||||
//- Initial wall patch areas
|
||||
vectorField initWallSf_;
|
||||
|
||||
@ -158,6 +161,9 @@ class activePressureForceBaffleVelocityFvPatchVectorField
|
||||
//- Baffle is activated
|
||||
bool baffleActivated_;
|
||||
|
||||
//- Baffle is opening or closing (1 opening, 0 closing)
|
||||
bool opening_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ License
|
||||
#include "PressureGradientForce.H"
|
||||
#include "SRFForce.H"
|
||||
#include "VirtualMassForce.H"
|
||||
#include "InterfaceForce.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -61,8 +62,8 @@ License
|
||||
makeParticleForceModelType(ParamagneticForce, CloudType); \
|
||||
makeParticleForceModelType(PressureGradientForce, CloudType); \
|
||||
makeParticleForceModelType(SRFForce, CloudType); \
|
||||
makeParticleForceModelType(VirtualMassForce, CloudType);
|
||||
|
||||
makeParticleForceModelType(VirtualMassForce, CloudType); \
|
||||
makeParticleForceModelType(InterfaceForce, CloudType);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -0,0 +1,146 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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 "InterfaceForce.H"
|
||||
#include "fvcGrad.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::InterfaceForce<CloudType>::InterfaceForce
|
||||
(
|
||||
CloudType& owner,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
|
||||
alpaName_
|
||||
(
|
||||
this->coeffs().template lookup("alphaName")
|
||||
),
|
||||
C_
|
||||
(
|
||||
readScalar(this->coeffs().lookup("C"))
|
||||
),
|
||||
gradInterForceInterpPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::InterfaceForce<CloudType>::InterfaceForce
|
||||
(
|
||||
const InterfaceForce& pf
|
||||
)
|
||||
:
|
||||
ParticleForce<CloudType>(pf),
|
||||
alpaName_(pf.alpaName_),
|
||||
C_(pf.C_),
|
||||
gradInterForceInterpPtr_(pf.gradInterForceInterpPtr_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::InterfaceForce<CloudType>::~InterfaceForce()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::InterfaceForce<CloudType>::cacheFields(const bool store)
|
||||
{
|
||||
static word fName("gradAlpha");
|
||||
|
||||
bool fieldExists =
|
||||
this->mesh().template foundObject<volVectorField>(fName);
|
||||
|
||||
if (store)
|
||||
{
|
||||
if (!fieldExists)
|
||||
{
|
||||
const volScalarField& alpha = this->mesh().template
|
||||
lookupObject<volScalarField>(alpaName_);
|
||||
|
||||
volVectorField* gradInterForcePtr =
|
||||
new volVectorField(fName, fvc::grad(alpha*(1-alpha)));
|
||||
|
||||
gradInterForcePtr->store();
|
||||
}
|
||||
|
||||
const volVectorField& gradInterForce = this->mesh().template
|
||||
lookupObject<volVectorField>(fName);
|
||||
|
||||
gradInterForceInterpPtr_.reset
|
||||
(
|
||||
interpolation<vector>::New
|
||||
(
|
||||
this->owner().solution().interpolationSchemes(),
|
||||
gradInterForce
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
gradInterForceInterpPtr_.clear();
|
||||
|
||||
if (fieldExists)
|
||||
{
|
||||
const volVectorField& gradInterForce = this->mesh().template
|
||||
lookupObject<volVectorField>(fName);
|
||||
|
||||
const_cast<volVectorField&>(gradInterForce).checkOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::forceSuSp Foam::InterfaceForce<CloudType>::calcNonCoupled
|
||||
(
|
||||
const typename CloudType::parcelType& p,
|
||||
const scalar dt,
|
||||
const scalar mass,
|
||||
const scalar Re,
|
||||
const scalar muc
|
||||
) const
|
||||
{
|
||||
forceSuSp value(vector::zero, 0.0);
|
||||
|
||||
const interpolation<vector>& gradInterForceInterp =
|
||||
gradInterForceInterpPtr_();
|
||||
|
||||
value.Su()=
|
||||
C_
|
||||
*mass
|
||||
*gradInterForceInterp.interpolate(p.position(), p.currentTetIndices());
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd
|
||||
\\/ 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::InterfaceForce
|
||||
|
||||
Description
|
||||
Vector force apply to particles to avoid the crossing of particles from
|
||||
one phase to the other. The magnitude is calculated as C*mass*grad(alpha)
|
||||
|
||||
SourceFiles
|
||||
InterfaceForce.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef InterfaceForce_H
|
||||
#define InterfaceForce_H
|
||||
|
||||
#include "ParticleForce.H"
|
||||
#include "interpolation.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class InterfaceForce Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
class InterfaceForce
|
||||
:
|
||||
public ParticleForce<CloudType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of VOF field
|
||||
const word alpaName_;
|
||||
|
||||
//- Model constant
|
||||
const scalar C_;
|
||||
|
||||
//- gradInterForce interpolator
|
||||
autoPtr<interpolation<vector> > gradInterForceInterpPtr_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("interface");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
InterfaceForce
|
||||
(
|
||||
CloudType& owner,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct copy
|
||||
InterfaceForce(const InterfaceForce& gf);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<ParticleForce<CloudType> > clone() const
|
||||
{
|
||||
return autoPtr<ParticleForce<CloudType> >
|
||||
(
|
||||
new InterfaceForce<CloudType>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~InterfaceForce();
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Cache fields
|
||||
virtual void cacheFields(const bool store);
|
||||
|
||||
//- Calculate the non-coupled force
|
||||
virtual forceSuSp calcNonCoupled
|
||||
(
|
||||
const typename CloudType::parcelType& p,
|
||||
const scalar dt,
|
||||
const scalar mass,
|
||||
const scalar Re,
|
||||
const scalar muc
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "InterfaceForce.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -69,10 +69,10 @@ Description
|
||||
maxDiameter 0.5e-4;
|
||||
minDiameter 0;
|
||||
setFormat gnuplot;
|
||||
coordinateSystem
|
||||
origin (0 0 0);
|
||||
coordinateRoation
|
||||
{
|
||||
type cartesian;
|
||||
origin (0 0 0);
|
||||
e3 (0 1 1);
|
||||
e1 (1 0 0);
|
||||
}
|
||||
@ -91,7 +91,8 @@ Description
|
||||
maxDiameter | maximum region equivalent diameter | yes |
|
||||
minDiameter | minimum region equivalent diameter | no | 0
|
||||
setFormat | writing format | yes |
|
||||
coordinateSystem | transformation for vector fields | no |
|
||||
origin | origin of local co-ordinate system | yes |
|
||||
coordinateRoation | orientation of local co-ordinate system | no |
|
||||
log | Log to standard output | no | yes
|
||||
\endtable
|
||||
|
||||
|
||||
@ -219,7 +219,7 @@ Foam::forceCoeffs::forceCoeffs
|
||||
CdBinFilePtr_(),
|
||||
ClBinFilePtr_()
|
||||
{
|
||||
if (readFields)
|
||||
if (active_ && readFields)
|
||||
{
|
||||
read(dict);
|
||||
if (log_) Info << endl;
|
||||
@ -310,6 +310,12 @@ void Foam::forceCoeffs::execute()
|
||||
|
||||
forces::calcForcesMoment();
|
||||
|
||||
// Need to re-check active_ flag - may have been reset in calcForcesMoment
|
||||
if (!active_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
createFiles();
|
||||
|
||||
scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
|
||||
|
||||
@ -279,8 +279,8 @@ void Foam::forces::initialiseBins()
|
||||
// Allocate storage for forces and moments
|
||||
forAll(force_, i)
|
||||
{
|
||||
force_[i].setSize(nBin_);
|
||||
moment_[i].setSize(nBin_);
|
||||
force_[i].setSize(nBin_, vector::zero);
|
||||
moment_[i].setSize(nBin_, vector::zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -841,8 +841,8 @@ Foam::forces::forces
|
||||
|
||||
forAll(force_, i)
|
||||
{
|
||||
force_[i].setSize(nBin_);
|
||||
moment_[i].setSize(nBin_);
|
||||
force_[i].setSize(nBin_, vector::zero);
|
||||
moment_[i].setSize(nBin_, vector::zero);
|
||||
}
|
||||
}
|
||||
|
||||
@ -944,8 +944,8 @@ void Foam::forces::read(const dictionary& dict)
|
||||
// Allocate storage for forces and moments
|
||||
forAll(force_, i)
|
||||
{
|
||||
force_[i].setSize(1);
|
||||
moment_[i].setSize(1);
|
||||
force_[i].setSize(1, vector::zero);
|
||||
moment_[i].setSize(1, vector::zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -77,6 +77,8 @@ Foam::fileName Foam::ensightSurfaceWriter::write
|
||||
const bool verbose
|
||||
) const
|
||||
{
|
||||
const ensight::FileName surfName(surfaceName);
|
||||
|
||||
if (!isDir(outputDir))
|
||||
{
|
||||
mkDir(outputDir);
|
||||
@ -85,10 +87,11 @@ Foam::fileName Foam::ensightSurfaceWriter::write
|
||||
// const scalar timeValue = Foam::name(this->mesh().time().timeValue());
|
||||
const scalar timeValue = 0.0;
|
||||
|
||||
OFstream osCase(outputDir/surfaceName + ".case");
|
||||
OFstream osCase(outputDir/surfName + ".case");
|
||||
ensightGeoFile osGeom
|
||||
(
|
||||
outputDir/surfaceName + ".0000.mesh",
|
||||
outputDir,
|
||||
surfName + ".0000.mesh",
|
||||
writeFormat_
|
||||
);
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,23 +47,43 @@ Foam::fileName Foam::ensightSurfaceWriter::writeUncollated
|
||||
const bool verbose
|
||||
) const
|
||||
{
|
||||
if (!isDir(outputDir/fieldName))
|
||||
const ensight::FileName surfName(surfaceName);
|
||||
const ensight::VarName varName(fieldName);
|
||||
|
||||
// use variable name as sub-directory for results
|
||||
// eg, something like this:
|
||||
// - VAR1/SURF1.case
|
||||
// - VAR1/SURF1.0000.mesh
|
||||
// - VAR1/SURF1.0001.VAR1
|
||||
// - VAR1/SURF2.case
|
||||
// - VAR1/SURF2.0000.mesh
|
||||
// - VAR1/SURF2.0001.VAR1
|
||||
// and
|
||||
// - VAR2/SURF1.case
|
||||
// - VAR2/SURF1.0000.mesh
|
||||
// - VAR2/SURF1.0001.VAR2
|
||||
|
||||
const fileName baseDir = outputDir/varName;
|
||||
|
||||
if (!isDir(baseDir))
|
||||
{
|
||||
mkDir(outputDir/fieldName);
|
||||
mkDir(baseDir);
|
||||
}
|
||||
|
||||
// const scalar timeValue = Foam::name(this->mesh().time().timeValue());
|
||||
const scalar timeValue = 0.0;
|
||||
|
||||
OFstream osCase(outputDir/fieldName/surfaceName + ".case");
|
||||
OFstream osCase(baseDir/surfName + ".case");
|
||||
ensightGeoFile osGeom
|
||||
(
|
||||
outputDir/fieldName/surfaceName + ".0000.mesh",
|
||||
baseDir,
|
||||
surfName + ".0000.mesh",
|
||||
writeFormat_
|
||||
);
|
||||
ensightFile osField
|
||||
(
|
||||
outputDir/fieldName/surfaceName + ".0000." + fieldName,
|
||||
baseDir,
|
||||
surfName + ".0000." + varName,
|
||||
writeFormat_
|
||||
);
|
||||
|
||||
@ -82,8 +102,8 @@ Foam::fileName Foam::ensightSurfaceWriter::writeUncollated
|
||||
<< "VARIABLE" << nl
|
||||
<< ensightPTraits<Type>::typeName << " per "
|
||||
<< word(isNodeValues ? "node:" : "element:") << setw(10) << 1
|
||||
<< " " << fieldName
|
||||
<< " " << surfaceName.c_str() << ".****." << fieldName << nl
|
||||
<< " " << varName
|
||||
<< " " << surfName.c_str() << ".****." << varName << nl
|
||||
<< nl
|
||||
<< "TIME" << nl
|
||||
<< "time set: 1" << nl
|
||||
@ -118,8 +138,22 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
||||
const bool verbose
|
||||
) const
|
||||
{
|
||||
const ensight::FileName surfName(surfaceName);
|
||||
const ensight::VarName varName(fieldName);
|
||||
|
||||
const fileName baseDir = outputDir.path()/surfaceName;
|
||||
// use surface name as sub-directory for results
|
||||
// eg, something like this:
|
||||
// - SURF1/SURF1.case
|
||||
// - SURF1/SURF1.0000.mesh
|
||||
// - SURF1/SURF1.0001.VAR1
|
||||
// - SURF1/SURF1.0001.VAR2
|
||||
// and
|
||||
// - SURF2/SURF2.case
|
||||
// - SURF2/SURF2.0000.mesh
|
||||
// - SURF2/SURF2.0001.VAR1
|
||||
// - SURF2/SURF2.0001.VAR2
|
||||
|
||||
const fileName baseDir = outputDir.path()/surfName;
|
||||
const fileName timeDir = outputDir.name();
|
||||
|
||||
if (!isDir(baseDir))
|
||||
@ -127,7 +161,8 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
||||
mkDir(baseDir);
|
||||
}
|
||||
|
||||
const fileName meshFile(baseDir/surfaceName + ".0000.mesh");
|
||||
// surfName already validated
|
||||
const fileName meshFile(baseDir/surfName + ".0000.mesh");
|
||||
const scalar timeValue = readScalar(IStringStream(timeDir)());
|
||||
label timeIndex = 0;
|
||||
|
||||
@ -171,6 +206,8 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
||||
{
|
||||
dictionary fieldDict;
|
||||
fieldDict.set("type", ensightPTraits<Type>::typeName);
|
||||
fieldDict.set("name", varName); // ensight variable name
|
||||
|
||||
fieldsDict.set(fieldName, fieldDict);
|
||||
|
||||
stateChanged = true;
|
||||
@ -180,6 +217,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
||||
{
|
||||
dictionary fieldDict;
|
||||
fieldDict.set("type", ensightPTraits<Type>::typeName);
|
||||
fieldDict.set("name", varName); // ensight variable name
|
||||
|
||||
dictionary fieldsDict;
|
||||
fieldsDict.set(fieldName, fieldDict);
|
||||
@ -201,7 +239,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
||||
os << dict;
|
||||
|
||||
|
||||
OFstream osCase(baseDir/surfaceName + ".case");
|
||||
OFstream osCase(baseDir/surfName + ".case");
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
@ -216,18 +254,24 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
||||
<< "model: 1 " << meshFile.name() << nl
|
||||
<< nl
|
||||
<< "VARIABLE" << nl;
|
||||
|
||||
const dictionary& fieldsDict = dict.subDict("fields");
|
||||
forAllConstIter(dictionary, fieldsDict, iter)
|
||||
{
|
||||
const word& fieldName = iter().keyword();
|
||||
const word fieldType(iter().dict().lookup("type"));
|
||||
const dictionary& subDict = iter().dict();
|
||||
const word fieldType(subDict.lookup("type"));
|
||||
const word varName = subDict.lookupOrDefault
|
||||
(
|
||||
"name",
|
||||
iter().keyword() // fieldName as fallback
|
||||
);
|
||||
|
||||
osCase
|
||||
<< fieldType << " per "
|
||||
<< word(isNodeValues ? "node:" : "element:")
|
||||
<< setw(10) << 1
|
||||
<< setw(15) << fieldName
|
||||
<< " " << surfaceName.c_str() << ".****." << fieldName
|
||||
<< setw(15) << varName
|
||||
<< " " << surfName.c_str() << ".****." << varName
|
||||
<< nl;
|
||||
}
|
||||
osCase << nl;
|
||||
@ -261,7 +305,8 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
||||
{
|
||||
Info<< "Writing mesh file to " << meshFile.name() << endl;
|
||||
}
|
||||
ensightGeoFile osGeom(meshFile, writeFormat_);
|
||||
// use two-argument form for path-name to avoid validating the base-dir
|
||||
ensightGeoFile osGeom(meshFile.path(), meshFile.name(), writeFormat_);
|
||||
osGeom << ensPart;
|
||||
}
|
||||
|
||||
@ -278,7 +323,8 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
||||
// Write field
|
||||
ensightFile osField
|
||||
(
|
||||
baseDir/surfaceName + "." + timeString + "." + fieldName,
|
||||
baseDir,
|
||||
surfName + "." + timeString + "." + varName,
|
||||
writeFormat_
|
||||
);
|
||||
if (verbose)
|
||||
@ -288,7 +334,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
||||
osField.writeKeyword(ensightPTraits<Type>::typeName);
|
||||
ensPart.writeField(osField, values, isNodeValues);
|
||||
|
||||
return baseDir/surfaceName + ".case";
|
||||
return baseDir/surfName + ".case";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionE
|
||||
submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C
|
||||
submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.C
|
||||
submodels/boundaryRadiationProperties/boundaryRadiationProperties.C
|
||||
submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C
|
||||
|
||||
/* Soot model */
|
||||
submodels/sootModel/sootModel/sootModel.C
|
||||
@ -52,6 +53,5 @@ derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTempe
|
||||
derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C
|
||||
derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
|
||||
derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C
|
||||
derivedFvPatchFields/boundaryRadiationProperties/boundaryRadiationPropertiesFvPatchField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libradiationModels
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,8 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "boundaryRadiationProperties.H"
|
||||
#include "boundaryRadiationPropertiesFvPatchField.H"
|
||||
#include "fvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -51,7 +49,7 @@ Foam::radiation::boundaryRadiationProperties::boundaryRadiationProperties
|
||||
Foam::GeometricMeshObject,
|
||||
boundaryRadiationProperties
|
||||
>(mesh),
|
||||
radBoundaryProperties_()
|
||||
radBoundaryPropertiesPtrList_(mesh.boundary().size())
|
||||
{
|
||||
IOobject boundaryIO
|
||||
(
|
||||
@ -59,15 +57,28 @@ Foam::radiation::boundaryRadiationProperties::boundaryRadiationProperties
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
if (boundaryIO.typeHeaderOk<volScalarField>(true))
|
||||
if (boundaryIO.typeHeaderOk<IOdictionary>(true))
|
||||
{
|
||||
radBoundaryProperties_.set
|
||||
(
|
||||
new volScalarField(boundaryIO, mesh)
|
||||
);
|
||||
const IOdictionary radiationDict(boundaryIO);
|
||||
|
||||
forAll (mesh.boundary(), patchi)
|
||||
{
|
||||
const polyPatch& pp = mesh.boundaryMesh()[patchi];
|
||||
|
||||
if (radiationDict.isDict(pp.name()))
|
||||
{
|
||||
const dictionary& dict = radiationDict.subDict(pp.name());
|
||||
|
||||
radBoundaryPropertiesPtrList_[patchi].set
|
||||
(
|
||||
new boundaryRadiationPropertiesPatch(pp, dict)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,18 +92,15 @@ Foam::radiation::boundaryRadiationProperties::emissivity
|
||||
const label bandI
|
||||
) const
|
||||
{
|
||||
if (!radBoundaryProperties_.empty())
|
||||
if (!radBoundaryPropertiesPtrList_[patchI].empty())
|
||||
{
|
||||
return refCast<const boundaryRadiationPropertiesFvPatchField>
|
||||
(
|
||||
radBoundaryProperties_->boundaryField()[patchI]
|
||||
).emissivity(bandI);
|
||||
return radBoundaryPropertiesPtrList_[patchI]->emissivity(bandI);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Field 'boundaryRadiationProperties'"
|
||||
<< "is not found in the constant directory. "
|
||||
<< "Patch : " << mesh().boundaryMesh()[patchI].name()
|
||||
<< " is not found in the boundaryRadiationProperties. "
|
||||
<< "Please add it"
|
||||
<< exit(FatalError);
|
||||
|
||||
@ -108,19 +116,16 @@ Foam::radiation::boundaryRadiationProperties::absorptivity
|
||||
const label bandI
|
||||
) const
|
||||
{
|
||||
if (!radBoundaryProperties_.empty())
|
||||
if (!radBoundaryPropertiesPtrList_[patchI].empty())
|
||||
{
|
||||
return refCast<const boundaryRadiationPropertiesFvPatchField>
|
||||
(
|
||||
radBoundaryProperties_->boundaryField()[patchI]
|
||||
).absorptivity(bandI);
|
||||
return radBoundaryPropertiesPtrList_[patchI]->absorptivity(bandI);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Field 'boundaryRadiationProperties'"
|
||||
<< "is not found in the constant directory. "
|
||||
<< "Please add it "
|
||||
<< "Patch : " << mesh().boundaryMesh()[patchI].name()
|
||||
<< " is not found in the boundaryRadiationProperties. "
|
||||
<< "Please add it"
|
||||
<< exit(FatalError);
|
||||
|
||||
return tmp<scalarField>(new scalarField());
|
||||
@ -135,18 +140,15 @@ Foam::radiation::boundaryRadiationProperties::transmissivity
|
||||
const label bandI
|
||||
) const
|
||||
{
|
||||
if (!radBoundaryProperties_.empty())
|
||||
if (!radBoundaryPropertiesPtrList_[patchI].empty())
|
||||
{
|
||||
return refCast<const boundaryRadiationPropertiesFvPatchField>
|
||||
(
|
||||
radBoundaryProperties_->boundaryField()[patchI]
|
||||
).transmissivity(bandI);
|
||||
return radBoundaryPropertiesPtrList_[patchI]->transmissivity(bandI);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Field 'boundaryRadiationProperties'"
|
||||
<< "is not found in the constant directory. "
|
||||
<< "Patch : " << mesh().boundaryMesh()[patchI].name()
|
||||
<< " is not found in the boundaryRadiationProperties. "
|
||||
<< "Please add it"
|
||||
<< exit(FatalError);
|
||||
|
||||
@ -162,18 +164,15 @@ Foam::radiation::boundaryRadiationProperties::reflectivity
|
||||
const label bandI
|
||||
) const
|
||||
{
|
||||
if (!radBoundaryProperties_.empty())
|
||||
if (!radBoundaryPropertiesPtrList_[patchI].empty())
|
||||
{
|
||||
return refCast<const boundaryRadiationPropertiesFvPatchField>
|
||||
(
|
||||
radBoundaryProperties_->boundaryField()[patchI]
|
||||
).reflectivity(bandI);
|
||||
return radBoundaryPropertiesPtrList_[patchI]->reflectivity(bandI);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Field 'boundaryRadiationProperties'"
|
||||
<< "is not found in the constant directory. "
|
||||
<< "Patch : " << mesh().boundaryMesh()[patchI].name()
|
||||
<< " is not found in the boundaryRadiationProperties. "
|
||||
<< "Please add it"
|
||||
<< exit(FatalError);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,8 +36,7 @@ SourceFiles
|
||||
#define boundaryRadiationProperties_H
|
||||
|
||||
#include "MeshObject.H"
|
||||
#include "GeometricField.H"
|
||||
#include "volMesh.H"
|
||||
#include "boundaryRadiationPropertiesPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,7 +49,7 @@ namespace radiation
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class boundaryRadiationProperties Declaration
|
||||
Class boundaryRadiationProperties Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class boundaryRadiationProperties
|
||||
@ -62,11 +61,11 @@ class boundaryRadiationProperties
|
||||
boundaryRadiationProperties
|
||||
>
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- AutoPtr to volSacalarField properties
|
||||
autoPtr<volScalarField> radBoundaryProperties_;
|
||||
//- Ptr list of boundaryRadiationProperties
|
||||
List<autoPtr<boundaryRadiationPropertiesPatch> >
|
||||
radBoundaryPropertiesPtrList_;
|
||||
|
||||
|
||||
public:
|
||||
@ -115,7 +114,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~boundaryRadiationProperties();
|
||||
~boundaryRadiationProperties();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,13 +23,10 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "boundaryRadiationPropertiesFvPatchField.H"
|
||||
#include "volFields.H"
|
||||
#include "boundaryRadiationPropertiesPatch.H"
|
||||
#include "mappedPatchBase.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "radiationModel.H"
|
||||
#include "absorptionEmissionModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,7 +35,7 @@ namespace Foam
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::methodType,
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::methodType,
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
@ -50,70 +47,54 @@ namespace Foam
|
||||
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::methodType,
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::methodType,
|
||||
3
|
||||
> Foam::radiation::boundaryRadiationPropertiesFvPatchField::methodTypeNames_;
|
||||
> Foam::radiation::boundaryRadiationPropertiesPatch::methodTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Private functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::label
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::nbrPatchIndex() const
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::nbrPatchIndex() const
|
||||
{
|
||||
// Get the coupling information from the mappedPatchBase
|
||||
const mappedPatchBase& mpp =
|
||||
refCast<const mappedPatchBase>(patch().patch());
|
||||
refCast<const mappedPatchBase>(patch_);
|
||||
|
||||
return (mpp.samplePolyPatch().index());
|
||||
}
|
||||
|
||||
|
||||
const Foam::fvMesh&
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::nbrRegion() const
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::nbrRegion() const
|
||||
{
|
||||
const mappedPatchBase& mpp =
|
||||
refCast<const mappedPatchBase>(patch().patch());
|
||||
refCast<const mappedPatchBase>(patch_);
|
||||
|
||||
return (refCast<const fvMesh>(mpp.sampleMesh()));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::
|
||||
boundaryRadiationPropertiesPatch
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
calculatedFvPatchScalarField(p, iF),
|
||||
method_(LOOKUP),
|
||||
dict_(),
|
||||
absorptionEmission_(NULL),
|
||||
transmissivity_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const polyPatch& p,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
calculatedFvPatchScalarField(p, iF),
|
||||
method_(methodTypeNames_.read(dict.lookup("mode"))),
|
||||
dict_(dict),
|
||||
absorptionEmission_(NULL),
|
||||
transmissivity_(NULL)
|
||||
transmissivity_(NULL),
|
||||
patch_(p)
|
||||
{
|
||||
switch (method_)
|
||||
{
|
||||
case SOLIDRADIATION:
|
||||
{
|
||||
if (!isA<mappedPatchBase>(p.patch()))
|
||||
if (!isA<mappedPatchBase>(p))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "\n patch type '" << p.type()
|
||||
@ -126,23 +107,18 @@ boundaryRadiationPropertiesFvPatchField
|
||||
|
||||
case MODEL:
|
||||
{
|
||||
const fvMesh& mesh = this->dimensionedInternalField().mesh();
|
||||
const fvMesh& mesh =
|
||||
refCast<const fvMesh>(p.boundaryMesh().mesh());
|
||||
|
||||
//if (dict.found("absorptionEmissionModel"))
|
||||
{
|
||||
absorptionEmission_.reset
|
||||
(
|
||||
absorptionEmissionModel::New(dict, mesh).ptr()
|
||||
);
|
||||
}
|
||||
absorptionEmission_.reset
|
||||
(
|
||||
absorptionEmissionModel::New(dict, mesh).ptr()
|
||||
);
|
||||
|
||||
// if (dict.found("transmissivityModel"))
|
||||
{
|
||||
transmissivity_.reset
|
||||
(
|
||||
transmissivityModel::New(dict, mesh).ptr()
|
||||
);
|
||||
}
|
||||
transmissivity_.reset
|
||||
(
|
||||
transmissivityModel::New(dict, mesh).ptr()
|
||||
);
|
||||
}
|
||||
case LOOKUP:
|
||||
{
|
||||
@ -151,87 +127,33 @@ boundaryRadiationPropertiesFvPatchField
|
||||
break;
|
||||
}
|
||||
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchScalarField::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchScalarField::operator=(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
(
|
||||
const boundaryRadiationPropertiesFvPatchField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
calculatedFvPatchScalarField(ptf, p, iF, mapper),
|
||||
method_(ptf.method_),
|
||||
dict_(ptf.dict_),
|
||||
absorptionEmission_(NULL),
|
||||
transmissivity_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
(
|
||||
const boundaryRadiationPropertiesFvPatchField& ptf
|
||||
)
|
||||
:
|
||||
calculatedFvPatchScalarField(ptf),
|
||||
method_(ptf.method_),
|
||||
dict_(ptf.dict_),
|
||||
absorptionEmission_(NULL),
|
||||
transmissivity_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
(
|
||||
const boundaryRadiationPropertiesFvPatchField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
calculatedFvPatchScalarField(ptf, iF),
|
||||
method_(ptf.method_),
|
||||
dict_(ptf.dict_),
|
||||
absorptionEmission_(NULL),
|
||||
transmissivity_(NULL)
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::
|
||||
~boundaryRadiationPropertiesPatch()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::radiation::absorptionEmissionModel&
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::
|
||||
absorptionEmission() const
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::absorptionEmission() const
|
||||
{
|
||||
return absorptionEmission_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::radiation::transmissivityModel&
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::
|
||||
transmissiveModel() const
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::transmissiveModel() const
|
||||
{
|
||||
return transmissivity_();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::emissivity
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::emissivity
|
||||
(
|
||||
const label bandI
|
||||
) const
|
||||
@ -257,7 +179,7 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::emissivity
|
||||
);
|
||||
|
||||
const mappedPatchBase& mpp =
|
||||
refCast<const mappedPatchBase>(patch().patch());
|
||||
refCast<const mappedPatchBase>(patch_);
|
||||
|
||||
mpp.distribute(emissivity);
|
||||
|
||||
@ -272,7 +194,11 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::emissivity
|
||||
{
|
||||
tmp<scalarField> e
|
||||
(
|
||||
new scalarField("emissivity", dict_, patch().size())
|
||||
new scalarField
|
||||
(
|
||||
patch_.size(),
|
||||
readScalar(dict_.lookup("emissivity"))
|
||||
)
|
||||
);
|
||||
|
||||
return e;
|
||||
@ -280,7 +206,7 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::emissivity
|
||||
|
||||
case MODEL:
|
||||
{
|
||||
const label index = patch().index();
|
||||
const label index = patch_.index();
|
||||
|
||||
tmp<scalarField> e
|
||||
(
|
||||
@ -307,7 +233,7 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::emissivity
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::absorptivity
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::absorptivity
|
||||
(
|
||||
const label bandI
|
||||
) const
|
||||
@ -333,7 +259,7 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::absorptivity
|
||||
);
|
||||
|
||||
const mappedPatchBase& mpp =
|
||||
refCast<const mappedPatchBase>(patch().patch());
|
||||
refCast<const mappedPatchBase>(patch_);
|
||||
|
||||
mpp.distribute(absorp);
|
||||
|
||||
@ -346,7 +272,7 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::absorptivity
|
||||
|
||||
case MODEL:
|
||||
{
|
||||
const label index = patch().index();
|
||||
const label index = patch_.index();
|
||||
tmp<scalarField> a
|
||||
(
|
||||
new scalarField
|
||||
@ -361,7 +287,11 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::absorptivity
|
||||
{
|
||||
tmp<scalarField> a
|
||||
(
|
||||
new scalarField("absorptivity", dict_, patch().size())
|
||||
new scalarField
|
||||
(
|
||||
patch_.size(),
|
||||
readScalar(dict_.lookup("absorptivity"))
|
||||
)
|
||||
);
|
||||
|
||||
return a;
|
||||
@ -383,7 +313,7 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::absorptivity
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::transmissivity
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::transmissivity
|
||||
(
|
||||
const label bandI
|
||||
) const
|
||||
@ -409,7 +339,7 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::transmissivity
|
||||
);
|
||||
|
||||
const mappedPatchBase& mpp =
|
||||
refCast<const mappedPatchBase>(patch().patch());
|
||||
refCast<const mappedPatchBase>(patch_);
|
||||
|
||||
mpp.distribute(trans);
|
||||
|
||||
@ -422,7 +352,7 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::transmissivity
|
||||
|
||||
case MODEL:
|
||||
{
|
||||
const label index = patch().index();
|
||||
const label index = patch_.index();
|
||||
tmp<scalarField> tau
|
||||
(
|
||||
new scalarField
|
||||
@ -439,9 +369,11 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::transmissivity
|
||||
(
|
||||
new scalarField
|
||||
(
|
||||
"transmissivity", dict_, patch().size()
|
||||
patch_.size(),
|
||||
readScalar(dict_.lookup("transmissivity"))
|
||||
)
|
||||
);
|
||||
|
||||
return tau;
|
||||
}
|
||||
|
||||
@ -460,9 +392,8 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::transmissivity
|
||||
}
|
||||
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::radiation::boundaryRadiationPropertiesFvPatchField::reflectivity
|
||||
Foam::radiation::boundaryRadiationPropertiesPatch::reflectivity
|
||||
(
|
||||
const label bandI
|
||||
) const
|
||||
@ -474,13 +405,11 @@ Foam::radiation::boundaryRadiationPropertiesFvPatchField::reflectivity
|
||||
}
|
||||
|
||||
|
||||
void Foam::radiation::boundaryRadiationPropertiesFvPatchField::write
|
||||
void Foam::radiation::boundaryRadiationPropertiesPatch::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
calculatedFvPatchScalarField::write(os);
|
||||
|
||||
os.writeKeyword("mode") << methodTypeNames_[method_]
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
@ -517,18 +446,18 @@ void Foam::radiation::boundaryRadiationPropertiesFvPatchField::write
|
||||
|
||||
case LOOKUP:
|
||||
{
|
||||
const scalarField emissivity("emissivity", dict_, patch().size());
|
||||
const scalarField emissivity("emissivity", dict_, patch_.size());
|
||||
emissivity.writeEntry("emissivity", os);
|
||||
|
||||
const scalarField absorptivity
|
||||
(
|
||||
"absorptivity", dict_, patch().size()
|
||||
"absorptivity", dict_, patch_.size()
|
||||
);
|
||||
absorptivity.writeEntry("absorptivity", os);
|
||||
|
||||
const scalarField transmissivity
|
||||
(
|
||||
"transmissivity", dict_, patch().size()
|
||||
"transmissivity", dict_, patch_.size()
|
||||
);
|
||||
transmissivity.writeEntry("transmissivity", os);
|
||||
|
||||
@ -542,18 +471,4 @@ void Foam::radiation::boundaryRadiationPropertiesFvPatchField::write
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::boundaryRadiationPropertiesFvPatchField
|
||||
Foam::boundaryRadiationPropertiesPatch
|
||||
|
||||
Description
|
||||
Common functions to emissivity. It gets supplied from lookup into a
|
||||
@ -33,12 +33,12 @@ Description
|
||||
- 'model' : use a model
|
||||
|
||||
SourceFiles
|
||||
boundaryRadiationPropertiesFvPatchField.C
|
||||
boundaryRadiationPropertiesPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef boundaryRadiationPropertiesFvPatchField_H
|
||||
#define boundaryRadiationPropertiesFvPatchField_H
|
||||
#ifndef boundaryRadiationPropertiesPatch_H
|
||||
#define boundaryRadiationPropertiesPatch_H
|
||||
|
||||
#include "scalarField.H"
|
||||
#include "NamedEnum.H"
|
||||
@ -54,16 +54,14 @@ namespace Foam
|
||||
namespace radiation
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class boundaryRadiationPropertiesFvPatchField Declaration
|
||||
Class boundaryRadiationPropertiesPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class boundaryRadiationPropertiesFvPatchField
|
||||
:
|
||||
public calculatedFvPatchScalarField
|
||||
class boundaryRadiationPropertiesPatch
|
||||
{
|
||||
public:
|
||||
|
||||
// - Type of look up
|
||||
// - Type of method
|
||||
enum methodType
|
||||
{
|
||||
SOLIDRADIATION,
|
||||
@ -90,6 +88,9 @@ private:
|
||||
//- transmissivity model
|
||||
autoPtr<transmissivityModel> transmissivity_;
|
||||
|
||||
//- reference to fvPatch
|
||||
const polyPatch& patch_;
|
||||
|
||||
|
||||
// Private functions
|
||||
|
||||
@ -102,70 +103,19 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("boundaryRadiation");
|
||||
|
||||
// Constructors
|
||||
|
||||
|
||||
//- Construct from patch and internal field
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
boundaryRadiationPropertiesPatch
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const polyPatch&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given a
|
||||
// greyDiffusiveViewFactorFixedValueFvPatchScalarField onto a new patch
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
(
|
||||
const boundaryRadiationPropertiesFvPatchField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
(
|
||||
const boundaryRadiationPropertiesFvPatchField&
|
||||
);
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
boundaryRadiationPropertiesFvPatchField
|
||||
(
|
||||
const boundaryRadiationPropertiesFvPatchField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new boundaryRadiationPropertiesFvPatchField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new boundaryRadiationPropertiesFvPatchField(*this, iF)
|
||||
);
|
||||
}
|
||||
//- Destructor
|
||||
virtual ~boundaryRadiationPropertiesPatch();
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -196,7 +146,7 @@ public:
|
||||
tmp<scalarField> reflectivity(const label bandI = 0) const;
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ boundaryField
|
||||
type activePressureForceBaffleVelocity;
|
||||
value uniform (0 0 0);
|
||||
cyclicPatch baffleCyclic_half0;
|
||||
orientation 1;
|
||||
opening 1;
|
||||
openingTime 0.01;
|
||||
maxOpenFractionDelta 0.1;
|
||||
openFraction 0;
|
||||
|
||||
@ -9,36 +9,25 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
region0_to_pyrolysisRegion_coupledWall
|
||||
{
|
||||
region0_to_pyrolysisRegion_coupledWall
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode solidRadiation;
|
||||
}
|
||||
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 1.0;
|
||||
transmissivity uniform 0.0;
|
||||
}
|
||||
"procBoundary.*"
|
||||
{
|
||||
type processor;
|
||||
value $internalField;
|
||||
}
|
||||
mode solidRadiation;
|
||||
}
|
||||
|
||||
".*"
|
||||
{
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
absorptivity 1.0;
|
||||
transmissivity 0.0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -9,35 +9,25 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
".*"
|
||||
{
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
value uniform 0;
|
||||
}
|
||||
"(region0_to.*)"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode solidRadiation;
|
||||
value uniform 0;
|
||||
}
|
||||
"procBoundary.*"
|
||||
{
|
||||
type processor;
|
||||
value $internalField;
|
||||
}
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
}
|
||||
|
||||
"(region0_to.*)"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode solidRadiation;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -9,33 +9,35 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
base
|
||||
{
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
value uniform 0;
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
"procBoundary.*"
|
||||
{
|
||||
type processor;
|
||||
value $internalField;
|
||||
}
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
}
|
||||
|
||||
sides
|
||||
{
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
}
|
||||
|
||||
inlet
|
||||
{
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -9,7 +9,7 @@ application=`getApplication`
|
||||
runApplication blockMesh
|
||||
runApplication topoSet
|
||||
runApplication createPatch -overwrite
|
||||
runApplication decomposePar -force -constant
|
||||
runApplication decomposePar -force
|
||||
|
||||
# Run
|
||||
runParallel $application
|
||||
|
||||
@ -9,30 +9,18 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
".*"
|
||||
{
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 0.0;
|
||||
value uniform 0.0;
|
||||
}
|
||||
"procBoundary.*"
|
||||
{
|
||||
type processor;
|
||||
value $internalField;
|
||||
}
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
absorptivity 0.0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -9,52 +9,18 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
".*"
|
||||
{
|
||||
box
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 1.0;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
floor
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 1.0;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
ceiling
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 1.0;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
fixedWalls
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 1.0;
|
||||
value uniform 0;
|
||||
}
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
absorptivity 1.0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -9,25 +9,18 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
".*"
|
||||
{
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 1.0;
|
||||
value uniform 0.0;
|
||||
}
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
absorptivity 1.0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -9,42 +9,30 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
".*"
|
||||
{
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 0.0;
|
||||
transmissivity uniform 1.0;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 0.0;
|
||||
transmissivity uniform 1.0;
|
||||
}
|
||||
|
||||
value uniform 0.0;
|
||||
}
|
||||
|
||||
air_to_solid
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode solidRadiation;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
air_to_floor
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode solidRadiation;
|
||||
value uniform 0;
|
||||
}
|
||||
air_to_solid
|
||||
{
|
||||
mode solidRadiation;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
air_to_floor
|
||||
{
|
||||
mode solidRadiation;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -9,32 +9,25 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
".*"
|
||||
{
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 1.0;
|
||||
value uniform 0; // Dummy value
|
||||
}
|
||||
|
||||
"bottomAir_to_.*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode solidRadiation;
|
||||
value uniform 0; // Dummy value
|
||||
}
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
absorptivity 1.0;
|
||||
}
|
||||
|
||||
"bottomAir_to_.*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode solidRadiation;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -9,31 +9,21 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
".*"
|
||||
{
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
value uniform 0; // Dummy value
|
||||
}
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
}
|
||||
|
||||
"topAir_to_.*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode solidRadiation;
|
||||
value uniform 0; // Dummy value
|
||||
}
|
||||
"topAir_to_.*"
|
||||
{
|
||||
mode solidRadiation;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -11,11 +11,11 @@ cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
|
||||
mkdir 0
|
||||
|
||||
runApplication blockMesh
|
||||
cp system/decomposeParDict.hierarchical system/decomposeParDict
|
||||
runApplication decomposePar
|
||||
# cp system/decomposeParDict.hierarchical system/decomposeParDict
|
||||
runApplication decomposePar -decomposeParDict system/decomposeParDict.hierarchical
|
||||
|
||||
cp system/decomposeParDict.ptscotch system/decomposeParDict
|
||||
runParallel snappyHexMesh -overwrite -parallel
|
||||
# cp system/decomposeParDict.ptscotch system/decomposeParDict
|
||||
runParallel snappyHexMesh -decomposeParDict system/decomposeParDict.ptscotch -overwrite -parallel
|
||||
|
||||
find . -type f -iname "*level*" -exec rm {} \;
|
||||
|
||||
|
||||
@ -9,33 +9,18 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
".*"
|
||||
{
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity uniform 1.0;
|
||||
absorptivity uniform 0.0;
|
||||
value uniform 0.0;
|
||||
}
|
||||
symmetry
|
||||
{
|
||||
type symmetryPlane;
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
absorptivity 0.0;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
52
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/0/U
Normal file
52
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/0/U
Normal file
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format binary;
|
||||
class volVectorField;
|
||||
object Uair;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform (0 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
inlet
|
||||
{
|
||||
type uniformFixedValue;
|
||||
uniformValue table
|
||||
(
|
||||
(0 (0 0 0.1))
|
||||
(1 (0 0 0.1))
|
||||
(4 (0 0 0.3))
|
||||
(14 (0 0 0.5))
|
||||
);
|
||||
}
|
||||
outlet
|
||||
{
|
||||
type pressureInletOutletVelocity;
|
||||
value $internalField;
|
||||
inletValue $internalField;
|
||||
}
|
||||
walls
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
base
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform (0 0 0);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,56 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object alpha.water;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 0 0 0 0];
|
||||
|
||||
internalField uniform 1;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
inlet
|
||||
{
|
||||
type uniformFixedValue;
|
||||
uniformValue table
|
||||
(
|
||||
(0 1)
|
||||
(1 1)
|
||||
(1.01 0)
|
||||
(14 0)
|
||||
);
|
||||
|
||||
}
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue uniform 0;
|
||||
value uniform 0;
|
||||
}
|
||||
walls
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
base
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
defaultFaces
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,48 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object epsilon;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 2 -3 0 0 0 0];
|
||||
|
||||
internalField uniform 0.1;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
walls
|
||||
{
|
||||
type epsilonWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
base
|
||||
{
|
||||
type epsilonWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
48
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/0/k
Normal file
48
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/0/k
Normal file
@ -0,0 +1,48 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object k;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 2 -2 0 0 0 0];
|
||||
|
||||
internalField uniform 1e-2;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
walls
|
||||
{
|
||||
type kqRWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
base
|
||||
{
|
||||
type kqRWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
47
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/0/nut
Normal file
47
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/0/nut
Normal file
@ -0,0 +1,47 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object nut;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 2 -1 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
inlet
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
outlet
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
walls
|
||||
{
|
||||
type nutkWallFunction;
|
||||
value uniform 0;
|
||||
}
|
||||
base
|
||||
{
|
||||
type nutkWallFunction;
|
||||
value uniform 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
46
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/0/p_rgh
Normal file
46
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/0/p_rgh
Normal file
@ -0,0 +1,46 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object p_rgh;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 1 -1 -2 0 0 0 0 ];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
inlet
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
value uniform 0;
|
||||
}
|
||||
outlet
|
||||
{
|
||||
type prghTotalPressure;
|
||||
p0 uniform 0;
|
||||
value uniform 0;
|
||||
}
|
||||
walls
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
value uniform 0;
|
||||
}
|
||||
base
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
value uniform 0;
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
12
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/Allclean
Executable file
12
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/Allclean
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Source tutorial clean functions
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||
|
||||
cleanCase
|
||||
|
||||
rm system/blockMeshDict
|
||||
rm 0/alpha.water
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
36
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/Allrun
Executable file
36
tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/Allrun
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
|
||||
# Set application name
|
||||
application=`getApplication`
|
||||
|
||||
# create the underlying block mesh
|
||||
m4 system/pachuka.m4 > system/blockMeshDict
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
cp 0/alpha.water.org 0/alpha.water
|
||||
|
||||
# create faceSet for burner inlet and faceZone for coupled wall
|
||||
runApplication topoSet
|
||||
|
||||
# create burner inlet
|
||||
runApplication createPatch -overwrite
|
||||
|
||||
# Set alpha.water
|
||||
runApplication setFields
|
||||
|
||||
# Decompose mesh
|
||||
decomposePar > log.decomposePar 2>&1
|
||||
|
||||
# Run
|
||||
runParallel `getApplication`
|
||||
|
||||
# Reconstruct case
|
||||
runApplication reconstructPar
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user