Compare commits

..

15 Commits

Author SHA1 Message Date
3cc0f809dc WIP: Updated lagrangian solvers followinf library changes 2022-09-12 21:16:09 +01:00
32dbc380ea WIP: deprecated lagrangian coal combustion - models added to reactingMultiphase 2022-09-12 21:16:09 +01:00
2e5c590db6 ENH: Added new parcelFoam solver based on kinematicParcelFoam 2022-09-12 21:16:09 +01:00
5c924f6cf9 STYLE: lagrangian turbulence library - removed 'basic' prefix 2022-09-12 21:16:09 +01:00
536bb445fb STYLE: lagrangian intermediate library - removed 'basic' prefix 2022-09-12 21:16:09 +01:00
1cac9ab826 WIP: Added new rhoParcelFoam solver based on reactingParcelFoam 2022-09-12 21:16:09 +01:00
ba8e26f4fd WIP: migrated coalCloudList to parcelCloudModelList 2022-09-12 21:16:09 +01:00
3c863d3fa3 WIP: clouds - moved spray cloud and parcels to main intermediate library 2022-09-12 21:16:09 +01:00
d2e6ff64c9 WIP: clouds - updated dependent code 2022-08-31 10:20:35 +01:00
9e55fec128 WIP: clouds - refactoring 2022-08-31 10:20:08 +01:00
f36629cf40 WIP: Clouds - new run-time selection based on openfoam.org changes 2022-08-31 10:20:08 +01:00
371ce8a89e WIP: clouds - added debug - based on openfoam.org changes 2022-08-31 10:20:08 +01:00
45e8754ec3 DUMMY 2022-08-31 10:20:04 +01:00
ba7034cc8f WIP: Clouds - new run-time selection based on openfoam.org changes 2022-08-30 17:59:26 +01:00
6acaf99580 WIP: Removed base classes 2022-08-26 16:38:35 +01:00
12650 changed files with 69871 additions and 132112 deletions

View File

@ -49,7 +49,7 @@
<!-- <!--
Providing details of your set-up can help us identify any issues, e.g. Providing details of your set-up can help us identify any issues, e.g.
OpenFOAM version : v2212|v2206|v2112|v2106|v2012 etc OpenFOAM version : v2206|v2112|v2106|v2012|v2006 etc
Operating system : ubuntu|openSUSE|centos etc Operating system : ubuntu|openSUSE|centos etc
Hardware info : any info that may help? Hardware info : any info that may help?
Compiler : gcc|intel|clang etc Compiler : gcc|intel|clang etc

View File

@ -1,2 +1,2 @@
api=2301 api=2206
patch=230110 patch=0

View File

@ -40,9 +40,9 @@ Violations of the Trademark are monitored, and will be duly prosecuted.
If OpenFOAM has already been compiled on your system, simply source If OpenFOAM has already been compiled on your system, simply source
the appropriate `etc/bashrc` or `etc/cshrc` file and get started. the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
For example, for the OpenFOAM-v2212 version: For example, for the OpenFOAM-v2206 version:
``` ```
source /installation/path/OpenFOAM-v2212/etc/bashrc source /installation/path/OpenFOAM-v2206/etc/bashrc
``` ```
## Compiling OpenFOAM ## Compiling OpenFOAM
@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
to the OpenFOAM directory. For example, to the OpenFOAM directory. For example,
``` ```
/path/parent /path/parent
|-- OpenFOAM-v2212 |-- OpenFOAM-v2206
\-- ThirdParty-v2212 \-- ThirdParty-v2206
``` ```
There are, however, many cases where this simple convention is inadequate: There are, however, many cases where this simple convention is inadequate:
@ -136,7 +136,7 @@ There are, however, many cases where this simple convention is inadequate:
operating system or cluster installation provides it) operating system or cluster installation provides it)
* When we have changed the OpenFOAM directory name to some arbitrary * When we have changed the OpenFOAM directory name to some arbitrary
directory name, e.g. openfoam-sandbox2212, etc.. directory name, e.g. openfoam-sandbox2206, etc..
* When we would like any additional 3rd party software to be located * When we would like any additional 3rd party software to be located
inside of the OpenFOAM directory to ensure that the installation is inside of the OpenFOAM directory to ensure that the installation is
@ -156,9 +156,9 @@ when locating the ThirdParty directory with the following precedence:
2. PREFIX/ThirdParty-VERSION 2. PREFIX/ThirdParty-VERSION
* this corresponds to the traditional approach * this corresponds to the traditional approach
3. PREFIX/ThirdParty-vAPI 3. PREFIX/ThirdParty-vAPI
* allows for an updated value of VERSION, *eg*, `v2212-myCustom`, * allows for an updated value of VERSION, *eg*, `v2206-myCustom`,
without requiring a renamed ThirdParty. The API value would still without requiring a renamed ThirdParty. The API value would still
be `2212` and the original `ThirdParty-v2212/` would be found. be `2206` and the original `ThirdParty-v2206/` would be found.
4. PREFIX/ThirdParty-API 4. PREFIX/ThirdParty-API
* same as the previous example, but using an unadorned API value. * same as the previous example, but using an unadorned API value.
5. PREFIX/ThirdParty-common 5. PREFIX/ThirdParty-common

View File

@ -11,5 +11,4 @@ EXE_LIBS = \
-lfvOptions \ -lfvOptions \
-lmeshTools \ -lmeshTools \
-lsampling \ -lsampling \
-lregionFaModels \ -lregionFaModels
-lfiniteArea

View File

@ -3,7 +3,6 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/overset/lnInclude \ -I$(LIB_SRC)/overset/lnInclude \
-I$(LIB_SRC)/overset/include/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \

View File

@ -31,25 +31,3 @@
Info<< "Reading diffusivity DT\n" << endl; Info<< "Reading diffusivity DT\n" << endl;
dimensionedScalar DT("DT", dimViscosity, transportProperties); dimensionedScalar DT("DT", dimViscosity, transportProperties);
bool oversetPatchErrOutput =
simple.dict().getOrDefault("oversetPatchErrOutput", false);
// Dummy phi for oversetPatchErrOutput
tmp<surfaceScalarField> tdummyPhi;
if (oversetPatchErrOutput)
{
tdummyPhi = tmp<surfaceScalarField>::New
(
IOobject
(
"dummyPhi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar(dimless, Zero)
);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,7 +58,6 @@ Description
#include "fvOptions.H" #include "fvOptions.H"
#include "simpleControl.H" #include "simpleControl.H"
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "oversetPatchPhiErr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -100,11 +99,6 @@ int main(int argc, char *argv[])
fvOptions.constrain(TEqn); fvOptions.constrain(TEqn);
TEqn.solve(); TEqn.solve();
fvOptions.correct(T); fvOptions.correct(T);
if (oversetPatchErrOutput)
{
oversetPatchPhiErr(TEqn, tdummyPhi.ref());
}
} }
#include "write.H" #include "write.H"

View File

@ -1,4 +1,125 @@
#include "../createFields.H" Info<< "Reading velocity field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
// Initialise the velocity internal field to zero
U = dimensionedVector(U.dimensions(), Zero);
surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
fvc::flux(U)
);
if (args.found("initialiseUBCs"))
{
U.correctBoundaryConditions();
phi = fvc::flux(U);
}
// Construct a pressure field
// If it is available read it otherwise construct from the velocity BCs
// converting fixed-value BCs to zero-gradient and vice versa.
// Allow override from command-line -pName option
const word pName = args.getOrDefault<word>("pName", "p");
// Infer the pressure BCs from the velocity
wordList pBCTypes
(
U.boundaryField().size(),
fixedValueFvPatchScalarField::typeName
);
forAll(U.boundaryField(), patchi)
{
if (U.boundaryField()[patchi].fixesValue())
{
pBCTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
}
}
// Note that registerObject is false for the pressure field. The pressure
// field in this solver doesn't have a physical value during the solution.
// It shouldn't be looked up and used by sub models or boundary conditions.
Info<< "Constructing pressure field " << pName << nl << endl;
volScalarField p
(
IOobject
(
pName,
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
),
mesh,
dimensionedScalar(sqr(dimVelocity), Zero),
pBCTypes
);
// Infer the velocity potential BCs from the pressure
wordList PhiBCTypes
(
p.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
);
forAll(p.boundaryField(), patchi)
{
if (p.boundaryField()[patchi].fixesValue())
{
PhiBCTypes[patchi] = fixedValueFvPatchScalarField::typeName;
}
}
Info<< "Constructing velocity potential field Phi\n" << endl;
volScalarField Phi
(
IOobject
(
"Phi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar(dimLength*dimVelocity, Zero),
PhiBCTypes
);
label PhiRefCell = 0;
scalar PhiRefValue = 0;
setRefCell
(
Phi,
potentialFlow.dict(),
PhiRefCell,
PhiRefValue
);
mesh.setFluxRequired(Phi.name());
#include "createMRF.H"
// Add solver-specific interpolations // Add solver-specific interpolations
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd Copyright (C) 2017 OpenCFD Ltd
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -83,7 +83,6 @@ Description
\heading Options \heading Options
\plaintable \plaintable
-writep | write the Euler pressure -writep | write the Euler pressure
-writephi | Write the final volumetric flux
-writePhi | Write the final velocity potential -writePhi | Write the final velocity potential
-initialiseUBCs | Update the velocity boundaries before solving for Phi -initialiseUBCs | Update the velocity boundaries before solving for Phi
\endplaintable \endplaintable
@ -118,12 +117,6 @@ int main(int argc, char *argv[])
"Initialise U boundary conditions" "Initialise U boundary conditions"
); );
argList::addBoolOption
(
"writephi",
"Write the final volumetric flux field"
);
argList::addBoolOption argList::addBoolOption
( (
"writePhi", "writePhi",
@ -142,8 +135,6 @@ int main(int argc, char *argv[])
"Execute functionObjects" "Execute functionObjects"
); );
#include "addRegionOption.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H" #include "setRootCaseLists.H"
#include "createTime.H" #include "createTime.H"
#include "createNamedDynamicFvMesh.H" #include "createNamedDynamicFvMesh.H"
@ -158,6 +149,7 @@ int main(int argc, char *argv[])
mesh.update(); mesh.update();
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
// Since solver contains no time loop it would never execute // Since solver contains no time loop it would never execute
// function objects so do it ourselves // function objects so do it ourselves
@ -203,16 +195,11 @@ int main(int argc, char *argv[])
<< endl; << endl;
} }
// Write U // Write U and phi
U.write(); U.write();
phi.write();
// Optionally write the volumetric flux, phi // Optionally write Phi
if (args.found("writephi"))
{
phi.write();
}
// Optionally write velocity potential, Phi
if (args.found("writePhi")) if (args.found("writePhi"))
{ {
Phi.write(); Phi.write();

View File

@ -116,7 +116,7 @@ int main(int argc, char *argv[])
"normalisedGradP", "normalisedGradP",
tmagGradP()/max(tmagGradP()) tmagGradP()/max(tmagGradP())
); );
normalisedGradP.writeOpt(IOobject::AUTO_WRITE); normalisedGradP.writeOpt() = IOobject::AUTO_WRITE;
tmagGradP.clear(); tmagGradP.clear();
++runTime; ++runTime;

