diff --git a/src/Allwmake b/src/Allwmake
index c11b065118..b12a0eb867 100755
--- a/src/Allwmake
+++ b/src/Allwmake
@@ -75,7 +75,7 @@ wmake $targetType sixDoFRigidBodyState
wmake $targetType rigidBodyDynamics
wmake $targetType rigidBodyMeshMotion
wmake $targetType rigidBodyState
-wmake $targetType semiPermeableBaffle
+wmake $targetType specieTransfer
wmake $targetType atmosphericModels
wmake $targetType waves
diff --git a/src/semiPermeableBaffle/Make/files b/src/semiPermeableBaffle/Make/files
deleted file mode 100644
index 2556e5fb53..0000000000
--- a/src/semiPermeableBaffle/Make/files
+++ /dev/null
@@ -1,4 +0,0 @@
-derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C
-derivedFvPatchFields/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.C
-
-LIB = $(FOAM_LIBBIN)/libsemiPermeableBaffle
diff --git a/src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C b/src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C
deleted file mode 100644
index cce3766e06..0000000000
--- a/src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C
+++ /dev/null
@@ -1,309 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
- \\/ M anipulation |
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-\*---------------------------------------------------------------------------*/
-
-#include "semiPermeableBaffleMassFractionFvPatchScalarField.H"
-#include "addToRunTimeSelectionTable.H"
-#include "fvPatchFieldMapper.H"
-#include "volFields.H"
-#include "surfaceFields.H"
-#include "turbulentFluidThermoModel.H"
-#include "psiReactionThermo.H"
-#include "rhoReactionThermo.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
- template<>
- const char* NamedEnum
- <
- semiPermeableBaffleMassFractionFvPatchScalarField::input,
- 4
- >::names[] =
- {
- "none",
- "massFraction",
- "moleFraction",
- "partialPressure",
- };
-}
-
-const Foam::NamedEnum
-<
- Foam::semiPermeableBaffleMassFractionFvPatchScalarField::input,
- 4
-> Foam::semiPermeableBaffleMassFractionFvPatchScalarField::inputNames_;
-
-
-// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
-
-const Foam::basicSpecieMixture&
-Foam::semiPermeableBaffleMassFractionFvPatchScalarField::composition
-(
- const objectRegistry& db
-)
-{
- const word& name = fluidThermo::dictName;
-
- if (db.foundObject(name))
- {
- return db.lookupObject(name).composition();
- }
- else if (db.foundObject(name))
- {
- return db.lookupObject(name).composition();
- }
- else
- {
- FatalErrorInFunction
- << "Could not find a multi-component thermodynamic model."
- << exit(FatalError);
-
- return NullObjectRef();
- }
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-
-Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
-semiPermeableBaffleMassFractionFvPatchScalarField
-(
- const fvPatch& p,
- const DimensionedField& iF
-)
-:
- mappedPatchBase(p.patch()),
- mixedFvPatchScalarField(p, iF),
- c_(0),
- input_(none),
- phiName_("phi"),
- pName_("p")
-{
- refValue() = Zero;
- refGrad() = Zero;
- valueFraction() = Zero;
-}
-
-
-Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
-semiPermeableBaffleMassFractionFvPatchScalarField
-(
- const fvPatch& p,
- const DimensionedField& iF,
- const dictionary& dict
-)
-:
- mappedPatchBase(p.patch(), NEARESTPATCHFACE, dict),
- mixedFvPatchScalarField(p, iF),
- c_(dict.lookupOrDefault("c", scalar(0))),
- input_
- (
- c_ == scalar(0)
- ? none
- : inputNames_.read(dict.lookup("input"))
- ),
- phiName_(dict.lookupOrDefault("phi", "phi")),
- pName_(dict.lookupOrDefault("p", "p"))
-{
- fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
-
- refValue() = Zero;
- refGrad() = Zero;
- valueFraction() = Zero;
-}
-
-
-Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
-semiPermeableBaffleMassFractionFvPatchScalarField
-(
- const semiPermeableBaffleMassFractionFvPatchScalarField& ptf,
- const fvPatch& p,
- const DimensionedField& iF,
- const fvPatchFieldMapper& mapper
-)
-:
- mappedPatchBase(p.patch(), ptf),
- mixedFvPatchScalarField(ptf, p, iF, mapper),
- c_(ptf.c_),
- input_(ptf.input_),
- phiName_(ptf.phiName_),
- pName_(ptf.pName_)
-{}
-
-
-Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
-semiPermeableBaffleMassFractionFvPatchScalarField
-(
- const semiPermeableBaffleMassFractionFvPatchScalarField& ptf
-)
-:
- mappedPatchBase(ptf.patch().patch(), ptf),
- mixedFvPatchScalarField(ptf),
- c_(ptf.c_),
- input_(ptf.input_),
- phiName_(ptf.phiName_),
- pName_(ptf.pName_)
-{}
-
-
-Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
-semiPermeableBaffleMassFractionFvPatchScalarField
-(
- const semiPermeableBaffleMassFractionFvPatchScalarField& ptf,
- const DimensionedField& iF
-)
-:
- mappedPatchBase(ptf.patch().patch(), ptf),
- mixedFvPatchScalarField(ptf, iF),
- c_(ptf.c_),
- input_(ptf.input_),
- phiName_(ptf.phiName_),
- pName_(ptf.pName_)
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-Foam::tmp
-Foam::semiPermeableBaffleMassFractionFvPatchScalarField::phiY() const
-{
- if (c_ == scalar(0))
- {
- return tmp(new scalarField(patch().size(), Zero));
- }
-
- const word& YName = internalField().name();
-
- // Initialise the input variables to the mass fractions
- scalarField psic(patchInternalField());
-
- const label nbrPatchi = samplePolyPatch().index();
- const fvPatch& nbrPatch = patch().boundaryMesh()[nbrPatchi];
- const fvPatchScalarField& nbrYp =
- nbrPatch.lookupPatchField(YName);
- scalarField nbrPsic(nbrYp.patchInternalField());
- mappedPatchBase::map().distribute(nbrPsic);
-
- switch (input_)
- {
- case none:
- FatalErrorInFunction
- << "A none input cannot be used with a non-zero transfer "
- << "coefficient" << exit(FatalError);
-
- case massFraction:
- // Do nothing
- break;
-
- case partialPressure:
- // Multiply by pressure
- {
- psic *=
- patch().lookupPatchField(pName_);
-
- fvPatchScalarField nbrP
- (
- nbrPatch.lookupPatchField(pName_)
- );
- mappedPatchBase::map().distribute(nbrP);
- nbrPsic *= nbrP;
- }
-
- // Falls through ...
-
- case moleFraction:
- // Convert to mole fraction
- {
- const basicSpecieMixture& mixture = composition(db());
- const scalar Wi(mixture.Wi(mixture.species()[YName]));
- const fluidThermo& thermo =
- db().lookupObject(fluidThermo::dictName);
-
- psic *= thermo.W(patch().index())/Wi;
-
- scalarField nbrW(thermo.W(nbrPatch.index()));
- mappedPatchBase::map().distribute(nbrW);
- nbrPsic *= nbrW/Wi;
- }
- break;
- }
-
- return c_*patch().magSf()*(psic - nbrPsic);
-}
-
-
-void Foam::semiPermeableBaffleMassFractionFvPatchScalarField::updateCoeffs()
-{
- if (updated())
- {
- return;
- }
-
- const scalarField& phip =
- patch().lookupPatchField(phiName_);
-
- const compressible::turbulenceModel& turbModel =
- db().lookupObject
- (
- turbulenceModel::propertiesName
- );
- const scalarField alphaEffp(turbModel.alphaEff(patch().index()));
- const scalarField AAlphaEffp(patch().magSf()*alphaEffp);
-
- valueFraction() = phip/(phip - patch().deltaCoeffs()*AAlphaEffp);
- refGrad() = - phiY()/AAlphaEffp;
-
- mixedFvPatchScalarField::updateCoeffs();
-}
-
-
-void Foam::semiPermeableBaffleMassFractionFvPatchScalarField::write
-(
- Ostream& os
-) const
-{
- fvPatchScalarField::write(os);
- mappedPatchBase::write(os);
- writeEntryIfDifferent(os, "c", scalar(0), c_);
- writeEntry(os, "input", inputNames_[input_]);
- writeEntryIfDifferent(os, "phi", "phi", phiName_);
- writeEntryIfDifferent(os, "p", "p", pName_);
- writeEntry(os, "value", *this);
-}
-
-
-// * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
-
-namespace Foam
-{
- makePatchTypeField
- (
- fvPatchScalarField,
- semiPermeableBaffleMassFractionFvPatchScalarField
- );
-}
-
-// ************************************************************************* //
diff --git a/src/specieTransfer/Make/files b/src/specieTransfer/Make/files
new file mode 100644
index 0000000000..7b729940c7
--- /dev/null
+++ b/src/specieTransfer/Make/files
@@ -0,0 +1,9 @@
+derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C
+derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.C
+derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C
+
+derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.C
+
+derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.C
+
+LIB = $(FOAM_LIBBIN)/libspecieTransfer
diff --git a/src/semiPermeableBaffle/Make/options b/src/specieTransfer/Make/options
similarity index 100%
rename from src/semiPermeableBaffle/Make/options
rename to src/specieTransfer/Make/options
diff --git a/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.C b/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.C
new file mode 100644
index 0000000000..3ed91275a4
--- /dev/null
+++ b/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.C
@@ -0,0 +1,190 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "adsorptionMassFractionFvPatchScalarField.H"
+#include "addToRunTimeSelectionTable.H"
+#include "volFields.H"
+#include "surfaceFields.H"
+#include "turbulentFluidThermoModel.H"
+#include "psiReactionThermo.H"
+#include "rhoReactionThermo.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::adsorptionMassFractionFvPatchScalarField::
+adsorptionMassFractionFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ specieTransferMassFractionFvPatchScalarField(p, iF)
+{}
+
+
+Foam::adsorptionMassFractionFvPatchScalarField::
+adsorptionMassFractionFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ specieTransferMassFractionFvPatchScalarField(p, iF, dict)
+{}
+
+
+Foam::adsorptionMassFractionFvPatchScalarField::
+adsorptionMassFractionFvPatchScalarField
+(
+ const adsorptionMassFractionFvPatchScalarField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ specieTransferMassFractionFvPatchScalarField(ptf, p, iF, mapper)
+{}
+
+
+Foam::adsorptionMassFractionFvPatchScalarField::
+adsorptionMassFractionFvPatchScalarField
+(
+ const adsorptionMassFractionFvPatchScalarField& ptf
+)
+:
+ specieTransferMassFractionFvPatchScalarField(ptf)
+{}
+
+
+Foam::adsorptionMassFractionFvPatchScalarField::
+adsorptionMassFractionFvPatchScalarField
+(
+ const adsorptionMassFractionFvPatchScalarField& ptf,
+ const DimensionedField& iF
+)
+:
+ specieTransferMassFractionFvPatchScalarField(ptf, iF)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+Foam::tmp
+Foam::adsorptionMassFractionFvPatchScalarField::calcPhiYp() const
+{
+ if (c_ == scalar(0))
+ {
+ return tmp(new scalarField(patch().size(), Zero));
+ }
+
+ const word& YName = internalField().name();
+
+ const fluidThermo& thermo =
+ db().lookupObject(fluidThermo::dictName);
+
+ // Get the cell-mass fraction
+ const scalarField Yc(patchInternalField());
+
+ // Get the patch delta coefficients multiplied by the diffusivity
+ const compressible::turbulenceModel& turb =
+ db().lookupObject
+ (
+ turbulenceModel::propertiesName
+ );
+ const scalarField alphaEffDeltap
+ (
+ turb.alphaEff(patch().index())*patch().deltaCoeffs()
+ );
+
+ // Get the specie molecular weight, if needed
+ scalar Wi = NaN;
+ if (property_ != massFraction)
+ {
+ const basicSpecieMixture& mixture = composition(db());
+ Wi = mixture.Wi(mixture.species()[YName]);
+ }
+
+ // Get the mixture molecular weights, if needed
+ tmp tW;
+ if (property_ == moleFraction || property_ == partialPressure)
+ {
+ tW = thermo.W(patch().index());
+ }
+
+ // Construct coefficients that convert mass fraction to the property that
+ // drives the transfer
+ scalarField k(patch().size(), 1);
+ switch(property_)
+ {
+ case massFraction:
+ break;
+
+ case moleFraction:
+ k *= tW/Wi;
+ break;
+
+ case molarConcentration:
+ k *= thermo.rho(patch().index())/Wi;
+ break;
+
+ case partialPressure:
+ k *= thermo.p().boundaryField()[patch().index()]*tW/Wi;
+ break;
+ }
+
+ // The transport is limited by both the difference in the amount of the
+ // specie available and the rate of diffusion to the wall. The coefficients
+ // associated with these two transfer process are harmonically averaged to
+ // represent this limiting.
+ return
+ patch().magSf()
+ /(1/c_ + k/alphaEffDeltap)
+ *k*Yc;
+}
+
+
+void Foam::adsorptionMassFractionFvPatchScalarField::write
+(
+ Ostream& os
+) const
+{
+ specieTransferMassFractionFvPatchScalarField::write(os);
+ writeEntry(os, "value", *this);
+}
+
+
+// * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
+
+namespace Foam
+{
+ makePatchTypeField
+ (
+ fvPatchScalarField,
+ adsorptionMassFractionFvPatchScalarField
+ );
+}
+
+// ************************************************************************* //
diff --git a/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.H b/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.H
new file mode 100644
index 0000000000..0fa9a9d3ff
--- /dev/null
+++ b/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.H
@@ -0,0 +1,198 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::adsorptionMassFractionFvPatchScalarField
+
+Description
+ This is a mass-fraction boundary condition for an adsorbing wall.
+
+ This condition models a baffle which adsorbs some species and not others.
+ It must be used in conjunction with a
+ specieTransferVelocityFvPatchVectorField velocity condition, and a
+ specieTransferTemperatureFvPatchScalarField temperature condition.
+
+ The mass flux of a species is calculated as a coefficient multiplied by the
+ concentration adjacent to the patch.
+ \f[
+ \phi_{Yi} = c A \psi_i
+ \f]
+ where
+ \vartable
+ \phi_{Yi} | Flux of the adsorbing specie [kg/s]
+ c | Transfer coefficient [kg/m^2/s/]
+ A | Patch face area [m^2]
+ \C_i | Property adjacent to the patch []
+ \endvartable
+
+ A species that is adsorbed by the patch will, therefore, have a coefficient
+ greater than zero, whilst a species that is not adsorbed will have a
+ coefficient equal to zero.
+
+Usage
+ \table
+ Property | Description | Req'd? | Default
+ c | Transfer coefficient | no | 0
+ property | Property used to drive the transfer; massFraction, \\
+ moleFraction, molarConcentration, or partialPressure | if c is \\
+ non-zero |
+ phi | Name of the flux field | no | phi
+ U | Name of the velocity field | no | U
+ \endtable
+
+ Example of the boundary condition specification:
+ \verbatim
+
+ {
+ type adsorptionMassFraction;
+ property molarConcentration;
+ c 1e-3;
+ value $internalField;
+ }
+ \endverbatim
+
+See also
+ Foam::specieTransferMassFractionFvPatchScalarField
+ Foam::specieTransferVelocityFvPatchVectorField
+ Foam::specieTransferTemperatureFvPatchScalarField
+
+SourceFiles
+ adsorptionMassFractionFvPatchScalarField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef adsorptionMassFractionFvPatchScalarField_H
+#define adsorptionMassFractionFvPatchScalarField_H
+
+#include "specieTransferMassFractionFvPatchScalarField.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class basicSpecieMixture;
+
+/*---------------------------------------------------------------------------*\
+ Class adsorptionMassFractionFvPatchScalarField Declaration
+\*---------------------------------------------------------------------------*/
+
+class adsorptionMassFractionFvPatchScalarField
+:
+ public specieTransferMassFractionFvPatchScalarField
+{
+public:
+
+ //- Runtime type information
+ TypeName("adsorptionMassFraction");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ adsorptionMassFractionFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ adsorptionMassFractionFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given fixedValueTypeFvPatchField
+ // onto a new patch
+ adsorptionMassFractionFvPatchScalarField
+ (
+ const adsorptionMassFractionFvPatchScalarField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Copy constructor
+ adsorptionMassFractionFvPatchScalarField
+ (
+ const adsorptionMassFractionFvPatchScalarField&
+ );
+
+ //- Construct and return a clone
+ virtual tmp clone() const
+ {
+ return tmp
+ (
+ new adsorptionMassFractionFvPatchScalarField(*this)
+ );
+ }
+
+ //- Copy constructor setting internal field reference
+ adsorptionMassFractionFvPatchScalarField
+ (
+ const adsorptionMassFractionFvPatchScalarField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp
+ (
+ new adsorptionMassFractionFvPatchScalarField
+ (
+ *this,
+ iF
+ )
+ );
+ }
+
+
+ // Member Functions
+
+ // Evaluation functions
+
+ //- Return the flux of this species
+ tmp calcPhiYp() const;
+
+
+ //- Write
+ virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C b/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C
new file mode 100644
index 0000000000..8b65c7f7fa
--- /dev/null
+++ b/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C
@@ -0,0 +1,224 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "semiPermeableBaffleMassFractionFvPatchScalarField.H"
+#include "addToRunTimeSelectionTable.H"
+#include "fvPatchFieldMapper.H"
+#include "volFields.H"
+#include "surfaceFields.H"
+#include "turbulentFluidThermoModel.H"
+#include "psiReactionThermo.H"
+#include "rhoReactionThermo.H"
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
+semiPermeableBaffleMassFractionFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ mappedPatchBase(p.patch()),
+ specieTransferMassFractionFvPatchScalarField(p, iF)
+{}
+
+
+Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
+semiPermeableBaffleMassFractionFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ mappedPatchBase(p.patch(), NEARESTPATCHFACE, dict),
+ specieTransferMassFractionFvPatchScalarField(p, iF, dict)
+{}
+
+
+Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
+semiPermeableBaffleMassFractionFvPatchScalarField
+(
+ const semiPermeableBaffleMassFractionFvPatchScalarField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ mappedPatchBase(p.patch(), ptf),
+ specieTransferMassFractionFvPatchScalarField(ptf, p, iF, mapper)
+{}
+
+
+Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
+semiPermeableBaffleMassFractionFvPatchScalarField
+(
+ const semiPermeableBaffleMassFractionFvPatchScalarField& ptf
+)
+:
+ mappedPatchBase(ptf.patch().patch(), ptf),
+ specieTransferMassFractionFvPatchScalarField(ptf)
+{}
+
+
+Foam::semiPermeableBaffleMassFractionFvPatchScalarField::
+semiPermeableBaffleMassFractionFvPatchScalarField
+(
+ const semiPermeableBaffleMassFractionFvPatchScalarField& ptf,
+ const DimensionedField& iF
+)
+:
+ mappedPatchBase(ptf.patch().patch(), ptf),
+ specieTransferMassFractionFvPatchScalarField(ptf, iF)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+Foam::tmp
+Foam::semiPermeableBaffleMassFractionFvPatchScalarField::calcPhiYp() const
+{
+ if (c_ == scalar(0))
+ {
+ return tmp(new scalarField(patch().size(), Zero));
+ }
+
+ const word& YName = internalField().name();
+
+ const fvPatch& nbrPatch = patch().boundaryMesh()[samplePolyPatch().index()];
+
+ const fluidThermo& thermo =
+ db().lookupObject(fluidThermo::dictName);
+
+ // Get the cell-mass fractions
+ const scalarField Yc(patchInternalField());
+ scalarField nbrYc
+ (
+ nbrPatch.lookupPatchField(YName)
+ .patchInternalField()
+ );
+ mappedPatchBase::map().distribute(nbrYc);
+
+ // Get the patch delta coefficients multiplied by the diffusivity
+ const compressible::turbulenceModel& turb =
+ db().lookupObject
+ (
+ turbulenceModel::propertiesName
+ );
+ const scalarField alphaEffDeltap
+ (
+ turb.alphaEff(patch().index())*patch().deltaCoeffs()
+ );
+ scalarField nbrAlphaEffDeltap
+ (
+ turb.alphaEff(nbrPatch.index())*nbrPatch.deltaCoeffs()
+ );
+ mappedPatchBase::map().distribute(nbrAlphaEffDeltap);
+
+ // Get the specie molecular weight, if needed
+ scalar Wi = NaN;
+ if (property_ != massFraction)
+ {
+ const basicSpecieMixture& mixture = composition(db());
+ Wi = mixture.Wi(mixture.species()[YName]);
+ }
+
+ // Get the mixture molecular weights, if needed
+ tmp tW, tNbrW;
+ if (property_ == moleFraction || property_ == partialPressure)
+ {
+ tW = thermo.W(patch().index());
+ tNbrW = thermo.W(nbrPatch.index());
+ mappedPatchBase::map().distribute(tNbrW.ref());
+ }
+
+ // Construct coefficients that convert mass fraction to the property that
+ // drives the transfer
+ scalarField k(patch().size(), 1), nbrK(patch().size(), 1);
+ switch(property_)
+ {
+ case massFraction:
+ break;
+
+ case moleFraction:
+ k *= tW/Wi;
+ nbrK *= tNbrW/Wi;
+ break;
+
+ case molarConcentration:
+ {
+ k *= thermo.rho(patch().index())/Wi;
+ scalarField nbrRhop(thermo.rho(nbrPatch.index()));
+ mappedPatchBase::map().distribute(nbrRhop);
+ nbrK *= nbrRhop/Wi;
+ }
+ break;
+
+ case partialPressure:
+ {
+ k *= thermo.p().boundaryField()[patch().index()]*tW/Wi;
+ scalarField nbrPp(thermo.p().boundaryField()[nbrPatch.index()]);
+ mappedPatchBase::map().distribute(nbrPp);
+ nbrK *= nbrPp*tNbrW/Wi;
+ }
+ break;
+ }
+
+ // The transport is limited by both the difference in the amount of the
+ // specie across the baffle and the rates of diffusion on either side. The
+ // coefficients associated with these three transfer process are
+ // harmonically averaged to represent this limiting.
+ return
+ patch().magSf()
+ /(1/c_ + k/alphaEffDeltap + nbrK/nbrAlphaEffDeltap)
+ *(k*Yc - nbrK*nbrYc);
+}
+
+
+void Foam::semiPermeableBaffleMassFractionFvPatchScalarField::write
+(
+ Ostream& os
+) const
+{
+ mappedPatchBase::write(os);
+ specieTransferMassFractionFvPatchScalarField::write(os);
+ writeEntry(os, "value", *this);
+}
+
+
+// * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
+
+namespace Foam
+{
+ makePatchTypeField
+ (
+ fvPatchScalarField,
+ semiPermeableBaffleMassFractionFvPatchScalarField
+ );
+}
+
+// ************************************************************************* //
diff --git a/src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H b/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H
similarity index 73%
rename from src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H
rename to src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H
index 33243994da..d1a033d21c 100644
--- a/src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H
+++ b/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H
@@ -28,45 +28,54 @@ Description
This is a mass-fraction boundary condition for a semi-permeable baffle.
This condition models a baffle which is permeable to a some species and
- impermeable to others. It must be used in conjunction with the
- corresponding velocity condition,
- semiPermeableBaffleVelocityFvPatchVectorField.
+ impermeable to others. It must be used in conjunction with a
+ specieTransferVelocityFvPatchVectorField velocity condition, and a
+ specieTransferTemperatureFvPatchScalarField temperature condition.
The mass flux of a species is calculated as a coefficient multiplied by the
- difference in an input variable across the baffle.
+ difference in a property across the baffle.
\f[
\phi_{Yi} = c A (\psi_i - \psi_{i,n})
\f]
where
\vartable
- \phi_{Yi} | flux of the permeable species [kg/s]
- c | transfer coefficient [kg/m^2/s/]
- A | patch face area [m^2]
- \psi_i | input variable on the patch []
- \psi_{i,n} | input variable on the neighbour patch []
+ \phi_{Yi} | Flux of the permeable specie [kg/s]
+ c | Transfer coefficient [kg/m^2/s/]
+ A | Patch face area [m^2]
+ \psi_i | Property on the patch []
+ \psi_{i,n} | Property on the neighbour patch []
\endvartable
A species that the baffle is permeable to will, therefore, have a
coefficient greater than zero, whilst a species that does not transfer will
have a coefficient equal to zero.
- This condition calculates the species flux. The fluxes are summed up by the
- velocity condition to generate the net mass transfer across the baffle.
- This mass-fraction condition then generates a corrective diffusive flux to
- ensure that the correct amounts of the permeable species are transferred.
-
Usage
\table
Property | Description | Req'd? | Default
c | Transfer coefficient | no | 0
- input | Input variable used to drive the transfer; massFraction, \\
- moleFraction or partialPressure | if c is non-zero | none
+ property | Property used to drive the transfer; massFraction, \\
+ moleFraction, molarConcentration, or partialPressure | if c is \\
+ non-zero |
phi | Name of the flux field | no | phi
- p | Name of the pressure field | no | p
+ U | Name of the velocity field | no | U
\endtable
+ Example of the boundary condition specification:
+ \verbatim
+
+ {
+ type semiPermeableBaffleMassFraction;
+ property molarConcentration;
+ c 1e-3;
+ value $internalField;
+ }
+ \endverbatim
+
See also
- Foam::semiPermeableBaffleVelocityFvPatchVectorField
+ Foam::specieTransferMassFractionFvPatchScalarField
+ Foam::specieTransferVelocityFvPatchVectorField
+ Foam::specieTransferTemperatureFvPatchScalarField
SourceFiles
semiPermeableBaffleMassFractionFvPatchScalarField.C
@@ -77,7 +86,7 @@ SourceFiles
#define semiPermeableBaffleMassFractionFvPatchScalarField_H
#include "mappedPatchBase.H"
-#include "mixedFvPatchFields.H"
+#include "specieTransferMassFractionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -93,40 +102,8 @@ class basicSpecieMixture;
class semiPermeableBaffleMassFractionFvPatchScalarField
:
public mappedPatchBase,
- public mixedFvPatchScalarField
+ public specieTransferMassFractionFvPatchScalarField
{
-public:
-
- //- Enumeration for the input variable driving the transfer
- enum input
- {
- none,
- massFraction,
- moleFraction,
- partialPressure,
- };
-
- //- Input variable type names
- static const NamedEnum inputNames_;
-
-
-private:
-
- // Private Data
-
- //- Transfer coefficient
- const scalar c_;
-
- //- Input variable driving the transfer
- const input input_;
-
- //- Name of the flux field
- const word phiName_;
-
- //- Name of the pressure field. Only needed if mode is pressure.
- const word pName_;
-
-
public:
//- Runtime type information
@@ -210,10 +187,7 @@ public:
// Evaluation functions
//- Return the flux of this species through the baffle
- tmp phiY() const;
-
- //- Update the coefficients associated with the patch field
- virtual void updateCoeffs();
+ virtual tmp calcPhiYp() const;
//- Write
diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C
new file mode 100644
index 0000000000..fc5ffb5ccb
--- /dev/null
+++ b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C
@@ -0,0 +1,286 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "specieTransferMassFractionFvPatchScalarField.H"
+#include "specieTransferVelocityFvPatchVectorField.H"
+#include "volFields.H"
+#include "surfaceFields.H"
+#include "turbulentFluidThermoModel.H"
+#include "psiReactionThermo.H"
+#include "rhoReactionThermo.H"
+
+// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ template<>
+ const char* NamedEnum
+ <
+ specieTransferMassFractionFvPatchScalarField::property,
+ 4
+ >::names[] =
+ {
+ "massFraction",
+ "moleFraction",
+ "molarConcentration",
+ "partialPressure"
+ };
+}
+
+const Foam::NamedEnum
+<
+ Foam::specieTransferMassFractionFvPatchScalarField::property,
+ 4
+> Foam::specieTransferMassFractionFvPatchScalarField::propertyNames_;
+
+
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+const Foam::basicSpecieMixture&
+Foam::specieTransferMassFractionFvPatchScalarField::composition
+(
+ const objectRegistry& db
+)
+{
+ const word& name = basicThermo::dictName;
+
+ if (db.foundObject(name))
+ {
+ return db.lookupObject(name).composition();
+ }
+ else if (db.foundObject(name))
+ {
+ return db.lookupObject(name).composition();
+ }
+ else
+ {
+ FatalErrorInFunction
+ << "Could not find a multi-component thermodynamic model."
+ << exit(FatalError);
+
+ return NullObjectRef();
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::specieTransferMassFractionFvPatchScalarField::
+specieTransferMassFractionFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchScalarField(p, iF),
+ phiName_("phi"),
+ UName_("U"),
+ phiYp_(p.size(), 0),
+ timeIndex_(-1),
+ c_(0),
+ property_(massFraction)
+{
+ refValue() = Zero;
+ refGrad() = Zero;
+ valueFraction() = Zero;
+}
+
+
+Foam::specieTransferMassFractionFvPatchScalarField::
+specieTransferMassFractionFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ mixedFvPatchScalarField(p, iF),
+ phiName_(dict.lookupOrDefault("phi", "phi")),
+ UName_(dict.lookupOrDefault("U", "U")),
+ phiYp_(p.size(), 0),
+ timeIndex_(-1),
+ c_(dict.lookupOrDefault("c", scalar(0))),
+ property_
+ (
+ c_ == scalar(0)
+ ? massFraction
+ : propertyNames_.read(dict.lookup("property"))
+ )
+{
+ fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
+
+ refValue() = Zero;
+ refGrad() = Zero;
+ valueFraction() = Zero;
+}
+
+
+Foam::specieTransferMassFractionFvPatchScalarField::
+specieTransferMassFractionFvPatchScalarField
+(
+ const specieTransferMassFractionFvPatchScalarField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ mixedFvPatchScalarField(ptf, p, iF, mapper),
+ phiName_(ptf.phiName_),
+ UName_(ptf.UName_),
+ phiYp_(p.size(), 0),
+ timeIndex_(-1),
+ c_(ptf.c_),
+ property_(ptf.property_)
+{}
+
+
+Foam::specieTransferMassFractionFvPatchScalarField::
+specieTransferMassFractionFvPatchScalarField
+(
+ const specieTransferMassFractionFvPatchScalarField& ptf
+)
+:
+ mixedFvPatchScalarField(ptf),
+ phiName_(ptf.phiName_),
+ UName_(ptf.UName_),
+ phiYp_(ptf.size(), 0),
+ timeIndex_(-1),
+ c_(ptf.c_),
+ property_(ptf.property_)
+{}
+
+
+Foam::specieTransferMassFractionFvPatchScalarField::
+specieTransferMassFractionFvPatchScalarField
+(
+ const specieTransferMassFractionFvPatchScalarField& ptf,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchScalarField(ptf, iF),
+ phiName_(ptf.phiName_),
+ UName_(ptf.UName_),
+ phiYp_(ptf.size(), 0),
+ timeIndex_(-1),
+ c_(ptf.c_),
+ property_(ptf.property_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::specieTransferMassFractionFvPatchScalarField::autoMap
+(
+ const fvPatchFieldMapper& m
+)
+{
+ mixedFvPatchScalarField::autoMap(m);
+
+ m(phiYp_, phiYp_);
+}
+
+
+void Foam::specieTransferMassFractionFvPatchScalarField::rmap
+(
+ const fvPatchScalarField& ptf,
+ const labelList& addr
+)
+{
+ mixedFvPatchScalarField::rmap(ptf, addr);
+
+ const specieTransferMassFractionFvPatchScalarField& tiptf =
+ refCast(ptf);
+
+ phiYp_.rmap(tiptf.phiYp_, addr);
+}
+
+
+const Foam::scalarField&
+Foam::specieTransferMassFractionFvPatchScalarField::phiYp() const
+{
+ if (timeIndex_ != this->db().time().timeIndex())
+ {
+ timeIndex_ = this->db().time().timeIndex();
+
+ phiYp_ = calcPhiYp();
+ }
+
+ return phiYp_;
+}
+
+
+void Foam::specieTransferMassFractionFvPatchScalarField::updateCoeffs()
+{
+ if (updated())
+ {
+ return;
+ }
+
+ // Get the fluxes
+ const scalarField& phip =
+ patch().lookupPatchField(phiName_);
+ const fvPatchVectorField& Up =
+ patch().lookupPatchField(UName_);
+ tmp uPhip =
+ refCast(Up).phip();
+
+ // Get the diffusivity
+ // !!! <-- This is a potential lagging issue as alphaEff(patchi) calculates
+ // alpha on demand, so the value may be different from alphaEff() which
+ // uses the alpha field cached by the thermodynamics.
+ const scalarField AAlphaEffp
+ (
+ patch().magSf()
+ *db().lookupObject
+ (
+ turbulenceModel::propertiesName
+ )
+ .alphaEff(patch().index())
+ );
+
+ // Set the gradient and value so that the transport and diffusion combined
+ // result in the desired specie flux
+ valueFraction() = phip/(phip - patch().deltaCoeffs()*AAlphaEffp);
+ refValue() = *this;
+ refGrad() = phip*(*this - phiYp()/uPhip)/AAlphaEffp;
+
+ mixedFvPatchScalarField::updateCoeffs();
+}
+
+
+void Foam::specieTransferMassFractionFvPatchScalarField::write
+(
+ Ostream& os
+) const
+{
+ fvPatchScalarField::write(os);
+ writeEntryIfDifferent(os, "c", scalar(0), c_);
+ writeEntry(os, "property", propertyNames_[property_]);
+ writeEntryIfDifferent(os, "phi", "phi", phiName_);
+ writeEntryIfDifferent(os, "U", "U", UName_);
+}
+
+
+// ************************************************************************* //
diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H
new file mode 100644
index 0000000000..e7281a267e
--- /dev/null
+++ b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H
@@ -0,0 +1,194 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::specieTransferMassFractionFvPatchScalarField
+
+Description
+ Abstract base class for specie-transferring mass fraction boundary
+ conditions.
+
+ Derived classes compute the actual species flux. Those fluxes are summed up
+ by the specieTransferVelocityFvPatchVectorField velocity condition to
+ generate the net mass transfer into or out of the patch. This mass-fraction
+ condition then generates a corrective diffusive flux to ensure that the
+ correct amounts of the transferring species are transported through the
+ patch.
+
+SourceFiles
+ specieTransferMassFractionFvPatchScalarField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef specieTransferMassFractionFvPatchScalarField_H
+#define specieTransferMassFractionFvPatchScalarField_H
+
+#include "mixedFvPatchFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class basicSpecieMixture;
+
+/*---------------------------------------------------------------------------*\
+ Class specieTransferMassFractionFvPatchScalarField Declaration
+\*---------------------------------------------------------------------------*/
+
+class specieTransferMassFractionFvPatchScalarField
+:
+ public mixedFvPatchScalarField
+{
+public:
+
+ //- Enumeration for the property driving the transfer
+ enum property
+ {
+ massFraction,
+ moleFraction,
+ molarConcentration,
+ partialPressure
+ };
+
+ //- Property type names
+ static const NamedEnum propertyNames_;
+
+
+private:
+
+ // Private Data
+
+ //- Name of the flux field
+ const word phiName_;
+
+ //- Name of the velocity field
+ const word UName_;
+
+ //- Flux of this species
+ mutable scalarField phiYp_;
+
+ //- Current time index
+ mutable label timeIndex_;
+
+
+protected:
+
+ // Protected Data
+
+ //- Transfer coefficient
+ const scalar c_;
+
+ //- Property driving the transfer
+ const property property_;
+
+
+public:
+
+ // Static member functions
+
+ //- Access the composition for the given database
+ static const basicSpecieMixture& composition(const objectRegistry& db);
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ specieTransferMassFractionFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ specieTransferMassFractionFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given fixedValueTypeFvPatchField
+ // onto a new patch
+ specieTransferMassFractionFvPatchScalarField
+ (
+ const specieTransferMassFractionFvPatchScalarField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Copy constructor
+ specieTransferMassFractionFvPatchScalarField
+ (
+ const specieTransferMassFractionFvPatchScalarField&
+ );
+
+ //- Copy constructor setting internal field reference
+ specieTransferMassFractionFvPatchScalarField
+ (
+ const specieTransferMassFractionFvPatchScalarField&,
+ const DimensionedField&
+ );
+
+
+ // Member Functions
+
+ // Mapping functions
+
+ //- Map (and resize as needed) from self given a mapping object
+ // Used to update fields following mesh topology change
+ virtual void autoMap(const fvPatchFieldMapper&);
+
+ //- Reverse map the given fvPatchField onto this fvPatchField
+ // Used to reconstruct fields
+ virtual void rmap(const fvPatchScalarField&, const labelList&);
+
+
+ // Evaluation functions
+
+ //- Return the flux of this species
+ virtual tmp calcPhiYp() const = 0;
+
+ //- Return the flux of this species
+ virtual const scalarField& phiYp() const;
+
+ //- Update the coefficients associated with the patch field
+ virtual void updateCoeffs();
+
+
+ //- Write
+ virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.C b/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.C
new file mode 100644
index 0000000000..6bce174225
--- /dev/null
+++ b/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.C
@@ -0,0 +1,211 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "specieTransferTemperatureFvPatchScalarField.H"
+#include "specieTransferMassFractionFvPatchScalarField.H"
+#include "specieTransferVelocityFvPatchVectorField.H"
+#include "addToRunTimeSelectionTable.H"
+#include "volFields.H"
+#include "surfaceFields.H"
+#include "turbulentFluidThermoModel.H"
+#include "basicSpecieMixture.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::specieTransferTemperatureFvPatchScalarField::
+specieTransferTemperatureFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ mixedEnergyCalculatedTemperatureFvPatchScalarField(p, iF),
+ phiName_("phi"),
+ UName_("U")
+{}
+
+
+Foam::specieTransferTemperatureFvPatchScalarField::
+specieTransferTemperatureFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict,
+ const bool readValue
+)
+:
+ mixedEnergyCalculatedTemperatureFvPatchScalarField(p, iF),
+ phiName_(dict.lookupOrDefault("phi", "phi")),
+ UName_(dict.lookupOrDefault("U", "U"))
+{
+ if (readValue)
+ {
+ fvPatchScalarField::operator==(scalarField("value", dict, p.size()));
+ }
+}
+
+
+Foam::specieTransferTemperatureFvPatchScalarField::
+specieTransferTemperatureFvPatchScalarField
+(
+ const specieTransferTemperatureFvPatchScalarField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ mixedEnergyCalculatedTemperatureFvPatchScalarField(ptf, p, iF, mapper),
+ phiName_(ptf.phiName_),
+ UName_(ptf.UName_)
+{}
+
+
+Foam::specieTransferTemperatureFvPatchScalarField::
+specieTransferTemperatureFvPatchScalarField
+(
+ const specieTransferTemperatureFvPatchScalarField& ptf
+)
+:
+ mixedEnergyCalculatedTemperatureFvPatchScalarField(ptf),
+ phiName_(ptf.phiName_),
+ UName_(ptf.UName_)
+{}
+
+
+Foam::specieTransferTemperatureFvPatchScalarField::
+specieTransferTemperatureFvPatchScalarField
+(
+ const specieTransferTemperatureFvPatchScalarField& ptf,
+ const DimensionedField& iF
+)
+:
+ mixedEnergyCalculatedTemperatureFvPatchScalarField(ptf, iF),
+ phiName_(ptf.phiName_),
+ UName_(ptf.UName_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+const Foam::tmp
+Foam::specieTransferTemperatureFvPatchScalarField::phiHep() const
+{
+ typedef specieTransferMassFractionFvPatchScalarField YBCType;
+ const basicSpecieMixture& mixture = YBCType::composition(db());
+ const PtrList& Y = mixture.Y();
+
+ // Get thermodynamic properties
+ const fluidThermo& thermo =
+ db().lookupObject(basicThermo::dictName);
+ const fvPatchScalarField& Tp = *this;
+ const fvPatchScalarField& pp = thermo.p().boundaryField()[patch().index()];
+
+ // Sum up the phiHep from all the species
+ tmp tPhiHep(new scalarField(this->size(), 0));
+ scalarField& phiHep = tPhiHep.ref();
+ forAll(Y, i)
+ {
+ const fvPatchScalarField& Yp = Y[i].boundaryField()[patch().index()];
+
+ if (!isA(Yp))
+ {
+ FatalErrorInFunction
+ << "The mass-fraction condition on patch " << patch().name()
+ << " is not of type " << YBCType::typeName << "."
+ << exit(FatalError);
+ }
+
+ phiHep += refCast(Yp).phiYp()*mixture.HE(i, pp, Tp);
+ }
+
+ return tPhiHep;
+}
+
+
+void Foam::specieTransferTemperatureFvPatchScalarField::updateCoeffs()
+{
+ if (updated())
+ {
+ return;
+ }
+
+ // Get the fluxes
+ const scalarField& phip =
+ patch().lookupPatchField(phiName_);
+ const fvPatchVectorField& Up =
+ patch().lookupPatchField(UName_);
+ tmp uPhip =
+ refCast(Up).phip();
+
+ // Get the diffusivity
+ // !!! <-- This is a potential lagging issue as alphaEff(patchi) calculates
+ // alpha on demand, so the value may be different from alphaEff() which
+ // uses the alpha field cached by the thermodynamics
+ const scalarField AAlphaEffp
+ (
+ patch().magSf()
+ *db().lookupObject
+ (
+ turbulenceModel::propertiesName
+ ).alphaEff(patch().index())
+ );
+
+ // Get the current energy to linearise around
+ const fluidThermo& thermo =
+ db().lookupObject(basicThermo::dictName);
+ const scalarField& hep = thermo.he().boundaryField()[patch().index()];
+
+ heValueFraction() = phip/(phip - patch().deltaCoeffs()*AAlphaEffp);
+ heRefValue() = hep;
+ heRefGrad() = phip*(hep - phiHep()/uPhip)/AAlphaEffp;
+
+ mixedEnergyCalculatedTemperatureFvPatchScalarField::updateCoeffs();
+}
+
+
+void Foam::specieTransferTemperatureFvPatchScalarField::write
+(
+ Ostream& os
+) const
+{
+ fvPatchScalarField::write(os);
+ writeEntryIfDifferent(os, "phi", "phi", phiName_);
+ writeEntryIfDifferent(os, "U", "U", UName_);
+ writeEntry(os, "value", *this);
+}
+
+
+// * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
+
+namespace Foam
+{
+ makePatchTypeField
+ (
+ fvPatchScalarField,
+ specieTransferTemperatureFvPatchScalarField
+ );
+}
+
+// ************************************************************************* //
diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.H b/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.H
new file mode 100644
index 0000000000..a7cd66345c
--- /dev/null
+++ b/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.H
@@ -0,0 +1,188 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::specieTransferTemperatureFvPatchScalarField
+
+Description
+ This is a temperature boundary condition for a specie-transferring wall.
+
+ This condition must be used in conjunction with mass-fraction boundary
+ conditions derived from specieTransferMassFractionFvPatchScalarField, and a
+ specieTransferVelocity condition for the velocity.
+
+ This condition sums the species' energy fluxes generated by the
+ mass-fraction conditions, and uses this total to set the flux of energy
+ into or out of the domain.
+
+Usage
+ \table
+ Property | Description | Req'd? | Default
+ phi | Name of the flux field | no | phi
+ U | Name of the velocity field | no | U
+ \endtable
+
+ Example of the boundary condition specification:
+ \verbatim
+
+ {
+ type specieTransferTemperature;
+ value $internalField;
+ }
+ \endverbatim
+
+See also
+ Foam::specieTransferMassFractionFvPatchScalarField
+ Foam::specieTransferVelocityFvPatchScalarField
+
+SourceFiles
+ specieTransferTemperatureFvPatchScalarField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef specieTransferTemperatureFvPatchScalarField_H
+#define specieTransferTemperatureFvPatchScalarField_H
+
+#include "mixedEnergyCalculatedTemperatureFvPatchScalarField.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class specieTransferTemperatureFvPatchScalarField Declaration
+\*---------------------------------------------------------------------------*/
+
+class specieTransferTemperatureFvPatchScalarField
+:
+ public mixedEnergyCalculatedTemperatureFvPatchScalarField
+{
+ // Private Data
+
+ //- Name of the flux field
+ const word phiName_;
+
+ //- Name of the velocity field
+ const word UName_;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("specieTransferTemperature");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ specieTransferTemperatureFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ specieTransferTemperatureFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&,
+ const bool readValue = true
+ );
+
+ //- Construct by mapping given fixedValueTypeFvPatchField
+ // onto a new patch
+ specieTransferTemperatureFvPatchScalarField
+ (
+ const specieTransferTemperatureFvPatchScalarField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Copy constructor
+ specieTransferTemperatureFvPatchScalarField
+ (
+ const specieTransferTemperatureFvPatchScalarField&
+ );
+
+ //- Construct and return a clone
+ virtual tmp clone() const
+ {
+ return tmp
+ (
+ new specieTransferTemperatureFvPatchScalarField(*this)
+ );
+ }
+
+ //- Copy constructor setting internal field reference
+ specieTransferTemperatureFvPatchScalarField
+ (
+ const specieTransferTemperatureFvPatchScalarField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp
+ (
+ new specieTransferTemperatureFvPatchScalarField
+ (
+ *this,
+ iF
+ )
+ );
+ }
+
+
+ // Member Functions
+
+ // Evaluation functions
+
+ //- Return the flux of energy
+ const tmp phiHep() const;
+
+ //- Update the coefficients associated with the patch field
+ virtual void updateCoeffs();
+
+
+ //- Write
+ virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.C b/src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.C
similarity index 63%
rename from src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.C
rename to src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.C
index 0c4bdfde3f..47160b4b61 100644
--- a/src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.C
+++ b/src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -23,19 +23,18 @@ License
\*---------------------------------------------------------------------------*/
-#include "semiPermeableBaffleVelocityFvPatchVectorField.H"
-#include "semiPermeableBaffleMassFractionFvPatchScalarField.H"
+#include "specieTransferVelocityFvPatchVectorField.H"
+#include "specieTransferMassFractionFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
-#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
-#include "psiReactionThermo.H"
-#include "rhoReactionThermo.H"
+#include "basicSpecieMixture.H"
+#include "basicThermo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-Foam::semiPermeableBaffleVelocityFvPatchVectorField::
-semiPermeableBaffleVelocityFvPatchVectorField
+Foam::specieTransferVelocityFvPatchVectorField::
+specieTransferVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField& iF
@@ -46,25 +45,29 @@ semiPermeableBaffleVelocityFvPatchVectorField
{}
-Foam::semiPermeableBaffleVelocityFvPatchVectorField::
-semiPermeableBaffleVelocityFvPatchVectorField
+Foam::specieTransferVelocityFvPatchVectorField::
+specieTransferVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField& iF,
- const dictionary& dict
+ const dictionary& dict,
+ const bool readValue
)
:
fixedValueFvPatchVectorField(p, iF),
rhoName_(dict.lookupOrDefault("rho", "rho"))
{
- fvPatchVectorField::operator==(vectorField("value", dict, p.size()));
+ if (readValue)
+ {
+ fvPatchVectorField::operator==(vectorField("value", dict, p.size()));
+ }
}
-Foam::semiPermeableBaffleVelocityFvPatchVectorField::
-semiPermeableBaffleVelocityFvPatchVectorField
+Foam::specieTransferVelocityFvPatchVectorField::
+specieTransferVelocityFvPatchVectorField
(
- const semiPermeableBaffleVelocityFvPatchVectorField& ptf,
+ const specieTransferVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField& iF,
const fvPatchFieldMapper& mapper
@@ -75,10 +78,10 @@ semiPermeableBaffleVelocityFvPatchVectorField
{}
-Foam::semiPermeableBaffleVelocityFvPatchVectorField::
-semiPermeableBaffleVelocityFvPatchVectorField
+Foam::specieTransferVelocityFvPatchVectorField::
+specieTransferVelocityFvPatchVectorField
(
- const semiPermeableBaffleVelocityFvPatchVectorField& ptf
+ const specieTransferVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchVectorField(ptf),
@@ -86,10 +89,10 @@ semiPermeableBaffleVelocityFvPatchVectorField
{}
-Foam::semiPermeableBaffleVelocityFvPatchVectorField::
-semiPermeableBaffleVelocityFvPatchVectorField
+Foam::specieTransferVelocityFvPatchVectorField::
+specieTransferVelocityFvPatchVectorField
(
- const semiPermeableBaffleVelocityFvPatchVectorField& ptf,
+ const specieTransferVelocityFvPatchVectorField& ptf,
const DimensionedField& iF
)
:
@@ -100,21 +103,15 @@ semiPermeableBaffleVelocityFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-void Foam::semiPermeableBaffleVelocityFvPatchVectorField::updateCoeffs()
+const Foam::tmp
+Foam::specieTransferVelocityFvPatchVectorField::phip() const
{
- if (updated())
- {
- return;
- }
-
- typedef semiPermeableBaffleMassFractionFvPatchScalarField YBCType;
-
- const scalarField& rhop =
- patch().lookupPatchField(rhoName_);
-
+ typedef specieTransferMassFractionFvPatchScalarField YBCType;
const PtrList& Y = YBCType::composition(db()).Y();
- scalarField phip(patch().size(), Zero);
+ // Sum up the phiYp-s from all the species
+ tmp tPhip(new scalarField(this->size(), 0));
+ scalarField& phip = tPhip.ref();
forAll(Y, i)
{
const fvPatchScalarField& Yp = Y[i].boundaryField()[patch().index()];
@@ -127,16 +124,34 @@ void Foam::semiPermeableBaffleVelocityFvPatchVectorField::updateCoeffs()
<< exit(FatalError);
}
- phip += refCast(Yp).phiY();
+ phip += refCast(Yp).phiYp();
}
- this->operator==(patch().nf()*phip/(rhop*patch().magSf()));
+ return tPhip;
+}
+
+
+void Foam::specieTransferVelocityFvPatchVectorField::updateCoeffs()
+{
+ if (updated())
+ {
+ return;
+ }
+
+ // Get the density
+ const scalarField& rhop =
+ patch().lookupPatchField(rhoName_);
+
+ // Set the normal component of the velocity to match the computed flux
+ const vectorField nf(patch().nf());
+ const tensorField Tau(tensor::I - sqr(nf));
+ this->operator==((Tau & *this) + nf*phip()/(rhop*patch().magSf()));
fixedValueFvPatchVectorField::updateCoeffs();
}
-void Foam::semiPermeableBaffleVelocityFvPatchVectorField::write
+void Foam::specieTransferVelocityFvPatchVectorField::write
(
Ostream& os
) const
@@ -154,7 +169,7 @@ namespace Foam
makePatchTypeField
(
fvPatchVectorField,
- semiPermeableBaffleVelocityFvPatchVectorField
+ specieTransferVelocityFvPatchVectorField
);
}
diff --git a/src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.H b/src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.H
similarity index 65%
rename from src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.H
rename to src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.H
index 7304230651..a247d84f75 100644
--- a/src/semiPermeableBaffle/derivedFvPatchFields/semiPermeableBaffleVelocity/semiPermeableBaffleVelocityFvPatchVectorField.H
+++ b/src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -22,18 +22,18 @@ License
along with OpenFOAM. If not, see .
Class
- Foam::semiPermeableBaffleVelocityFvPatchVectorField
+ Foam::specieTransferVelocityFvPatchVectorField
Description
- This is a velocity boundary condition for a semi-permeable baffle.
+ This is a velocity boundary condition for a specie-transferring wall.
- This is a velocity boundary condition for baffles which are permeable to a
- some species and impermeable to others. It must be used in conjunction
- with the corresponding mass-fraction condition,
- semiPermeableBaffleMassFractionFvPatchScalarField.
+ This condition must be used in conjunction with mass-fraction boundary
+ conditions derived from specieTransferMassFractionFvPatchScalarField, and a
+ specieTransferTemperature condition for the temperature.
- This condition sums the species fluxes generated by the mass-fraction
- conditions, and uses this total to set the velocity.
+ This condition sums the species' mass fluxes generated by the
+ mass-fraction conditions, and uses this total to set the normal velocity
+ into or out of the wall.
Usage
\table
@@ -41,18 +41,27 @@ Usage
rho | Name of the density field | no | rho
\endtable
+ Example of the boundary condition specification:
+ \verbatim
+
+ {
+ type specieTransferVelocity;
+ value $internalField;
+ }
+ \endverbatim
+
See also
- Foam::semiPermeableBaffleMassFractionFvPatchScalarField
+ Foam::specieTransferMassFractionFvPatchScalarField
+ Foam::specieTransferTemperatureFvPatchScalarField
SourceFiles
- semiPermeableBaffleVelocityFvPatchVectorField.C
+ specieTransferVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
-#ifndef semiPermeableBaffleVelocityFvPatchVectorField_H
-#define semiPermeableBaffleVelocityFvPatchVectorField_H
+#ifndef specieTransferVelocityFvPatchVectorField_H
+#define specieTransferVelocityFvPatchVectorField_H
-#include "mappedPatchBase.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -61,10 +70,10 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
- Class semiPermeableBaffleVelocityFvPatchVectorField Declaration
+ Class specieTransferVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
-class semiPermeableBaffleVelocityFvPatchVectorField
+class specieTransferVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
@@ -77,40 +86,41 @@ class semiPermeableBaffleVelocityFvPatchVectorField
public:
//- Runtime type information
- TypeName("semiPermeableBaffleVelocity");
+ TypeName("specieTransferVelocity");
// Constructors
//- Construct from patch and internal field
- semiPermeableBaffleVelocityFvPatchVectorField
+ specieTransferVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField&
);
//- Construct from patch, internal field and dictionary
- semiPermeableBaffleVelocityFvPatchVectorField
+ specieTransferVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField&,
- const dictionary&
+ const dictionary&,
+ const bool readValue = true
);
//- Construct by mapping given fixedValueTypeFvPatchField
// onto a new patch
- semiPermeableBaffleVelocityFvPatchVectorField
+ specieTransferVelocityFvPatchVectorField
(
- const semiPermeableBaffleVelocityFvPatchVectorField&,
+ const specieTransferVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField&,
const fvPatchFieldMapper&
);
//- Copy constructor
- semiPermeableBaffleVelocityFvPatchVectorField
+ specieTransferVelocityFvPatchVectorField
(
- const semiPermeableBaffleVelocityFvPatchVectorField&
+ const specieTransferVelocityFvPatchVectorField&
);
//- Construct and return a clone
@@ -118,14 +128,14 @@ public:
{
return tmp
(
- new semiPermeableBaffleVelocityFvPatchVectorField(*this)
+ new specieTransferVelocityFvPatchVectorField(*this)
);
}
//- Copy constructor setting internal field reference
- semiPermeableBaffleVelocityFvPatchVectorField
+ specieTransferVelocityFvPatchVectorField
(
- const semiPermeableBaffleVelocityFvPatchVectorField&,
+ const specieTransferVelocityFvPatchVectorField&,
const DimensionedField&
);
@@ -137,7 +147,7 @@ public:
{
return tmp
(
- new semiPermeableBaffleVelocityFvPatchVectorField
+ new specieTransferVelocityFvPatchVectorField
(
*this,
iF
@@ -150,6 +160,9 @@ public:
// Evaluation functions
+ //- Return the flux
+ const tmp phip() const;
+
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files
index 83ee06f8bf..1e5963d0c3 100644
--- a/src/thermophysicalModels/basic/Make/files
+++ b/src/thermophysicalModels/basic/Make/files
@@ -10,7 +10,9 @@ rhoThermo/liquidThermo.C
derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C
derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C
+derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.C
derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C
+derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C
derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C
derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C
diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C
index 815fb57b01..6d831a4be8 100644
--- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C
+++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C
@@ -27,7 +27,9 @@ License
#include "zeroGradientFvPatchFields.H"
#include "fixedEnergyFvPatchScalarField.H"
#include "gradientEnergyFvPatchScalarField.H"
+#include "gradientEnergyCalculatedTemperatureFvPatchScalarField.H"
#include "mixedEnergyFvPatchScalarField.H"
+#include "mixedEnergyCalculatedTemperatureFvPatchScalarField.H"
#include "fixedJumpFvPatchFields.H"
#include "fixedJumpAMIFvPatchFields.H"
#include "energyJumpFvPatchScalarField.H"
@@ -96,11 +98,22 @@ Foam::wordList Foam::basicThermo::heBoundaryTypes()
(
isA(tbf[patchi])
|| isA(tbf[patchi])
+ || isA
+ (
+ tbf[patchi]
+ )
)
{
hbt[patchi] = gradientEnergyFvPatchScalarField::typeName;
}
- else if (isA(tbf[patchi]))
+ else if
+ (
+ isA(tbf[patchi])
+ || isA
+ (
+ tbf[patchi]
+ )
+ )
{
hbt[patchi] = mixedEnergyFvPatchScalarField::typeName;
}
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C
index 74b04047ce..c3cb0e8ee4 100644
--- a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C
@@ -100,10 +100,12 @@ void Foam::fixedEnergyFvPatchScalarField::updateCoeffs()
const basicThermo& thermo = basicThermo::lookupThermo(*this);
const label patchi = patch().index();
- fvPatchScalarField& Tw =
+ fvPatchScalarField& Tp =
const_cast(thermo.T().boundaryField()[patchi]);
- Tw.evaluate();
- operator==(thermo.he(Tw, patchi));
+
+ Tp.evaluate();
+
+ operator==(thermo.he(Tp, patchi));
fixedValueFvPatchScalarField::updateCoeffs();
}
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.H
index 3fe3ea08f8..f65434a8d7 100644
--- a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.H
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.H
@@ -25,17 +25,8 @@ Class
Foam::fixedEnergyFvPatchScalarField
Description
- This boundary condition provides a fixed condition for internal energy
-
-Usage
- Example of the boundary condition specification:
- \verbatim
-
- {
- type fixedEnergy;
- value uniform 100;
- }
- \endverbatim
+ This boundary condition provides a fixed condition for energy. This is
+ selected when the corresponding temperature condition is fixedValue.
See also
Foam::fixedValueFvPatchField
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.C
new file mode 100644
index 0000000000..9b89a158d0
--- /dev/null
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.C
@@ -0,0 +1,136 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "gradientEnergyCalculatedTemperatureFvPatchScalarField.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineTypeNameAndDebug
+ (
+ gradientEnergyCalculatedTemperatureFvPatchScalarField,
+ 0
+ );
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField::
+gradientEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ calculatedFvPatchScalarField(p, iF),
+ heGradient_(p.size())
+{}
+
+
+Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField::
+gradientEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ calculatedFvPatchScalarField(p, iF),
+ heGradient_(p.size())
+{
+ calculatedFvPatchScalarField::evaluate();
+}
+
+
+Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField::
+gradientEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const gradientEnergyCalculatedTemperatureFvPatchScalarField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ calculatedFvPatchScalarField(ptf, p, iF, mapper),
+ heGradient_(mapper(ptf.heGradient_))
+{}
+
+
+Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField::
+gradientEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const gradientEnergyCalculatedTemperatureFvPatchScalarField& ptf
+)
+:
+ calculatedFvPatchScalarField(ptf),
+ heGradient_(ptf.heGradient_)
+{}
+
+
+Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField::
+gradientEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const gradientEnergyCalculatedTemperatureFvPatchScalarField& ptf,
+ const DimensionedField& iF
+)
+:
+ calculatedFvPatchScalarField(ptf, iF),
+ heGradient_(ptf.heGradient_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField::autoMap
+(
+ const fvPatchFieldMapper& m
+)
+{
+ calculatedFvPatchScalarField::autoMap(m);
+ m(heGradient_, heGradient_);
+}
+
+
+void Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField::rmap
+(
+ const fvPatchScalarField& ptf,
+ const labelList& addr
+)
+{
+ calculatedFvPatchScalarField::rmap(ptf, addr);
+
+ const gradientEnergyCalculatedTemperatureFvPatchScalarField& mptf =
+ refCast
+ (
+ ptf
+ );
+
+ heGradient_.rmap(mptf.heGradient_, addr);
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.H
new file mode 100644
index 0000000000..163c4caa3c
--- /dev/null
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchScalarField.H
@@ -0,0 +1,177 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField
+
+Description
+ Base class for temperature boundary conditions in which the parameters of
+ the gradient energy condition can be set directly
+
+SourceFiles
+ gradientEnergyCalculatedTemperatureFvPatchScalarField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef gradientEnergyCalculatedTemperatureFvPatchScalarField_H
+#define gradientEnergyCalculatedTemperatureFvPatchScalarField_H
+
+#include "calculatedFvPatchFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class gradientEnergyCalculatedTemperatureFvPatchScalarField Declaration
+\*---------------------------------------------------------------------------*/
+
+class gradientEnergyCalculatedTemperatureFvPatchScalarField
+:
+ public calculatedFvPatchScalarField
+{
+ // Private Data
+
+ //- Energy normal gradient field
+ scalarField heGradient_;
+
+
+public:
+
+ // Static Data Members
+
+ //- Run-time type information
+ TypeName("gradientEnergyCalculatedTemperature");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ gradientEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ gradientEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given fixedValueTypeFvPatchField
+ // onto a new patch
+ gradientEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const gradientEnergyCalculatedTemperatureFvPatchScalarField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Copy constructor
+ gradientEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const gradientEnergyCalculatedTemperatureFvPatchScalarField&
+ );
+
+ //- Construct and return a clone
+ virtual tmp clone() const
+ {
+ return tmp
+ (
+ new gradientEnergyCalculatedTemperatureFvPatchScalarField(*this)
+ );
+ }
+
+ //- Copy constructor setting internal field reference
+ gradientEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const gradientEnergyCalculatedTemperatureFvPatchScalarField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp
+ (
+ new gradientEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ *this,
+ iF
+ )
+ );
+ }
+
+
+ // Member Functions
+
+ // Access
+
+ //- Return true if this patch field fixes a value
+ virtual bool fixesValue() const
+ {
+ return false;
+ }
+
+ //- Access the energy gradient
+ inline scalarField& heGradient()
+ {
+ return heGradient_;
+ }
+
+ //- Access the energy gradient
+ inline const scalarField& heGradient() const
+ {
+ return heGradient_;
+ }
+
+
+ // Mapping functions
+
+ //- Map (and resize as needed) from self given a mapping object
+ // Used to update fields following mesh topology change
+ virtual void autoMap(const fvPatchFieldMapper&);
+
+ //- Reverse map the given fvPatchField onto this fvPatchField
+ // Used to reconstruct fields
+ virtual void rmap(const fvPatchScalarField&, const labelList&);
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C
index 163f02f32d..3d54b6ccfd 100644
--- a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C
@@ -23,7 +23,9 @@ License
\*---------------------------------------------------------------------------*/
+#include "zeroGradientFvPatchFields.H"
#include "gradientEnergyFvPatchScalarField.H"
+#include "gradientEnergyCalculatedTemperatureFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
@@ -100,17 +102,43 @@ void Foam::gradientEnergyFvPatchScalarField::updateCoeffs()
const basicThermo& thermo = basicThermo::lookupThermo(*this);
const label patchi = patch().index();
- fvPatchScalarField& Tw =
+ fvPatchScalarField& Tp =
const_cast(thermo.T().boundaryField()[patchi]);
- Tw.evaluate();
+ Tp.evaluate();
- gradient() = thermo.Cpv(Tw, patchi)*Tw.snGrad()
- + patch().deltaCoeffs()*
- (
- thermo.he(Tw, patchi)
- - thermo.he(Tw, patch().faceCells())
- );
+ if
+ (
+ isA(Tp)
+ || isA(Tp)
+ )
+ {
+ gradient() =
+ thermo.Cpv(Tp, patchi)*Tp.snGrad()
+ + patch().deltaCoeffs()*
+ (
+ thermo.he(Tp, patchi)
+ - thermo.he(Tp, patch().faceCells())
+ );
+ }
+ else if (isA(Tp))
+ {
+ gradientEnergyCalculatedTemperatureFvPatchScalarField& Tg =
+ refCast(Tp);
+
+ gradient() = Tg.heGradient();
+ }
+ else
+ {
+ FatalErrorInFunction
+ << "Temperature boundary condition not recognised."
+ << "A " << typeName << " condition for energy must be used with a "
+ << zeroGradientFvPatchScalarField::typeName << ", "
+ << fixedGradientFvPatchScalarField::typeName << " or "
+ << gradientEnergyCalculatedTemperatureFvPatchScalarField::typeName
+ << " condition for temperature."
+ << exit(FatalError);
+ }
fixedGradientFvPatchScalarField::updateCoeffs();
}
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.H
index 646e664d76..bcbe274e8d 100644
--- a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.H
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.H
@@ -25,35 +25,22 @@ Class
Foam::gradientEnergyFvPatchScalarField
Description
- This boundary condition provides a gradient condition for internal energy,
- where the gradient is calculated using:
+ This boundary condition provides a gradient condition for energy. This is
+ selected when the corresponding temperature condition is zeroGradient,
+ fixedGradient or gradientEnergyCalculatedTemperature.
- \f[
- \nabla(e_p) = \nabla_\perp C_p(p, T) + \frac{e_p - e_c}{\Delta}
- \f]
+ If the temperature condition is fixedGradient or zeroGradient, the
+ parameters of the energy condition are obtained from a linearisation of the
+ corresponding parameters of the temperature condition.
- where
- \vartable
- e_p | energy at patch faces [J]
- e_c | energy at patch internal cells [J]
- p | pressure [bar]
- T | temperature [K]
- C_p | specific heat [J/kg/K]
- \Delta | distance between patch face and internal cell centres [m]
- \endvartable
-
-Usage
- Example of the boundary condition specification:
- \verbatim
-
- {
- type gradientEnergy;
- gradient uniform 10;
- }
- \endverbatim
+ If the temperature condition is gradientEnergyCalculatedTemperature, then
+ the temperature condition explicitly provides an energy gradient field, so
+ no linearisation is needed.
See also
- Foam::fixedGradientFvPatchField
+ Foam::zeroGradientFvPatchScalarField
+ Foam::fixedGradientFvPatchScalarField
+ Foam::gradientEnergyCalculatedTemperatureFvPatchScalarField
SourceFiles
gradientEnergyFvPatchScalarField.C
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C
new file mode 100644
index 0000000000..def645ea62
--- /dev/null
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C
@@ -0,0 +1,147 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "mixedEnergyCalculatedTemperatureFvPatchScalarField.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineTypeNameAndDebug
+ (
+ mixedEnergyCalculatedTemperatureFvPatchScalarField,
+ 0
+ );
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField::
+mixedEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ calculatedFvPatchScalarField(p, iF),
+ heRefValue_(p.size()),
+ heRefGrad_(p.size()),
+ heValueFraction_(p.size())
+{}
+
+
+Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField::
+mixedEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ calculatedFvPatchScalarField(p, iF),
+ heRefValue_(p.size()),
+ heRefGrad_(p.size()),
+ heValueFraction_(p.size())
+{
+ calculatedFvPatchScalarField::evaluate();
+}
+
+
+Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField::
+mixedEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const mixedEnergyCalculatedTemperatureFvPatchScalarField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ calculatedFvPatchScalarField(ptf, p, iF, mapper),
+ heRefValue_(mapper(ptf.heRefValue_)),
+ heRefGrad_(mapper(ptf.heRefGrad_)),
+ heValueFraction_(mapper(ptf.heValueFraction_))
+{}
+
+
+Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField::
+mixedEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const mixedEnergyCalculatedTemperatureFvPatchScalarField& ptf
+)
+:
+ calculatedFvPatchScalarField(ptf),
+ heRefValue_(ptf.heRefValue_),
+ heRefGrad_(ptf.heRefGrad_),
+ heValueFraction_(ptf.heValueFraction_)
+{}
+
+
+Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField::
+mixedEnergyCalculatedTemperatureFvPatchScalarField
+(
+ const mixedEnergyCalculatedTemperatureFvPatchScalarField& ptf,
+ const DimensionedField& iF
+)
+:
+ calculatedFvPatchScalarField(ptf, iF),
+ heRefValue_(ptf.heRefValue_),
+ heRefGrad_(ptf.heRefGrad_),
+ heValueFraction_(ptf.heValueFraction_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField::autoMap
+(
+ const fvPatchFieldMapper& m
+)
+{
+ calculatedFvPatchScalarField::autoMap(m);
+ m(heRefValue_, heRefValue_);
+ m(heRefGrad_, heRefGrad_);
+ m(heValueFraction_, heValueFraction_);
+}
+
+
+void Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField::rmap
+(
+ const fvPatchScalarField& ptf,
+ const labelList& addr
+)
+{
+ calculatedFvPatchScalarField::rmap(ptf, addr);
+
+ const mixedEnergyCalculatedTemperatureFvPatchScalarField& mptf =
+ refCast(ptf);
+
+ heRefValue_.rmap(mptf.heRefValue_, addr);
+ heRefGrad_.rmap(mptf.heRefGrad_, addr);
+ heValueFraction_.rmap(mptf.heValueFraction_, addr);
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.H
new file mode 100644
index 0000000000..45f6ed164a
--- /dev/null
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.H
@@ -0,0 +1,207 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::mixedEnergyCalculatedTemperatureFvPatchScalarField
+
+Description
+ Base class for temperature boundary conditions in which the parameters of
+ the mixed energy condition can be set directly.
+
+SourceFiles
+ mixedEnergyCalculatedTemperatureFvPatchScalarField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef mixedEnergyCalculatedTemperatureFvPatchScalarField_H
+#define mixedEnergyCalculatedTemperatureFvPatchScalarField_H
+
+#include "calculatedFvPatchFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class mixedEnergyCalculatedTemperatureFvPatchScalarField Declaration
+\*---------------------------------------------------------------------------*/
+
+class mixedEnergyCalculatedTemperatureFvPatchScalarField
+:
+ public calculatedFvPatchScalarField
+{
+ // Private Data
+
+ //- Energy value field
+ scalarField heRefValue_;
+
+ //- Energy normal gradient field
+ scalarField heRefGrad_;
+
+ //- Fraction (0-1) of energy value used for boundary condition
+ scalarField heValueFraction_;
+
+
+public:
+
+ // Static Data Members
+
+ //- Run-time type information
+ TypeName("mixedEnergyCalculatedTemperature");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ mixedEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ mixedEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given fixedValueTypeFvPatchField
+ // onto a new patch
+ mixedEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const mixedEnergyCalculatedTemperatureFvPatchScalarField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Copy constructor
+ mixedEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const mixedEnergyCalculatedTemperatureFvPatchScalarField&
+ );
+
+ //- Construct and return a clone
+ virtual tmp clone() const
+ {
+ return tmp
+ (
+ new mixedEnergyCalculatedTemperatureFvPatchScalarField(*this)
+ );
+ }
+
+ //- Copy constructor setting internal field reference
+ mixedEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ const mixedEnergyCalculatedTemperatureFvPatchScalarField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp
+ (
+ new mixedEnergyCalculatedTemperatureFvPatchScalarField
+ (
+ *this,
+ iF
+ )
+ );
+ }
+
+
+ // Member Functions
+
+ // Access
+
+ //- Return true if this patch field fixes a value
+ virtual bool fixesValue() const
+ {
+ return false;
+ }
+
+ //- Access the energy value
+ inline scalarField& heRefValue()
+ {
+ return heRefValue_;
+ }
+
+ //- Access the energy value
+ inline const scalarField& heRefValue() const
+ {
+ return heRefValue_;
+ }
+
+ //- Access the energy gradient
+ inline scalarField& heRefGrad()
+ {
+ return heRefGrad_;
+ }
+
+ //- Access the energy gradient
+ inline const scalarField& heRefGrad() const
+ {
+ return heRefGrad_;
+ }
+
+ //- Access the energy fraction
+ inline scalarField& heValueFraction()
+ {
+ return heValueFraction_;
+ }
+
+ //- Access the energy fraction
+ inline const scalarField& heValueFraction() const
+ {
+ return heValueFraction_;
+ }
+
+
+ // Mapping functions
+
+ //- Map (and resize as needed) from self given a mapping object
+ // Used to update fields following mesh topology change
+ virtual void autoMap(const fvPatchFieldMapper&);
+
+ //- Reverse map the given fvPatchField onto this fvPatchField
+ // Used to reconstruct fields
+ virtual void rmap(const fvPatchScalarField&, const labelList&);
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C
index 0b2db4b428..52fd156180 100644
--- a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C
@@ -28,7 +28,7 @@ License
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "basicThermo.H"
-
+#include "mixedEnergyCalculatedTemperatureFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@@ -105,22 +105,47 @@ void Foam::mixedEnergyFvPatchScalarField::updateCoeffs()
const basicThermo& thermo = basicThermo::lookupThermo(*this);
const label patchi = patch().index();
- mixedFvPatchScalarField& Tw = refCast
- (
- const_cast(thermo.T().boundaryField()[patchi])
- );
+ fvPatchScalarField& Tp =
+ const_cast(thermo.T().boundaryField()[patchi]);
- Tw.evaluate();
+ if (isA(Tp))
+ {
+ mixedFvPatchScalarField& Tm =
+ refCast(Tp);
- valueFraction() = Tw.valueFraction();
- refValue() = thermo.he(Tw.refValue(), patchi);
- refGrad() =
- thermo.Cpv(Tw, patchi)*Tw.refGrad()
- + patch().deltaCoeffs()*
- (
- thermo.he(Tw, patchi)
- - thermo.he(Tw, patch().faceCells())
- );
+ Tm.evaluate();
+
+ valueFraction() = Tm.valueFraction();
+ refValue() = thermo.he(Tm.refValue(), patchi);
+ refGrad() =
+ thermo.Cpv(Tm, patchi)*Tm.refGrad()
+ + patch().deltaCoeffs()*
+ (
+ thermo.he(Tm, patchi)
+ - thermo.he(Tm, patch().faceCells())
+ );
+ }
+ else if (isA(Tp))
+ {
+ mixedEnergyCalculatedTemperatureFvPatchScalarField& Tm =
+ refCast(Tp);
+
+ Tm.evaluate();
+
+ valueFraction() = Tm.heValueFraction();
+ refValue() = Tm.heRefValue();
+ refGrad() = Tm.heRefGrad();
+ }
+ else
+ {
+ FatalErrorInFunction
+ << "Temperature boundary condition not recognised."
+ << "A " << typeName << " condition for energy must be used with a "
+ << mixedFvPatchScalarField::typeName << " or "
+ << mixedEnergyCalculatedTemperatureFvPatchScalarField::typeName
+ << " condition for temperature."
+ << exit(FatalError);
+ }
mixedFvPatchScalarField::updateCoeffs();
}
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.H
index c2c2893c21..4c9302ac46 100644
--- a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.H
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.H
@@ -25,10 +25,21 @@ Class
Foam::mixedEnergyFvPatchScalarField
Description
- This boundary condition provides a mixed condition for internal energy
+ This boundary condition provides a mixed condition for energy. This is
+ selected when the corresponding temperature condition is mixed, or
+ mixedEnergyCalculatedTemperature.
+
+ If the temperature condition is mixed, the parameters of the energy
+ condition are obtained from a linearisation of the corresponding parameters
+ of the temperature condition.
+
+ If the temperature condition is mixedEnergyCalculatedTemperature, then the
+ temperature condition explicitly provides energy
+ refValue/refGrad/valueFraction fields, so no linearisation is needed.
See also
Foam::mixedFvPatchField
+ Foam::mixedEnergyCalculatedTemperatureFvPatchField
SourceFiles
mixedEnergyFvPatchScalarField.C
diff --git a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.C
index 60961e6391..01e4eea9ea 100644
--- a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.C
+++ b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.C
@@ -82,6 +82,35 @@ Foam::SpecieMixture::volScalarFieldProperty
}
+template
+Foam::tmp Foam::SpecieMixture::fieldProperty
+(
+ scalar (MixtureType::thermoType::*psiMethod)
+ (
+ const scalar,
+ const scalar
+ ) const,
+ const label speciei,
+ const scalarField& p,
+ const scalarField& T
+) const
+{
+ const typename MixtureType::thermoType& thermo =
+ this->getLocalThermo(speciei);
+
+ tmp tPsi(new scalarField(p.size()));
+
+ scalarField& psi = tPsi.ref();
+
+ forAll(p, facei)
+ {
+ psi[facei] = (thermo.*psiMethod)(p[facei], T[facei]);
+ }
+
+ return tPsi;
+}
+
+
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
@@ -188,6 +217,18 @@ Foam::scalar Foam::SpecieMixture::HE
}
+template
+Foam::tmp Foam::SpecieMixture::HE
+(
+ const label speciei,
+ const scalarField& p,
+ const scalarField& T
+) const
+{
+ return fieldProperty(&MixtureType::thermoType::HE, speciei, p, T);
+}
+
+
template
Foam::tmp Foam::SpecieMixture::HE
(
diff --git a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H
index a81d27c986..0b7e6f87b8 100644
--- a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H
+++ b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H
@@ -75,6 +75,19 @@ class SpecieMixture
const volScalarField& T
) const;
+ //- Return a field of the given property
+ tmp fieldProperty
+ (
+ scalar (MixtureType::thermoType::*psiMethod)
+ (
+ const scalar,
+ const scalar
+ ) const,
+ const label speciei,
+ const scalarField& p,
+ const scalarField& T
+ ) const;
+
public:
@@ -142,6 +155,14 @@ public:
const scalar T
) const;
+ //- Enthalpy/Internal energy [J/kg]
+ virtual tmp HE
+ (
+ const label speciei,
+ const scalarField& p,
+ const scalarField& T
+ ) const;
+
//- Enthalpy/Internal energy [J/kg]
virtual tmp HE
(
diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H
index ad2db0540c..cb29f540be 100644
--- a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H
+++ b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H
@@ -131,6 +131,14 @@ public:
const scalar T
) const = 0;
+ //- Enthalpy/Internal energy [J/kg]
+ virtual tmp HE
+ (
+ const label speciei,
+ const scalarField& p,
+ const scalarField& T
+ ) const = 0;
+
//- Enthalpy/Internal energy [J/kg]
virtual tmp HE
(
diff --git a/tutorials/combustion/reactingFoam/RAS/membrane/0/CH4.orig b/tutorials/combustion/reactingFoam/RAS/membrane/0/CH4.orig
index d9ce7828c3..06fb9ed13a 100644
--- a/tutorials/combustion/reactingFoam/RAS/membrane/0/CH4.orig
+++ b/tutorials/combustion/reactingFoam/RAS/membrane/0/CH4.orig
@@ -54,7 +54,7 @@ boundaryField
type semiPermeableBaffleMassFraction;
samplePatch membranePipe;
c 0.1;
- input massFraction;
+ property massFraction;
value uniform $!sleeve/CH4;
}
membranePipe
@@ -62,7 +62,7 @@ boundaryField
type semiPermeableBaffleMassFraction;
samplePatch membraneSleeve;
c 0.1;
- input massFraction;
+ property massFraction;
value uniform $!pipe/CH4;
}
}
diff --git a/tutorials/combustion/reactingFoam/RAS/membrane/0/T b/tutorials/combustion/reactingFoam/RAS/membrane/0/T
index d0897c6a78..dfafff846b 100644
--- a/tutorials/combustion/reactingFoam/RAS/membrane/0/T
+++ b/tutorials/combustion/reactingFoam/RAS/membrane/0/T
@@ -32,10 +32,20 @@ boundaryField
inletValue $internalField;
value $internalField;
}
- "(wall|membrane).*"
+ wall
{
type zeroGradient;
}
+ membraneSleeve
+ {
+ type specieTransferTemperature;
+ value $internalField;
+ }
+ membranePipe
+ {
+ type specieTransferTemperature;
+ value $internalField;
+ }
}
diff --git a/tutorials/combustion/reactingFoam/RAS/membrane/0/U b/tutorials/combustion/reactingFoam/RAS/membrane/0/U
index 0b4f225b0a..4810458d45 100644
--- a/tutorials/combustion/reactingFoam/RAS/membrane/0/U
+++ b/tutorials/combustion/reactingFoam/RAS/membrane/0/U
@@ -42,12 +42,12 @@ boundaryField
}
membraneSleeve
{
- type semiPermeableBaffleVelocity;
+ type specieTransferVelocity;
value $internalField;
}
membranePipe
{
- type semiPermeableBaffleVelocity;
+ type specieTransferVelocity;
value $internalField;
}
}
diff --git a/tutorials/combustion/reactingFoam/RAS/membrane/Allclean b/tutorials/combustion/reactingFoam/RAS/membrane/Allclean
deleted file mode 100755
index ea673bfcc0..0000000000
--- a/tutorials/combustion/reactingFoam/RAS/membrane/Allclean
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-cd ${0%/*} || exit 1
-
-. $WM_PROJECT_DIR/bin/tools/CleanFunctions
-
-rm -rf constant/triSurface/membrane-*.stl.gz
-cleanCase
-
-#------------------------------------------------------------------------------
diff --git a/tutorials/combustion/reactingFoam/RAS/membrane/Allrun b/tutorials/combustion/reactingFoam/RAS/membrane/Allrun
index f1e90c9e9e..24090efd83 100755
--- a/tutorials/combustion/reactingFoam/RAS/membrane/Allrun
+++ b/tutorials/combustion/reactingFoam/RAS/membrane/Allrun
@@ -4,11 +4,6 @@ cd ${0%/*} || exit 1
. $WM_PROJECT_DIR/bin/tools/RunFunctions
-cp \
- $FOAM_TUTORIALS/resources/geometry/membrane-boundaries.stl.gz \
- $FOAM_TUTORIALS/resources/geometry/membrane-membrane.stl.gz \
- constant/triSurface
-
runApplication blockMesh
runApplication snappyHexMesh -overwrite
runApplication createBaffles -overwrite
@@ -16,5 +11,3 @@ runApplication createBaffles -overwrite
runApplication setFields
runApplication reactingFoam
-
-#------------------------------------------------------------------------------
diff --git a/tutorials/combustion/reactingFoam/RAS/membrane/constant/triSurface/README b/tutorials/combustion/reactingFoam/RAS/membrane/constant/triSurface/README
deleted file mode 100644
index de3f29cc01..0000000000
--- a/tutorials/combustion/reactingFoam/RAS/membrane/constant/triSurface/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Directory to house tri-surfaces
-
-The Allrun script copies the surface from the $FOAM_TUTORIALS/resources/geometry
-directory
diff --git a/tutorials/resources/geometry/membrane-boundaries.stl.gz b/tutorials/combustion/reactingFoam/RAS/membrane/constant/triSurface/membrane-boundaries.stl.gz
similarity index 100%
rename from tutorials/resources/geometry/membrane-boundaries.stl.gz
rename to tutorials/combustion/reactingFoam/RAS/membrane/constant/triSurface/membrane-boundaries.stl.gz
diff --git a/tutorials/resources/geometry/membrane-membrane.stl.gz b/tutorials/combustion/reactingFoam/RAS/membrane/constant/triSurface/membrane-membrane.stl.gz
similarity index 100%
rename from tutorials/resources/geometry/membrane-membrane.stl.gz
rename to tutorials/combustion/reactingFoam/RAS/membrane/constant/triSurface/membrane-membrane.stl.gz
diff --git a/tutorials/combustion/reactingFoam/RAS/membrane/system/controlDict b/tutorials/combustion/reactingFoam/RAS/membrane/system/controlDict
index f02be5d162..3188beb0f6 100644
--- a/tutorials/combustion/reactingFoam/RAS/membrane/system/controlDict
+++ b/tutorials/combustion/reactingFoam/RAS/membrane/system/controlDict
@@ -49,7 +49,7 @@ adjustTimeStep yes;
maxCo 1;
-libs ( "libsemiPermeableBaffle.so" );
+libs ( "libspecieTransfer.so" );
// ************************************************************************* //