View File

@ -109,7 +109,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh, mesh,
dimensionedScalar(Nv.dimensions(), Zero) dimensionedScalar(Nv.dimensions(), Zero)

View File

@ -171,7 +171,10 @@ if (ign.ignited())
fvOptions.correct(Su); fvOptions.correct(Su);
Su.clamp_range(SuMin, SuMax); // Limit the maximum Su
// ~~~~~~~~~~~~~~~~~~~~
Su.min(SuMax);
Su.max(SuMin);
} }
else else
{ {
@ -215,7 +218,7 @@ if (ign.ignited())
+ ( + (
scalar(1) scalar(1)
+ (2*XiShapeCoef) + (2*XiShapeCoef)
*(scalar(0.5) - clamp(b, zero_one{})) *(scalar(0.5) - min(max(b, scalar(0)), scalar(1)))
)*(XiEqStar - scalar(1.001)) )*(XiEqStar - scalar(1.001))
); );

View File

@ -12,7 +12,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh, mesh,
dimensionedScalar("Ydefault", dimless, 1) dimensionedScalar("Ydefault", dimless, 1)
@ -29,7 +29,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh, mesh,
dimensionedScalar("p", dimPressure, p0) dimensionedScalar("p", dimPressure, p0)
@ -46,7 +46,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh, mesh,
dimensionedScalar("T", dimTemperature, T0) dimensionedScalar("T", dimTemperature, T0)

View File

@ -1,8 +1,8 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \

View File

@ -39,13 +39,13 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
radiation->correct(); radiation->correct();

View File

@ -1,9 +1,9 @@
Info<< "\nConstructing reacting cloud" << endl; Info<< "\nConstructing reacting cloud" << endl;
basicReactingCloud parcels reactingCloud parcels
( (
"reactingCloud1", "reactingCloud1",
g,
rho, rho,
U, U,
g,
slgThermo slgThermo
); );

View File

@ -37,7 +37,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "basicReactingCloud.H" #include "reactingCloud.H"
#include "surfaceFilmModel.H" #include "surfaceFilmModel.H"
#include "pyrolysisModelCollection.H" #include "pyrolysisModelCollection.H"
#include "radiationModel.H" #include "radiationModel.H"

View File

@ -38,11 +38,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }

View File

@ -103,7 +103,14 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
<< exit(FatalIOError); << exit(FatalIOError);
} }
if (!this->readValueEntry(dict)) if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
{ {
fvPatchField<scalar>::operator=(patchInternalField()); fvPatchField<scalar>::operator=(patchInternalField());
} }
@ -158,10 +165,14 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
return; return;
} }
const auto& pmu = patch().lookupPatchField<volScalarField>(muName_); const fvPatchScalarField& pmu =
const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_); patch().lookupPatchField<volScalarField, scalar>(muName_);
const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_); const fvPatchScalarField& prho =
const auto& pU = patch().lookupPatchField<volVectorField>(UName_); patch().lookupPatchField<volScalarField, scalar>(rhoName_);
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>(psiName_);
const fvPatchVectorField& pU =
patch().lookupPatchField<volVectorField, vector>(UName_);
// Prandtl number reading consistent with rhoCentralFoam // Prandtl number reading consistent with rhoCentralFoam
const dictionary& thermophysicalProperties = const dictionary& thermophysicalProperties =
@ -196,7 +207,7 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
// Write // Write
void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeEntryIfDifferent<word>("U", "U", UName_); os.writeEntryIfDifferent<word>("U", "U", UName_);
os.writeEntryIfDifferent<word>("rho", "rho", rhoName_); os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
@ -206,7 +217,7 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
os.writeEntry("accommodationCoeff", accommodationCoeff_); os.writeEntry("accommodationCoeff", accommodationCoeff_);
Twall_.writeEntry("Twall", os); Twall_.writeEntry("Twall", os);
os.writeEntry("gamma", gamma_); os.writeEntry("gamma", gamma_);
fvPatchField<scalar>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -105,15 +105,18 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
<< exit(FatalIOError); << exit(FatalIOError);
} }
if (this->readValueEntry(dict)) if (dict.found("value"))
{ {
const auto* hasRefValue = dict.findEntry("refValue", keyType::LITERAL); fvPatchField<vector>::operator=
const auto* hasFrac = dict.findEntry("valueFraction", keyType::LITERAL); (
vectorField("value", dict, p.size())
);
if (hasRefValue && hasFrac) if (dict.found("refValue") && dict.found("valueFraction"))
{ {
this->refValue().assign(*hasRefValue, p.size()); this->refValue() = vectorField("refValue", dict, p.size());
this->valueFraction().assign(*hasFrac, p.size()); this->valueFraction() =
scalarField("valueFraction", dict, p.size());
} }
else else
{ {
@ -152,9 +155,12 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
return; return;
} }
const auto& pmu = patch().lookupPatchField<volScalarField>(muName_); const fvPatchScalarField& pmu =
const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_); patch().lookupPatchField<volScalarField, scalar>(muName_);
const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_); const fvPatchScalarField& prho =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>(psiName_);
Field<scalar> C1 Field<scalar> C1
( (
@ -181,8 +187,8 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
if (curvature_) if (curvature_)
{ {
const auto& ptauMC = const fvPatchTensorField& ptauMC =
patch().lookupPatchField<volTensorField>(tauMCName_); patch().lookupPatchField<volTensorField, tensor>(tauMCName_);
vectorField n(patch().nf()); vectorField n(patch().nf());
refValue() -= C1/prho*transform(I - n*n, (n & ptauMC)); refValue() -= C1/prho*transform(I - n*n, (n & ptauMC));
@ -194,7 +200,7 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchField<vector>::write(os); fvPatchVectorField::write(os);
os.writeEntryIfDifferent<word>("T", "T", TName_); os.writeEntryIfDifferent<word>("T", "T", TName_);
os.writeEntryIfDifferent<word>("rho", "rho", rhoName_); os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_); os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
@ -209,7 +215,7 @@ void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const
refValue().writeEntry("refValue", os); refValue().writeEntry("refValue", os);
valueFraction().writeEntry("valueFraction", os); valueFraction().writeEntry("valueFraction", os);
fvPatchField<vector>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -104,8 +104,11 @@ void Foam::fixedRhoFvPatchScalarField::updateCoeffs()
return; return;
} }
const auto& psip = patch().lookupPatchField<volScalarField>(psiName_); const fvPatchField<scalar>& psip =
const auto& pp = patch().lookupPatchField<volScalarField>(pName_); patch().lookupPatchField<volScalarField, scalar>(psiName_);
const fvPatchField<scalar>& pp =
patch().lookupPatchField<volScalarField, scalar>(pName_);
operator==(psip*pp); operator==(psip*pp);
@ -115,10 +118,11 @@ void Foam::fixedRhoFvPatchScalarField::updateCoeffs()
void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeEntryIfDifferent<word>("p", "p", pName_); os.writeEntryIfDifferent<word>("p", "p", pName_);
os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_); os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
fvPatchField<scalar>::writeValueEntry(os); writeEntry("value", os);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -9,7 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels/lnInclude -I$(LIB_SRC)/regionFaModels\lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
@ -26,5 +26,4 @@ EXE_LIBS = \
-ltopoChangerFvMesh \ -ltopoChangerFvMesh \
-lsampling \ -lsampling \
-latmosphericModels \ -latmosphericModels \
-lregionFaModels \ -lregionFaModels
-lfiniteArea

View File

@ -0,0 +1,4 @@
bool ddtCorr
(
pimple.dict().getOrDefault("ddtCorr", true)
);

View File

@ -69,8 +69,6 @@ mesh.setFluxRequired(p.name());
// Mask field for zeroing out contributions on hole cells // Mask field for zeroing out contributions on hole cells
#include "createCellMask.H" #include "createCellMask.H"
// Create bool field with interpolated cells
#include "createInterpolatedCells.H"
Info<< "Creating turbulence model\n" << endl; Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence autoPtr<compressible::turbulenceModel> turbulence

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -43,6 +43,7 @@ Description
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "fluidThermo.H" #include "fluidThermo.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "bound.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureControl.H" #include "pressureControl.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"
@ -88,8 +89,10 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readControls.H"
#include "readDyMControls.H" #include "readDyMControls.H"
// Store divrhoU from the previous mesh so that it can be mapped // Store divrhoU from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the // and used in correctPhi to ensure the corrected phi has the
// same divergence // same divergence
@ -125,6 +128,7 @@ int main(int argc, char *argv[])
{ {
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstIter() || moveMeshOuterCorrectors)
{ {
// Do any mesh changes // Do any mesh changes
mesh.update(); mesh.update();
@ -133,22 +137,52 @@ int main(int argc, char *argv[])
MRF.update(); MRF.update();
#include "setCellMask.H" #include "setCellMask.H"
#include "setInterpolatedCells.H"
#include "correctRhoPhiFaceMask.H" const surfaceScalarField faceMaskOld
(
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
);
// Zero Uf on old faceMask (H-I)
rhoUf() *= faceMaskOld;
surfaceVectorField rhoUfint(fvc::interpolate(rho*U));
// Update Uf and phi on new C-I faces
rhoUf() += (1-faceMaskOld)*rhoUfint;
// Update Uf boundary
forAll(rhoUf().boundaryField(), patchI)
{
rhoUf().boundaryFieldRef()[patchI] =
rhoUfint.boundaryField()[patchI];
}
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
if (correctPhi) if (correctPhi)
{ {
// Corrects flux on separated regions
#include "correctPhi.H" #include "correctPhi.H"
} }
// Zero phi on current H-I
const surfaceScalarField faceMask
(
localMin<scalar>(mesh).interpolate(cellMask)
);
phi *= faceMask;
U *= cellMask;
// Make the fluxes relative to the mesh-motion // Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U); fvc::makeRelative(phi, rho, U);
if (checkMeshCourantNo) }
{
#include "meshCourantNo.H" if (checkMeshCourantNo)
} {
#include "meshCourantNo.H"
} }
} }

View File

@ -25,6 +25,17 @@ surfaceScalarField phiHbyA
fvc::interpolate(rho)*fvc::flux(HbyA) fvc::interpolate(rho)*fvc::flux(HbyA)
); );
if (ddtCorr)
{
surfaceScalarField faceMaskOld
(
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
);
phiHbyA +=
faceMaskOld*MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf));
}
fvc::makeRelative(phiHbyA, rho, U); fvc::makeRelative(phiHbyA, rho, U);
MRF.makeRelative(fvc::interpolate(rho), phiHbyA); MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
@ -123,4 +134,8 @@ if (thermo.dpdt())
} }
} }
surfaceScalarField faceMask
(
localMin<scalar>(mesh).interpolate(cellMask)
);
phi *= faceMask; phi *= faceMask;

View File

@ -0,0 +1,9 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
checkMeshCourantNo =
pimple.dict().getOrDefault("checkMeshCourantNo", false);
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels/lnInclude -I$(LIB_SRC)/regionFaModels\lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
@ -21,5 +21,4 @@ EXE_LIBS = \
-lcompressibleTurbulenceModels \ -lcompressibleTurbulenceModels \
-lthermoTools \ -lthermoTools \
-latmosphericModels \ -latmosphericModels \
-lregionFaModels \ -lregionFaModels
-lfiniteArea

View File

@ -4,7 +4,7 @@
sqrt sqrt
( (
2*M_PI*sigma*sqr(aMesh.edgeInterpolation::deltaCoeffs()) 2*M_PI*sigma*sqr(aMesh.edgeInterpolation::deltaCoeffs())
*mag(aMesh.edgeInterpolation::deltaCoeffs()) *aMesh.edgeInterpolation::deltaCoeffs()
/rhol /rhol
) )
).value()*runTime.deltaT().value(); ).value()*runTime.deltaT().value();

View File

@ -1,6 +1,3 @@
// Volume-to surface mapping object
const volSurfaceMapping vsm(aMesh);
volVectorField U volVectorField U
( (
IOobject IOobject
@ -29,3 +26,6 @@ volScalarField H
mesh, mesh,
dimensionedScalar(dimLength, Zero) dimensionedScalar(dimLength, Zero)
); );
// Create volume-to surface mapping object
volSurfaceMapping vsm(aMesh);

View File

@ -1,5 +1,5 @@
// Volume-to surface mapping object // Create volume-to surface mapping object
const volSurfaceMapping vsm(aMesh); volSurfaceMapping vsm(aMesh);
volScalarField Cvf volScalarField Cvf
( (

View File

@ -1,5 +1,5 @@
// Volume-to surface mapping object // Create volume-to surface mapping object
const volSurfaceMapping vsm(aMesh); volSurfaceMapping vsm(aMesh);
volScalarField Cvf volScalarField Cvf
( (

View File

@ -10,7 +10,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels/lnInclude -I$(LIB_SRC)/regionFaModels\lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
@ -28,5 +28,4 @@ EXE_LIBS = \
-ldynamicMesh \ -ldynamicMesh \
-ldynamicFvMesh \ -ldynamicFvMesh \
-ltopoChangerFvMesh \ -ltopoChangerFvMesh \
-lregionFaModels \ -lregionFaModels
-lfiniteArea

View File

@ -124,6 +124,3 @@ dimensionedScalar initialMass("initialMass", fvc::domainIntegrate(rho));
// Mask field for zeroing out contributions on hole cells // Mask field for zeroing out contributions on hole cells
#include "createCellMask.H" #include "createCellMask.H"
// Create bool field with interpolated cells
#include "createInterpolatedCells.H"

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2022 OpenCFD Ltd. Copyright (C) 2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -50,7 +50,6 @@ Description
#include "CorrectPhi.H" #include "CorrectPhi.H"
#include "cellCellStencilObject.H" #include "cellCellStencilObject.H"
#include "localMin.H" #include "localMin.H"
#include "oversetAdjustPhi.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -87,6 +86,9 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readTimeControls.H"
#include "readControls.H"
#include "readDyMControls.H" #include "readDyMControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
@ -126,14 +128,45 @@ int main(int argc, char *argv[])
MRF.update(); MRF.update();
#include "setCellMask.H" #include "setCellMask.H"
#include "setInterpolatedCells.H"
#include "correctRhoPhiFaceMask.H" const surfaceScalarField faceMaskOld
(
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
);
// Zero Uf on old faceMask (H-I)
rhoUf() *= faceMaskOld;
//fvc::correctRhoUf(rhoUfint, rho, U, phi);
surfaceVectorField rhoUfint(fvc::interpolate(rho*U));
// Update Uf and phi on new C-I faces
rhoUf() += (1-faceMaskOld)*rhoUfint;
// Update Uf boundary
forAll(rhoUf().boundaryField(), patchI)
{
rhoUf().boundaryFieldRef()[patchI] =
rhoUfint.boundaryField()[patchI];
}
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
if (correctPhi) if (correctPhi)
{ {
#include "correctPhi.H" #include "correctPhi.H"
} }
// Zero phi on current H-I
const surfaceScalarField faceMask
(
localMin<scalar>(mesh).interpolate(cellMask)
);
phi *= faceMask;
U *= cellMask;
// Make the fluxes relative to the mesh-motion // Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U); fvc::makeRelative(phi, rho, U);
} }

View File

@ -21,13 +21,16 @@ surfaceScalarField phiHbyA
fvc::flux(rho*HbyA) + phig fvc::flux(rho*HbyA) + phig
); );
if (adjustFringe) if (ddtCorr)
{ {
fvc::makeRelative(phiHbyA,rho, U); surfaceScalarField faceMaskOld
oversetAdjustPhi(phiHbyA, U); (
fvc::makeAbsolute(phiHbyA,rho, U); localMin<scalar>(mesh).interpolate(cellMask.oldTime())
} );
phiHbyA +=
faceMaskOld*MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi));
}
MRF.makeRelative(fvc::interpolate(rho), phiHbyA); MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
@ -119,4 +122,8 @@ if (thermo.dpdt())
} }
} }
surfaceScalarField faceMask
(
localMin<scalar>(mesh).interpolate(cellMask)
);
phi *= faceMask; phi *= faceMask;

View File

@ -0,0 +1,9 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
checkMeshCourantNo =
pimple.dict().getOrDefault("checkMeshCourantNo", false);
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels/lnInclude -I$(LIB_SRC)/regionFaModels\lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
@ -22,5 +22,4 @@ EXE_LIBS = \
-lcompressibleTurbulenceModels \ -lcompressibleTurbulenceModels \
-lthermoTools \ -lthermoTools \
-latmosphericModels \ -latmosphericModels \
-lregionFaModels \ -lregionFaModels
-lfiniteArea

View File

@ -19,7 +19,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionFaModels/lnInclude -I$(LIB_SRC)/regionFaModels\lnInclude
EXE_LIBS = \ EXE_LIBS = \
@ -40,5 +40,4 @@ EXE_LIBS = \
-lthermoTools \ -lthermoTools \
-lradiationModels \ -lradiationModels \
-lregionModels \ -lregionModels \
-lregionFaModels \ -lregionFaModels
-lfiniteArea

View File

@ -113,19 +113,15 @@ int main(int argc, char *argv[])
forAll(fluidRegions, i) forAll(fluidRegions, i)
{ {
fvMesh& mesh = fluidRegions[i];
#include "readFluidMultiRegionPIMPLEControls.H"
#include "setRegionFluidFields.H" #include "setRegionFluidFields.H"
#include "readFluidMultiRegionPIMPLEControls.H"
#include "solveFluid.H" #include "solveFluid.H"
} }
forAll(solidRegions, i) forAll(solidRegions, i)
{ {
fvMesh& mesh = solidRegions[i];
#include "readSolidMultiRegionPIMPLEControls.H"
#include "setRegionSolidFields.H" #include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
#include "solveSolid.H" #include "solveSolid.H"
} }
@ -137,10 +133,8 @@ int main(int argc, char *argv[])
forAll(fluidRegions, i) forAll(fluidRegions, i)
{ {
fvMesh& mesh = fluidRegions[i];
#include "readFluidMultiRegionPIMPLEControls.H"
#include "setRegionFluidFields.H" #include "setRegionFluidFields.H"
#include "readFluidMultiRegionPIMPLEControls.H"
if (!frozenFlow) if (!frozenFlow)
{ {
Info<< "\nSolving for fluid region " Info<< "\nSolving for fluid region "
@ -172,24 +166,20 @@ int main(int argc, char *argv[])
forAll(fluidRegions, i) forAll(fluidRegions, i)
{ {
fvMesh& mesh = fluidRegions[i];
Info<< "\nSolving for fluid region " Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl; << fluidRegions[i].name() << endl;
#include "readFluidMultiRegionPIMPLEControls.H" #include "setRegionFluidFields.H"
#include "setRegionFluidFields.H" #include "readFluidMultiRegionPIMPLEControls.H"
frozenFlow = true; frozenFlow = true;
#include "solveFluid.H" #include "solveFluid.H"
} }
forAll(solidRegions, i) forAll(solidRegions, i)
{ {
fvMesh& mesh = solidRegions[i];
Info<< "\nSolving for solid region " Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl; << solidRegions[i].name() << endl;
#include "readSolidMultiRegionPIMPLEControls.H"
#include "setRegionSolidFields.H" #include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
#include "solveSolid.H" #include "solveSolid.H"
} }

View File

@ -36,5 +36,5 @@ EXE_LIBS = \
-lfaOptions \ -lfaOptions \
-lregionModels \ -lregionModels \
-lsampling \ -lsampling \
-lregionFaModels \ -lregionFaModels
-lfiniteArea

View File

@ -76,21 +76,17 @@ int main(int argc, char *argv[])
forAll(fluidRegions, i) forAll(fluidRegions, i)
{ {
fvMesh& mesh = fluidRegions[i];
Info<< "\nSolving for fluid region " Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl; << fluidRegions[i].name() << endl;
#include "readFluidMultiRegionSIMPLEControls.H"
#include "setRegionFluidFields.H" #include "setRegionFluidFields.H"
#include "readFluidMultiRegionSIMPLEControls.H"
#include "solveFluid.H" #include "solveFluid.H"
} }
forAll(solidRegions, i) forAll(solidRegions, i)
{ {
fvMesh& mesh = solidRegions[i];
#include "readSolidMultiRegionSIMPLEControls.H"
#include "setRegionSolidFields.H" #include "setRegionSolidFields.H"
#include "readSolidMultiRegionSIMPLEControls.H"
#include "solveSolid.H" #include "solveSolid.H"
} }
@ -103,10 +99,8 @@ int main(int argc, char *argv[])
forAll(fluidRegions, i) forAll(fluidRegions, i)
{ {
fvMesh& mesh = fluidRegions[i];
#include "readSolidMultiRegionSIMPLEControls.H"
#include "setRegionFluidFields.H" #include "setRegionFluidFields.H"
#include "readSolidMultiRegionSIMPLEControls.H"
if (!frozenFlow) if (!frozenFlow)
{ {
#include "pEqn.H" #include "pEqn.H"
@ -127,24 +121,20 @@ int main(int argc, char *argv[])
forAll(fluidRegions, i) forAll(fluidRegions, i)
{ {
fvMesh& mesh = fluidRegions[i];
Info<< "\nSolving for fluid region " Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl; << fluidRegions[i].name() << endl;
#include "readFluidMultiRegionSIMPLEControls.H" #include "setRegionFluidFields.H"
#include "setRegionFluidFields.H" #include "readFluidMultiRegionSIMPLEControls.H"
frozenFlow = true; frozenFlow = true;
#include "solveFluid.H" #include "solveFluid.H"
} }
forAll(solidRegions, i) forAll(solidRegions, i)
{ {
fvMesh& mesh = solidRegions[i];
Info<< "\nSolving for solid region " Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl; << solidRegions[i].name() << endl;
#include "readSolidMultiRegionSIMPLEControls.H"
#include "setRegionSolidFields.H" #include "setRegionSolidFields.H"
#include "readSolidMultiRegionSIMPLEControls.H"
#include "solveSolid.H" #include "solveSolid.H"
} }

View File

@ -5,5 +5,3 @@
const bool momentumPredictor = const bool momentumPredictor =
simple.getOrDefault("momentumPredictor", true); simple.getOrDefault("momentumPredictor", true);
simple.readIfPresent("frozenFlow", frozenFlowFluid[i]);

View File

@ -1,3 +1,5 @@
const fvMesh& mesh = fluidRegions[i];
rhoThermo& thermo = thermoFluid[i]; rhoThermo& thermo = thermoFluid[i];
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -108,23 +108,19 @@ int main(int argc, char *argv[])
forAll(fluidRegions, i) forAll(fluidRegions, i)
{ {
fvMesh& mesh = fluidRegions[i];
Info<< "\nSolving for fluid region " Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl; << fluidRegions[i].name() << endl;
#include "readFluidMultiRegionPIMPLEControls.H"
#include "setRegionFluidFields.H" #include "setRegionFluidFields.H"
#include "readFluidMultiRegionPIMPLEControls.H"
#include "solveFluid.H" #include "solveFluid.H"
} }
forAll(solidRegions, i) forAll(solidRegions, i)
{ {
fvMesh& mesh = solidRegions[i];
Info<< "\nSolving for solid region " Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl; << solidRegions[i].name() << endl;
#include "readSolidMultiRegionPIMPLEControls.H"
#include "setRegionSolidFields.H" #include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
#include "solveSolid.H" #include "solveSolid.H"
} }
@ -139,24 +135,20 @@ int main(int argc, char *argv[])
forAll(fluidRegions, i) forAll(fluidRegions, i)
{ {
fvMesh& mesh = fluidRegions[i];
Info<< "\nSolving for fluid region " Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl; << fluidRegions[i].name() << endl;
#include "readFluidMultiRegionPIMPLEControls.H" #include "setRegionFluidFields.H"
#include "setRegionFluidFields.H" #include "readFluidMultiRegionPIMPLEControls.H"
frozenFlow = true; frozenFlow = true;
#include "solveFluid.H" #include "solveFluid.H"
} }
forAll(solidRegions, i) forAll(solidRegions, i)
{ {
fvMesh& mesh = solidRegions[i];
Info<< "\nSolving for solid region " Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl; << solidRegions[i].name() << endl;
#include "readSolidMultiRegionPIMPLEControls.H"
#include "setRegionSolidFields.H" #include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
#include "solveSolid.H" #include "solveSolid.H"
} }
} }

View File

@ -88,29 +88,26 @@ kappa
case mtLookup: case mtLookup:
{ {
if (mesh.foundObject<volScalarField>(kappaName_))
{ {
const auto* ptr = return patch().lookupPatchField<volScalarField, scalar>
mesh.cfindObject<volScalarField>(kappaName_); (
kappaName_
if (ptr) );
{
return patch().patchField(*ptr);
}
} }
else if (mesh.foundObject<volSymmTensorField>(kappaName_))
{ {
const auto* ptr = const symmTensorField& KWall =
mesh.cfindObject<volSymmTensorField>(kappaName_); patch().lookupPatchField<volSymmTensorField, scalar>
(
kappaName_
);
if (ptr) const vectorField n(patch().nf());
{
const symmTensorField& KWall = patch().patchField(*ptr);
const vectorField n(patch().nf()); return n & KWall & n;
return n & KWall & n;
}
} }
else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Did not find field " << kappaName_ << "Did not find field " << kappaName_
@ -120,6 +117,9 @@ kappa
<< " or volSymmTensorField." << " or volSymmTensorField."
<< exit(FatalError); << exit(FatalError);
} }
break; break;
} }
@ -131,8 +131,10 @@ kappa
mesh.lookupObject<phaseSystem>("phaseProperties") mesh.lookupObject<phaseSystem>("phaseProperties")
); );
auto tkappaEff = tmp<scalarField>::New(patch().size(), Zero); tmp<scalarField> kappaEff
auto& kappaEff = tkappaEff.ref(); (
new scalarField(patch().size(), 0.0)
);
forAll(fluid.phases(), phasei) forAll(fluid.phases(), phasei)
{ {
@ -140,10 +142,10 @@ kappa
const fvPatchScalarField& alpha = phase.boundaryField()[patchi]; const fvPatchScalarField& alpha = phase.boundaryField()[patchi];
kappaEff += alpha*phase.kappaEff(patchi)(); kappaEff.ref() += alpha*phase.kappaEff(patchi)();
} }
return tkappaEff; return kappaEff;
break; break;
} }
@ -159,11 +161,9 @@ kappa
} }
} }
// Return zero-sized (not nullptr) return scalarField(0);
return tmp<scalarField>::New();
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -243,12 +243,14 @@ turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
<< exit(FatalError); << exit(FatalError);
} }
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ); if (dict.found("refValue"))
if (this->readMixedEntries(dict))
{ {
// Full restart // Full restart
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
} }
else else
{ {
@ -306,11 +308,12 @@ updateCoeffs()
scalarField& Tp = *this; scalarField& Tp = *this;
const auto& nbrField = const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField&
refCast nbrField = refCast
< <const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField>
const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField (
>(nbrPatch.lookupPatchField<volScalarField>(TnbrName_)); nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_)
);
// Swap to obtain full local values of neighbour internal field // Swap to obtain full local values of neighbour internal field
scalarField TcNbr(nbrField.patchInternalField()); scalarField TcNbr(nbrField.patchInternalField());
@ -327,13 +330,13 @@ updateCoeffs()
scalarField qr(Tp.size(), 0.0); scalarField qr(Tp.size(), 0.0);
if (qrName_ != "none") if (qrName_ != "none")
{ {
qr = patch().lookupPatchField<volScalarField>(qrName_); qr = patch().lookupPatchField<volScalarField, scalar>(qrName_);
} }
scalarField qrNbr(Tp.size(), 0.0); scalarField qrNbr(Tp.size(), 0.0);
if (qrNbrName_ != "none") if (qrNbrName_ != "none")
{ {
qrNbr = nbrPatch.lookupPatchField<volScalarField>(qrNbrName_); qrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(qrNbrName_);
mpp.distribute(qrNbr); mpp.distribute(qrNbr);
} }
@ -483,7 +486,7 @@ void turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
mixedFvPatchField<scalar>::write(os); mixedFvPatchScalarField::write(os);
os.writeEntry("kappaMethod", KMethodTypeNames_[method_]); os.writeEntry("kappaMethod", KMethodTypeNames_[method_]);
os.writeEntryIfDifferent<word>("kappa","none", kappaName_); os.writeEntryIfDifferent<word>("kappa","none", kappaName_);

View File

@ -9,5 +9,3 @@
( (
pimpleDict.getOrDefault<int>("nEnergyCorrectors", 1) pimpleDict.getOrDefault<int>("nEnergyCorrectors", 1)
); );
pimpleDict.readIfPresent("frozenFlow", frozenFlowFluid[i]);

View File

@ -1,3 +1,5 @@
fvMesh& mesh = fluidRegions[i];
twoPhaseSystem& fluid = phaseSystemFluid[i]; twoPhaseSystem& fluid = phaseSystemFluid[i];
phaseModel& phase1 = fluid.phase1(); phaseModel& phase1 = fluid.phase1();

View File

@ -48,7 +48,7 @@ if (Y.size())
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
@ -56,6 +56,6 @@ if (Y.size())
if (Y.size()) if (Y.size())
{ {
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }
} }

View File

@ -8,5 +8,3 @@
const bool momentumPredictor = const bool momentumPredictor =
pimple.getOrDefault("momentumPredictor", true); pimple.getOrDefault("momentumPredictor", true);
pimple.readIfPresent("frozenFlow", frozenFlowFluid[i]);

View File

@ -1,3 +1,5 @@
fvMesh& mesh = fluidRegions[i];
CombustionModel<rhoReactionThermo>& reaction = reactionFluid[i]; CombustionModel<rhoReactionThermo>& reaction = reactionFluid[i];
rhoReactionThermo& thermo = reaction.thermo(); rhoReactionThermo& thermo = reaction.thermo();

View File

@ -35,7 +35,7 @@
( (
solidRegions[i], solidRegions[i],
thermos[i], thermos[i],
coordinateSystem::typeName coordinateSystem::typeName_()
) )
); );

View File

@ -1,3 +1,4 @@
fvMesh& mesh = solidRegions[i];
solidThermo& thermo = thermos[i]; solidThermo& thermo = thermos[i];
tmp<volScalarField> trho = thermo.rho(); tmp<volScalarField> trho = thermo.rho();

View File

@ -15,7 +15,7 @@ if (!thermo.isotropic())
( (
mesh, mesh,
thermo, thermo,
coordinateSystem::typeName coordinateSystem::typeName_()
); );
tmp<volVectorField> tkappaByCp = thermo.Kappa()/thermo.Cp(); tmp<volVectorField> tkappaByCp = thermo.Kappa()/thermo.Cp();

View File

@ -44,7 +44,7 @@ IOobject turbulencePropertiesHeader
mesh, mesh,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
); );
if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(false)) if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(false))

View File

@ -89,10 +89,17 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
return; return;
} }
const auto& phip = patch().lookupPatchField<surfaceScalarField>("phi"); const fvsPatchField<scalar>& phip =
const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia"); patch().lookupPatchField<surfaceScalarField, scalar>("phi");
const auto& Up = patch().lookupPatchField<volVectorField>("U");
const auto& Uap = patch().lookupPatchField<volVectorField>("Ua"); const fvsPatchField<scalar>& phiap =
patch().lookupPatchField<surfaceScalarField, scalar>("phia");
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>("U");
const fvPatchField<vector>& Uap =
patch().lookupPatchField<volVectorField, vector>("Ua");
operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap)); operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap));
@ -102,8 +109,8 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
void Foam::adjointOutletPressureFvPatchScalarField::write(Ostream& os) const void Foam::adjointOutletPressureFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
fvPatchField<scalar>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -90,8 +90,11 @@ void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia"); const fvsPatchField<scalar>& phiap =
const auto& Up = patch().lookupPatchField<volVectorField>("U"); patch().lookupPatchField<surfaceScalarField, scalar>("phia");
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>("U");
scalarField Un(mag(patch().nf() & Up)); scalarField Un(mag(patch().nf() & Up));
vectorField UtHat((Up - patch().nf()*Un)/(Un + SMALL)); vectorField UtHat((Up - patch().nf()*Un)/(Un + SMALL));
@ -107,8 +110,8 @@ void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs()
void Foam::adjointOutletVelocityFvPatchVectorField::write(Ostream& os) const void Foam::adjointOutletVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchField<vector>::write(os); fvPatchVectorField::write(os);
fvPatchField<vector>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -8,7 +8,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels/lnInclude -I$(LIB_SRC)/regionFaModels\lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
@ -22,5 +22,4 @@ EXE_LIBS = \
-ldynamicFvMesh \ -ldynamicFvMesh \
-ltopoChangerFvMesh \ -ltopoChangerFvMesh \
-latmosphericModels \ -latmosphericModels \
-lregionFaModels \ -lregionFaModels
-lfiniteArea

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,10 +37,7 @@ scalar meanCoNum = 0.0;
if (mesh.nInternalFaces()) if (mesh.nInternalFaces())
{ {
surfaceScalarField phiMask surfaceScalarField phiMask(localMin<scalar>(mesh).interpolate(cellMask));
(
localMin<scalar>(mesh).interpolate(cellMask + interpolatedCells)
);
scalarField sumPhi(fvc::surfaceSum(mag(phiMask*phi))().internalField()); scalarField sumPhi(fvc::surfaceSum(mag(phiMask*phi))().internalField());

View File

@ -1,4 +1,5 @@
// Solve the Momentum equation // Solve the Momentum equation
MRF.correctBoundaryVelocity(U); MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> tUEqn tmp<fvVectorMatrix> tUEqn

View File

@ -94,7 +94,7 @@ if (mesh.changing())
{ {
if (refCells[zoneId] != -1) if (refCells[zoneId] != -1)
{ {
validCells.push_back(refCells[zoneId]); validCells.append(refCells[zoneId]);
} }
} }

View File

@ -0,0 +1,26 @@
#include "createTimeControls.H"
bool correctPhi
(
pimple.dict().getOrDefault("correctPhi", false)
);
bool checkMeshCourantNo
(
pimple.dict().getOrDefault("checkMeshCourantNo", false)
);
bool massFluxInterpolation
(
pimple.dict().getOrDefault("massFluxInterpolation", false)
);
bool adjustFringe
(
pimple.dict().getOrDefault("oversetAdjustPhi", false)
);
bool ddtCorr
(
pimple.dict().getOrDefault("ddtCorr", true)
);

View File

@ -0,0 +1,273 @@
// Interpolation used
interpolationCellPoint<vector> UInterpolator(HbyA);
// Determine faces on outside of interpolated cells
bitSet isOwnerInterpolatedFace(mesh.nInternalFaces());
bitSet isNeiInterpolatedFace(mesh.nInternalFaces());
// Determine donor cells
labelListList donorCell(mesh.nInternalFaces());
scalarListList weightCellCells(mesh.nInternalFaces());
// Interpolated HbyA faces
vectorField UIntFaces(mesh.nInternalFaces(), Zero);
// Determine receptor neighbour cells
labelList receptorNeigCell(mesh.nInternalFaces(), -1);
{
const cellCellStencilObject& overlap = Stencil::New(mesh);
const labelList& cellTypes = overlap.cellTypes();
const labelIOList& zoneID = overlap.zoneID();
label nZones = gMax(zoneID)+1;
PtrList<fvMeshSubset> meshParts(nZones);
labelList nCellsPerZone(nZones, Zero);
// A mesh subset for each zone
forAll(meshParts, zonei)
{
meshParts.set
(
zonei,
// Select cells where the zoneID == zonei
new fvMeshSubset(mesh, zonei, zoneID)
);
}
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
{
label ownType = cellTypes[mesh.faceOwner()[faceI]];
label neiType = cellTypes[mesh.faceNeighbour()[faceI]];
if
(
ownType == cellCellStencil::INTERPOLATED
&& neiType == cellCellStencil::CALCULATED
)
{
isOwnerInterpolatedFace.set(faceI);
const vector& fc = mesh.faceCentres()[faceI];
for (label zoneI = 0; zoneI < nZones; zoneI++)
{
if (zoneI != zoneID[mesh.faceOwner()[faceI]])
{
const fvMesh& partMesh = meshParts[zoneI].subMesh();
const labelList& cellMap = meshParts[zoneI].cellMap();
label cellI = partMesh.findCell(fc);
if (cellI != -1)
{
// Determine weights
labelList stencil(partMesh.cellCells()[cellI]);
stencil.append(cellI);
label st = stencil.size();
donorCell[faceI].setSize(st);
weightCellCells[faceI].setSize(st);
scalarField weights(st);
forAll(stencil, i)
{
scalar d = mag
(
partMesh.cellCentres()[stencil[i]]
- fc
);
weights[i] = 1.0/d;
donorCell[faceI][i] = cellMap[stencil[i]];
}
weights /= sum(weights);
weightCellCells[faceI] = weights;
forAll(stencil, i)
{
UIntFaces[faceI] +=
weightCellCells[faceI][i]
*UInterpolator.interpolate
(
fc,
donorCell[faceI][i]
);
}
break;
}
}
}
receptorNeigCell[faceI] = mesh.faceNeighbour()[faceI];
}
else if
(
ownType == cellCellStencil::CALCULATED
&& neiType == cellCellStencil::INTERPOLATED
)
{
isNeiInterpolatedFace.set(faceI);
const vector& fc = mesh.faceCentres()[faceI];
for (label zoneI = 0; zoneI < nZones; zoneI++)
{
if (zoneI != zoneID[mesh.faceNeighbour()[faceI]])
{
const fvMesh& partMesh = meshParts[zoneI].subMesh();
const labelList& cellMap = meshParts[zoneI].cellMap();
label cellI = partMesh.findCell(fc);
if (cellI != -1)
{
// Determine weights
labelList stencil(partMesh.cellCells()[cellI]);
stencil.append(cellI);
label st = stencil.size();
donorCell[faceI].setSize(st);
weightCellCells[faceI].setSize(st);
scalarField weights(st);
forAll(stencil, i)
{
scalar d = mag
(
partMesh.cellCentres()[stencil[i]]
- fc
);
weights[i] = 1.0/d;
donorCell[faceI][i] = cellMap[stencil[i]];
}
weights /= sum(weights);
weightCellCells[faceI] = weights;
forAll(stencil, i)
{
UIntFaces[faceI] +=
weightCellCells[faceI][i]
*UInterpolator.interpolate
(
fc,
donorCell[faceI][i]
);
}
break;
}
}
}
receptorNeigCell[faceI] = mesh.faceOwner()[faceI];
}
}
}
// contravariant U
vectorField U1Contrav(mesh.nInternalFaces(), Zero);
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf());
forAll(isNeiInterpolatedFace, faceI)
{
label cellId = -1;
if (isNeiInterpolatedFace.test(faceI))
{
cellId = mesh.faceNeighbour()[faceI];
}
else if (isOwnerInterpolatedFace.test(faceI))
{
cellId = mesh.faceOwner()[faceI];
}
if (cellId != -1)
{
const vector& n = faceNormals[faceI];
vector n1(Zero);
// 2-D cases
if (mesh.nSolutionD() == 2)
{
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
{
if (mesh.geometricD()[cmpt] == -1)
{
switch (cmpt)
{
case vector::X:
{
n1 = vector(0, n.z(), -n.y());
break;
}
case vector::Y:
{
n1 = vector(n.z(), 0, -n.x());
break;
}
case vector::Z:
{
n1 = vector(n.y(), -n.x(), 0);
break;
}
}
}
}
}
else if (mesh.nSolutionD() == 3)
{
//Determine which is the primary direction
if (mag(n.x()) > mag(n.y()) && mag(n.x()) > mag(n.z()))
{
n1 = vector(n.y(), -n.x(), 0);
}
else if (mag(n.y()) > mag(n.z()))
{
n1 = vector(0, n.z(), -n.y());
}
else
{
n1 = vector(-n.z(), 0, n.x());
}
}
n1.normalise();
const vector n2 = normalised(n ^ n1);
tensor rot =
tensor
(
n.x() ,n.y(), n.z(),
n1.x() ,n1.y(), n1.z(),
n2.x() ,n2.y(), n2.z()
);
// tensor rot =
// tensor
// (
// n & x ,n & y, n & z,
// n1 & x ,n1 & y, n1 & z,
// n2 & x ,n2 & y, n2 & z
// );
U1Contrav[faceI].x() =
2*transform(rot, UIntFaces[faceI]).x()
- transform(rot, HbyA[receptorNeigCell[faceI]]).x();
U1Contrav[faceI].y() = transform(rot, HbyA[cellId]).y();
U1Contrav[faceI].z() = transform(rot, HbyA[cellId]).z();
HbyA[cellId] = transform(inv(rot), U1Contrav[faceI]);
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -46,9 +46,12 @@ Description
#include "fvOptions.H" #include "fvOptions.H"
#include "cellCellStencilObject.H" #include "cellCellStencilObject.H"
#include "zeroGradientFvPatchFields.H"
#include "localMin.H" #include "localMin.H"
#include "interpolationCellPoint.H"
#include "transform.H"
#include "fvMeshSubset.H"
#include "oversetAdjustPhi.H" #include "oversetAdjustPhi.H"
#include "oversetPatchPhiErr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,9 +68,10 @@ int main(int argc, char *argv[])
#include "setRootCaseLists.H" #include "setRootCaseLists.H"
#include "createTime.H" #include "createTime.H"
#include "createDynamicFvMesh.H" #include "createDynamicFvMesh.H"
#include "createDyMControls.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
pimpleControl pimple(mesh);
#include "createFields.H" #include "createFields.H"
#include "createUf.H" #include "createUf.H"
#include "createMRF.H" #include "createMRF.H"
@ -84,9 +88,7 @@ int main(int argc, char *argv[])
while (runTime.run()) while (runTime.run())
{ {
#include "readDyMControls.H" #include "readControls.H"
#include "readOversetDyMControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setDeltaT.H" #include "setDeltaT.H"
@ -95,20 +97,45 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
mesh.update(); bool changed = mesh.update();
if (mesh.changing()) if (changed)
{ {
#include "setCellMask.H" #include "setCellMask.H"
#include "setInterpolatedCells.H" #include "setInterpolatedCells.H"
#include "correctPhiFaceMask.H"
fvc::makeRelative(phi, U); surfaceScalarField faceMaskOld
(
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
);
if (checkMeshCourantNo) // Zero Uf on old faceMask (H-I)
{ Uf *= faceMaskOld;
#include "meshCourantNo.H" // Update Uf and phi on new C-I faces
} Uf += (1-faceMaskOld)*fvc::interpolate(U);
phi = mesh.Sf() & Uf;
// Zero phi on current H-I
surfaceScalarField faceMask
(
localMin<scalar>(mesh).interpolate(cellMask)
);
phi *= faceMask;
}
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
#include "correctPhi.H"
}
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
} }
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop

View File

@ -1,11 +1,36 @@
// Option 1: interpolate rAU, do not block out rAU on blocked cells
volScalarField rAU("rAU", 1.0/UEqn.A()); volScalarField rAU("rAU", 1.0/UEqn.A());
mesh.interpolate(rAU);
// Option 2: do not interpolate rAU but block out rAU
//surfaceScalarField rAUf("rAUf", fvc::interpolate(blockedCells*rAU));
// Option 3: do not interpolate rAU but zero out rAUf on faces on holes
// But what about:
//
// H
// H I C C C C
// H
//
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField H("H", UEqn.H()); volVectorField H("H", UEqn.H());
volVectorField HbyA("HbyA", U); volVectorField HbyA("HbyA", U);
HbyA = constrainHbyA(rAU*H, U, p); HbyA = constrainHbyA(rAU*H, U, p);
if (massFluxInterpolation)
{
#include "interpolatedFaces.H"
}
if (runTime.outputTime())
{
H.write();
rAU.write();
HbyA.write();
}
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPISO() <= 1)
{ {
tUEqn.clear(); tUEqn.clear();
@ -13,16 +38,33 @@ if (pimple.nCorrPISO() <= 1)
phiHbyA = fvc::flux(HbyA); phiHbyA = fvc::flux(HbyA);
if (ddtCorr)
{
surfaceScalarField faceMaskOld
(
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
);
phiHbyA += rAUf*faceMaskOld*fvc::ddtCorr(U, Uf);
}
MRF.makeRelative(phiHbyA); MRF.makeRelative(phiHbyA);
// WIP
if (p.needReference())
{
fvc::makeRelative(phiHbyA, U);
adjustPhi(phiHbyA, U, p);
fvc::makeAbsolute(phiHbyA, U);
}
if (adjustFringe) if (adjustFringe)
{ {
fvc::makeRelative(phiHbyA, U); fvc::makeRelative(phiHbyA, U);
oversetAdjustPhi(phiHbyA, U, zoneIdMass); oversetAdjustPhi(phiHbyA, U);
fvc::makeAbsolute(phiHbyA, U); fvc::makeAbsolute(phiHbyA, U);
} }
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
@ -37,26 +79,27 @@ while (pimple.correctNonOrthogonal())
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
phi = phiHbyA - pEqn.flux(); phi = phiHbyA - pEqn.flux();
pEqn.relax(); // option 2:
U = // rAUf*fvc::snGrad(p)*mesh.magSf();
cellMask*
(
HbyA
- rAU*fvc::reconstruct((pEqn.flux())/rAUf)
);
U.correctBoundaryConditions();
fvOptions.correct(U);
}
if (oversetPatchErrOutput)
{
oversetPatchPhiErr(pEqn, phiHbyA);
} }
} }
// Excludes error in interpolated/hole cells
#include "continuityErrs.H" #include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
volVectorField gradP(fvc::grad(p));
// Option 2: zero out velocity on blocked out cells
//U = HbyA - rAU*cellMask*gradP;
// Option 3: zero out velocity on blocked out cells
// This is needed for the scalar Eq (k,epsilon, etc)
// which can use U as source term
U = cellMask*(HbyA - rAU*gradP);
U.correctBoundaryConditions();
fvOptions.correct(U);
{ {
Uf = fvc::interpolate(U); Uf = fvc::interpolate(U);
@ -66,4 +109,9 @@ while (pimple.correctNonOrthogonal())
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U); fvc::makeRelative(phi, U);
surfaceScalarField faceMask
(
localMin<scalar>(mesh).interpolate(cellMask)
);
phi *= faceMask; phi *= faceMask;

View File

@ -0,0 +1,10 @@
#include "readTimeControls.H"
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
checkMeshCourantNo = pimple.dict().getOrDefault("checkMeshCourantNo", false);
massFluxInterpolation =
pimple.dict().getOrDefault("massFluxInterpolation", false);
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);

View File

@ -24,3 +24,7 @@ bool adjustFringe
( (
simple.dict().getOrDefault("oversetAdjustPhi", false) simple.dict().getOrDefault("oversetAdjustPhi", false)
); );
bool massFluxInterpolation
(
simple.dict().getOrDefault("massFluxInterpolation", false)
);

View File

@ -1,10 +1,18 @@
{ {
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU)); surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU));
volVectorField HbyA("HbyA", U); volVectorField HbyA("HbyA", U);
HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p); HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p);
//mesh.interpolate(HbyA);
if (massFluxInterpolation)
{
#include "interpolatedFaces.H"
}
tUEqn.clear(); tUEqn.clear();
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)); surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA));

View File

@ -42,11 +42,11 @@ Description
#include "CorrectPhi.H" #include "CorrectPhi.H"
#ifdef MPPIC #ifdef MPPIC
#include "basicKinematicCloud.H" #include "kinematicCloud.H"
#define basicKinematicTypeCloud basicKinematicCloud #define kinematicTypeCloud kinematicCloud
#else #else
#include "basicKinematicCollidingCloud.H" #include "kinematicCollidingCloud.H"
#define basicKinematicTypeCloud basicKinematicCollidingCloud #define kinematicTypeCloud kinematicCollidingCloud
#endif #endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -88,7 +88,7 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
// Store the particle positions // Store the particle positions
kinematicCloud.storeGlobalPositions(); kCloud.storeGlobalPositions();
mesh.update(); mesh.update();
@ -111,15 +111,15 @@ int main(int argc, char *argv[])
continuousPhaseTransport.correct(); continuousPhaseTransport.correct();
muc = rhoc*continuousPhaseTransport.nu(); muc = rhoc*continuousPhaseTransport.nu();
kinematicCloud.evolve(); kCloud.evolve();
// Update continuous phase volume fraction field // Update continuous phase volume fraction field
alphac = max(1.0 - kinematicCloud.theta(), alphacMin); alphac = max(1.0 - kCloud.theta(), alphacMin);
alphac.correctBoundaryConditions(); alphac.correctBoundaryConditions();
alphacf = fvc::interpolate(alphac); alphacf = fvc::interpolate(alphac);
alphaPhic = alphacf*phic; alphaPhic = alphacf*phic;
fvVectorMatrix cloudSU(kinematicCloud.SU(Uc)); fvVectorMatrix cloudSU(kCloud.SU(Uc));
volVectorField cloudVolSUSu volVectorField cloudVolSUSu
( (
IOobject IOobject

View File

@ -12,6 +12,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \

View File

@ -11,8 +11,11 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \

View File

@ -43,11 +43,11 @@ Description
#include "pimpleControl.H" #include "pimpleControl.H"
#ifdef MPPIC #ifdef MPPIC
#include "basicKinematicCloud.H" #include "kinematicCloud.H"
#define basicKinematicTypeCloud basicKinematicCloud #define kinematicTypeCloud kinematicCloud
#else #else
#include "basicKinematicCollidingCloud.H" #include "kinematicCollidingCloud.H"
#define basicKinematicTypeCloud basicKinematicCollidingCloud #define kinematicTypeCloud kinematicCollidingCloud
#endif #endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -91,16 +91,16 @@ int main(int argc, char *argv[])
continuousPhaseTransport.correct(); continuousPhaseTransport.correct();
muc = rhoc*continuousPhaseTransport.nu(); muc = rhoc*continuousPhaseTransport.nu();
Info<< "Evolving " << kinematicCloud.name() << endl; Info<< "Evolving " << kCloud.name() << endl;
kinematicCloud.evolve(); kCloud.evolve();
// Update continuous phase volume fraction field // Update continuous phase volume fraction field
alphac = max(1.0 - kinematicCloud.theta(), alphacMin); alphac = max(1.0 - kCloud.theta(), alphacMin);
alphac.correctBoundaryConditions(); alphac.correctBoundaryConditions();
alphacf = fvc::interpolate(alphac); alphacf = fvc::interpolate(alphac);
alphaPhic = alphacf*phic; alphaPhic = alphacf*phic;
fvVectorMatrix cloudSU(kinematicCloud.SU(Uc)); fvVectorMatrix cloudSU(kCloud.SU(Uc));
volVectorField cloudVolSUSu volVectorField cloudVolSUSu
( (
IOobject IOobject

View File

@ -10,6 +10,8 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \

View File

@ -10,8 +10,11 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \

View File

@ -125,13 +125,13 @@ const word kinematicCloudName
); );
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl; Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicTypeCloud kinematicCloud kinematicTypeCloud kCloud
( (
kinematicCloudName, kinematicCloudName,
g,
rhoc, rhoc,
Uc, Uc,
muc, muc
g
); );
// Particle fraction upper limit // Particle fraction upper limit
@ -139,13 +139,13 @@ scalar alphacMin
( (
1.0 1.0
- ( - (
kinematicCloud.particleProperties().subDict("constantProperties") kCloud.particleProperties().subDict("constantProperties")
.get<scalar>("alphaMax") .get<scalar>("alphaMax")
) )
); );
// Update alphac from the particle locations // Update alphac from the particle locations
alphac = max(1.0 - kinematicCloud.theta(), alphacMin); alphac = max(1.0 - kCloud.theta(), alphacMin);
alphac.correctBoundaryConditions(); alphac.correctBoundaryConditions();
surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac)); surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));

View File

@ -1,12 +1,11 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/lagrangian/coalCombustion/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \
@ -35,7 +34,6 @@ EXE_LIBS = \
-llagrangian \ -llagrangian \
-llagrangianIntermediate \ -llagrangianIntermediate \
-llagrangianTurbulence \ -llagrangianTurbulence \
-lcoalCombustion\
-lspecie \ -lspecie \
-lcompressibleTransportModels \ -lcompressibleTransportModels \
-lfluidThermophysicalModels \ -lfluidThermophysicalModels \

View File

@ -40,11 +40,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }

View File

@ -37,8 +37,8 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "basicThermoCloud.H" #include "thermoCloud.H"
#include "coalCloud.H" #include "reactingMultiphaseCloud.H"
#include "psiReactionThermo.H" #include "psiReactionThermo.H"
#include "CombustionModel.H" #include "CombustionModel.H"
#include "fvOptions.H" #include "fvOptions.H"

View File

@ -1,19 +1,19 @@
Info<< "\nConstructing coal cloud" << endl; Info<< "\nConstructing coal cloud" << endl;
coalCloud coalParcels reactingMultiphaseCloud coalParcels
( (
"coalCloud1", "coalCloud1",
g,
rho, rho,
U, U,
g,
slgThermo slgThermo
); );
Info<< "\nConstructing limestone cloud" << endl; Info<< "\nConstructing limestone cloud" << endl;
basicThermoCloud limestoneParcels thermoCloud limestoneParcels
( (
"limestoneCloud1", "limestoneCloud1",
g,
rho, rho,
U, U,
g,
slgThermo slgThermo
); );

View File

@ -9,6 +9,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \

View File

@ -63,13 +63,13 @@ const word kinematicCloudName
); );
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl; Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicCollidingCloud kinematicCloud kinematicCollidingCloud kCloud
( (
kinematicCloudName, kinematicCloudName,
g,
rhoInf, rhoInf,
U, U,
mu, mu
g
); );
IOobject Hheader IOobject Hheader

View File

@ -10,6 +10,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \

View File

@ -41,7 +41,7 @@ Description
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H" #include "turbulentTransportModel.H"
#include "basicKinematicCollidingCloud.H" #include "kinematicCollidingCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -76,19 +76,19 @@ int main(int argc, char *argv[])
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
kinematicCloud.storeGlobalPositions(); kCloud.storeGlobalPositions();
mesh.update(); mesh.update();
U.correctBoundaryConditions(); U.correctBoundaryConditions();
Info<< "Evolving " << kinematicCloud.name() << endl; Info<< "Evolving " << kCloud.name() << endl;
laminarTransport.correct(); laminarTransport.correct();
mu = laminarTransport.nu()*rhoInfValue; mu = laminarTransport.nu()*rhoInfValue;
kinematicCloud.evolve(); kCloud.evolve();
runTime.write(); runTime.write();

View File

@ -40,7 +40,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H" #include "turbulentTransportModel.H"
#include "basicKinematicCollidingCloud.H" #include "kinematicCollidingCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -75,13 +75,13 @@ int main(int argc, char *argv[])
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
Info<< "Evolving " << kinematicCloud.name() << endl; Info<< "Evolving " << kCloud.name() << endl;
laminarTransport.correct(); laminarTransport.correct();
mu = laminarTransport.nu()*rhoInfValue; mu = laminarTransport.nu()*rhoInfValue;
kinematicCloud.evolve(); kCloud.evolve();
runTime.write(); runTime.write();

View File

@ -8,6 +8,12 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \

View File

@ -6,7 +6,7 @@
+ MRF.DDt(U) + MRF.DDt(U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
== ==
parcels.SU(U, true) scalar(1)/rhoInfValue*parcels.SU(U)
+ fvOptions(U) + fvOptions(U)
); );

View File

@ -4,13 +4,12 @@ const word kinematicCloudName
); );
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl; Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
kinematicCloud parcels
basicKinematicCloud parcels
( (
kinematicCloudName, kinematicCloudName,
g,
rhoInf, rhoInf,
U, U,
muc, muc
g
); );

View File

@ -40,7 +40,7 @@ Description
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H" #include "turbulentTransportModel.H"
#include "surfaceFilmModel.H" #include "surfaceFilmModel.H"
#include "basicKinematicCloud.H" #include "kinematicCloud.H"
#include "fvOptions.H" #include "fvOptions.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"
@ -67,7 +67,6 @@ int main(int argc, char *argv[])
#include "createDyMControls.H" #include "createDyMControls.H"
#include "createFields.H" #include "createFields.H"
#include "createFieldRefs.H" #include "createFieldRefs.H"
#include "createRegionControls.H"
#include "createUfIfPresent.H" #include "createUfIfPresent.H"
turbulence->validate(); turbulence->validate();
@ -95,7 +94,7 @@ int main(int argc, char *argv[])
// Do any mesh changes // Do any mesh changes
mesh.update(); mesh.update();
if (solvePrimaryRegion && mesh.changing()) if (pimple.solveFlow() && mesh.changing())
{ {
MRF.update(); MRF.update();
@ -120,7 +119,7 @@ int main(int argc, char *argv[])
parcels.evolve(); parcels.evolve();
surfaceFilm.evolve(); surfaceFilm.evolve();
if (solvePrimaryRegion) if (pimple.solveFlow())
{ {
// --- PIMPLE loop // --- PIMPLE loop
while (pimple.loop()) while (pimple.loop())

View File

@ -0,0 +1,3 @@
parcelFoam.C
EXE = $(FOAM_USER_APPBIN)/parcelFoam

View File

@ -1,49 +1,48 @@
EXE_INC = \ EXE_INC = \
-I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/regionFaModels/lnInclude \ -I$(LIB_SRC)/regionFaModels/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/faOptions/lnInclude \
-I$(LIB_SRC)/faOptions/lnInclude -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude
LIB_LIBS = \
EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lfvOptions \
-lmeshTools \ -lmeshTools \
-lsampling \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-ldynamicMesh \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-latmosphericModels \
-lregionModels \
-lsurfaceFilmModels \
-lsurfaceFilmDerivedFvPatchFields \
-llagrangian \ -llagrangian \
-llagrangianIntermediate \ -llagrangianIntermediate \
-llagrangianTurbulence \ -llagrangianTurbulence \
-ldistributionModels \
-lspecie \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lthermophysicalProperties \
-lreactionThermophysicalModels \
-lSLGThermo \
-lradiationModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lregionModels \
-lsurfaceFilmModels \
-ldynamicMesh \
-ldynamicFvMesh \
-lregionFaModels \ -lregionFaModels \
-lfiniteArea -lfiniteArea \
-lfaOptions

View File

@ -0,0 +1,22 @@
MRF.correctBoundaryVelocity(U);
fvVectorMatrix UEqn
(
fvm::ddt(U) + fvm::div(phi, U)
+ MRF.DDt(U)
+ turbulence->divDevReff(U)
==
scalar(1)/rhoInfValue*parcels.SU(U)
+ fvOptions(U)
);
UEqn.relax();
fvOptions.constrain(UEqn);
if (pimple.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
fvOptions.correct(U);
}

View File

@ -0,0 +1,2 @@
auto parcels = parcelCloudModelList(g, rhoInf, U, muc);

View File

@ -0,0 +1 @@
regionModels::surfaceFilmModel& surfaceFilm = tsurfaceFilm();

View File

@ -0,0 +1,85 @@
#include "readGravitationalAcceleration.H"
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "\nReading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "createPhi.H"
singlePhaseTransportModel laminarTransport(U, phi);
dimensionedScalar rhoInfValue
(
"rhoInf",
dimDensity,
laminarTransport
);
volScalarField rhoInf
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
rhoInfValue
);
volScalarField muc
(
IOobject
(
"muc",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rhoInf*laminarTransport.nu()
);
Info<< "Creating turbulence model\n" << endl;
autoPtr<incompressible::turbulenceModel> turbulence
(
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, pimple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name());
#include "createMRF.H"
#include "createClouds.H"
#include "createSurfaceFilmModel.H"
#include "createFvOptions.H"

View File

@ -0,0 +1,58 @@
volScalarField rAU(1.0/UEqn.A());
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA));
if (pimple.ddtCorr())
{
phiHbyA += MRF.zeroFilter(fvc::interpolate(rAU)*fvc::ddtCorr(U, phi, Uf));
}
MRF.makeRelative(phiHbyA);
if (p.needReference())
{
fvc::makeRelative(phiHbyA, U);
adjustPhi(phiHbyA, U, p);
fvc::makeAbsolute(phiHbyA, U);
}
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, U, phiHbyA, rAU, MRF);
// Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p)
==
fvc::div(phiHbyA)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA - pEqn.flux();
}
}
#include "continuityErrs.H"
p.relax();
U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();
fvOptions.correct(U);
// Correct rhoUf if the mesh is moving
fvc::correctUf(Uf, U, phi);
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
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
parcelFoam
Group
grpLagrangianSolvers
Description
Transient solver for incompressible, turbulent flow with kinematic,
particle cloud, and surface film modelling.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "surfaceFilmModel.H"
#include "parcelCloudModelList.H"
#include "fvOptions.H"
#include "pimpleControl.H"
#include "CorrectPhi.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Transient solver for incompressible, turbulent flow"
" with kinematic particle clouds"
" and surface film modelling."
);
#define CREATE_MESH createMeshesPostProcess.H
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "initContinuityErrs.H"
#include "createDyMControls.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createUfIfPresent.H"
turbulence->validate();
#include "CourantNo.H"
#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readDyMControls.H"
#include "CourantNo.H"
#include "setMultiRegionDeltaT.H"
++runTime;
Info<< "Time = " << runTime.timeName() << nl << endl;
// Store the particle positions
parcels.storeGlobalPositions();
// Do any mesh changes
mesh.update();
if (pimple.solveFlow() && mesh.changing())
{
MRF.update();
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & Uf();
#include "../../incompressible/pimpleFoam/correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, U);
}
if (checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
}
parcels.evolve();
surfaceFilm.evolve();
if (pimple.solveFlow())
{
// --- PIMPLE loop
while (pimple.loop())
{
#include "UEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
laminarTransport.correct();
turbulence->correct();
}
}
}
runTime.write();
runTime.printExecutionTime(Info);
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -2,10 +2,10 @@ EXE_INC = \
-I../reactingParcelFoam \ -I../reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \

View File

@ -41,11 +41,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }

View File

@ -1,9 +1,9 @@
Info<< "\nConstructing reacting cloud" << endl; Info<< "\nConstructing reacting cloud" << endl;
basicReactingTypeCloud parcels reactingTypeCloud parcels
( (
"reactingCloud1", "reactingCloud1",
g,
rho, rho,
U, U,
g,
slgThermo slgThermo
); );

View File

@ -9,7 +9,7 @@ IOobject io
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
); );
if (io.typeHeaderOk<IOdictionary>()) if (io.typeHeaderOk<IOdictionary>())
@ -32,4 +32,4 @@ if (io.typeHeaderOk<IOdictionary>())
); );
} }
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More