mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: New vibro-acoustic model suite
- New solver: `acousticFoam`
- New base finite-area region class: `regionFaModel`
- New base shell model classes:
- `vibrationShellModel`
- `thermalShellModel`
- New shell models:
- A vibration-shell model: `KirchhoffShell`
- A thermal-shell model: `thermalShell`
- New finite-area/finite-volume boundary conditions:
- `clampedPlate`
- `timeVaryingFixedValue`
- `acousticWaveTransmissive`
- New base classes for `fvOption` of finite-area methods: `faOption`
- New `faOption`s:
- `contactHeatFluxSource`
- `externalFileSource`
- `externalHeatFluxSource`
- `jouleHeatingSource`
- New tutorial: `compressible/acousticFoam/obliqueAirJet`
Signed-off-by: Kutalmis Bercin <kutalmis.bercin@esi-group.com>
This commit is contained in:
3
applications/solvers/acoustic/acousticFoam/Make/files
Normal file
3
applications/solvers/acoustic/acousticFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
acousticFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/acousticFoam
|
||||||
14
applications/solvers/acoustic/acousticFoam/Make/options
Normal file
14
applications/solvers/acoustic/acousticFoam/Make/options
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/fvOption/lnInclude \
|
||||||
|
-I$(LIB_SRC)/regionFaModels/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
|
-I$(LIB_SRC)/transportModels/compressible/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lfvOptions \
|
||||||
|
-lmeshTools \
|
||||||
|
-lsampling \
|
||||||
|
-lregionFaModels
|
||||||
99
applications/solvers/acoustic/acousticFoam/acousticFoam.C
Normal file
99
applications/solvers/acoustic/acousticFoam/acousticFoam.C
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
acousticFoam
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpAcousticSolvers
|
||||||
|
|
||||||
|
Description
|
||||||
|
Acoustic solver solving the acoustic pressure wave equation.
|
||||||
|
|
||||||
|
\f[
|
||||||
|
\ddt2{pa} - c^2 \laplacian{pa} = 0
|
||||||
|
\f]
|
||||||
|
|
||||||
|
where
|
||||||
|
\vartable
|
||||||
|
c | Sound speed
|
||||||
|
pa | Acoustic pressure
|
||||||
|
\endvartable
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
acousticFoam.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "fvOptions.H"
|
||||||
|
#include "pimpleControl.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::addNote
|
||||||
|
(
|
||||||
|
"Acoustic solver solving the acoustic pressure wave equation."
|
||||||
|
);
|
||||||
|
|
||||||
|
#include "postProcess.H"
|
||||||
|
|
||||||
|
#include "addCheckCaseOptions.H"
|
||||||
|
#include "setRootCaseLists.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
#include "createControl.H"
|
||||||
|
#include "createRegionControls.H"
|
||||||
|
|
||||||
|
#include "readTransportProperties.H"
|
||||||
|
#include "createFields.H"
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (runTime.run())
|
||||||
|
{
|
||||||
|
++runTime;
|
||||||
|
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
while (pimple.correct())
|
||||||
|
{
|
||||||
|
#include "paEqn.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
runTime.printExecutionTime(Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
15
applications/solvers/acoustic/acousticFoam/createFields.H
Normal file
15
applications/solvers/acoustic/acousticFoam/createFields.H
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
Info << "\nReading pa" << endl;
|
||||||
|
|
||||||
|
volScalarField pa
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"pa",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
fvSolution solutionDict(runTime);
|
||||||
|
|
||||||
|
const dictionary& pimpleDict = solutionDict.subDict("PIMPLE");
|
||||||
|
|
||||||
|
bool solvePrimaryRegion
|
||||||
|
(
|
||||||
|
pimpleDict.getOrDefault("solvePrimaryRegion", true)
|
||||||
|
);
|
||||||
15
applications/solvers/acoustic/acousticFoam/paEqn.H
Normal file
15
applications/solvers/acoustic/acousticFoam/paEqn.H
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
fvScalarMatrix paEqn
|
||||||
|
(
|
||||||
|
fvm::d2dt2(pa) - sqr(c0)*fvc::laplacian(pa)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (solvePrimaryRegion)
|
||||||
|
{
|
||||||
|
paEqn.relax();
|
||||||
|
paEqn.solve();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pa.correctBoundaryConditions();
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
Info<< "\nReading transportProperties" << endl;
|
||||||
|
|
||||||
|
IOdictionary transportProperties
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"transportProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar c0("c0", dimVelocity, transportProperties);
|
||||||
|
|
||||||
|
dimensionedScalar rho("rho", dimDensity, transportProperties);
|
||||||
|
|
||||||
|
scalar MaxCo =
|
||||||
|
max(mesh.surfaceInterpolation::deltaCoeffs()*c0).value()
|
||||||
|
*runTime.deltaT().value();
|
||||||
|
|
||||||
|
Info<< "Max acoustic Courant Number = " << MaxCo << endl;
|
||||||
@ -14,7 +14,9 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||||
|
-I$(LIB_SRC)/regionFaModels/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
@ -28,4 +30,8 @@ EXE_LIBS = \
|
|||||||
-lturbulenceModels \
|
-lturbulenceModels \
|
||||||
-lcompressibleTurbulenceModels \
|
-lcompressibleTurbulenceModels \
|
||||||
-lradiationModels \
|
-lradiationModels \
|
||||||
-lregionModels
|
-lfvOptions \
|
||||||
|
-lfaOptions \
|
||||||
|
-lregionModels \
|
||||||
|
-lsampling \
|
||||||
|
-lregionFaModels
|
||||||
|
|||||||
@ -49,6 +49,7 @@ wmake $targetType fileFormats
|
|||||||
wmake $targetType surfMesh
|
wmake $targetType surfMesh
|
||||||
wmake $targetType meshTools
|
wmake $targetType meshTools
|
||||||
|
|
||||||
|
wmake $targetType finiteArea
|
||||||
wmake $targetType finiteVolume
|
wmake $targetType finiteVolume
|
||||||
|
|
||||||
wmake $targetType mesh/blockMesh
|
wmake $targetType mesh/blockMesh
|
||||||
@ -85,7 +86,9 @@ regionModels/Allwmake $targetType $*
|
|||||||
lagrangian/Allwmake $targetType $*
|
lagrangian/Allwmake $targetType $*
|
||||||
|
|
||||||
wmake $targetType fvOptions
|
wmake $targetType fvOptions
|
||||||
|
wmake $targetType faOptions
|
||||||
wmake $targetType fvMotionSolver
|
wmake $targetType fvMotionSolver
|
||||||
|
wmake $targetType regionFaModels
|
||||||
|
|
||||||
wmake $targetType overset
|
wmake $targetType overset
|
||||||
|
|
||||||
@ -97,7 +100,6 @@ wmake $targetType waveModels
|
|||||||
|
|
||||||
wmake $targetType engine
|
wmake $targetType engine
|
||||||
|
|
||||||
wmake $targetType finiteArea
|
|
||||||
wmake $targetType genericPatchFields
|
wmake $targetType genericPatchFields
|
||||||
|
|
||||||
conversion/Allwmake $targetType $*
|
conversion/Allwmake $targetType $*
|
||||||
|
|||||||
@ -59,7 +59,12 @@ class subCycleField
|
|||||||
GeometricField& gf0_;
|
GeometricField& gf0_;
|
||||||
|
|
||||||
//- Copy of the "real" old-time value of the field
|
//- Copy of the "real" old-time value of the field
|
||||||
GeometricField gf_0_;
|
tmp<GeometricField> gf_0_;
|
||||||
|
|
||||||
|
GeometricField& gf00_;
|
||||||
|
|
||||||
|
//- Copy of the "real" old-old-time value of the field
|
||||||
|
tmp<GeometricField> gf_00_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -71,19 +76,28 @@ public:
|
|||||||
:
|
:
|
||||||
gf_(gf),
|
gf_(gf),
|
||||||
gf0_(gf.oldTime()),
|
gf0_(gf.oldTime()),
|
||||||
gf_0_(gf0_.name() + "_", gf0_)
|
gf00_(gf.oldTime().oldTime())
|
||||||
{}
|
{
|
||||||
|
{
|
||||||
|
gf_0_ = GeometricField::New(gf0_.name() + "_", gf0_);
|
||||||
|
gf_00_ = GeometricField::New(gf00_.name() + "_", gf00_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~subCycleField()
|
~subCycleField()
|
||||||
|
{
|
||||||
|
if (gf_0_.valid())
|
||||||
{
|
{
|
||||||
// Reset the old-time field
|
// Reset the old-time field
|
||||||
gf0_ = gf_0_;
|
gf0_ = gf_0_;
|
||||||
|
|
||||||
|
gf00_ = gf_00_;
|
||||||
|
|
||||||
// Correct the time index of the field to correspond to the global time
|
// Correct the time index of the field to correspond to the global time
|
||||||
gf_.timeIndex() = gf_.time().timeIndex();
|
gf_.timeIndex() = gf_.time().timeIndex();
|
||||||
gf0_.timeIndex() = gf_.time().timeIndex();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,7 +110,8 @@ public:
|
|||||||
void updateTimeIndex()
|
void updateTimeIndex()
|
||||||
{
|
{
|
||||||
gf_.timeIndex() = gf_.time().timeIndex() + 1;
|
gf_.timeIndex() = gf_.time().timeIndex() + 1;
|
||||||
gf0_.timeIndex() = gf_.time().timeIndex() + 1;
|
gf0_.timeIndex() = gf0_.time().timeIndex() + 1;
|
||||||
|
gf00_.timeIndex() = gf00_.time().timeIndex() + 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,10 @@ Foam::subCycleTime::subCycleTime(Time& runTime, const label nCycles)
|
|||||||
total_(nCycles)
|
total_(nCycles)
|
||||||
{
|
{
|
||||||
// Could avoid 0 or 1 nCycles here on construction
|
// Could avoid 0 or 1 nCycles here on construction
|
||||||
|
if (nCycles > 1)
|
||||||
|
{
|
||||||
time_.subCycle(nCycles);
|
time_.subCycle(nCycles);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,7 +67,10 @@ bool Foam::subCycleTime::end() const
|
|||||||
|
|
||||||
void Foam::subCycleTime::endSubCycle()
|
void Foam::subCycleTime::endSubCycle()
|
||||||
{
|
{
|
||||||
|
if (total_ > 1)
|
||||||
|
{
|
||||||
time_.endSubCycle();
|
time_.endSubCycle();
|
||||||
|
}
|
||||||
|
|
||||||
// If called manually, ensure status() will return false
|
// If called manually, ensure status() will return false
|
||||||
|
|
||||||
@ -89,8 +95,12 @@ bool Foam::subCycleTime::loop()
|
|||||||
|
|
||||||
Foam::subCycleTime& Foam::subCycleTime::operator++()
|
Foam::subCycleTime& Foam::subCycleTime::operator++()
|
||||||
{
|
{
|
||||||
++time_;
|
if (total_ > 1)
|
||||||
++index_;
|
{
|
||||||
|
time_++;
|
||||||
|
}
|
||||||
|
|
||||||
|
index_++;
|
||||||
|
|
||||||
// Register index change with Time, in case someone wants this information
|
// Register index change with Time, in case someone wants this information
|
||||||
time_.subCycleIndex(index_);
|
time_.subCycleIndex(index_);
|
||||||
|
|||||||
16
src/faOptions/Make/files
Normal file
16
src/faOptions/Make/files
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
faOption/faOption.C
|
||||||
|
faOption/faOptionIO.C
|
||||||
|
faOption/faOptionList.C
|
||||||
|
faOption/faOptions.C
|
||||||
|
|
||||||
|
faceSetOption/faceSetOption.C
|
||||||
|
|
||||||
|
/* Sources */
|
||||||
|
derivedSources=sources/derived
|
||||||
|
|
||||||
|
$(derivedSources)/externalHeatFluxSource/externalHeatFluxSource.C
|
||||||
|
$(derivedSources)/jouleHeatingSource/jouleHeatingSource.C
|
||||||
|
$(derivedSources)/contactHeatFluxSource/contactHeatFluxSource.C
|
||||||
|
$(derivedSources)/externalFileSource/externalFileSource.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libfaOptions
|
||||||
22
src/faOptions/Make/options
Normal file
22
src/faOptions/Make/options
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
|
||||||
|
-I$(LIB_SRC)/transportModels \
|
||||||
|
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||||
|
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
|
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||||
|
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||||
|
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude
|
||||||
|
|
||||||
|
LIB_LIBS = \
|
||||||
|
-lfiniteArea \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lsampling \
|
||||||
|
-lmeshTools \
|
||||||
|
-lturbulenceModels \
|
||||||
|
-lincompressibleTurbulenceModels \
|
||||||
|
-lcompressibleTurbulenceModels
|
||||||
291
src/faOptions/faOption/faOption.C
Normal file
291
src/faOptions/faOption/faOption.C
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "faOption.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(option, 0);
|
||||||
|
defineRunTimeSelectionTable(option, dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fa::option::constructMeshObjects()
|
||||||
|
{
|
||||||
|
regionMeshPtr_.reset(new faMesh(mesh_));
|
||||||
|
|
||||||
|
vsmPtr_.reset(new volSurfaceMapping(regionMeshPtr_()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fa::option::option
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
modelType_(modelType),
|
||||||
|
mesh_(patch.boundaryMesh().mesh()),
|
||||||
|
patch_(patch),
|
||||||
|
dict_(dict),
|
||||||
|
coeffs_(dict.optionalSubDict(modelType + "Coeffs")),
|
||||||
|
active_(dict.getOrDefault<Switch>("active", true)),
|
||||||
|
fieldNames_(),
|
||||||
|
applied_(),
|
||||||
|
regionName_(dict.get<word>("region")),
|
||||||
|
regionMeshPtr_(nullptr),
|
||||||
|
vsmPtr_(nullptr)
|
||||||
|
{
|
||||||
|
constructMeshObjects();
|
||||||
|
|
||||||
|
Info<< incrIndent << indent << "Source: " << name_ << endl << decrIndent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::fa::option> Foam::fa::option::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& coeffs,
|
||||||
|
const fvPatch& patch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word modelType(coeffs.get<word>("type"));
|
||||||
|
|
||||||
|
Info<< indent
|
||||||
|
<< "Selecting finite area options type " << modelType << endl;
|
||||||
|
|
||||||
|
const_cast<Time&>(patch.boundaryMesh().mesh().time()).libs().open
|
||||||
|
(
|
||||||
|
coeffs,
|
||||||
|
"libs",
|
||||||
|
dictionaryConstructorTablePtr_
|
||||||
|
);
|
||||||
|
|
||||||
|
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||||
|
|
||||||
|
if (!cstrIter.found())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unknown faOption model type "
|
||||||
|
<< modelType << nl << nl
|
||||||
|
<< "Valid faOption types are:" << nl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<option>(cstrIter()(name, modelType, coeffs, patch));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::fa::option::isActive()
|
||||||
|
{
|
||||||
|
return active_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::label Foam::fa::option::applyToField(const word& fieldName) const
|
||||||
|
{
|
||||||
|
return fieldNames_.find(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::checkApplied() const
|
||||||
|
{
|
||||||
|
forAll(applied_, i)
|
||||||
|
{
|
||||||
|
if (!applied_[i])
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Source " << name_ << " defined for field "
|
||||||
|
<< fieldNames_[i] << " but never used" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<vector>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<symmTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<tensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<vector>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<symmTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<tensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::constrain(faMatrix<scalar>& eqn, const label fieldi)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::constrain(faMatrix<vector>& eqn, const label fieldi)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::constrain
|
||||||
|
(
|
||||||
|
faMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::constrain
|
||||||
|
(
|
||||||
|
faMatrix<symmTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::constrain(faMatrix<tensor>& eqn, const label fieldi)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::correct(areaScalarField& field)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::correct(areaVectorField& field)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::correct(areaSphericalTensorField& field)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::correct(areaSymmTensorField& field)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::correct(areaTensorField& field)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
441
src/faOptions/faOption/faOption.H
Normal file
441
src/faOptions/faOption/faOption.H
Normal file
@ -0,0 +1,441 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fa::option
|
||||||
|
|
||||||
|
Description
|
||||||
|
Base abstract class for handling finite area options (i.e. \c faOption).
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Minimal example by using \c constant/faOptions:
|
||||||
|
\verbatim
|
||||||
|
<userDefinedName1>
|
||||||
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
type <faOptionName>;
|
||||||
|
|
||||||
|
// Mandatory entries (runtime modifiable)
|
||||||
|
region <regionName>;
|
||||||
|
|
||||||
|
// Optional entries (unmodifiable/runtime modifiable)
|
||||||
|
<faOption>Coeffs
|
||||||
|
{
|
||||||
|
// subdictionary entries
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional entries (runtime modifiable)
|
||||||
|
active true;
|
||||||
|
log true;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Name of operand faOption | word | yes | -
|
||||||
|
region | Name of operand region | word | yes | -
|
||||||
|
\<faOption\>Coeffs | Dictionary containing settings of <!--
|
||||||
|
--> the selected faOption settings | dictionary | no | -
|
||||||
|
active | Flag to (de)activate faOption | bool | no | true
|
||||||
|
log | Flag to log faOption-related info | bool | no | true
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
- Source/sink options are to be added to the right-hand side of equations.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
faOption.C
|
||||||
|
faOptionIO.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef faOption_H
|
||||||
|
#define faOption_H
|
||||||
|
|
||||||
|
#include "faMatrices.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "volSurfaceMapping.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class option Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class option
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Construct region mesh and fields
|
||||||
|
void constructMeshObjects();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
//- Source name
|
||||||
|
const word name_;
|
||||||
|
|
||||||
|
//- Model type
|
||||||
|
const word modelType_;
|
||||||
|
|
||||||
|
//- Reference to the mesh database
|
||||||
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
|
//- Reference to the patch
|
||||||
|
const fvPatch& patch_;
|
||||||
|
|
||||||
|
//- Top level source dictionary
|
||||||
|
dictionary dict_;
|
||||||
|
|
||||||
|
//- Dictionary containing source coefficients
|
||||||
|
dictionary coeffs_;
|
||||||
|
|
||||||
|
//- Source active flag
|
||||||
|
Switch active_;
|
||||||
|
|
||||||
|
//- Field names to apply source to - populated by derived models
|
||||||
|
wordList fieldNames_;
|
||||||
|
|
||||||
|
//- Applied flag list - corresponds to each fieldNames_ entry
|
||||||
|
List<bool> applied_;
|
||||||
|
|
||||||
|
//- Region name
|
||||||
|
word regionName_;
|
||||||
|
|
||||||
|
//- Pointer to the region mesh database
|
||||||
|
autoPtr<faMesh> regionMeshPtr_;
|
||||||
|
|
||||||
|
//-Volume-to surface mapping
|
||||||
|
autoPtr<volSurfaceMapping> vsmPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("option");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
option,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
),
|
||||||
|
(name, modelType, dict, patch)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
option
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return clone
|
||||||
|
autoPtr<option> clone() const
|
||||||
|
{
|
||||||
|
NotImplemented;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return pointer to new faOption object created
|
||||||
|
//- on the freestore from an Istream
|
||||||
|
class iNew
|
||||||
|
{
|
||||||
|
|
||||||
|
//- Reference to the patch
|
||||||
|
const fvPatch& patch_;
|
||||||
|
|
||||||
|
//- Name
|
||||||
|
const word& name_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
iNew
|
||||||
|
(
|
||||||
|
const fvPatch& patch,
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(patch),
|
||||||
|
name_(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
autoPtr<option> operator()(Istream& is) const
|
||||||
|
{
|
||||||
|
const dictionary dict(is);
|
||||||
|
|
||||||
|
return autoPtr<option>
|
||||||
|
(
|
||||||
|
option::New(name_, dict, patch_)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected faOption model
|
||||||
|
static autoPtr<option> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~option() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return const access to the source name
|
||||||
|
inline const word& name() const;
|
||||||
|
|
||||||
|
//- Return const access to the mesh database
|
||||||
|
inline const fvMesh& mesh() const;
|
||||||
|
|
||||||
|
//- Return const access to fvPatch
|
||||||
|
inline const fvPatch& patch() const;
|
||||||
|
|
||||||
|
//- Return dictionary
|
||||||
|
inline const dictionary& coeffs() const;
|
||||||
|
|
||||||
|
//- Return const access to the source active flag
|
||||||
|
inline bool active() const;
|
||||||
|
|
||||||
|
//- Set the applied flag to true for field index fieldi
|
||||||
|
inline void setApplied(const label fieldi);
|
||||||
|
|
||||||
|
//- Return the region mesh database
|
||||||
|
inline const faMesh& regionMesh() const;
|
||||||
|
|
||||||
|
//- Return volSurfaceMapping
|
||||||
|
inline const volSurfaceMapping& vsm() const;
|
||||||
|
|
||||||
|
//- Region name
|
||||||
|
inline const word& regionName() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Return access to the source active flag
|
||||||
|
inline Switch& active();
|
||||||
|
|
||||||
|
|
||||||
|
// Checks
|
||||||
|
|
||||||
|
//- Is the source active?
|
||||||
|
virtual bool isActive();
|
||||||
|
|
||||||
|
//- Return index of field name if found in fieldNames list
|
||||||
|
virtual label applyToField(const word& fieldName) const;
|
||||||
|
|
||||||
|
//- Check that the source has been applied
|
||||||
|
virtual void checkApplied() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
// Explicit and implicit sources
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<vector>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<symmTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
faMatrix<tensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Explicit and implicit sources for compressible equations
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<vector>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<symmTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<tensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constraints
|
||||||
|
|
||||||
|
virtual void constrain
|
||||||
|
(
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void constrain
|
||||||
|
(
|
||||||
|
faMatrix<vector>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void constrain
|
||||||
|
(
|
||||||
|
faMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void constrain
|
||||||
|
(
|
||||||
|
faMatrix<symmTensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual void constrain
|
||||||
|
(
|
||||||
|
faMatrix<tensor>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Correction
|
||||||
|
|
||||||
|
virtual void correct(areaScalarField& field);
|
||||||
|
virtual void correct(areaVectorField& field);
|
||||||
|
virtual void correct(areaSphericalTensorField& field);
|
||||||
|
virtual void correct(areaSymmTensorField& field);
|
||||||
|
virtual void correct(areaTensorField& field);
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Write the source header information
|
||||||
|
virtual void writeHeader(Ostream&) const;
|
||||||
|
|
||||||
|
//- Write the source footer information
|
||||||
|
virtual void writeFooter(Ostream&) const;
|
||||||
|
|
||||||
|
//- Write the source properties
|
||||||
|
virtual void writeData(Ostream&) const;
|
||||||
|
|
||||||
|
//- Read source dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fa
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "faOptionI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
108
src/faOptions/faOption/faOptionI.H
Normal file
108
src/faOptions/faOption/faOptionI.H
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline const Foam::word& Foam::fa::option::name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::fvMesh& Foam::fa::option::mesh() const
|
||||||
|
{
|
||||||
|
return mesh_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::fvPatch& Foam::fa::option::patch() const
|
||||||
|
{
|
||||||
|
return patch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::dictionary& Foam::fa::option::coeffs() const
|
||||||
|
{
|
||||||
|
return coeffs_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::fa::option::active() const
|
||||||
|
{
|
||||||
|
return active_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::fa::option::setApplied(const label fieldi)
|
||||||
|
{
|
||||||
|
applied_[fieldi] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::Switch& Foam::fa::option::active()
|
||||||
|
{
|
||||||
|
return active_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::word& Foam::fa::option::regionName() const
|
||||||
|
{
|
||||||
|
return regionName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::faMesh& Foam::fa::option::regionMesh() const
|
||||||
|
{
|
||||||
|
if (regionMeshPtr_.valid())
|
||||||
|
{
|
||||||
|
return regionMeshPtr_();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Region mesh not available" << abort(FatalError);
|
||||||
|
}
|
||||||
|
return *(new faMesh(mesh_));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::volSurfaceMapping& Foam::fa::option::vsm() const
|
||||||
|
{
|
||||||
|
if (vsmPtr_.valid())
|
||||||
|
{
|
||||||
|
return vsmPtr_();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "vsmPtr not available" << abort(FatalError);
|
||||||
|
}
|
||||||
|
return *(new volSurfaceMapping(regionMeshPtr_()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
64
src/faOptions/faOption/faOptionIO.C
Normal file
64
src/faOptions/faOption/faOptionIO.C
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "faOption.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fa::option::writeHeader(Ostream& os) const
|
||||||
|
{
|
||||||
|
os.beginBlock(name_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::writeFooter(Ostream& os) const
|
||||||
|
{
|
||||||
|
os.endBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::option::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
os.writeEntry("type", type());
|
||||||
|
os.writeEntry("active", active_);
|
||||||
|
|
||||||
|
os << nl;
|
||||||
|
coeffs_.writeEntry(word(type() + "Coeffs"), os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::option::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
dict.readIfPresent("active", active_);
|
||||||
|
|
||||||
|
coeffs_ = dict.optionalSubDict(modelType_ + "Coeffs");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
178
src/faOptions/faOption/faOptionList.C
Normal file
178
src/faOptions/faOption/faOptionList.C
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "faOptionList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(optionList, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::dictionary& Foam::fa::optionList::optionsDict
|
||||||
|
(
|
||||||
|
const dictionary& dict
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (dict.found("options"))
|
||||||
|
{
|
||||||
|
return dict.subDict("options");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::optionList::readOptions(const dictionary& dict)
|
||||||
|
{
|
||||||
|
checkTimeIndex_ = mesh_.time().timeIndex() + 2;
|
||||||
|
|
||||||
|
bool allOk = true;
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
option& bs = this->operator[](i);
|
||||||
|
bool ok = bs.read(dict.subDict(bs.name()));
|
||||||
|
allOk = (allOk && ok);
|
||||||
|
}
|
||||||
|
return allOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::optionList::checkApplied() const
|
||||||
|
{
|
||||||
|
if (mesh_.time().timeIndex() == checkTimeIndex_)
|
||||||
|
{
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
const option& bs = this->operator[](i);
|
||||||
|
bs.checkApplied();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fa::optionList::optionList
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
PtrList<option>(),
|
||||||
|
mesh_(p.boundaryMesh().mesh()),
|
||||||
|
patch_(p),
|
||||||
|
checkTimeIndex_(mesh_.time().startTimeIndex() + 2)
|
||||||
|
{
|
||||||
|
reset(optionsDict(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fa::optionList::optionList(const fvPatch& p)
|
||||||
|
:
|
||||||
|
PtrList<option>(),
|
||||||
|
mesh_(p.boundaryMesh().mesh()),
|
||||||
|
patch_(p),
|
||||||
|
checkTimeIndex_(mesh_.time().startTimeIndex() + 2)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fa::optionList::reset(const dictionary& dict)
|
||||||
|
{
|
||||||
|
// Count number of active faOptions
|
||||||
|
label count = 0;
|
||||||
|
for (const entry& dEntry : dict)
|
||||||
|
{
|
||||||
|
if (dEntry.isDict())
|
||||||
|
{
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->resize(count);
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
for (const entry& dEntry : dict)
|
||||||
|
{
|
||||||
|
if (dEntry.isDict())
|
||||||
|
{
|
||||||
|
const word& name = dEntry.keyword();
|
||||||
|
const dictionary& sourceDict = dEntry.dict();
|
||||||
|
|
||||||
|
this->set
|
||||||
|
(
|
||||||
|
count++,
|
||||||
|
option::New(name, sourceDict, patch_)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::optionList::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
return readOptions(optionsDict(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::optionList::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
// Write list contents
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
os << nl;
|
||||||
|
this->operator[](i).writeHeader(os);
|
||||||
|
this->operator[](i).writeData(os);
|
||||||
|
this->operator[](i).writeFooter(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check state of IOstream
|
||||||
|
return os.good();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Ostream& Foam::operator<<(Ostream& os, const fa::optionList& options)
|
||||||
|
{
|
||||||
|
options.writeData(os);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
250
src/faOptions/faOption/faOptionList.H
Normal file
250
src/faOptions/faOption/faOptionList.H
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fa::optionList
|
||||||
|
|
||||||
|
Description
|
||||||
|
List of finite volume options
|
||||||
|
|
||||||
|
SourceFile
|
||||||
|
optionList.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef faOptionList_H
|
||||||
|
#define faOptionList_H
|
||||||
|
|
||||||
|
#include "faOption.H"
|
||||||
|
#include "PtrList.H"
|
||||||
|
#include "GeometricField.H"
|
||||||
|
#include "geometricOneField.H"
|
||||||
|
#include "faPatchField.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of friend functions and operators
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
class optionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ostream& operator<<(Ostream& os, const fa::optionList& options);
|
||||||
|
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class optionList Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class optionList
|
||||||
|
:
|
||||||
|
public PtrList<option>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
//- Reference to the mesh database
|
||||||
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
|
//- Reference to the patch
|
||||||
|
const fvPatch& patch_;
|
||||||
|
|
||||||
|
//- Time index to check that all defined sources have been applied
|
||||||
|
label checkTimeIndex_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Return the "options" sub-dictionary if present otherwise return dict
|
||||||
|
const dictionary& optionsDict(const dictionary& dict) const;
|
||||||
|
|
||||||
|
//- Read options dictionary
|
||||||
|
bool readOptions(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Check that all sources have been applied
|
||||||
|
void checkApplied() const;
|
||||||
|
|
||||||
|
//- Return source for equation with specified name and dimensions
|
||||||
|
template<class Type>
|
||||||
|
tmp<faMatrix<Type>> source
|
||||||
|
(
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const areaScalarField& h,
|
||||||
|
const word& fieldName,
|
||||||
|
const dimensionSet& ds
|
||||||
|
);
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
optionList(const optionList&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const optionList&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("optionList");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
optionList(const fvPatch& p);
|
||||||
|
|
||||||
|
//- Construct from mesh and dictionary
|
||||||
|
optionList(const fvPatch&, const dictionary& );
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~optionList()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Reset the source list
|
||||||
|
void reset(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
// Sources
|
||||||
|
|
||||||
|
//- Return source for equation
|
||||||
|
template<class Type>
|
||||||
|
tmp<faMatrix<Type>> operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return source for equation with specified name
|
||||||
|
template<class Type>
|
||||||
|
tmp<faMatrix<Type>> operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const word& fieldName
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return source for equation
|
||||||
|
template<class Type>
|
||||||
|
tmp<faMatrix<Type>> operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return source for equation with specified name
|
||||||
|
template<class Type>
|
||||||
|
tmp<faMatrix<Type>> operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const word& fieldName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Return source for equation with specified name and dimensios
|
||||||
|
template<class Type>
|
||||||
|
tmp<faMatrix<Type>> operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& rho,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const dimensionSet& ds
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Return source for equation with second time derivative
|
||||||
|
template<class Type>
|
||||||
|
tmp<faMatrix<Type>> d2dt2
|
||||||
|
(
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return source for equation with second time derivative
|
||||||
|
template<class Type>
|
||||||
|
tmp<faMatrix<Type>> d2dt2
|
||||||
|
(
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const word& fieldName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constraints
|
||||||
|
|
||||||
|
//- Apply constraints to equation
|
||||||
|
template<class Type>
|
||||||
|
void constrain(faMatrix<Type>& eqn);
|
||||||
|
|
||||||
|
|
||||||
|
// Correction
|
||||||
|
|
||||||
|
//- Apply correction to field
|
||||||
|
template<class Type>
|
||||||
|
void correct(GeometricField<Type, faPatchField, areaMesh>& field);
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Read dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Write data to Ostream
|
||||||
|
virtual bool writeData(Ostream& os) const;
|
||||||
|
|
||||||
|
//- Ostream operator
|
||||||
|
friend Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const optionList& options
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fa
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "faOptionListTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
290
src/faOptions/faOption/faOptionListTemplates.C
Normal file
290
src/faOptions/faOption/faOptionListTemplates.C
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "profiling.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::source
|
||||||
|
(
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const areaScalarField& h,
|
||||||
|
const word& fieldName,
|
||||||
|
const dimensionSet& ds
|
||||||
|
)
|
||||||
|
{
|
||||||
|
checkApplied();
|
||||||
|
|
||||||
|
tmp<faMatrix<Type>> tmtx(new faMatrix<Type>(field, ds));
|
||||||
|
faMatrix<Type>& mtx = tmtx.ref();
|
||||||
|
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
option& source = this->operator[](i);
|
||||||
|
|
||||||
|
label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
|
if (fieldi != -1)
|
||||||
|
{
|
||||||
|
addProfiling(faopt, "faOption()." + source.name());
|
||||||
|
|
||||||
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
|
if (source.isActive())
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Applying source " << source.name() << " to field "
|
||||||
|
<< fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
source.addSup(h, mtx, fieldi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmtx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return this->operator()(h, field, field.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const word& fieldName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return source(field, h, fieldName, field.dimensions()/dimTime*dimArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return this->operator()(h, rho, field, field.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const word& fieldName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
checkApplied();
|
||||||
|
|
||||||
|
const dimensionSet ds
|
||||||
|
(
|
||||||
|
rho.dimensions()*field.dimensions()/dimTime*dimArea
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<faMatrix<Type>> tmtx(new faMatrix<Type>(field, ds));
|
||||||
|
faMatrix<Type>& mtx = tmtx.ref();
|
||||||
|
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
option& source = this->operator[](i);
|
||||||
|
|
||||||
|
label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
|
if (fieldi != -1)
|
||||||
|
{
|
||||||
|
addProfiling(faopt, "faOption()." + source.name());
|
||||||
|
|
||||||
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
|
if (source.isActive())
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Applying source " << source.name() << " to field "
|
||||||
|
<< fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
source.addSup(h, rho, mtx, fieldi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmtx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::operator()
|
||||||
|
(
|
||||||
|
const areaScalarField& rho,
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const dimensionSet& ds
|
||||||
|
)
|
||||||
|
{
|
||||||
|
checkApplied();
|
||||||
|
|
||||||
|
const dimensionSet dsMat(ds*dimArea);
|
||||||
|
|
||||||
|
tmp<faMatrix<Type>> tmtx(new faMatrix<Type>(field, dsMat));
|
||||||
|
faMatrix<Type>& mtx = tmtx.ref();
|
||||||
|
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
option& source = this->operator[](i);
|
||||||
|
|
||||||
|
label fieldi = source.applyToField(field.name());
|
||||||
|
|
||||||
|
if (fieldi != -1)
|
||||||
|
{
|
||||||
|
addProfiling(faopt, "faOption()." + source.name());
|
||||||
|
|
||||||
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
|
if (source.isActive())
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Applying source " << source.name() << " to field "
|
||||||
|
<< field.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
source.addSup(rho, mtx, fieldi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmtx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::d2dt2
|
||||||
|
(
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return this->d2dt2(field, field.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::faMatrix<Type>> Foam::fa::optionList::d2dt2
|
||||||
|
(
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field,
|
||||||
|
const word& fieldName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return source(field, fieldName, field.dimensions()/sqr(dimTime)*dimArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fa::optionList::constrain(faMatrix<Type>& eqn)
|
||||||
|
{
|
||||||
|
checkApplied();
|
||||||
|
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
option& source = this->operator[](i);
|
||||||
|
|
||||||
|
label fieldi = source.applyToField(eqn.psi().name());
|
||||||
|
|
||||||
|
if (fieldi != -1)
|
||||||
|
{
|
||||||
|
addProfiling(faopt, "faOption::constrain." + eqn.psi().name());
|
||||||
|
|
||||||
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
|
if (source.isActive())
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Applying constraint " << source.name()
|
||||||
|
<< " to field " << eqn.psi().name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
source.constrain(eqn, fieldi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fa::optionList::correct
|
||||||
|
(
|
||||||
|
GeometricField<Type, faPatchField, areaMesh>& field
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word& fieldName = field.name();
|
||||||
|
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
option& source = this->operator[](i);
|
||||||
|
|
||||||
|
label fieldi = source.applyToField(fieldName);
|
||||||
|
|
||||||
|
if (fieldi != -1)
|
||||||
|
{
|
||||||
|
addProfiling(faopt, "faOption::correct." + source.name());
|
||||||
|
|
||||||
|
source.setApplied(fieldi);
|
||||||
|
|
||||||
|
if (source.isActive())
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Correcting source " << source.name()
|
||||||
|
<< " for field " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
source.correct(field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
144
src/faOptions/faOption/faOptions.C
Normal file
144
src/faOptions/faOption/faOptions.C
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "faOptions.H"
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(options, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::IOobject Foam::fa::options::createIOobject
|
||||||
|
(
|
||||||
|
const fvMesh& mesh
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
typeName,
|
||||||
|
mesh.time().constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
);
|
||||||
|
|
||||||
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
|
{
|
||||||
|
Info<< "Creating finite area options from "
|
||||||
|
<< io.instance()/io.name() << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||||
|
return io;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check if the faOptions file is in system
|
||||||
|
io.instance() = mesh.time().system();
|
||||||
|
|
||||||
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
|
{
|
||||||
|
Info<< "Creating finite area options from "
|
||||||
|
<< io.instance()/io.name() << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||||
|
return io;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
io.readOpt() = IOobject::NO_READ;
|
||||||
|
return io;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fa::options::options
|
||||||
|
(
|
||||||
|
const fvPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
IOdictionary(createIOobject(p.boundaryMesh().mesh())),
|
||||||
|
optionList(p, *this)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fa::options& Foam::fa::options::New(const fvPatch& p)
|
||||||
|
{
|
||||||
|
const fvMesh& mesh = p.boundaryMesh().mesh();
|
||||||
|
|
||||||
|
if (mesh.thisDb().foundObject<options>(typeName))
|
||||||
|
{
|
||||||
|
return const_cast<options&>
|
||||||
|
(
|
||||||
|
mesh.lookupObject<options>(typeName)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
InfoInFunction
|
||||||
|
<< "Constructing " << typeName
|
||||||
|
<< " for region " << mesh.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
options* objectPtr = new options(p);
|
||||||
|
regIOobject::store(objectPtr);
|
||||||
|
return *objectPtr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::options::read()
|
||||||
|
{
|
||||||
|
if (IOdictionary::regIOobject::read())
|
||||||
|
{
|
||||||
|
optionList::read(*this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
112
src/faOptions/faOption/faOptions.H
Normal file
112
src/faOptions/faOption/faOptions.H
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fa::options
|
||||||
|
|
||||||
|
Description
|
||||||
|
Finite-area options
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
faOptions.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fa_options_H
|
||||||
|
#define fa_options_H
|
||||||
|
|
||||||
|
#include "faOptionList.H"
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class options Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class options
|
||||||
|
:
|
||||||
|
public IOdictionary,
|
||||||
|
public optionList
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Create IO object if dictionary is present
|
||||||
|
IOobject createIOobject(const fvMesh& mesh) const;
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
options(const options&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const options&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Declare name of the class and its debug switch
|
||||||
|
ClassName("faOptions");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components with list of field names
|
||||||
|
options(const fvPatch& p);
|
||||||
|
|
||||||
|
//- Construct faOptions and register to database if not present
|
||||||
|
//- otherwise lookup and return
|
||||||
|
static options& New(const fvPatch& p);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~options()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Inherit read from optionList
|
||||||
|
using optionList::read;
|
||||||
|
|
||||||
|
//- Read dictionary
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fa
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
54
src/faOptions/faOption/makeFaOption.H
Normal file
54
src/faOptions/faOption/makeFaOption.H
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef makeFaOption_H
|
||||||
|
#define makeFaOption_H
|
||||||
|
|
||||||
|
#include "faOption.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#define makeFaOption(Option, Type) \
|
||||||
|
\
|
||||||
|
defineTemplateTypeNameAndDebugWithName \
|
||||||
|
( \
|
||||||
|
Foam::fa::Option<Foam::Type>, \
|
||||||
|
#Type#Option, \
|
||||||
|
0 \
|
||||||
|
); \
|
||||||
|
\
|
||||||
|
Foam::fa::option::adddictionaryConstructorToTable \
|
||||||
|
<Foam::fa::Option<Foam::Type>> \
|
||||||
|
add##Option##Type##dictionary##ConstructorTooptionTable_
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
246
src/faOptions/faceSetOption/faceSetOption.C
Normal file
246
src/faOptions/faceSetOption/faceSetOption.C
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "faceSetOption.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(faceSetOption, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::fa::faceSetOption::selectionModeType
|
||||||
|
>
|
||||||
|
Foam::fa::faceSetOption::selectionModeTypeNames_
|
||||||
|
({
|
||||||
|
{ selectionModeType::smAll, "all" },
|
||||||
|
{ selectionModeType::smVolFaceZone, "volFaceZone" }
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fa::faceSetOption::setSelection(const dictionary& dict)
|
||||||
|
{
|
||||||
|
switch (selectionMode_)
|
||||||
|
{
|
||||||
|
case smAll:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case smVolFaceZone:
|
||||||
|
{
|
||||||
|
dict.readEntry("faceZone", faceSetName_);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unknown selectionMode "
|
||||||
|
<< selectionModeTypeNames_[selectionMode_]
|
||||||
|
<< ". Valid selectionMode types : "
|
||||||
|
<< selectionModeTypeNames_
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::faceSetOption::setArea()
|
||||||
|
{
|
||||||
|
// Set area information
|
||||||
|
|
||||||
|
scalar sumArea = 0.0;
|
||||||
|
for (const label facei : faces_)
|
||||||
|
{
|
||||||
|
sumArea += regionMesh().S()[facei];
|
||||||
|
}
|
||||||
|
reduce(sumArea, sumOp<scalar>());
|
||||||
|
|
||||||
|
const scalar AOld = A_;
|
||||||
|
A_ = sumArea;
|
||||||
|
|
||||||
|
// Convert both areas to representation using current writeprecision
|
||||||
|
word AOldName(Time::timeName(AOld, IOstream::defaultPrecision()));
|
||||||
|
word AName(Time::timeName(A_, IOstream::defaultPrecision()));
|
||||||
|
|
||||||
|
if (AName != AOldName)
|
||||||
|
{
|
||||||
|
Info<< indent
|
||||||
|
<< "- selected " << returnReduce(faces_.size(), sumOp<label>())
|
||||||
|
<< " face(s) with area " << A_ << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::faceSetOption::setFaceSet()
|
||||||
|
{
|
||||||
|
switch (selectionMode_)
|
||||||
|
{
|
||||||
|
case smVolFaceZone:
|
||||||
|
{
|
||||||
|
Info<< indent
|
||||||
|
<< "- selecting faces using volume-mesh faceZone "
|
||||||
|
<< faceSetName_ << endl;
|
||||||
|
|
||||||
|
label zoneID = mesh_.faceZones().findZoneID(faceSetName_);
|
||||||
|
if (zoneID == -1)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Cannot find faceZone " << faceSetName_ << endl
|
||||||
|
<< "Valid faceZones are " << mesh_.faceZones().names()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceZone& addr = mesh_.faceZones()[zoneID];
|
||||||
|
|
||||||
|
const bitSet isZoneFace(mesh_.nFaces(), addr);
|
||||||
|
|
||||||
|
// Do we loop over faMesh faces or over faceZone faces?
|
||||||
|
const labelUList& faceLabels = regionMesh().faceLabels();
|
||||||
|
|
||||||
|
label n = 0;
|
||||||
|
for (const label facei : faceLabels)
|
||||||
|
{
|
||||||
|
if (isZoneFace[facei])
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
faces_.setSize(n);
|
||||||
|
n = 0;
|
||||||
|
for (const label facei : faceLabels)
|
||||||
|
{
|
||||||
|
if (isZoneFace[facei])
|
||||||
|
{
|
||||||
|
faces_[n++] = facei;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case smAll:
|
||||||
|
{
|
||||||
|
Info<< indent << "- selecting all faces" << endl;
|
||||||
|
faces_ = identity(regionMesh().nFaces());
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unknown selectionMode "
|
||||||
|
<< selectionModeTypeNames_[selectionMode_]
|
||||||
|
<< ". Valid selectionMode types are "
|
||||||
|
<< selectionModeTypeNames_
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fa::faceSetOption::faceSetOption
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
)
|
||||||
|
:
|
||||||
|
option(name, modelType, dict, patch),
|
||||||
|
timeStart_(-1.0),
|
||||||
|
duration_(0.0),
|
||||||
|
selectionMode_(selectionModeTypeNames_.get("selectionMode", coeffs_)),
|
||||||
|
faceSetName_("none"),
|
||||||
|
A_(0.0)
|
||||||
|
{
|
||||||
|
if (isActive())
|
||||||
|
{
|
||||||
|
Info<< incrIndent;
|
||||||
|
read(dict);
|
||||||
|
setSelection(coeffs_);
|
||||||
|
setFaceSet();
|
||||||
|
setArea();
|
||||||
|
Info<< decrIndent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::fa::faceSetOption::isActive()
|
||||||
|
{
|
||||||
|
if (option::isActive() && inTimeLimits(mesh_.time().value()))
|
||||||
|
{
|
||||||
|
// Update the face set if the mesh is changing
|
||||||
|
if (mesh_.changing())
|
||||||
|
{
|
||||||
|
if (mesh_.topoChanging())
|
||||||
|
{
|
||||||
|
setArea();
|
||||||
|
// Force printing of new set area
|
||||||
|
A_ = -GREAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Report new area (if changed)
|
||||||
|
setArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::faceSetOption::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (option::read(dict))
|
||||||
|
{
|
||||||
|
if (coeffs_.readIfPresent("timeStart", timeStart_))
|
||||||
|
{
|
||||||
|
coeffs_.readEntry("duration", duration_);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
241
src/faOptions/faceSetOption/faceSetOption.H
Normal file
241
src/faOptions/faceSetOption/faceSetOption.H
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fa::faceSetOption
|
||||||
|
|
||||||
|
Description
|
||||||
|
Intermediate abstract class for handling
|
||||||
|
face-set options for the derived faOptions.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Minimal example by using \c constant/faOptions:
|
||||||
|
\verbatim
|
||||||
|
<userDefinedName1>
|
||||||
|
{
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
selectionMode all;
|
||||||
|
|
||||||
|
// Optional entries (runtime modifiable)
|
||||||
|
timeStart 1.0;
|
||||||
|
|
||||||
|
// Conditional mandatory entries (runtime modifiable)
|
||||||
|
|
||||||
|
// when timeStart entry is present
|
||||||
|
duration 1.4;
|
||||||
|
|
||||||
|
// when selectionMode=volFaceZone
|
||||||
|
faceZone <faceZoneName>;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
selectionMode | Mode of face selection - see below | word | yes | -
|
||||||
|
timeStart | Start time of faOption | scalar | no | -1
|
||||||
|
duration | Duration of faOption execution <!--
|
||||||
|
--> starting from timeStart | scalar | cndtnl | 0
|
||||||
|
faceZone | Name of operand faceZone | word | cndtnl | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Options for the \c selectionMode entry:
|
||||||
|
\verbatim
|
||||||
|
all | Use all faces in the computational domain
|
||||||
|
faceZone | Use a given faceZone
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link faOption.H \endlink
|
||||||
|
|
||||||
|
Note
|
||||||
|
- Source/sink options are to be added to the right-hand side of equations.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
faceSetOption.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef faceSetOption_H
|
||||||
|
#define faceSetOption_H
|
||||||
|
|
||||||
|
#include "faOption.H"
|
||||||
|
#include "faceSet.H"
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class faceSetOption Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class faceSetOption
|
||||||
|
:
|
||||||
|
public option
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Public Enumeration
|
||||||
|
|
||||||
|
//- Enumeration for selection mode types
|
||||||
|
enum selectionModeType
|
||||||
|
{
|
||||||
|
smAll,
|
||||||
|
smVolFaceZone
|
||||||
|
};
|
||||||
|
|
||||||
|
//- List of selection mode type names
|
||||||
|
static const Enum<selectionModeType> selectionModeTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
//- Time start
|
||||||
|
scalar timeStart_;
|
||||||
|
|
||||||
|
//- Duration
|
||||||
|
scalar duration_;
|
||||||
|
|
||||||
|
//- Face selection mode
|
||||||
|
selectionModeType selectionMode_;
|
||||||
|
|
||||||
|
//- Name of zone for "faceZone" selectionMode
|
||||||
|
word faceSetName_;
|
||||||
|
|
||||||
|
//- Set of faces to apply source to
|
||||||
|
labelList faces_;
|
||||||
|
|
||||||
|
//- Sum of face area
|
||||||
|
scalar A_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Functions
|
||||||
|
|
||||||
|
//- Set the face selection
|
||||||
|
void setSelection(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Set the face set based on the user input selection mode
|
||||||
|
void setFaceSet();
|
||||||
|
|
||||||
|
//- Recalculate the area
|
||||||
|
void setArea();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("faceSetOption");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
faceSetOption
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~faceSetOption() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return const access to the time start
|
||||||
|
inline scalar timeStart() const;
|
||||||
|
|
||||||
|
//- Return const access to the duration
|
||||||
|
inline scalar duration() const;
|
||||||
|
|
||||||
|
//- Return true if within time limits
|
||||||
|
inline bool inTimeLimits(const scalar time) const;
|
||||||
|
|
||||||
|
//- Return const access to the face selection mode
|
||||||
|
inline const selectionModeType& selectionMode() const;
|
||||||
|
|
||||||
|
//- Return const access to the name of face set for "faceZone"
|
||||||
|
//- selectionMode
|
||||||
|
inline const word& faceSetName() const;
|
||||||
|
|
||||||
|
//- Return const access to the total face area
|
||||||
|
inline scalar A() const;
|
||||||
|
|
||||||
|
//- Return const access to the face set
|
||||||
|
inline const labelList& faces() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Return access to the time start
|
||||||
|
inline scalar& timeStart();
|
||||||
|
|
||||||
|
//- Return access to the duration
|
||||||
|
inline scalar& duration();
|
||||||
|
|
||||||
|
|
||||||
|
// Checks
|
||||||
|
|
||||||
|
//- Is the source active?
|
||||||
|
virtual bool isActive();
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Read source dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fa
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "faceSetOptionI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
93
src/faOptions/faceSetOption/faceSetOptionI.H
Normal file
93
src/faOptions/faceSetOption/faceSetOptionI.H
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::fa::faceSetOption::timeStart() const
|
||||||
|
{
|
||||||
|
return timeStart_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::fa::faceSetOption::duration() const
|
||||||
|
{
|
||||||
|
return duration_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::fa::faceSetOption::inTimeLimits(const scalar time) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
(timeStart_ < 0)
|
||||||
|
||
|
||||||
|
(
|
||||||
|
(mesh_.time().value() >= timeStart_)
|
||||||
|
&& (mesh_.time().value() <= (timeStart_ + duration_))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::fa::faceSetOption::selectionModeType&
|
||||||
|
Foam::fa::faceSetOption::selectionMode() const
|
||||||
|
{
|
||||||
|
return selectionMode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::word& Foam::fa::faceSetOption::faceSetName() const
|
||||||
|
{
|
||||||
|
return faceSetName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::fa::faceSetOption::A() const
|
||||||
|
{
|
||||||
|
return A_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::labelList& Foam::fa::faceSetOption::faces() const
|
||||||
|
{
|
||||||
|
return faces_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::fa::faceSetOption::timeStart()
|
||||||
|
{
|
||||||
|
return timeStart_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::fa::faceSetOption::duration()
|
||||||
|
{
|
||||||
|
return duration_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,204 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "contactHeatFluxSource.H"
|
||||||
|
#include "faMatrices.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "famSup.H"
|
||||||
|
#include "zeroGradientFaPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(contactHeatFluxSource, 0);
|
||||||
|
addToRunTimeSelectionTable(option, contactHeatFluxSource, dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fa::contactHeatFluxSource::contactHeatFluxSource
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faceSetOption(sourceName, modelType, dict, patch),
|
||||||
|
temperatureCoupledBase(patch, dict),
|
||||||
|
TName_(dict.getOrDefault<word>("T", "T")),
|
||||||
|
TprimaryName_(dict.get<word>("Tprimary")),
|
||||||
|
Tp_(mesh().lookupObject<volScalarField>(TprimaryName_)),
|
||||||
|
Tw1_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Tw1_" + sourceName,
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(dimTemperature, Zero),
|
||||||
|
zeroGradientFaPatchScalarField::typeName
|
||||||
|
),
|
||||||
|
thicknessLayers_(Zero),
|
||||||
|
kappaLayers_(Zero),
|
||||||
|
contactRes_(0),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{
|
||||||
|
fieldNames_.setSize(1, TName_);
|
||||||
|
|
||||||
|
applied_.setSize(fieldNames_.size(), false);
|
||||||
|
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::areaScalarField> Foam::fa::contactHeatFluxSource::htc() const
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
"thtc",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<areaScalarField> thtc
|
||||||
|
(
|
||||||
|
new areaScalarField
|
||||||
|
(
|
||||||
|
io,
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
areaScalarField& htc = thtc.ref();
|
||||||
|
|
||||||
|
const volScalarField::Boundary& vfb = Tp_.boundaryField();
|
||||||
|
|
||||||
|
htc.primitiveFieldRef() =
|
||||||
|
temperatureCoupledBase::kappa
|
||||||
|
(
|
||||||
|
vsm().mapInternalToSurface<scalar>(vfb)()
|
||||||
|
)*patch().deltaCoeffs();
|
||||||
|
|
||||||
|
if (contactRes_ != 0)
|
||||||
|
{
|
||||||
|
tmp<areaScalarField> tcontact
|
||||||
|
(
|
||||||
|
new areaScalarField
|
||||||
|
(
|
||||||
|
io,
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar
|
||||||
|
(
|
||||||
|
"contact",
|
||||||
|
dimPower/dimArea/dimTemperature,
|
||||||
|
contactRes_
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
areaScalarField& contact = tcontact.ref();
|
||||||
|
htc.primitiveFieldRef() += contact.primitiveField();
|
||||||
|
}
|
||||||
|
|
||||||
|
return thtc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fa::contactHeatFluxSource::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rhoCph,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (isActive())
|
||||||
|
{
|
||||||
|
DebugInfo<< name() << ": applying source to " << eqn.psi().name()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
if (curTimeIndex_ != mesh().time().timeIndex())
|
||||||
|
{
|
||||||
|
const volScalarField::Boundary& vfb = Tp_.boundaryField();
|
||||||
|
|
||||||
|
Tw1_.primitiveFieldRef() =
|
||||||
|
this->vsm().mapInternalToSurface<scalar>(vfb);
|
||||||
|
|
||||||
|
tmp<areaScalarField> htcw = htc();
|
||||||
|
|
||||||
|
eqn += -fam::Sp(htcw(), eqn.psi()) + htcw()*Tw1_;
|
||||||
|
|
||||||
|
curTimeIndex_ = mesh().time().timeIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::contactHeatFluxSource::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (option::read(dict))
|
||||||
|
{
|
||||||
|
coeffs_.readIfPresent("T", TName_);
|
||||||
|
|
||||||
|
if (dict.readIfPresent("thicknessLayers", thicknessLayers_))
|
||||||
|
{
|
||||||
|
dict.readEntry("kappaLayers", kappaLayers_);
|
||||||
|
|
||||||
|
if (thicknessLayers_.size() > 0)
|
||||||
|
{
|
||||||
|
// Calculate effective thermal resistance by harmonic averaging
|
||||||
|
forAll(thicknessLayers_, iLayer)
|
||||||
|
{
|
||||||
|
contactRes_ += thicknessLayers_[iLayer]/kappaLayers_[iLayer];
|
||||||
|
}
|
||||||
|
contactRes_ = scalar(1)/contactRes_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,196 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fa::contactHeatFluxSource
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpFaOptionsSources
|
||||||
|
|
||||||
|
Description
|
||||||
|
Applies contact heat flux between specified \c faMesh
|
||||||
|
and \c fvMesh within a specified region for compressible flows.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Minimal example by using \c constant/faOptions:
|
||||||
|
\verbatim
|
||||||
|
contactHeatFluxSource1
|
||||||
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
type contactHeatFluxSource;
|
||||||
|
Tprimary <TprimaryFieldName>;
|
||||||
|
|
||||||
|
// Optional entries (runtime modifiable)
|
||||||
|
T <Tname>;
|
||||||
|
thicknessLayers (<layer1> <layer2> ... <layerN>);
|
||||||
|
|
||||||
|
// Conditional optional entries (runtime modifiable)
|
||||||
|
|
||||||
|
// when the entry "thicknessLayers" is present
|
||||||
|
kappaLayers (<layer1> <layer2> ... <layerN>);
|
||||||
|
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Type name: contactHeatFluxSource | word | yes | -
|
||||||
|
Tprimary | Name of primary temperature field | word | yes | -
|
||||||
|
T | Name of operand temperature field | word | no | T
|
||||||
|
thicknessLayers | List of thicknesses of layers | scalarList | no | -
|
||||||
|
kappaLayers | List of conductivities of layers | scalarList | cndtnl | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link faOption.H \endlink
|
||||||
|
- \link faceSetOption.H \endlink
|
||||||
|
- \link temperatureCoupledBase.H \endlink
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
contactHeatFluxSource.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fa_contactHeatFluxSource_H
|
||||||
|
#define fa_contactHeatFluxSource_H
|
||||||
|
|
||||||
|
#include "faOption.H"
|
||||||
|
#include "Function1.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
#include "faceSetOption.H"
|
||||||
|
#include "temperatureCoupledBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class contactHeatFluxSource Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class contactHeatFluxSource
|
||||||
|
:
|
||||||
|
public faceSetOption,
|
||||||
|
public temperatureCoupledBase
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Name of temperature field
|
||||||
|
word TName_;
|
||||||
|
|
||||||
|
//- Name of primary temperature field
|
||||||
|
word TprimaryName_;
|
||||||
|
|
||||||
|
//- Primary region temperature
|
||||||
|
const volScalarField& Tp_;
|
||||||
|
|
||||||
|
//- Temperature - wall [K]
|
||||||
|
areaScalarField Tw1_;
|
||||||
|
|
||||||
|
//- Thickness of layers
|
||||||
|
scalarList thicknessLayers_;
|
||||||
|
|
||||||
|
//- Conductivity of layers
|
||||||
|
scalarList kappaLayers_;
|
||||||
|
|
||||||
|
//- Total contact resistance
|
||||||
|
scalar contactRes_;
|
||||||
|
|
||||||
|
//- Current time index (used for updating)
|
||||||
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Return htc from the primary region
|
||||||
|
tmp<areaScalarField> htc() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("contactHeatFluxSource");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from explicit source name and mesh
|
||||||
|
contactHeatFluxSource
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
);
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
contactHeatFluxSource(const contactHeatFluxSource&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const contactHeatFluxSource&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~contactHeatFluxSource() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
//- Add explicit contribution to compressible momentum equation
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Read source dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fa
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,130 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "externalFileSource.H"
|
||||||
|
#include "faMatrices.H"
|
||||||
|
#include "faCFD.H"
|
||||||
|
#include "zeroGradientFaPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(externalFileSource, 0);
|
||||||
|
addToRunTimeSelectionTable(option, externalFileSource, dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fa::externalFileSource::externalFileSource
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& p
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faceSetOption(sourceName, modelType, dict, p),
|
||||||
|
fieldName_(dict.get<word>("fieldName")),
|
||||||
|
tableName_(dict.get<word>("tableName")),
|
||||||
|
pExt_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"pExt",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar("pExt", dimPressure, Zero),
|
||||||
|
zeroGradientFaPatchScalarField::typeName
|
||||||
|
),
|
||||||
|
value_
|
||||||
|
(
|
||||||
|
new PatchFunction1Types::MappedFile<scalar>
|
||||||
|
(
|
||||||
|
p.patch(),
|
||||||
|
"uniformValue",
|
||||||
|
dict,
|
||||||
|
tableName_, // field table name
|
||||||
|
true // face values
|
||||||
|
)
|
||||||
|
),
|
||||||
|
curTimeIndex_(-1)
|
||||||
|
{
|
||||||
|
fieldNames_.setSize(1, fieldName_);
|
||||||
|
|
||||||
|
applied_.setSize(fieldNames_.size(), false);
|
||||||
|
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fa::externalFileSource::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& solidMass,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const scalar t = mesh().time().value();
|
||||||
|
|
||||||
|
if (isActive() && t > timeStart() && t < (timeStart() + duration()))
|
||||||
|
{
|
||||||
|
DebugInfo<< name() << ": applying source to " << eqn.psi().name()<<endl;
|
||||||
|
|
||||||
|
if (curTimeIndex_ != mesh().time().timeIndex())
|
||||||
|
{
|
||||||
|
pExt_.field() = value_->value(t);
|
||||||
|
eqn += pExt_/solidMass;
|
||||||
|
curTimeIndex_ = mesh().time().timeIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::externalFileSource::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (option::read(dict))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,169 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fa::externalFileSource
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpFaOptionsSources
|
||||||
|
|
||||||
|
Description
|
||||||
|
Applies sources on a specified field within a specified region
|
||||||
|
by using an external table file for compressible flows.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Minimal example by using \c constant/faOptions:
|
||||||
|
\verbatim
|
||||||
|
externalFileSource1
|
||||||
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
type externalFileSource;
|
||||||
|
fieldName <fieldName>;
|
||||||
|
tableName <tableFileName.dat>;
|
||||||
|
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Type name: externalFileSource | word | yes | -
|
||||||
|
fieldName | Name of operand field | word | yes | -
|
||||||
|
tableName | Name of operand table file | word | yes | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link faOption.H \endlink
|
||||||
|
- \link faceSetOption.H \endlink
|
||||||
|
|
||||||
|
See also
|
||||||
|
- Foam::PatchFunction1Types
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
externalFileSource.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fa_externalFileSource_H
|
||||||
|
#define fa_externalFileSource_H
|
||||||
|
|
||||||
|
#include "faOption.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
#include "faceSetOption.H"
|
||||||
|
#include "MappedFile.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class externalFileSource Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class externalFileSource
|
||||||
|
:
|
||||||
|
public faceSetOption
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Name of the field to apply this source
|
||||||
|
word fieldName_;
|
||||||
|
|
||||||
|
//- Name of the table
|
||||||
|
word tableName_;
|
||||||
|
|
||||||
|
//- External pressure field
|
||||||
|
areaScalarField pExt_;
|
||||||
|
|
||||||
|
//- Mapped data from file
|
||||||
|
autoPtr<PatchFunction1Types::MappedFile<scalar>> value_;
|
||||||
|
|
||||||
|
//- Current time index (used for updating)
|
||||||
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("externalFileSource");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from explicit source name and mesh
|
||||||
|
externalFileSource
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
);
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
externalFileSource(const externalFileSource&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const externalFileSource&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~externalFileSource() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
//- Add explicit contribution to compressible momentum equation
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Read source dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fa
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,208 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "externalHeatFluxSource.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "physicoChemicalConstants.H"
|
||||||
|
#include "zeroGradientFaPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
using Foam::constant::physicoChemical::sigma;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(externalHeatFluxSource, 0);
|
||||||
|
addToRunTimeSelectionTable(option, externalHeatFluxSource, dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::fa::externalHeatFluxSource::operationMode
|
||||||
|
>
|
||||||
|
Foam::fa::externalHeatFluxSource::operationModeNames
|
||||||
|
({
|
||||||
|
{ operationMode::fixedPower, "power" },
|
||||||
|
{ operationMode::fixedHeatFlux, "flux" },
|
||||||
|
{ operationMode::fixedHeatTransferCoeff, "coefficient" },
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fa::externalHeatFluxSource::externalHeatFluxSource
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faceSetOption(sourceName, modelType, dict, patch),
|
||||||
|
mode_(operationModeNames.get("mode", dict)),
|
||||||
|
TName_(dict.getOrDefault<word>("T", "T")),
|
||||||
|
Q_(0),
|
||||||
|
q_(0),
|
||||||
|
h_(0),
|
||||||
|
Ta_(),
|
||||||
|
emissivity_(dict.getOrDefault<scalar>("emissivity", 0))
|
||||||
|
{
|
||||||
|
fieldNames_.setSize(1, TName_);
|
||||||
|
|
||||||
|
applied_.setSize(fieldNames_.size(), false);
|
||||||
|
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fa::externalHeatFluxSource::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (isActive())
|
||||||
|
{
|
||||||
|
DebugInfo<< name() << ": applying source to "
|
||||||
|
<< eqn.psi().name() << endl;
|
||||||
|
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
"Q",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
auto tQ = new areaScalarField
|
||||||
|
(
|
||||||
|
io,
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar("q", dimPower/sqr(dimLength), 0),
|
||||||
|
zeroGradientFaPatchScalarField::typeName
|
||||||
|
);
|
||||||
|
areaScalarField& Q = *tQ;
|
||||||
|
|
||||||
|
switch (mode_)
|
||||||
|
{
|
||||||
|
case fixedPower:
|
||||||
|
{
|
||||||
|
Q.primitiveFieldRef() = Q_/regionMesh().S().field();
|
||||||
|
eqn += Q;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case fixedHeatFlux:
|
||||||
|
{
|
||||||
|
Q.primitiveFieldRef() = q_;
|
||||||
|
eqn += Q;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case fixedHeatTransferCoeff:
|
||||||
|
{
|
||||||
|
const dimensionedScalar Ta
|
||||||
|
(
|
||||||
|
"Ta",
|
||||||
|
dimTemperature,
|
||||||
|
Ta_->value(mesh_.time().timeOutputValue())
|
||||||
|
);
|
||||||
|
|
||||||
|
areaScalarField hp
|
||||||
|
(
|
||||||
|
io,
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar
|
||||||
|
(
|
||||||
|
"h",
|
||||||
|
dimPower/sqr(dimLength)/dimTemperature,
|
||||||
|
h_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const areaScalarField hpTa(hp*Ta);
|
||||||
|
|
||||||
|
if (emissivity_ > 0)
|
||||||
|
{
|
||||||
|
hp -= emissivity_*sigma.value()*pow3(eqn.psi());
|
||||||
|
}
|
||||||
|
|
||||||
|
eqn -= fam::SuSp(hp, eqn.psi()) - hpTa;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::externalHeatFluxSource::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (option::read(dict))
|
||||||
|
{
|
||||||
|
dict.readIfPresent("T", TName_);
|
||||||
|
dict.readIfPresent("emissivity", emissivity_);
|
||||||
|
|
||||||
|
mode_ = operationModeNames.get("mode", dict);
|
||||||
|
|
||||||
|
switch (mode_)
|
||||||
|
{
|
||||||
|
case fixedPower:
|
||||||
|
{
|
||||||
|
dict.readEntry("Q", Q_);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case fixedHeatFlux:
|
||||||
|
{
|
||||||
|
dict.readEntry("q", q_);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case fixedHeatTransferCoeff:
|
||||||
|
{
|
||||||
|
dict.readEntry("h", h_);
|
||||||
|
Ta_ = Function1<scalar>::New("Ta", dict);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,241 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fa::externalHeatFluxSource
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpFaOptionsSources
|
||||||
|
|
||||||
|
Description
|
||||||
|
Applies a heat flux condition for a specified \c faMesh region
|
||||||
|
to temperature on an external wall for compressible flows
|
||||||
|
in one of three modes:
|
||||||
|
|
||||||
|
- fixed power: supply \c Q
|
||||||
|
- fixed heat flux: supply \c q
|
||||||
|
- fixed heat transfer coefficient: supply \c h and \c Ta
|
||||||
|
|
||||||
|
where
|
||||||
|
\vartable
|
||||||
|
Q | Power [W]
|
||||||
|
q | Heat flux [W/m^2]
|
||||||
|
h | Heat transfer coefficient [W/m^2/K]
|
||||||
|
Ta | Ambient temperature [K]
|
||||||
|
\endvartable
|
||||||
|
|
||||||
|
The ambient temperature \c Ta is specified
|
||||||
|
as a \c Foam::Function1 of time but uniform in space.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Minimal example by using \c constant/faOptions:
|
||||||
|
\verbatim
|
||||||
|
externalHeatFluxSource1
|
||||||
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
type externalHeatFluxSource;
|
||||||
|
|
||||||
|
// Mandatory entries (runtime modifiable)
|
||||||
|
mode <mode>;
|
||||||
|
|
||||||
|
// Optional entries (runtime modifiable)
|
||||||
|
T <Tname>;
|
||||||
|
emissivity 0;
|
||||||
|
|
||||||
|
// Conditional mandatory entries (runtime modifiable)
|
||||||
|
|
||||||
|
// when mode=power
|
||||||
|
Q 1.0;
|
||||||
|
|
||||||
|
// when mode=flux
|
||||||
|
q 1.0;
|
||||||
|
|
||||||
|
// when mode=coefficient
|
||||||
|
h 1.0;
|
||||||
|
Ta <Function1>;
|
||||||
|
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Type name: externalHeatFluxSource | word | yes | -
|
||||||
|
mode | Mode of heat flux condition | word | yes | -
|
||||||
|
T | Name of operand temperature field | word | no | T
|
||||||
|
emissivity | Surface emissivity for radiative flux to ambient <!--
|
||||||
|
--> | scalar | no | 0
|
||||||
|
Q | Fixed heat power [W] | scalar | cndtnl | -
|
||||||
|
q | Fixed heat flux [W/m2] | scalar | cndtnl | -
|
||||||
|
h | Heat transfer coefficient [W/m^2/K] | scalar | cndtnl | -
|
||||||
|
Ta | Ambient temperature [K] | Function1 | cndtnl | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link faOption.H \endlink
|
||||||
|
- \link faceSetOption.H \endlink
|
||||||
|
|
||||||
|
Options for the \c mode entry:
|
||||||
|
\verbatim
|
||||||
|
power | Use fixed power (supply Q)
|
||||||
|
flux | Use fixed heat flux (supply q)
|
||||||
|
coefficient | Use fixes heat transfer coefficient (supply h and T)
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
See also
|
||||||
|
- Foam::Function1
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
externalHeatFluxSource.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fa_externalHeatFluxSource_H
|
||||||
|
#define fa_externalHeatFluxSource_H
|
||||||
|
|
||||||
|
#include "faOption.H"
|
||||||
|
#include "Function1.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
#include "faceSetOption.H"
|
||||||
|
#include "faCFD.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class externalHeatFluxSource Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class externalHeatFluxSource
|
||||||
|
:
|
||||||
|
public faceSetOption
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Public Enumeration
|
||||||
|
|
||||||
|
//- Options for the heat transfer condition mode
|
||||||
|
enum operationMode
|
||||||
|
{
|
||||||
|
fixedPower, //!< Fixed heat power [W]
|
||||||
|
fixedHeatFlux, //!< Fixed heat flux [W/m2]
|
||||||
|
fixedHeatTransferCoeff, //!< Fixed heat transfer coefficient
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Names for operationMode
|
||||||
|
static const Enum<operationMode> operationModeNames;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Operation mode
|
||||||
|
operationMode mode_;
|
||||||
|
|
||||||
|
//- Name of temperature field
|
||||||
|
word TName_;
|
||||||
|
|
||||||
|
//- Heat power [W]
|
||||||
|
scalar Q_;
|
||||||
|
|
||||||
|
//- Heat flux [W/m2]
|
||||||
|
scalar q_;
|
||||||
|
|
||||||
|
//- Heat transfer coefficient [W/m2K]
|
||||||
|
scalar h_;
|
||||||
|
|
||||||
|
//- Ambient temperature [K]
|
||||||
|
autoPtr<Function1<scalar>> Ta_;
|
||||||
|
|
||||||
|
//- Optional surface emissivity for radiative transfer to ambient
|
||||||
|
scalar emissivity_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("externalHeatFluxSource");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from explicit source name and mesh
|
||||||
|
externalHeatFluxSource
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
);
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
externalHeatFluxSource(const externalHeatFluxSource&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const externalHeatFluxSource&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~externalHeatFluxSource() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
//- Add explicit contribution to compressible momentum equation
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Read source dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fa
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,193 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "jouleHeatingSource.H"
|
||||||
|
#include "faMatrices.H"
|
||||||
|
#include "faCFD.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(jouleHeatingSource, 0);
|
||||||
|
addToRunTimeSelectionTable(option, jouleHeatingSource, dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fa::jouleHeatingSource::jouleHeatingSource
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faceSetOption(sourceName, modelType, dict, patch),
|
||||||
|
TName_(dict.getOrDefault<word>("T", "T")),
|
||||||
|
V_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
typeName + ":V_" + regionName_,
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh()
|
||||||
|
),
|
||||||
|
scalarSigmaVsTPtr_(nullptr),
|
||||||
|
tensorSigmaVsTPtr_(nullptr),
|
||||||
|
curTimeIndex_(-1),
|
||||||
|
nIter_(1),
|
||||||
|
anisotropicElectricalConductivity_(false)
|
||||||
|
{
|
||||||
|
fieldNames_.setSize(1, TName_);
|
||||||
|
|
||||||
|
applied_.setSize(fieldNames_.size(), false);
|
||||||
|
|
||||||
|
if (anisotropicElectricalConductivity_)
|
||||||
|
{
|
||||||
|
Info<< " Using tensor electrical conductivity" << endl;
|
||||||
|
|
||||||
|
initialiseSigma(coeffs_, tensorSigmaVsTPtr_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< " Using scalar electrical conductivity" << endl;
|
||||||
|
|
||||||
|
initialiseSigma(coeffs_, scalarSigmaVsTPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fa::jouleHeatingSource::addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (isActive())
|
||||||
|
{
|
||||||
|
DebugInfo<< name() << ": applying source to " << eqn.psi().name()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
if (curTimeIndex_ != mesh().time().timeIndex())
|
||||||
|
{
|
||||||
|
for (label i = 0; i < nIter_; ++i)
|
||||||
|
{
|
||||||
|
if (anisotropicElectricalConductivity_)
|
||||||
|
{
|
||||||
|
// Update sigma as a function of T if required
|
||||||
|
const areaTensorField& sigma =
|
||||||
|
updateSigma(tensorSigmaVsTPtr_);
|
||||||
|
|
||||||
|
// Solve the electrical potential equation
|
||||||
|
faScalarMatrix VEqn(fam::laplacian(h*sigma, V_));
|
||||||
|
VEqn.relax();
|
||||||
|
VEqn.solve();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Update sigma as a function of T if required
|
||||||
|
const areaScalarField& sigma =
|
||||||
|
updateSigma(scalarSigmaVsTPtr_);
|
||||||
|
|
||||||
|
// Solve the electrical potential equation
|
||||||
|
faScalarMatrix VEqn(fam::laplacian(h*sigma, V_));
|
||||||
|
VEqn.relax();
|
||||||
|
VEqn.solve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curTimeIndex_ = mesh().time().timeIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the Joule heating contribution
|
||||||
|
areaVectorField gradV("gradV", fac::grad(V_));
|
||||||
|
|
||||||
|
if (anisotropicElectricalConductivity_)
|
||||||
|
{
|
||||||
|
const auto& sigma =
|
||||||
|
mesh_.lookupObject<areaTensorField>
|
||||||
|
(
|
||||||
|
typeName + ":sigma_" + regionName_
|
||||||
|
);
|
||||||
|
|
||||||
|
eqn += (h*sigma & gradV) & gradV;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto& sigma =
|
||||||
|
mesh_.lookupObject<areaScalarField>
|
||||||
|
(
|
||||||
|
typeName + ":sigma_" + regionName_
|
||||||
|
);
|
||||||
|
|
||||||
|
eqn += (h*sigma*gradV) & gradV;
|
||||||
|
|
||||||
|
if (mesh().time().outputTime() && debug)
|
||||||
|
{
|
||||||
|
areaScalarField qgradV("gradVSource", (gradV & gradV));
|
||||||
|
qgradV.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::fa::jouleHeatingSource::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (option::read(dict))
|
||||||
|
{
|
||||||
|
dict.readIfPresent("T", TName_);
|
||||||
|
|
||||||
|
dict.readIfPresent("nIter", nIter_);
|
||||||
|
|
||||||
|
anisotropicElectricalConductivity_ =
|
||||||
|
dict.get<bool>("anisotropicElectricalConductivity");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,265 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fa::jouleHeatingSource
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpFaOptionsSources
|
||||||
|
|
||||||
|
Description
|
||||||
|
Evolves an electrical potential equation
|
||||||
|
|
||||||
|
\f[
|
||||||
|
\grad \left( \sigma \grad V \right)
|
||||||
|
\f]
|
||||||
|
|
||||||
|
where \f$ V \f$ is electrical potential
|
||||||
|
and \f$\sigma\f$ is the electrical current.
|
||||||
|
|
||||||
|
To provide a Joule heating contribution according to:
|
||||||
|
|
||||||
|
Differential form of Joule heating - power per unit volume:
|
||||||
|
|
||||||
|
\f[
|
||||||
|
\frac{d(P)}{d(V)} = J \cdot E
|
||||||
|
\f]
|
||||||
|
|
||||||
|
where \f$ J \f$ is the current density and \f$ E \f$ the electric field.
|
||||||
|
If no magnetic field is present:
|
||||||
|
|
||||||
|
\f[
|
||||||
|
J = \sigma E
|
||||||
|
\f]
|
||||||
|
|
||||||
|
The electric field given by
|
||||||
|
|
||||||
|
\f[
|
||||||
|
E = \grad V
|
||||||
|
\f]
|
||||||
|
|
||||||
|
Therefore:
|
||||||
|
|
||||||
|
\f[
|
||||||
|
\frac{d(P)}{d(V)} = J \cdot E
|
||||||
|
= (sigma E) \cdot E
|
||||||
|
= (sigma \grad V) \cdot \grad V
|
||||||
|
\f]
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Minimal example by using \c constant/faOptions:
|
||||||
|
\verbatim
|
||||||
|
jouleHeatingSource1
|
||||||
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
type jouleHeatingSource;
|
||||||
|
|
||||||
|
// Mandatory entries (runtime modifiable)
|
||||||
|
anisotropicElectricalConductivity true;
|
||||||
|
|
||||||
|
// Optional entries (runtime modifiable)
|
||||||
|
T <Tname>;
|
||||||
|
nIter -1;
|
||||||
|
|
||||||
|
// Conditional mandatory entries (runtime modifiable)
|
||||||
|
|
||||||
|
// when the entry "sigma" is present
|
||||||
|
sigma <Function1>;
|
||||||
|
|
||||||
|
// when when the entry "sigma" is not present
|
||||||
|
// read "sigma" from file
|
||||||
|
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Type name: jouleHeatingSource | word | yes | -
|
||||||
|
anisotropicElectricalConductivity | Flag to indicate that <!--
|
||||||
|
--> if the electrical conductivity is anisotropic <!--
|
||||||
|
--> | bool | yes | -
|
||||||
|
T | Name of operand temperature field | word | no | T
|
||||||
|
sigma | Electrical conductivity as a function of temperature <!--
|
||||||
|
--> | table | no | -
|
||||||
|
nIter | Number of iterations for electrical potential equation <!--
|
||||||
|
--> solution | label | no | -1
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link faOption.H \endlink
|
||||||
|
- \link faceSetOption.H \endlink
|
||||||
|
|
||||||
|
Note
|
||||||
|
- \c anisotropicElectricalConductivity=true enables
|
||||||
|
anisotropic (tensorial) electrical conductivity.
|
||||||
|
- \c anisotropicElectricalConductivity=false enables
|
||||||
|
isotropic (scalar) electrical conductivity.
|
||||||
|
- The electrical conductivity can be specified using either:
|
||||||
|
- If the \c sigma entry is present the electrical conductivity is specified
|
||||||
|
as a function of temperature using a \c Function1 type.
|
||||||
|
- If not present the \c sigma field will be read from file.
|
||||||
|
- If the \c anisotropicElectricalConductivity flag is set to \c true,
|
||||||
|
\c sigma should be specified as a tensor quantity.
|
||||||
|
|
||||||
|
See also
|
||||||
|
- Foam::Function1
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
jouleHeatingSource.C
|
||||||
|
jouleHeatingSourceTemplates.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fa_jouleHeatingSource_H
|
||||||
|
#define fa_jouleHeatingSource_H
|
||||||
|
|
||||||
|
#include "faOption.H"
|
||||||
|
#include "Function1.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
#include "faceSetOption.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace fa
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class jouleHeatingSource Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class jouleHeatingSource
|
||||||
|
:
|
||||||
|
public faceSetOption
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Name of temperature field
|
||||||
|
word TName_;
|
||||||
|
|
||||||
|
//- Electrical potential field / [V]
|
||||||
|
areaScalarField V_;
|
||||||
|
|
||||||
|
//- Electrical conductivity as a scalar function of temperature
|
||||||
|
autoPtr<Function1<scalar>> scalarSigmaVsTPtr_;
|
||||||
|
|
||||||
|
//- Electrical conductivity as a tensor function of temperature
|
||||||
|
autoPtr<Function1<tensor>> tensorSigmaVsTPtr_;
|
||||||
|
|
||||||
|
//- Current time index (used for updating)
|
||||||
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
//- Number of iterations for electrical potential equation solution
|
||||||
|
label nIter_;
|
||||||
|
|
||||||
|
//- Flag to indicate that the electrical conductivity is anisotropic
|
||||||
|
bool anisotropicElectricalConductivity_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Initialise the electrical conductivity field
|
||||||
|
template<class Type>
|
||||||
|
void initialiseSigma
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
autoPtr<Function1<Type>>& sigmaVsTPtr
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Update the electrical conductivity field
|
||||||
|
template<class Type>
|
||||||
|
const GeometricField<Type, faPatchField, areaMesh>&
|
||||||
|
updateSigma(const autoPtr<Function1<Type>>& sigmaVsTPtr) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("jouleHeatingSource");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from explicit source name and mesh
|
||||||
|
jouleHeatingSource
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvPatch& patch
|
||||||
|
);
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
jouleHeatingSource(const jouleHeatingSource&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const jouleHeatingSource&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~jouleHeatingSource() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
//- Add explicit contribution to compressible momentum equation
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
const areaScalarField& h,
|
||||||
|
const areaScalarField& rho,
|
||||||
|
faMatrix<scalar>& eqn,
|
||||||
|
const label fieldi
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Read source dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace fa
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "jouleHeatingSourceTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,140 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "emptyFaPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fa::jouleHeatingSource::initialiseSigma
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
autoPtr<Function1<Type>>& sigmaVsTPtr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, faPatchField, areaMesh> AreaFieldType;
|
||||||
|
|
||||||
|
if (dict.found("sigma"))
|
||||||
|
{
|
||||||
|
// Sigma to be defined using a Function1 type
|
||||||
|
sigmaVsTPtr = Function1<Type>::New("sigma", dict);
|
||||||
|
|
||||||
|
auto tsigma = tmp<AreaFieldType>::New
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
typeName + ":sigma_" + regionName_,
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensioned<Type>(sqr(dimCurrent)/dimPower/dimLength, Zero)
|
||||||
|
);
|
||||||
|
|
||||||
|
mesh_.objectRegistry::store(tsigma.ptr());
|
||||||
|
|
||||||
|
Info<< " Conductivity 'sigma' read from dictionary as f(T)"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Sigma to be defined by user input
|
||||||
|
auto tsigma = tmp<AreaFieldType>::New
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
typeName + ":sigma_" + regionName_,
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh()
|
||||||
|
);
|
||||||
|
|
||||||
|
mesh().objectRegistry::store(tsigma.ptr());
|
||||||
|
|
||||||
|
Info<< " Conductivity 'sigma' read from file" << nl << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Foam::GeometricField<Type, Foam::faPatchField, Foam::areaMesh>&
|
||||||
|
Foam::fa::jouleHeatingSource::updateSigma
|
||||||
|
(
|
||||||
|
const autoPtr<Function1<Type>>& sigmaVsTPtr
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, faPatchField, areaMesh> AreaFieldType;
|
||||||
|
|
||||||
|
auto& sigma =
|
||||||
|
mesh().lookupObjectRef<AreaFieldType>
|
||||||
|
(
|
||||||
|
typeName + ":sigma_" + regionName_
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!sigmaVsTPtr.valid())
|
||||||
|
{
|
||||||
|
// Electrical conductivity field, sigma, was specified by the user
|
||||||
|
return sigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& T = mesh().lookupObject<areaScalarField>(TName_);
|
||||||
|
|
||||||
|
// Internal field
|
||||||
|
forAll(sigma, i)
|
||||||
|
{
|
||||||
|
sigma[i] = sigmaVsTPtr->value(T[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Boundary field
|
||||||
|
typename AreaFieldType::Boundary& bf = sigma.boundaryFieldRef();
|
||||||
|
forAll(bf, patchi)
|
||||||
|
{
|
||||||
|
faPatchField<Type>& pf = bf[patchi];
|
||||||
|
if (!isA<emptyFaPatch>(bf[patchi]))
|
||||||
|
{
|
||||||
|
const scalarField& Tbf = T.boundaryField()[patchi];
|
||||||
|
forAll(pf, facei)
|
||||||
|
{
|
||||||
|
pf[facei] = sigmaVsTPtr->value(Tbf[facei]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update processor patches
|
||||||
|
sigma.correctBoundaryConditions();
|
||||||
|
|
||||||
|
return sigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -48,7 +48,8 @@ $(derivedFaPatchFields)/fixedValueOutflow/fixedValueOutflowFaPatchFields.C
|
|||||||
$(derivedFaPatchFields)/inletOutlet/inletOutletFaPatchFields.C
|
$(derivedFaPatchFields)/inletOutlet/inletOutletFaPatchFields.C
|
||||||
$(derivedFaPatchFields)/slip/slipFaPatchFields.C
|
$(derivedFaPatchFields)/slip/slipFaPatchFields.C
|
||||||
$(derivedFaPatchFields)/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C
|
$(derivedFaPatchFields)/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C
|
||||||
$(derivedFaPatchFields)/uniformFixedValue/uniformFixedValueFaPatchFields.C
|
$(derivedFaPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C
|
||||||
|
$(derivedFaPatchFields)/clampedPlate/clampedPlateFaPatchFields.C
|
||||||
|
|
||||||
faePatchFields = fields/faePatchFields
|
faePatchFields = fields/faePatchFields
|
||||||
$(faePatchFields)/faePatchField/faePatchFields.C
|
$(faePatchFields)/faePatchField/faePatchFields.C
|
||||||
@ -81,6 +82,7 @@ $(schemes)/upwind/upwindEdgeInterpolationMake.C
|
|||||||
$(schemes)/linearUpwind/linearUpwindEdgeInterpolationMake.C
|
$(schemes)/linearUpwind/linearUpwindEdgeInterpolationMake.C
|
||||||
$(schemes)/Gamma/GammaEdgeInterpolationMake.C
|
$(schemes)/Gamma/GammaEdgeInterpolationMake.C
|
||||||
$(schemes)/blended/blendedEdgeInterpolationMake.C
|
$(schemes)/blended/blendedEdgeInterpolationMake.C
|
||||||
|
$(schemes)/skewCorrected/skewCorrectedEdgeInterpolationMake.C
|
||||||
|
|
||||||
finiteArea/fa/fa.C
|
finiteArea/fa/fa.C
|
||||||
finiteArea/faSchemes/faSchemes.C
|
finiteArea/faSchemes/faSchemes.C
|
||||||
|
|||||||
@ -343,8 +343,8 @@ Foam::tmp<Foam::vectorField> Foam::faPatch::ngbPolyPatchPointNormals() const
|
|||||||
|
|
||||||
const labelListList& pntEdges = pointEdges();
|
const labelListList& pntEdges = pointEdges();
|
||||||
|
|
||||||
tmp<vectorField> tpN(new vectorField(pntEdges.size(), Zero));
|
auto tpN = tmp<vectorField>::New(pntEdges.size(), Zero);
|
||||||
vectorField& pN = tpN.ref();
|
auto& pN = tpN.ref();
|
||||||
|
|
||||||
const vectorField faceNormals(ngbPolyPatchFaceNormals());
|
const vectorField faceNormals(ngbPolyPatchFaceNormals());
|
||||||
|
|
||||||
@ -406,8 +406,8 @@ Foam::tmp<Foam::vectorField> Foam::faPatch::edgeNormals() const
|
|||||||
|
|
||||||
Foam::tmp<Foam::vectorField> Foam::faPatch::edgeFaceCentres() const
|
Foam::tmp<Foam::vectorField> Foam::faPatch::edgeFaceCentres() const
|
||||||
{
|
{
|
||||||
tmp<vectorField> tfc(new vectorField(size()));
|
auto tfc = tmp<vectorField>::New(size());
|
||||||
vectorField& fc = tfc.ref();
|
auto& fc = tfc.ref();
|
||||||
|
|
||||||
// get reference to global face centres
|
// get reference to global face centres
|
||||||
const vectorField& gfc =
|
const vectorField& gfc =
|
||||||
@ -427,13 +427,22 @@ Foam::tmp<Foam::vectorField> Foam::faPatch::edgeFaceCentres() const
|
|||||||
Foam::tmp<Foam::vectorField> Foam::faPatch::delta() const
|
Foam::tmp<Foam::vectorField> Foam::faPatch::delta() const
|
||||||
{
|
{
|
||||||
return edgeNormals()*(edgeNormals() & (edgeCentres() - edgeFaceCentres()));
|
return edgeNormals()*(edgeNormals() & (edgeCentres() - edgeFaceCentres()));
|
||||||
//return edgeCentres() - edgeFaceCentres();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::faPatch::makeDeltaCoeffs(scalarField& dc) const
|
void Foam::faPatch::makeDeltaCoeffs(scalarField& dc) const
|
||||||
{
|
{
|
||||||
dc = 1.0/(edgeNormals() & delta());
|
dc = scalar(1)/(edgeNormals() & delta());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::faPatch::makeCorrectionVectors(vectorField& k) const
|
||||||
|
{
|
||||||
|
vectorField unitDelta(delta()/mag(delta()));
|
||||||
|
vectorField edgeNormMag(edgeNormals()/mag(edgeNormals()));
|
||||||
|
scalarField dn(edgeNormals() & delta());
|
||||||
|
|
||||||
|
k = edgeNormMag - (scalar(1)/(unitDelta & edgeNormMag))*unitDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -445,7 +454,7 @@ const Foam::scalarField& Foam::faPatch::deltaCoeffs() const
|
|||||||
|
|
||||||
void Foam::faPatch::makeWeights(scalarField& w) const
|
void Foam::faPatch::makeWeights(scalarField& w) const
|
||||||
{
|
{
|
||||||
w = 1.0;
|
w = scalar(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,7 +36,9 @@ Author
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faPatch.C
|
faPatch.C
|
||||||
newFaPatch.C
|
faPatchNew.C
|
||||||
|
faPatchTemplates.C
|
||||||
|
faPatchFaMeshTemplates.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -68,9 +71,7 @@ class faPatch
|
|||||||
public labelList,
|
public labelList,
|
||||||
public patchIdentifier
|
public patchIdentifier
|
||||||
{
|
{
|
||||||
private:
|
// Private Data
|
||||||
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Neighbour polyPatch index
|
//- Neighbour polyPatch index
|
||||||
const label ngbPolyPatchIndex_;
|
const label ngbPolyPatchIndex_;
|
||||||
@ -106,6 +107,8 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
//- The faPatch geometry initialisation is called by faBoundaryMesh
|
//- The faPatch geometry initialisation is called by faBoundaryMesh
|
||||||
friend class faBoundaryMesh;
|
friend class faBoundaryMesh;
|
||||||
|
|
||||||
@ -143,7 +146,6 @@ public:
|
|||||||
|
|
||||||
typedef faBoundaryMesh BoundaryMesh;
|
typedef faBoundaryMesh BoundaryMesh;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("patch");
|
TypeName("patch");
|
||||||
|
|
||||||
@ -189,7 +191,7 @@ public:
|
|||||||
faPatch(const faPatch&, const faBoundaryMesh&);
|
faPatch(const faPatch&, const faBoundaryMesh&);
|
||||||
|
|
||||||
//- Construct and return a clone, resetting the edge list
|
//- Construct and return a clone, resetting the edge list
|
||||||
// and boundary mesh
|
//- and boundary mesh
|
||||||
virtual autoPtr<faPatch> clone
|
virtual autoPtr<faPatch> clone
|
||||||
(
|
(
|
||||||
const faBoundaryMesh& bm,
|
const faBoundaryMesh& bm,
|
||||||
@ -207,7 +209,7 @@ public:
|
|||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Return a pointer to a new patch created
|
//- Return a pointer to a new patch created
|
||||||
// on freestore from dictionary
|
//- on freestore from dictionary
|
||||||
static autoPtr<faPatch> New
|
static autoPtr<faPatch> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -320,6 +322,8 @@ public:
|
|||||||
//- Make patch edge - neighbour face distances
|
//- Make patch edge - neighbour face distances
|
||||||
virtual void makeDeltaCoeffs(scalarField&) const;
|
virtual void makeDeltaCoeffs(scalarField&) const;
|
||||||
|
|
||||||
|
void makeCorrectionVectors(vectorField&) const;
|
||||||
|
|
||||||
//- Return patch edge - neighbour face distances
|
//- Return patch edge - neighbour face distances
|
||||||
const scalarField& deltaCoeffs() const;
|
const scalarField& deltaCoeffs() const;
|
||||||
|
|
||||||
@ -330,7 +334,7 @@ public:
|
|||||||
void resetEdges(const labelList&);
|
void resetEdges(const labelList&);
|
||||||
|
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation
|
||||||
|
|
||||||
//- Return given internal field next to patch as patch field
|
//- Return given internal field next to patch as patch field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -344,7 +348,7 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Lookup and return the patchField of the named field from the
|
//- Lookup and return the patchField of the named field from the
|
||||||
// local objectRegistry.
|
//- local objectRegistry.
|
||||||
// N.B. The dummy pointer arguments are used if this function is
|
// N.B. The dummy pointer arguments are used if this function is
|
||||||
// instantiated within a templated function to avoid a bug in gcc.
|
// instantiated within a templated function to avoid a bug in gcc.
|
||||||
// See inletOutletFvPatchField.C and outletInletFvPatchField.C
|
// See inletOutletFvPatchField.C and outletInletFvPatchField.C
|
||||||
|
|||||||
@ -0,0 +1,179 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "clampedPlateFaPatchField.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
#include "uniformDimensionedFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
clampedPlateFaPatchField<Type>::clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const faPatch& p,
|
||||||
|
const DimensionedField<Type, areaMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faPatchField<Type>(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
clampedPlateFaPatchField<Type>::clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const faPatch& p,
|
||||||
|
const DimensionedField<Type, areaMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faPatchField<Type>(p, iF)
|
||||||
|
{
|
||||||
|
faPatchField<Type>::operator=(this->patchInternalField());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
clampedPlateFaPatchField<Type>::clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const clampedPlateFaPatchField<Type>& ptf,
|
||||||
|
const faPatch& p,
|
||||||
|
const DimensionedField<Type, areaMesh>& iF,
|
||||||
|
const faPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faPatchField<Type>(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
clampedPlateFaPatchField<Type>::clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const clampedPlateFaPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faPatchField<Type>(ptf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
clampedPlateFaPatchField<Type>::clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const clampedPlateFaPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, areaMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faPatchField<Type>(ptf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void clampedPlateFaPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||||
|
{
|
||||||
|
notImplemented(type() + "::evaluate(const Pstream::commsType)");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void clampedPlateFaPatchField<scalar>::evaluate(const Pstream::commsTypes)
|
||||||
|
{
|
||||||
|
if (!this->updated())
|
||||||
|
{
|
||||||
|
this->updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
Field<scalar>::operator=(pTraits<scalar>::zero);
|
||||||
|
|
||||||
|
const labelUList& edgeFaces = this->patch().edgeFaces();
|
||||||
|
forAll(edgeFaces, edgeID)
|
||||||
|
{
|
||||||
|
label faceID = edgeFaces[edgeID];
|
||||||
|
const_cast<Field<scalar>&>(this->primitiveField())[faceID] =
|
||||||
|
pTraits<scalar>::zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
faPatchField<scalar>::evaluate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > clampedPlateFaPatchField<Type>::valueInternalCoeffs
|
||||||
|
(
|
||||||
|
const tmp<scalarField>&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<Field<Type>>
|
||||||
|
(new Field<Type>(this->size(), pTraits<Type>::zero));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > clampedPlateFaPatchField<Type>::valueBoundaryCoeffs
|
||||||
|
(
|
||||||
|
const tmp<scalarField>&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> >
|
||||||
|
clampedPlateFaPatchField<Type>::gradientInternalCoeffs() const
|
||||||
|
{
|
||||||
|
return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> >
|
||||||
|
clampedPlateFaPatchField<Type>::gradientBoundaryCoeffs() const
|
||||||
|
{
|
||||||
|
return this->patch().deltaCoeffs()*(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void clampedPlateFaPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
faPatchField<Type>::write(os);
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,214 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::clampedPlateFaPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
This BC provides a clamped BC. It sets zero fixe value and zeroGradient.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<patchName>
|
||||||
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
type clampedPlate;
|
||||||
|
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Type name: clampedPlate | word | yes | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link faPatchFields.H \endlink
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
clampedPlateFaPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef clampedPlateFaPatchField_H
|
||||||
|
#define clampedPlateFaPatchField_H
|
||||||
|
|
||||||
|
#include "faPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class clampedPlateFaPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class clampedPlateFaPatchField
|
||||||
|
:
|
||||||
|
public faPatchField<Type>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("clampedPlate");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const faPatch&,
|
||||||
|
const DimensionedField<Type, areaMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const faPatch&,
|
||||||
|
const DimensionedField<Type, areaMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping the given clampedPlateFaPatchField<Type>
|
||||||
|
//- onto a new patch
|
||||||
|
clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const clampedPlateFaPatchField<Type>&,
|
||||||
|
const faPatch&,
|
||||||
|
const DimensionedField<Type, areaMesh>&,
|
||||||
|
const faPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const clampedPlateFaPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<faPatchField<Type>> clone() const
|
||||||
|
{
|
||||||
|
return tmp<faPatchField<Type>>
|
||||||
|
(
|
||||||
|
new clampedPlateFaPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
clampedPlateFaPatchField
|
||||||
|
(
|
||||||
|
const clampedPlateFaPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, areaMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<faPatchField<Type> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<Type, areaMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<faPatchField<Type> >
|
||||||
|
(
|
||||||
|
new clampedPlateFaPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~clampedPlateFaPatchField()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
//- Return gradient at boundary
|
||||||
|
virtual tmp<Field<Type>> snGrad() const
|
||||||
|
{
|
||||||
|
return tmp<Field<Type>>
|
||||||
|
(
|
||||||
|
new Field<Type>(this->size(), Zero)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType=Pstream::commsTypes::blocking
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return the matrix diagonal coefficients corresponding to the
|
||||||
|
//- evaluation of the value of this patchField with given weights
|
||||||
|
virtual tmp<Field<Type> > valueInternalCoeffs
|
||||||
|
(
|
||||||
|
const tmp<scalarField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return the matrix source coefficients corresponding to the
|
||||||
|
//- evaluation of the value of this patchField with given weights
|
||||||
|
virtual tmp<Field<Type> > valueBoundaryCoeffs
|
||||||
|
(
|
||||||
|
const tmp<scalarField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return the matrix diagonal coefficients corresponding to the
|
||||||
|
//- evaluation of the gradient of this patchField
|
||||||
|
virtual tmp<Field<Type> > gradientInternalCoeffs() const;
|
||||||
|
|
||||||
|
//- Return the matrix source coefficients corresponding to the
|
||||||
|
//- evaluation of the gradient of this patchField
|
||||||
|
virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "clampedPlateFaPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -21,11 +21,11 @@ License
|
|||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "uniformFixedValueFaPatchFields.H"
|
#include "clampedPlateFaPatchFields.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "areaFields.H"
|
#include "areaFields.H"
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
makeFaPatchFields(uniformFixedValue);
|
makeFaPatchFields(clampedPlate);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -21,14 +21,14 @@ License
|
|||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef uniformFixedValueFaPatchFields_H
|
#ifndef clampedPlateFaPatchFields_H
|
||||||
#define uniformFixedValueFaPatchFields_H
|
#define clampedPlateFaPatchFields_H
|
||||||
|
|
||||||
#include "uniformFixedValueFaPatchField.H"
|
#include "clampedPlateFaPatchField.H"
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -38,7 +38,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
makeFaPatchTypeFieldTypedefs(uniformFixedValue)
|
makeFaPatchTypeFieldTypedefs(clampedPlate)
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef clampedPlateFaPatchFieldsFwd_H
|
||||||
|
#define clampedPlateFaPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class clampedPlateFaPatchField;
|
||||||
|
|
||||||
|
makeFaPatchTypeFieldTypedefs(clampedPlate)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,24 +25,27 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "uniformFixedValueFaPatchField.H"
|
#include "timeVaryingUniformFixedValueFaPatchField.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
|
Foam::timeVaryingUniformFixedValueFaPatchField<Type>::
|
||||||
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const faPatch& p,
|
const faPatch& p,
|
||||||
const DimensionedField<Type, areaMesh>& iF
|
const DimensionedField<Type, areaMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFaPatchField<Type>(p, iF),
|
fixedValueFaPatchField<Type>(p, iF),
|
||||||
uniformValue_(nullptr)
|
timeSeries_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
|
Foam::timeVaryingUniformFixedValueFaPatchField<Type>::
|
||||||
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const faPatch& p,
|
const faPatch& p,
|
||||||
const DimensionedField<Type, areaMesh>& iF,
|
const DimensionedField<Type, areaMesh>& iF,
|
||||||
@ -50,83 +53,85 @@ Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFaPatchField<Type>(p, iF),
|
fixedValueFaPatchField<Type>(p, iF),
|
||||||
uniformValue_(Function1<Type>::New("uniformValue", dict))
|
timeSeries_(dict)
|
||||||
{
|
{
|
||||||
if (dict.found("value"))
|
if (dict.found("value"))
|
||||||
{
|
{
|
||||||
faPatchField<Type>::operator==
|
faPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
|
||||||
(
|
|
||||||
Field<Type>("value", dict, p.size())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->evaluate();
|
updateCoeffs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
|
Foam::timeVaryingUniformFixedValueFaPatchField<Type>::
|
||||||
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const uniformFixedValueFaPatchField<Type>& ptf,
|
const timeVaryingUniformFixedValueFaPatchField<Type>& ptf,
|
||||||
const faPatch& p,
|
const faPatch& p,
|
||||||
const DimensionedField<Type, areaMesh>& iF,
|
const DimensionedField<Type, areaMesh>& iF,
|
||||||
const faPatchFieldMapper& mapper
|
const faPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFaPatchField<Type>(ptf, p, iF, mapper),
|
fixedValueFaPatchField<Type>(ptf, p, iF, mapper),
|
||||||
uniformValue_(ptf.uniformValue_.clone())
|
timeSeries_(ptf.timeSeries_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
|
Foam::timeVaryingUniformFixedValueFaPatchField<Type>::
|
||||||
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const uniformFixedValueFaPatchField<Type>& ptf
|
const timeVaryingUniformFixedValueFaPatchField<Type>& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFaPatchField<Type>(ptf),
|
fixedValueFaPatchField<Type>(ptf),
|
||||||
uniformValue_(ptf.uniformValue_.clone())
|
timeSeries_(ptf.timeSeries_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
|
Foam::timeVaryingUniformFixedValueFaPatchField<Type>::
|
||||||
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const uniformFixedValueFaPatchField<Type>& ptf,
|
const timeVaryingUniformFixedValueFaPatchField<Type>& ptf,
|
||||||
const DimensionedField<Type, areaMesh>& iF
|
const DimensionedField<Type, areaMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFaPatchField<Type>(ptf, iF),
|
fixedValueFaPatchField<Type>(ptf, iF),
|
||||||
uniformValue_(ptf.uniformValue_.clone())
|
timeSeries_(ptf.timeSeries_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::uniformFixedValueFaPatchField<Type>::updateCoeffs()
|
void Foam::timeVaryingUniformFixedValueFaPatchField<Type>::updateCoeffs()
|
||||||
{
|
{
|
||||||
if (this->updated())
|
if (this->updated())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar t = this->db().time().timeOutputValue();
|
faPatchField<Type>::operator==
|
||||||
faPatchField<Type>::operator==(uniformValue_->value(t));
|
(
|
||||||
|
timeSeries_(this->db().time().timeOutputValue())
|
||||||
|
);
|
||||||
fixedValueFaPatchField<Type>::updateCoeffs();
|
fixedValueFaPatchField<Type>::updateCoeffs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::uniformFixedValueFaPatchField<Type>::write
|
void Foam::timeVaryingUniformFixedValueFaPatchField<Type>::write
|
||||||
(
|
(
|
||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
faPatchField<Type>::write(os);
|
faPatchField<Type>::write(os);
|
||||||
uniformValue_->writeData(os);
|
timeSeries_.write(os);
|
||||||
this->writeEntry("value", os);
|
this->writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5,6 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,42 +25,59 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::uniformFixedValueFaPatchField
|
Foam::timeVaryingUniformFixedValueFaPatchField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
This finiteArea boundary condition
|
A time-varying form of a uniform fixed value finite area
|
||||||
provides a uniform fixed value condition, which can also be time-varying.
|
boundary condition.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
\table
|
|
||||||
Property | Description | Required | Default
|
|
||||||
uniformValue | uniform value | yes |
|
|
||||||
\endtable
|
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
\verbatim
|
\verbatim
|
||||||
<patchName>
|
<patchName>
|
||||||
{
|
{
|
||||||
type uniformFixedValue;
|
// Mandatory entries (unmodifiable)
|
||||||
uniformValue constant 0.2;
|
type timeVaryingUniformFixedValue;
|
||||||
|
fileName "<case>/time-series";
|
||||||
|
outOfBounds clamp; // (error|warn|clamp|repeat)
|
||||||
|
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Type name: timeVaryingUniformFixedValue | word | yes | -
|
||||||
|
fileName | Name of operand file | word | yes | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link faPatchFields.H \endlink
|
||||||
|
|
||||||
|
Author
|
||||||
|
Zeljko Tukovic, FMENA
|
||||||
|
Hrvoje Jasak, Wikki Ltd.
|
||||||
|
|
||||||
|
Note
|
||||||
|
This class is derived directly from a fixedValue patch rather than from
|
||||||
|
a uniformFixedValue patch.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
Foam::Function1Types
|
- Foam::interpolationTable
|
||||||
Foam::fixedValueFvPatchField
|
- Foam::fixedValueFaPatchField
|
||||||
Foam::uniformFixedValueFvPatchField.C
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
uniformFixedValueFaPatchField.C
|
timeVaryingUniformFixedValueFaPatchField.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef uniformFixedValueFaPatchField_H
|
#ifndef timeVaryingUniformFixedValueFaPatchField_H
|
||||||
#define uniformFixedValueFaPatchField_H
|
#define timeVaryingUniformFixedValueFaPatchField_H
|
||||||
|
|
||||||
#include "fixedValueFaPatchField.H"
|
#include "fixedValueFaPatchField.H"
|
||||||
#include "Function1.H"
|
#include "interpolationTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -67,56 +85,56 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class uniformFixedValueFaPatch Declaration
|
Class timeVaryingUniformFixedValueFaPatch Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class uniformFixedValueFaPatchField
|
class timeVaryingUniformFixedValueFaPatchField
|
||||||
:
|
:
|
||||||
public fixedValueFaPatchField<Type>
|
public fixedValueFaPatchField<Type>
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Value
|
//- The time series being used, including the bounding treatment
|
||||||
autoPtr<Function1<Type>> uniformValue_;
|
interpolationTable<Type> timeSeries_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("uniformFixedValue");
|
TypeName("timeVaryingUniformFixedValue");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
//- Construct from patch and internal field
|
||||||
uniformFixedValueFaPatchField
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const faPatch&,
|
const faPatch&,
|
||||||
const DimensionedField<Type, areaMesh>&
|
const DimensionedField<Type, areaMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from patch, internal field and dictionary
|
//- Construct from patch, internal field and dictionary
|
||||||
uniformFixedValueFaPatchField
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const faPatch&,
|
const faPatch&,
|
||||||
const DimensionedField<Type, areaMesh>&,
|
const DimensionedField<Type, areaMesh>&,
|
||||||
const dictionary&
|
const dictionary&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct by mapping onto a new patch
|
//- Construct by mapping given patch field onto a new patch
|
||||||
uniformFixedValueFaPatchField
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const uniformFixedValueFaPatchField<Type>&,
|
const timeVaryingUniformFixedValueFaPatchField<Type>&,
|
||||||
const faPatch&,
|
const faPatch&,
|
||||||
const DimensionedField<Type, areaMesh>&,
|
const DimensionedField<Type, areaMesh>&,
|
||||||
const faPatchFieldMapper&
|
const faPatchFieldMapper&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Construct as copy
|
||||||
uniformFixedValueFaPatchField
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const uniformFixedValueFaPatchField<Type>&
|
const timeVaryingUniformFixedValueFaPatchField<Type>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
@ -124,14 +142,14 @@ public:
|
|||||||
{
|
{
|
||||||
return tmp<faPatchField<Type>>
|
return tmp<faPatchField<Type>>
|
||||||
(
|
(
|
||||||
new uniformFixedValueFaPatchField<Type>(*this)
|
new timeVaryingUniformFixedValueFaPatchField<Type>(*this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
uniformFixedValueFaPatchField
|
timeVaryingUniformFixedValueFaPatchField
|
||||||
(
|
(
|
||||||
const uniformFixedValueFaPatchField<Type>&,
|
const timeVaryingUniformFixedValueFaPatchField<Type>&,
|
||||||
const DimensionedField<Type, areaMesh>&
|
const DimensionedField<Type, areaMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -143,22 +161,36 @@ public:
|
|||||||
{
|
{
|
||||||
return tmp<faPatchField<Type>>
|
return tmp<faPatchField<Type>>
|
||||||
(
|
(
|
||||||
new uniformFixedValueFaPatchField<Type>(*this, iF)
|
new timeVaryingUniformFixedValueFaPatchField<Type>(*this, iF)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~uniformFixedValueFaPatchField() = default;
|
virtual ~timeVaryingUniformFixedValueFaPatchField() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the time series used
|
||||||
|
const interpolationTable<Type>& timeSeries() const
|
||||||
|
{
|
||||||
|
return timeSeries_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
//- Update the coefficients associated with the patch field
|
||||||
virtual void updateCoeffs();
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write(Ostream& os) const;
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -169,7 +201,7 @@ public:
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "uniformFixedValueFaPatchField.C"
|
#include "timeVaryingUniformFixedValueFaPatchField.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "timeVaryingUniformFixedValueFaPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeFaPatchFields(timeVaryingUniformFixedValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef timeVaryingUniformFixedValueFaPatchFields_H
|
||||||
|
#define timeVaryingUniformFixedValueFaPatchFields_H
|
||||||
|
|
||||||
|
#include "timeVaryingUniformFixedValueFaPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef timeVaryingUniformFixedValueFaPatchFieldsFwd_H
|
||||||
|
#define timeVaryingUniformFixedValueFaPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "faPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class timeVaryingUniformFixedValueFaPatchField;
|
||||||
|
|
||||||
|
makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -81,7 +81,7 @@ class faPatchField
|
|||||||
:
|
:
|
||||||
public Field<Type>
|
public Field<Type>
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to a patch
|
//- Reference to a patch
|
||||||
const faPatch& patch_;
|
const faPatch& patch_;
|
||||||
@ -94,8 +94,8 @@ class faPatchField
|
|||||||
bool updated_;
|
bool updated_;
|
||||||
|
|
||||||
//- Optional patch type, used to allow specified boundary conditions
|
//- Optional patch type, used to allow specified boundary conditions
|
||||||
// to be applied to constraint patches by providing the constraint
|
//- to be applied to constraint patches by providing the constraint
|
||||||
// patch type as 'patchType'
|
//- patch type as 'patchType'
|
||||||
word patchType_;
|
word patchType_;
|
||||||
|
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ public:
|
|||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Return a pointer to a new patchField created on freestore given
|
//- Return a pointer to a new patchField created on freestore given
|
||||||
// patch and internal field
|
//- patch and internal field
|
||||||
// (does not set the patch field values)
|
// (does not set the patch field values)
|
||||||
static tmp<faPatchField<Type>> New
|
static tmp<faPatchField<Type>> New
|
||||||
(
|
(
|
||||||
@ -228,7 +228,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Return a pointer to a new patchField created on freestore given
|
//- Return a pointer to a new patchField created on freestore given
|
||||||
// patch and internal field
|
//- patch and internal field
|
||||||
// (does not set the patch field values)
|
// (does not set the patch field values)
|
||||||
static tmp<faPatchField<Type>> New
|
static tmp<faPatchField<Type>> New
|
||||||
(
|
(
|
||||||
@ -238,7 +238,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Return a pointer to a new patchField created on freestore from
|
//- Return a pointer to a new patchField created on freestore from
|
||||||
// a given faPatchField mapped onto a new patch
|
//- a given faPatchField mapped onto a new patch
|
||||||
static tmp<faPatchField<Type>> New
|
static tmp<faPatchField<Type>> New
|
||||||
(
|
(
|
||||||
const faPatchField<Type>&,
|
const faPatchField<Type>&,
|
||||||
@ -248,7 +248,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Return a pointer to a new patchField created on freestore
|
//- Return a pointer to a new patchField created on freestore
|
||||||
// from dictionary
|
//- from dictionary
|
||||||
static tmp<faPatchField<Type>> New
|
static tmp<faPatchField<Type>> New
|
||||||
(
|
(
|
||||||
const faPatch&,
|
const faPatch&,
|
||||||
@ -257,7 +257,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Return a pointer to a new calculatedFaPatchField created on
|
//- Return a pointer to a new calculatedFaPatchField created on
|
||||||
// freestore without setting patchField values
|
//- freestore without setting patchField values
|
||||||
template<class Type2>
|
template<class Type2>
|
||||||
static tmp<faPatchField<Type>> NewCalculatedType
|
static tmp<faPatchField<Type>> NewCalculatedType
|
||||||
(
|
(
|
||||||
@ -269,7 +269,7 @@ public:
|
|||||||
virtual ~faPatchField<Type>() = default;
|
virtual ~faPatchField<Type>() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Mapping functions
|
// Mapping
|
||||||
|
|
||||||
//- Map (and resize as needed) from self given a mapping object
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
virtual void autoMap
|
virtual void autoMap
|
||||||
@ -346,7 +346,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation
|
||||||
|
|
||||||
//- Return patch-normal gradient
|
//- Return patch-normal gradient
|
||||||
virtual tmp<Field<Type>> snGrad() const;
|
virtual tmp<Field<Type>> snGrad() const;
|
||||||
@ -383,9 +383,8 @@ public:
|
|||||||
Pstream::commsTypes::blocking
|
Pstream::commsTypes::blocking
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Return the matrix diagonal coefficients corresponding to the
|
//- Return the matrix diagonal coefficients corresponding to the
|
||||||
// evaluation of the value of this patchField with given weights
|
//- evaluation of the value of this patchField with given weights
|
||||||
virtual tmp<Field<Type>> valueInternalCoeffs
|
virtual tmp<Field<Type>> valueInternalCoeffs
|
||||||
(
|
(
|
||||||
const tmp<Field<scalar>>&
|
const tmp<Field<scalar>>&
|
||||||
@ -396,7 +395,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return the matrix source coefficients corresponding to the
|
//- Return the matrix source coefficients corresponding to the
|
||||||
// evaluation of the value of this patchField with given weights
|
//- evaluation of the value of this patchField with given weights
|
||||||
virtual tmp<Field<Type>> valueBoundaryCoeffs
|
virtual tmp<Field<Type>> valueBoundaryCoeffs
|
||||||
(
|
(
|
||||||
const tmp<Field<scalar>>&
|
const tmp<Field<scalar>>&
|
||||||
@ -407,7 +406,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return the matrix diagonal coefficients corresponding to the
|
//- Return the matrix diagonal coefficients corresponding to the
|
||||||
// evaluation of the gradient of this patchField
|
//- evaluation of the gradient of this patchField
|
||||||
virtual tmp<Field<Type>> gradientInternalCoeffs() const
|
virtual tmp<Field<Type>> gradientInternalCoeffs() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
@ -415,7 +414,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return the matrix source coefficients corresponding to the
|
//- Return the matrix source coefficients corresponding to the
|
||||||
// evaluation of the gradient of this patchField
|
//- evaluation of the gradient of this patchField
|
||||||
virtual tmp<Field<Type>> gradientBoundaryCoeffs() const
|
virtual tmp<Field<Type>> gradientBoundaryCoeffs() const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
@ -423,6 +422,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
|
|
||||||
@ -433,7 +434,7 @@ public:
|
|||||||
void check(const faPatchField<Type>&) const;
|
void check(const faPatchField<Type>&) const;
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
virtual void operator=(const UList<Type>&);
|
virtual void operator=(const UList<Type>&);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,7 +37,12 @@ Foam::tmp<Foam::faPatchField<Type>> Foam::faPatchField<Type>::New
|
|||||||
const DimensionedField<Type, areaMesh>& iF
|
const DimensionedField<Type, areaMesh>& iF
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DebugInFunction << "Constructing faPatchField<Type>" << endl;
|
DebugInFunction
|
||||||
|
<< "Constructing faPatchField<Type> "
|
||||||
|
<< "patchFieldType:" << patchFieldType
|
||||||
|
<< "actualPatchType:" << actualPatchType
|
||||||
|
<< "p.Type():" << p.type()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
auto cstrIter = patchConstructorTablePtr_->cfind(patchFieldType);
|
auto cstrIter = patchConstructorTablePtr_->cfind(patchFieldType);
|
||||||
|
|
||||||
|
|||||||
@ -165,9 +165,19 @@ SuSp
|
|||||||
);
|
);
|
||||||
faMatrix<Type>& fam = tfam.ref();
|
faMatrix<Type>& fam = tfam.ref();
|
||||||
|
|
||||||
fam.diag() += mesh.S()*max(sp.internalField(), scalar(0));
|
fam.diag() +=
|
||||||
|
mesh.S()*max
|
||||||
|
(
|
||||||
|
sp.internalField(),
|
||||||
|
dimensionedScalar("0", sp.dimensions(), Zero)
|
||||||
|
);
|
||||||
|
|
||||||
fam.source() -= mesh.S()*min(sp.internalField(), scalar(0))
|
fam.source() -=
|
||||||
|
mesh.S()*min
|
||||||
|
(
|
||||||
|
sp.internalField(),
|
||||||
|
dimensionedScalar("0", sp.dimensions(), Zero)
|
||||||
|
)
|
||||||
*vf.internalField();
|
*vf.internalField();
|
||||||
|
|
||||||
return tfam;
|
return tfam;
|
||||||
|
|||||||
@ -281,6 +281,7 @@ Foam::fac::interpolate
|
|||||||
tmp<GeometricField<Type, faePatchField, edgeMesh>> tsf =
|
tmp<GeometricField<Type, faePatchField, edgeMesh>> tsf =
|
||||||
interpolate(tvf());
|
interpolate(tvf());
|
||||||
tvf.clear();
|
tvf.clear();
|
||||||
|
|
||||||
return tsf;
|
return tsf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -47,8 +48,6 @@ void Foam::edgeInterpolation::clearOut()
|
|||||||
deleteDemandDrivenData(differenceFactors_);
|
deleteDemandDrivenData(differenceFactors_);
|
||||||
deleteDemandDrivenData(correctionVectors_);
|
deleteDemandDrivenData(correctionVectors_);
|
||||||
deleteDemandDrivenData(skewCorrectionVectors_);
|
deleteDemandDrivenData(skewCorrectionVectors_);
|
||||||
// deleteDemandDrivenData(leastSquarePvectors_);
|
|
||||||
// deleteDemandDrivenData(leastSquareNvectors_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,8 +63,6 @@ Foam::edgeInterpolation::edgeInterpolation(const faMesh& fam)
|
|||||||
correctionVectors_(nullptr),
|
correctionVectors_(nullptr),
|
||||||
skew_(true),
|
skew_(true),
|
||||||
skewCorrectionVectors_(nullptr)
|
skewCorrectionVectors_(nullptr)
|
||||||
// leastSquarePvectors_(nullptr),
|
|
||||||
// leastSquareNvectors_(nullptr)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -161,30 +158,6 @@ Foam::edgeInterpolation::skewCorrectionVectors() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// const Foam::edgeVectorField&
|
|
||||||
// Foam::edgeInterpolation::leastSquarePvectors() const
|
|
||||||
// {
|
|
||||||
// if (!leastSquarePvectors_)
|
|
||||||
// {
|
|
||||||
// makeLeastSquareVectors();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return (*leastSquarePvectors_);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// const Foam::edgeVectorField&
|
|
||||||
// Foam::edgeInterpolation::leastSquareNvectors() const
|
|
||||||
// {
|
|
||||||
// if (!leastSquareNvectors_)
|
|
||||||
// {
|
|
||||||
// makeLeastSquareVectors();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return (*leastSquareNvectors_);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::edgeInterpolation::movePoints() const
|
bool Foam::edgeInterpolation::movePoints() const
|
||||||
{
|
{
|
||||||
deleteDemandDrivenData(lPN_);
|
deleteDemandDrivenData(lPN_);
|
||||||
@ -197,9 +170,6 @@ bool Foam::edgeInterpolation::movePoints() const
|
|||||||
skew_ = true;
|
skew_ = true;
|
||||||
deleteDemandDrivenData(skewCorrectionVectors_);
|
deleteDemandDrivenData(skewCorrectionVectors_);
|
||||||
|
|
||||||
// deleteDemandDrivenData(leastSquarePvectors_);
|
|
||||||
// deleteDemandDrivenData(leastSquareNvectors_);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,10 +497,12 @@ void Foam::edgeInterpolation::makeCorrectionVectors() const
|
|||||||
- deltaCoeffs[edgeI]*unitDelta;
|
- deltaCoeffs[edgeI]*unitDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
edgeVectorField::Boundary& CorrVecsbf = CorrVecs.boundaryFieldRef();
|
edgeVectorField::Boundary& CorrVecsbf = CorrVecs.boundaryFieldRef();
|
||||||
for (faePatchVectorField& patchCorrVecs : CorrVecsbf)
|
|
||||||
|
forAll(CorrVecs.boundaryField(), patchI)
|
||||||
{
|
{
|
||||||
patchCorrVecs = vector::zero;
|
mesh().boundary()[patchI].makeCorrectionVectors(CorrVecsbf[patchI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar NonOrthogCoeff = 0.0;
|
scalar NonOrthogCoeff = 0.0;
|
||||||
|
|||||||
@ -0,0 +1,219 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::skewCorrectedEdgeInterpolation
|
||||||
|
|
||||||
|
Description
|
||||||
|
Linear/upwind blended differencing scheme
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
skewCorrectedEdgeInterpolationMake.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef skewCorrectedEdgeInterpolation_H
|
||||||
|
#define skewCorrectedEdgeInterpolation_H
|
||||||
|
|
||||||
|
#include "edgeInterpolationScheme.H"
|
||||||
|
#include "linearEdgeInterpolation.H"
|
||||||
|
#include "gaussFaGrad.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
#include "zeroGradientFaPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class skewCorrectedEdgeInterpolation Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class skewCorrectedEdgeInterpolation
|
||||||
|
:
|
||||||
|
virtual public edgeInterpolationScheme<Type>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
tmp<edgeInterpolationScheme<Type>> tScheme_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("skewCorrected");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from Istream
|
||||||
|
skewCorrectedEdgeInterpolation(const faMesh& mesh, Istream& is)
|
||||||
|
:
|
||||||
|
edgeInterpolationScheme<Type>(mesh),
|
||||||
|
tScheme_
|
||||||
|
(
|
||||||
|
edgeInterpolationScheme<Type>::New(mesh, is)
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Construct from mesh, faceFlux and blendingFactor
|
||||||
|
skewCorrectedEdgeInterpolation
|
||||||
|
(
|
||||||
|
const faMesh& mesh,
|
||||||
|
const edgeScalarField& faceFlux,
|
||||||
|
Istream& is
|
||||||
|
)
|
||||||
|
:
|
||||||
|
edgeInterpolationScheme<Type>(mesh),
|
||||||
|
tScheme_
|
||||||
|
(
|
||||||
|
edgeInterpolationScheme<Type>::New(mesh, faceFlux, is)
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
skewCorrectedEdgeInterpolation(const skewCorrectedEdgeInterpolation&) =
|
||||||
|
delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const skewCorrectedEdgeInterpolation&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the interpolation weighting factors
|
||||||
|
virtual tmp<edgeScalarField> weights
|
||||||
|
(
|
||||||
|
const GeometricField<Type, faPatchField, areaMesh>& vf
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tScheme_().weights(vf);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return true if this scheme uses an explicit correction
|
||||||
|
virtual bool corrected() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
tScheme_().corrected() || (this->mesh()).skew();
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, faePatchField, edgeMesh>>
|
||||||
|
skewCorrection
|
||||||
|
(
|
||||||
|
const GeometricField<Type, faPatchField, areaMesh>& vf
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const faMesh& mesh = this->mesh();
|
||||||
|
|
||||||
|
const edgeVectorField& scv = mesh.skewCorrectionVectors();
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, faePatchField, edgeMesh>> tsfCorr
|
||||||
|
(
|
||||||
|
new GeometricField<Type, faePatchField, edgeMesh>
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"skewCorrected::skewCorrection(" + vf.name() + ')',
|
||||||
|
vf.instance(),
|
||||||
|
vf.db()
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensioned<Type>(vf.dimensions(), Zero)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
GeometricField<Type, faePatchField, edgeMesh>& corr = tsfCorr.ref();
|
||||||
|
|
||||||
|
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
|
||||||
|
{
|
||||||
|
corr.replace
|
||||||
|
(
|
||||||
|
cmpt,
|
||||||
|
scv & linearEdgeInterpolation
|
||||||
|
<
|
||||||
|
typename outerProduct
|
||||||
|
<
|
||||||
|
vector,
|
||||||
|
typename pTraits<Type>::cmptType
|
||||||
|
>::type
|
||||||
|
>(mesh).interpolate
|
||||||
|
(
|
||||||
|
fa::gaussGrad<typename pTraits<Type>::cmptType>
|
||||||
|
(mesh).grad(vf.component(cmpt))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tsfCorr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return the explicit correction to the face-interpolate
|
||||||
|
virtual tmp<GeometricField<Type, faePatchField, edgeMesh>>
|
||||||
|
correction
|
||||||
|
(
|
||||||
|
const GeometricField<Type, faPatchField, areaMesh>& vf
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
tScheme_().corrected()
|
||||||
|
&& (this->mesh()).skew()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return tScheme_().correction(vf) + skewCorrection(vf);
|
||||||
|
}
|
||||||
|
else if (tScheme_().corrected())
|
||||||
|
{
|
||||||
|
return tScheme_().correction(vf);
|
||||||
|
}
|
||||||
|
else if ((this->mesh()).skew())
|
||||||
|
{
|
||||||
|
return skewCorrection(vf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return
|
||||||
|
tmp<GeometricField<Type, faePatchField, edgeMesh>>
|
||||||
|
(
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "skewCorrectedEdgeInterpolation.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makeEdgeInterpolationScheme(skewCorrectedEdgeInterpolation)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,11 +39,8 @@ Foam::tmp<Foam::Field<Type>> Foam::volSurfaceMapping::mapToSurface
|
|||||||
// Grab labels for all faces in faMesh
|
// Grab labels for all faces in faMesh
|
||||||
const labelList& faceLabels = mesh_.faceLabels();
|
const labelList& faceLabels = mesh_.faceLabels();
|
||||||
|
|
||||||
tmp<Field<Type>> tresult
|
auto tresult = tmp<Field<Type>>::New(faceLabels.size(), Zero);
|
||||||
(
|
auto& result = tresult.ref();
|
||||||
new Field<Type>(faceLabels.size(), Zero)
|
|
||||||
);
|
|
||||||
Field<Type>& result = tresult.ref();
|
|
||||||
|
|
||||||
// Get reference to volume mesh
|
// Get reference to volume mesh
|
||||||
const polyMesh& pMesh = mesh_();
|
const polyMesh& pMesh = mesh_();
|
||||||
@ -67,6 +65,41 @@ Foam::tmp<Foam::Field<Type>> Foam::volSurfaceMapping::mapToSurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type>> Foam::volSurfaceMapping::mapInternalToSurface
|
||||||
|
(
|
||||||
|
const typename GeometricField<Type, fvPatchField, volMesh>::Boundary& df
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Grab labels for all faces in faMesh
|
||||||
|
const labelList& faceLabels = mesh_.faceLabels();
|
||||||
|
|
||||||
|
auto tresult = tmp<Field<Type>>::New(faceLabels.size(), Zero);
|
||||||
|
auto& result = tresult.ref();
|
||||||
|
|
||||||
|
// Get reference to volume mesh
|
||||||
|
const polyMesh& pMesh = mesh_();
|
||||||
|
const polyBoundaryMesh& bm = pMesh.boundaryMesh();
|
||||||
|
|
||||||
|
label patchID, faceID;
|
||||||
|
|
||||||
|
// Grab droplet cloud source by identifying patch and face
|
||||||
|
forAll(faceLabels, i)
|
||||||
|
{
|
||||||
|
// Escape if face is beyond active faces, eg belongs to a face zone
|
||||||
|
if (faceLabels[i] < pMesh.nFaces())
|
||||||
|
{
|
||||||
|
patchID = bm.whichPatch(faceLabels[i]);
|
||||||
|
faceID = bm[patchID].whichFace(faceLabels[i]);
|
||||||
|
|
||||||
|
result[i] = df[patchID].patchInternalField()()[faceID];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::volSurfaceMapping::mapToVolume
|
void Foam::volSurfaceMapping::mapToVolume
|
||||||
(
|
(
|
||||||
@ -112,4 +145,31 @@ void Foam::volSurfaceMapping::mapToVolume
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::volSurfaceMapping::mapToField
|
||||||
|
(
|
||||||
|
const GeometricField<Type, faPatchField, areaMesh>& af,
|
||||||
|
Field<Type>& f
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const labelList& faceLabels = mesh_.faceLabels();
|
||||||
|
|
||||||
|
const polyMesh& pMesh = mesh_();
|
||||||
|
const polyBoundaryMesh& bm = pMesh.boundaryMesh();
|
||||||
|
label patchID, faceID;
|
||||||
|
|
||||||
|
const Field<Type>& afi = af.internalField();
|
||||||
|
|
||||||
|
forAll(faceLabels, i)
|
||||||
|
{
|
||||||
|
if (faceLabels[i] < pMesh.nFaces())
|
||||||
|
{
|
||||||
|
patchID = bm.whichPatch(faceLabels[i]);
|
||||||
|
faceID = bm[patchID].whichFace(faceLabels[i]);
|
||||||
|
f[faceID] = afi[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,21 +56,12 @@ template<class Type> class fvPatchField;
|
|||||||
|
|
||||||
class volSurfaceMapping
|
class volSurfaceMapping
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to mesh
|
//- Reference to mesh
|
||||||
const faMesh& mesh_;
|
const faMesh& mesh_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
volSurfaceMapping(const volSurfaceMapping&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const volSurfaceMapping&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -81,6 +72,12 @@ public:
|
|||||||
mesh_(mesh)
|
mesh_(mesh)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
volSurfaceMapping(const volSurfaceMapping&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const volSurfaceMapping&) = delete;
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~volSurfaceMapping() = default;
|
~volSurfaceMapping() = default;
|
||||||
@ -96,6 +93,15 @@ public:
|
|||||||
GeometricField<Type, fvPatchField, volMesh>::Boundary& df
|
GeometricField<Type, fvPatchField, volMesh>::Boundary& df
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Map patch internal field to surface
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type>> mapInternalToSurface
|
||||||
|
(
|
||||||
|
const typename
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>::Boundary& df
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Map surface field to volume boundary field
|
//- Map surface field to volume boundary field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void mapToVolume
|
void mapToVolume
|
||||||
@ -104,12 +110,22 @@ public:
|
|||||||
typename GeometricField<Type, fvPatchField, volMesh>::Boundary& bf
|
typename GeometricField<Type, fvPatchField, volMesh>::Boundary& bf
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Map surface tmp field to volume boundary field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void mapToVolume
|
void mapToVolume
|
||||||
(
|
(
|
||||||
const tmp<GeometricField<Type, faPatchField, areaMesh>>& taf,
|
const tmp<GeometricField<Type, faPatchField, areaMesh>>& taf,
|
||||||
typename GeometricField<Type, fvPatchField, volMesh>::Boundary& bf
|
typename GeometricField<Type, fvPatchField, volMesh>::Boundary& bf
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Map surface field to field assumes Field
|
||||||
|
//- faces in the same order as Boundary
|
||||||
|
template<class Type>
|
||||||
|
void mapToField
|
||||||
|
(
|
||||||
|
const GeometricField<Type, faPatchField, areaMesh>& af,
|
||||||
|
Field<Type>& f
|
||||||
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -227,6 +227,7 @@ $(derivedFvPatchFields)/fixedProfile/fixedProfileFvPatchFields.C
|
|||||||
$(derivedFvPatchFields)/plenumPressure/plenumPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/plenumPressure/plenumPressureFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/interfaceCompression/interfaceCompressionFvPatchScalarField.C
|
$(derivedFvPatchFields)/interfaceCompression/interfaceCompressionFvPatchScalarField.C
|
||||||
$(derivedFvPatchFields)/swirlFanVelocity/swirlFanVelocityFvPatchField.C
|
$(derivedFvPatchFields)/swirlFanVelocity/swirlFanVelocityFvPatchField.C
|
||||||
|
$(derivedFvPatchFields)/acousticWaveTransmissive/acousticWaveTransmissiveFvPatchFields.C
|
||||||
|
|
||||||
$(derivedFvPatchFields)/mappedMixed/mappedMixedFvPatchFields.C
|
$(derivedFvPatchFields)/mappedMixed/mappedMixedFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/mappedField/Sampled/makeSampledPatchFunction1s.C
|
$(derivedFvPatchFields)/mappedField/Sampled/makeSampledPatchFunction1s.C
|
||||||
|
|||||||
@ -0,0 +1,119 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "acousticWaveTransmissiveFvPatchField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "EulerDdtScheme.H"
|
||||||
|
#include "CrankNicolsonDdtScheme.H"
|
||||||
|
#include "backwardDdtScheme.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::acousticWaveTransmissiveFvPatchField<Type>::acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(p, iF),
|
||||||
|
advectiveU_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::acousticWaveTransmissiveFvPatchField<Type>::acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const acousticWaveTransmissiveFvPatchField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
advectiveU_(ptf.advectiveU_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::acousticWaveTransmissiveFvPatchField<Type>::acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(p, iF, dict),
|
||||||
|
advectiveU_(dict.get<scalar>("advectiveSpeed"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::acousticWaveTransmissiveFvPatchField<Type>::acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const acousticWaveTransmissiveFvPatchField& ptpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(ptpsf),
|
||||||
|
advectiveU_(ptpsf.advectiveU_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::acousticWaveTransmissiveFvPatchField<Type>::acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const acousticWaveTransmissiveFvPatchField& ptpsf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
advectiveFvPatchField<Type>(ptpsf, iF),
|
||||||
|
advectiveU_(ptpsf.advectiveU_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::scalarField>
|
||||||
|
Foam::acousticWaveTransmissiveFvPatchField<Type>::advectionSpeed() const
|
||||||
|
{
|
||||||
|
return tmp<scalarField>::New(this->size(), advectiveU_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::acousticWaveTransmissiveFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::write(os);
|
||||||
|
os.writeEntry("advectiveSpeed", advectiveU_);
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,192 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::acousticWaveTransmissiveFvPatchField
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpOutletBoundaryConditions
|
||||||
|
|
||||||
|
Description
|
||||||
|
This boundary condition provides a wave transmissive outflow condition,
|
||||||
|
based on solving DDt(W, field) = 0 at the boundary \c W is the wave velocity
|
||||||
|
and \c field is the field to which this boundary condition is applied.
|
||||||
|
The wave speed is input in the BC.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<patchName>
|
||||||
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
type acousticWaveTransmissive;
|
||||||
|
advectiveSpeed 50.0;
|
||||||
|
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Type name: acousticWaveTransmissive | word | yes | -
|
||||||
|
advectiveSpeed | Advective speed value | scalar | yes | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link advectiveFvPatchField.H \endlink
|
||||||
|
|
||||||
|
See also
|
||||||
|
- Foam::advectiveFvPatchFields
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
acousticWaveTransmissiveFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef acousticWaveTransmissiveFvPatchField_H
|
||||||
|
#define acousticWaveTransmissiveFvPatchField_H
|
||||||
|
|
||||||
|
#include "advectiveFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class acousticWaveTransmissiveFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class acousticWaveTransmissiveFvPatchField
|
||||||
|
:
|
||||||
|
public advectiveFvPatchField<Type>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Advection speed value
|
||||||
|
scalar advectiveU_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("acousticWaveTransmissive");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given acousticWaveTransmissiveFvPatchField
|
||||||
|
//- onto a new patch
|
||||||
|
acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const acousticWaveTransmissiveFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const acousticWaveTransmissiveFvPatchField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type>> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type>>
|
||||||
|
(
|
||||||
|
new acousticWaveTransmissiveFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
acousticWaveTransmissiveFvPatchField
|
||||||
|
(
|
||||||
|
const acousticWaveTransmissiveFvPatchField&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchField<Type>> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type>>
|
||||||
|
(
|
||||||
|
new acousticWaveTransmissiveFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
//- Calculate and return the advection speed at the boundary
|
||||||
|
virtual tmp<scalarField> advectionSpeed() const;
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "acousticWaveTransmissiveFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "acousticWaveTransmissiveFvPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(acousticWaveTransmissive);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef acousticWaveTransmissiveFvPatchFields_H
|
||||||
|
#define acousticWaveTransmissiveFvPatchFields_H
|
||||||
|
|
||||||
|
#include "acousticWaveTransmissiveFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(acousticWaveTransmissive);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -25,10 +25,9 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef uniformFixedValueFaPatchFieldsFwd_H
|
#ifndef acousticWaveTransmissiveFvPatchFieldsFwd_H
|
||||||
#define uniformFixedValueFaPatchFieldsFwd_H
|
#define acousticWaveTransmissiveFvPatchFieldsFwd_H
|
||||||
|
|
||||||
#include "faPatchField.H"
|
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -38,9 +37,9 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type> class uniformFixedValueFaPatchField;
|
template<class Type> class acousticWaveTransmissiveFvPatchField;
|
||||||
|
|
||||||
makeFaPatchTypeFieldTypedefs(uniformFixedValue);
|
makePatchTypeFieldTypedefs(acousticWaveTransmissive);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
319
src/regionFaModels/KirchhoffShell/KirchhoffShell.C
Normal file
319
src/regionFaModels/KirchhoffShell/KirchhoffShell.C
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "KirchhoffShell.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
#include "zeroGradientFaPatchFields.H"
|
||||||
|
#include "subCycle.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(KirchhoffShell, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(vibrationShellModel, KirchhoffShell, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool KirchhoffShell::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
this->solution().readEntry("nNonOrthCorr", nNonOrthCorr_);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KirchhoffShell::solveDisplacement()
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
InfoInFunction << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Time& time = primaryMesh().time();
|
||||||
|
|
||||||
|
areaScalarField solidMass(rho()*h_);
|
||||||
|
areaScalarField solidD(D()/solidMass);
|
||||||
|
|
||||||
|
// Save old times
|
||||||
|
areaScalarField w0(w_.oldTime());
|
||||||
|
areaScalarField w00(w_.oldTime().oldTime());
|
||||||
|
|
||||||
|
if (nSubCycles_ > 1)
|
||||||
|
{
|
||||||
|
// Restore the oldTime in sub-cycling
|
||||||
|
w_.oldTime() = w0_;
|
||||||
|
w_.oldTime().oldTime() = w00_;
|
||||||
|
laplaceW_.oldTime() = laplaceW0_;
|
||||||
|
laplace2W_.oldTime() = laplace2W0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
subCycleTime wSubCycle
|
||||||
|
(
|
||||||
|
const_cast<Time&>(time),
|
||||||
|
nSubCycles_
|
||||||
|
);
|
||||||
|
!(++wSubCycle).end();
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
laplaceW_ = fac::laplacian(w_);
|
||||||
|
laplace2W_ = fac::laplacian(laplaceW_);
|
||||||
|
|
||||||
|
faScalarMatrix wEqn
|
||||||
|
(
|
||||||
|
fam::d2dt2(w_)
|
||||||
|
+ f1_*fam::ddt(w_)
|
||||||
|
- f0_*sqrt(solidD)*fac::ddt(laplaceW_)
|
||||||
|
+ solidD*(laplace2W_ + f2_*fac::ddt(laplace2W_))
|
||||||
|
==
|
||||||
|
ps_/solidMass
|
||||||
|
+ faOptions()(solidMass, w_, dimLength/sqr(dimTime))
|
||||||
|
);
|
||||||
|
|
||||||
|
faOptions().constrain(wEqn);
|
||||||
|
|
||||||
|
wEqn.solve();
|
||||||
|
|
||||||
|
Info<< "w min/max = " << min(w_) << ", " << max(w_) << endl;
|
||||||
|
|
||||||
|
if (wSubCycle.index() >= wSubCycle.nSubCycles())
|
||||||
|
{
|
||||||
|
// Cache oldTimes inside the sub-cycling
|
||||||
|
w0_ = w_.oldTime();
|
||||||
|
w00_ = w_.oldTime().oldTime();
|
||||||
|
laplaceW0_ = laplaceW_.oldTime();
|
||||||
|
laplace2W0_ = laplace2W_.oldTime();
|
||||||
|
|
||||||
|
// Update shell acceleration
|
||||||
|
a_ = fac::d2dt2(w_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore old time in main time
|
||||||
|
w_.oldTime() = w0;
|
||||||
|
w_.oldTime().oldTime() = w00;
|
||||||
|
|
||||||
|
faOptions().correct(w_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
KirchhoffShell::KirchhoffShell
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
vibrationShellModel(modelType, patch, dict),
|
||||||
|
f0_("f0", dimless, dict),
|
||||||
|
f1_("f1", inv(dimTime), dict),
|
||||||
|
f2_("f2", dimTime, dict),
|
||||||
|
nNonOrthCorr_(1),
|
||||||
|
nSubCycles_(1),
|
||||||
|
ps_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"ps_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(dimPressure, Zero)
|
||||||
|
),
|
||||||
|
h_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"h_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh()
|
||||||
|
),
|
||||||
|
laplaceW_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"laplaceW_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(inv(dimLength), Zero)
|
||||||
|
),
|
||||||
|
laplace2W_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"laplace2W_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(inv(pow3(dimLength)), Zero)
|
||||||
|
),
|
||||||
|
w0_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"w0_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(dimLength, Zero)
|
||||||
|
),
|
||||||
|
w00_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"w00_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(dimLength, Zero)
|
||||||
|
),
|
||||||
|
laplaceW0_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"laplaceW0_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(inv(dimLength), Zero)
|
||||||
|
),
|
||||||
|
laplace2W0_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"laplace2W0_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(inv(pow3(dimLength)), Zero)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void KirchhoffShell::init()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void KirchhoffShell::preEvolveRegion()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void KirchhoffShell::evolveRegion()
|
||||||
|
{
|
||||||
|
nNonOrthCorr_ = solution().get<label>("nNonOrthCorr");
|
||||||
|
nSubCycles_ = solution().get<label>("nSubCycles");
|
||||||
|
|
||||||
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++)
|
||||||
|
{
|
||||||
|
solveDisplacement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const tmp<areaScalarField> KirchhoffShell::D() const
|
||||||
|
{
|
||||||
|
const dimensionedScalar E("E", dimForce/dimArea , solid().E());
|
||||||
|
const dimensionedScalar nu("nu", dimless, solid().nu());
|
||||||
|
|
||||||
|
return tmp<areaScalarField>(E*pow3(h_)/(12*(1 - sqr(nu))));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const tmp<areaScalarField> KirchhoffShell::rho() const
|
||||||
|
{
|
||||||
|
return tmp<areaScalarField>
|
||||||
|
(
|
||||||
|
new areaScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhos",
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar("rho", dimDensity, solid().rho()),
|
||||||
|
zeroGradientFaPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KirchhoffShell::info()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
217
src/regionFaModels/KirchhoffShell/KirchhoffShell.H
Normal file
217
src/regionFaModels/KirchhoffShell/KirchhoffShell.H
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::regionFaModels::KirchhoffShell
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<patchName>
|
||||||
|
{
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
vibrationShellModel KirchhoffShell;
|
||||||
|
f0 0.04;
|
||||||
|
f1 0.0;
|
||||||
|
f2 0.0;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
vibrationShellModel | Type name: KirchhoffShell | word | yes | -
|
||||||
|
f0 | Damping coefficient [1/s] | scalar | yes | -
|
||||||
|
f1 | Damping coefficient [1/s] | scalar | yes | -
|
||||||
|
f2 | Damping coefficient [1/s] | scalar | yes | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link vibrationShellModel.H \endlink
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
KirchhoffShell.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef KirchhoffShell_H
|
||||||
|
#define KirchhoffShell_H
|
||||||
|
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "vibrationShellModel.H"
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "faCFD.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class KirchhoffShell Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class KirchhoffShell
|
||||||
|
:
|
||||||
|
public vibrationShellModel
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Damping coefficients [1/s]
|
||||||
|
dimensionedScalar f0_;
|
||||||
|
dimensionedScalar f1_;
|
||||||
|
dimensionedScalar f2_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Initialize KirchhoffShell
|
||||||
|
void init();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
// Solution parameters
|
||||||
|
|
||||||
|
//- Number of non orthogonal correctors
|
||||||
|
label nNonOrthCorr_;
|
||||||
|
|
||||||
|
//- Sub cycles
|
||||||
|
label nSubCycles_;
|
||||||
|
|
||||||
|
|
||||||
|
// Source term fields
|
||||||
|
|
||||||
|
//- External surface source [Pa]
|
||||||
|
areaScalarField ps_;
|
||||||
|
|
||||||
|
//- Thickness [m]
|
||||||
|
areaScalarField h_;
|
||||||
|
|
||||||
|
//- Laplace of the displacement
|
||||||
|
areaScalarField laplaceW_;
|
||||||
|
|
||||||
|
//- Laplace of the Laplace for the displacement
|
||||||
|
areaScalarField laplace2W_;
|
||||||
|
|
||||||
|
//- Cache w.oldTime() in sub-cycling
|
||||||
|
areaScalarField w0_;
|
||||||
|
|
||||||
|
//- Cache w.oldTime.oldTime() in sub-cycling
|
||||||
|
areaScalarField w00_;
|
||||||
|
|
||||||
|
//- Cache laplaceW.oldTime() in sub-cycling
|
||||||
|
areaScalarField laplaceW0_;
|
||||||
|
|
||||||
|
//- Cache laplace2.oldTime() in sub-cycling
|
||||||
|
areaScalarField laplace2W0_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read control parameters from dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
// Equations
|
||||||
|
|
||||||
|
//- Solve energy equation
|
||||||
|
void solveDisplacement();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("KirchhoffShell");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components and dict
|
||||||
|
KirchhoffShell
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
KirchhoffShell(const KirchhoffShell&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const KirchhoffShell&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~KirchhoffShell() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
|
||||||
|
//- Return stiffness
|
||||||
|
const tmp<areaScalarField> D() const;
|
||||||
|
|
||||||
|
//- Return density [Kg/m3]
|
||||||
|
const tmp<areaScalarField> rho() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Evolution
|
||||||
|
|
||||||
|
//- Pre-evolve thermal baffle
|
||||||
|
virtual void preEvolveRegion();
|
||||||
|
|
||||||
|
//- Evolve the thermal baffle
|
||||||
|
virtual void evolveRegion();
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Provide some feedback
|
||||||
|
virtual void info();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
16
src/regionFaModels/Make/files
Normal file
16
src/regionFaModels/Make/files
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/* Region models */
|
||||||
|
regionFaModel/regionFaModel.C
|
||||||
|
thermalShellModel/thermalShellModel.C
|
||||||
|
thermalShellModel/thermalShellModelNew.C
|
||||||
|
vibrationShellModel/vibrationShellModel.C
|
||||||
|
vibrationShellModel/vibrationShellModelNew.C
|
||||||
|
|
||||||
|
/* Shell models */
|
||||||
|
thermalShell/thermalShell.C
|
||||||
|
KirchhoffShell/KirchhoffShell.C
|
||||||
|
|
||||||
|
/* Boundary conditions */
|
||||||
|
derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.C
|
||||||
|
derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libregionFaModels
|
||||||
16
src/regionFaModels/Make/options
Normal file
16
src/regionFaModels/Make/options
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/faOptions/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
|
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude
|
||||||
|
|
||||||
|
LIB_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lfiniteArea \
|
||||||
|
-lmeshTools \
|
||||||
|
-lthermophysicalProperties \
|
||||||
|
-lspecie \
|
||||||
|
-lfaOptions
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free
|
||||||
|
Software Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
\defgroup grpThermoBaffleBoundaryConditions Thermo baffle boundary conditions
|
||||||
|
@{
|
||||||
|
\ingroup grpThermoBoundaryConditions
|
||||||
|
This group contains thermo baffle model boundary conditions
|
||||||
|
@}
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -0,0 +1,152 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalShellFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(p, iF),
|
||||||
|
baffle_(),
|
||||||
|
dict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const thermalShellFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>
|
||||||
|
(
|
||||||
|
ptf,
|
||||||
|
p,
|
||||||
|
iF,
|
||||||
|
mapper
|
||||||
|
),
|
||||||
|
baffle_(),
|
||||||
|
dict_(ptf.dict_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||||
|
baffle_(),
|
||||||
|
dict_(dict)
|
||||||
|
{
|
||||||
|
typedef regionModels::thermalShellModel baffle;
|
||||||
|
|
||||||
|
if (!baffle_)
|
||||||
|
{
|
||||||
|
baffle_.reset(baffle::New(p, dict).ptr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const thermalShellFvPatchScalarField& ptf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(ptf, iF),
|
||||||
|
baffle_(),
|
||||||
|
dict_(ptf.dict_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void thermalShellFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
baffle_->evolve();
|
||||||
|
|
||||||
|
volScalarField::Boundary& vfb =
|
||||||
|
db().lookupObjectRef<volScalarField>
|
||||||
|
(
|
||||||
|
this->internalField().name()
|
||||||
|
).boundaryFieldRef();
|
||||||
|
|
||||||
|
baffle_->vsm().mapToVolume(baffle_->T(), vfb);
|
||||||
|
|
||||||
|
fixedValueFvPatchField<scalar>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void thermalShellFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<scalar>::write(os);
|
||||||
|
|
||||||
|
// Remove value and type already written by fixedValueFvPatchField
|
||||||
|
dict_.remove("value");
|
||||||
|
dict_.remove("type");
|
||||||
|
dict_.write(os, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
thermalShellFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,184 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::compressible::thermalShellFvPatchScalarField
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpThermoBoundaryConditions
|
||||||
|
|
||||||
|
Description
|
||||||
|
This boundary condition provides a coupled temperature condition between
|
||||||
|
a primary region (3D mesh) and a thermal shell model (2D mesh).
|
||||||
|
|
||||||
|
The primary region boundary creates the finite area region
|
||||||
|
and evolves its energy equation.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<masterPatchName>
|
||||||
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
type compressible::thermalShell;
|
||||||
|
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Type name: compressible::thermalShell | word | yes | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link fixedValueFvPatchField.H \endlink
|
||||||
|
- \link thermalShellModel.H \endlink
|
||||||
|
|
||||||
|
Note
|
||||||
|
- The two-dimensional area mesh needs to be
|
||||||
|
generated in the pre-processing steps.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
thermalShellFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef thermalShellFvPatchScalarField_H
|
||||||
|
#define thermalShellFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "thermalShellModel.H"
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class thermalShellFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class thermalShellFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchField<scalar>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Thermal baffle
|
||||||
|
autoPtr<regionModels::thermalShellModel> baffle_;
|
||||||
|
|
||||||
|
//- Dictionary
|
||||||
|
mutable dictionary dict_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("compressible::thermalShell");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
thermalShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
thermalShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
//- thermalShellFvPatchScalarField onto a new patch
|
||||||
|
thermalShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const thermalShellFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new thermalShellFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
thermalShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const thermalShellFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new thermalShellFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,169 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "vibrationShellFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchField<scalar>(p, iF),
|
||||||
|
baffle_(),
|
||||||
|
dict_(dictionary::null)
|
||||||
|
{
|
||||||
|
refValue() = 0;
|
||||||
|
refGrad() = 0;
|
||||||
|
valueFraction() = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const vibrationShellFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchField<scalar>
|
||||||
|
(
|
||||||
|
ptf,
|
||||||
|
p,
|
||||||
|
iF,
|
||||||
|
mapper
|
||||||
|
),
|
||||||
|
baffle_(),
|
||||||
|
dict_(ptf.dict_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchField<scalar>(p, iF),
|
||||||
|
baffle_(),
|
||||||
|
dict_(dict)
|
||||||
|
{
|
||||||
|
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||||
|
|
||||||
|
if (dict.found("refValue"))
|
||||||
|
{
|
||||||
|
// Full restart
|
||||||
|
refValue() = scalarField("refValue", dict, p.size());
|
||||||
|
refGrad() = scalarField("refGradient", dict, p.size());
|
||||||
|
valueFraction() = scalarField("valueFraction", dict, p.size());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Start from user entered data. Assume fixedValue.
|
||||||
|
refValue() = *this;
|
||||||
|
refGrad() = 0;
|
||||||
|
valueFraction() = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!baffle_)
|
||||||
|
{
|
||||||
|
baffle_.reset(regionModels::vibrationShellModel::New(p, dict).ptr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const vibrationShellFvPatchScalarField& ptf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchField<scalar>(ptf, iF),
|
||||||
|
baffle_(),
|
||||||
|
dict_(ptf.dict_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void vibrationShellFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
baffle_->evolve();
|
||||||
|
|
||||||
|
const auto& transportProperties =
|
||||||
|
db().lookupObject<IOdictionary>("transportProperties");
|
||||||
|
|
||||||
|
dimensionedScalar rho("rho", dimDensity, transportProperties);
|
||||||
|
|
||||||
|
const areaScalarField aRho(rho*baffle_->a());
|
||||||
|
|
||||||
|
baffle_->vsm().mapToField(aRho, this->refGrad());
|
||||||
|
|
||||||
|
this->refValue() = Zero;
|
||||||
|
this->valueFraction() = Zero;
|
||||||
|
|
||||||
|
mixedFvPatchField<scalar>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vibrationShellFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
mixedFvPatchField<scalar>::write(os);
|
||||||
|
|
||||||
|
dict_.write(os, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
vibrationShellFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,172 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::compressible::vibrationShellFvPatchScalarField
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpVibrationBoundaryConditions
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<masterPatchName>
|
||||||
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
type vibrationShell;
|
||||||
|
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
type | Type name: vibrationShell | word | yes | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link mixedFvPatchField.H \endlink
|
||||||
|
- \link vibrationShellModel.H \endlink
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
vibrationShellFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef vibrationShellFvPatchScalarField_H
|
||||||
|
#define vibrationShellFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "vibrationShellModel.H"
|
||||||
|
#include "mixedFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class vibrationShellFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class vibrationShellFvPatchScalarField
|
||||||
|
:
|
||||||
|
public mixedFvPatchField<scalar>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Thermal baffle
|
||||||
|
autoPtr<regionModels::vibrationShellModel> baffle_;
|
||||||
|
|
||||||
|
//- Dictionary
|
||||||
|
mutable dictionary dict_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("vibrationShell");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
vibrationShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
vibrationShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
//- vibrationShellFvPatchScalarField onto a new patch
|
||||||
|
vibrationShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const vibrationShellFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new vibrationShellFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
vibrationShellFvPatchScalarField
|
||||||
|
(
|
||||||
|
const vibrationShellFvPatchScalarField&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchScalarField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new vibrationShellFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
172
src/regionFaModels/regionFaModel/regionFaModel.C
Normal file
172
src/regionFaModels/regionFaModel/regionFaModel.C
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "regionFaModel.H"
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "mappedWallPolyPatch.H"
|
||||||
|
#include "zeroGradientFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(regionFaModel, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::regionModels::regionFaModel::constructMeshObjects()
|
||||||
|
{
|
||||||
|
regionMeshPtr_.reset
|
||||||
|
(
|
||||||
|
new faMesh(primaryMesh_)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::regionModels::regionFaModel::initialise()
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "regionFaModel::initialise()" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
vsmPtr_.reset(new volSurfaceMapping(regionMeshPtr_()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::regionModels::regionFaModel::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
if (const dictionary* dictptr = dict.findDict(modelName_ + "Coeffs"))
|
||||||
|
{
|
||||||
|
coeffs_ <<= *dictptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
infoOutput_.readIfPresent("infoOutput", dict);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::volSurfaceMapping& Foam::regionModels::regionFaModel::vsm() const
|
||||||
|
{
|
||||||
|
return vsmPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::regionModels::regionFaModel::regionFaModel
|
||||||
|
(
|
||||||
|
const fvPatch& patch,
|
||||||
|
const word& regionType,
|
||||||
|
const word& modelName,
|
||||||
|
const dictionary& dict,
|
||||||
|
bool readFields
|
||||||
|
)
|
||||||
|
:
|
||||||
|
primaryMesh_(patch.boundaryMesh().mesh()),
|
||||||
|
patch_(patch),
|
||||||
|
time_(patch.boundaryMesh().mesh().time()),
|
||||||
|
active_(dict.get<Switch>("active")),
|
||||||
|
infoOutput_(false),
|
||||||
|
modelName_(modelName),
|
||||||
|
regionMeshPtr_(nullptr),
|
||||||
|
coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")),
|
||||||
|
vsmPtr_(nullptr),
|
||||||
|
patchID_(patch.index()),
|
||||||
|
regionName_(dict.lookup("region"))
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
constructMeshObjects();
|
||||||
|
initialise();
|
||||||
|
|
||||||
|
if (readFields)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::regionModels::regionFaModel::evolve()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
Info<< "\nEvolving " << modelName_ << " for region "
|
||||||
|
<< regionMesh().name() << endl;
|
||||||
|
|
||||||
|
preEvolveRegion();
|
||||||
|
|
||||||
|
evolveRegion();
|
||||||
|
|
||||||
|
postEvolveRegion();
|
||||||
|
|
||||||
|
// Provide some feedback
|
||||||
|
if (infoOutput_)
|
||||||
|
{
|
||||||
|
Info<< incrIndent;
|
||||||
|
info();
|
||||||
|
Info<< endl << decrIndent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::regionModels::regionFaModel::preEvolveRegion()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::regionModels::regionFaModel::evolveRegion()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::regionModels::regionFaModel::postEvolveRegion()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::regionModels::regionFaModel::info()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
256
src/regionFaModels/regionFaModel/regionFaModel.H
Normal file
256
src/regionFaModels/regionFaModel/regionFaModel.H
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::regionModels::regionFaModel
|
||||||
|
|
||||||
|
Description
|
||||||
|
Base class for area region models.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the model specification:
|
||||||
|
\verbatim
|
||||||
|
<patchName>
|
||||||
|
{
|
||||||
|
// Mandatory entries (runtime modifiable)
|
||||||
|
region <regionName>;
|
||||||
|
active true;
|
||||||
|
|
||||||
|
// Optional entries (runtime modifiable)
|
||||||
|
infoOutput false;
|
||||||
|
<model>Coeffs
|
||||||
|
{
|
||||||
|
// subdictionary entries
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mandatory/Optional (derived) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
region | Name of operand region | word | yes | -
|
||||||
|
active | Flag to activate the model | bool | yes | -
|
||||||
|
infoOutput | Flag to activate information output | bool | no | false
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
regionFaModelI.H
|
||||||
|
regionFaModel.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef regionFaModel_H
|
||||||
|
#define regionFaModel_H
|
||||||
|
|
||||||
|
#include "volMesh.H"
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
#include "labelList.H"
|
||||||
|
#include "areaFields.H"
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "volSurfaceMapping.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class regionFaModel Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class regionFaModel
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Construct region mesh and fields
|
||||||
|
void constructMeshObjects();
|
||||||
|
|
||||||
|
//- Initialise the region
|
||||||
|
void initialise();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
//- Reference to the primary mesh database
|
||||||
|
const fvMesh& primaryMesh_;
|
||||||
|
|
||||||
|
//- Reference to fvPatch
|
||||||
|
const fvPatch& patch_;
|
||||||
|
|
||||||
|
//- Reference to the time database
|
||||||
|
const Time& time_;
|
||||||
|
|
||||||
|
//- Active flag
|
||||||
|
Switch active_;
|
||||||
|
|
||||||
|
//- Active information output
|
||||||
|
Switch infoOutput_;
|
||||||
|
|
||||||
|
//- Model name
|
||||||
|
const word modelName_;
|
||||||
|
|
||||||
|
//- Pointer to the region mesh database
|
||||||
|
autoPtr<faMesh> regionMeshPtr_;
|
||||||
|
|
||||||
|
//- Model coefficients dictionary
|
||||||
|
dictionary coeffs_;
|
||||||
|
|
||||||
|
//-Volume-to surface mapping
|
||||||
|
autoPtr<volSurfaceMapping> vsmPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Addressing
|
||||||
|
|
||||||
|
//- Patch IDs on the primary region coupled to this region
|
||||||
|
label patchID_;
|
||||||
|
|
||||||
|
|
||||||
|
//- Region name
|
||||||
|
word regionName_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read control parameters from dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("regionFaModel");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from mesh and name and dict
|
||||||
|
regionFaModel
|
||||||
|
(
|
||||||
|
const fvPatch& patch,
|
||||||
|
const word& regionType,
|
||||||
|
const word& modelName,
|
||||||
|
const dictionary& dict,
|
||||||
|
bool readFields = true
|
||||||
|
);
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
regionFaModel(const regionFaModel&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const regionFaModel&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~regionFaModel() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the reference to the primary mesh database
|
||||||
|
inline const fvMesh& primaryMesh() const;
|
||||||
|
|
||||||
|
//- Return the reference to the time database
|
||||||
|
inline const Time& time() const;
|
||||||
|
|
||||||
|
//- Return the active flag
|
||||||
|
inline const Switch& active() const;
|
||||||
|
|
||||||
|
//- Return the information flag
|
||||||
|
inline const Switch& infoOutput() const;
|
||||||
|
|
||||||
|
//- Return the model name
|
||||||
|
inline const word& modelName() const;
|
||||||
|
|
||||||
|
//- Return the region mesh database
|
||||||
|
inline const faMesh& regionMesh() const;
|
||||||
|
|
||||||
|
//- Return the region mesh database for manipulation
|
||||||
|
inline faMesh& regionMesh();
|
||||||
|
|
||||||
|
//- Return the model coefficients dictionary
|
||||||
|
inline const dictionary& coeffs() const;
|
||||||
|
|
||||||
|
//- Return the solution dictionary
|
||||||
|
inline const dictionary& solution() const;
|
||||||
|
|
||||||
|
//- Return volSurfaceMapping
|
||||||
|
const volSurfaceMapping& vsm() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Addressing
|
||||||
|
|
||||||
|
//- Return the list of patch IDs on the primary region coupled
|
||||||
|
//- to this region
|
||||||
|
inline label patchID();
|
||||||
|
|
||||||
|
|
||||||
|
// Evolution
|
||||||
|
|
||||||
|
//- Main driver routing to evolve the region - calls other evolves
|
||||||
|
virtual void evolve();
|
||||||
|
|
||||||
|
//- Pre-evolve region
|
||||||
|
virtual void preEvolveRegion();
|
||||||
|
|
||||||
|
//- Evolve the region
|
||||||
|
virtual void evolveRegion();
|
||||||
|
|
||||||
|
//- Post-evolve region
|
||||||
|
virtual void postEvolveRegion();
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Provide some feedback
|
||||||
|
virtual void info();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionFaModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "regionFaModelI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
118
src/regionFaModels/regionFaModel/regionFaModelI.H
Normal file
118
src/regionFaModels/regionFaModel/regionFaModelI.H
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "regionFaModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline const Foam::fvMesh&
|
||||||
|
Foam::regionModels::regionFaModel::primaryMesh() const
|
||||||
|
{
|
||||||
|
return primaryMesh_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::Time& Foam::regionModels::regionFaModel::time() const
|
||||||
|
{
|
||||||
|
return time_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::Switch& Foam::regionModels::regionFaModel::active() const
|
||||||
|
{
|
||||||
|
return active_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::Switch& Foam::regionModels::regionFaModel::infoOutput() const
|
||||||
|
{
|
||||||
|
return infoOutput_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::word& Foam::regionModels::regionFaModel::modelName() const
|
||||||
|
{
|
||||||
|
return modelName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::faMesh& Foam::regionModels::regionFaModel::regionMesh() const
|
||||||
|
{
|
||||||
|
const auto* regionPtr = time_.findObject<faMesh>(regionName_);
|
||||||
|
|
||||||
|
if (regionPtr)
|
||||||
|
{
|
||||||
|
return *regionPtr;
|
||||||
|
}
|
||||||
|
else if (!regionMeshPtr_.valid())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Region mesh not available" << abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *regionMeshPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::faMesh& Foam::regionModels::regionFaModel::regionMesh()
|
||||||
|
{
|
||||||
|
auto* regionPtr = time_.getObjectPtr<faMesh>(regionName_);
|
||||||
|
|
||||||
|
if (regionPtr)
|
||||||
|
{
|
||||||
|
return *regionPtr;
|
||||||
|
}
|
||||||
|
else if (!regionMeshPtr_.valid())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Region mesh not available" << abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *regionMeshPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::dictionary& Foam::regionModels::regionFaModel::coeffs() const
|
||||||
|
{
|
||||||
|
return coeffs_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::dictionary&
|
||||||
|
Foam::regionModels::regionFaModel::solution() const
|
||||||
|
{
|
||||||
|
return regionMesh().solutionDict();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::regionModels::regionFaModel::patchID()
|
||||||
|
{
|
||||||
|
return patchID_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
232
src/regionFaModels/thermalShell/thermalShell.C
Normal file
232
src/regionFaModels/thermalShell/thermalShell.C
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalShell.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
#include "zeroGradientFaPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(thermalShell, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(thermalShellModel, thermalShell, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool thermalShell::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
this->solution().readEntry("nNonOrthCorr", nNonOrthCorr_);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void thermalShell::solveEnergy()
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
InfoInFunction << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const areaScalarField rhoCph(Cp()*rho()*h_);
|
||||||
|
|
||||||
|
faScalarMatrix TEqn
|
||||||
|
(
|
||||||
|
fam::ddt(rhoCph, T_)
|
||||||
|
- fam::laplacian(kappa()*h_, T_)
|
||||||
|
==
|
||||||
|
qs_
|
||||||
|
//+ q(T_) handled by faOption contactHeatFlux
|
||||||
|
+ faOptions()(h_, rhoCph, T_)
|
||||||
|
);
|
||||||
|
|
||||||
|
TEqn.relax();
|
||||||
|
|
||||||
|
faOptions().constrain(TEqn);
|
||||||
|
|
||||||
|
TEqn.solve();
|
||||||
|
|
||||||
|
faOptions().correct(T_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermalShell::thermalShell
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
thermalShellModel(modelType, patch, dict),
|
||||||
|
nNonOrthCorr_(1),
|
||||||
|
thermo_(dict.subDict("thermo")),
|
||||||
|
qs_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"qs_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(dimPower/dimArea, Zero)
|
||||||
|
),
|
||||||
|
h_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"h_" + regionName_,
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void thermalShell::init()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void thermalShell::preEvolveRegion()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void thermalShell::evolveRegion()
|
||||||
|
{
|
||||||
|
nNonOrthCorr_ = solution().get<label>("nNonOrthCorr");
|
||||||
|
|
||||||
|
for (int nonOrth = 0; nonOrth <= nNonOrthCorr_; ++nonOrth)
|
||||||
|
{
|
||||||
|
solveEnergy();
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "T min/max = " << min(T_) << ", " << max(T_) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const tmp<areaScalarField> thermalShell::Cp() const
|
||||||
|
{
|
||||||
|
return tmp<areaScalarField>
|
||||||
|
(
|
||||||
|
new areaScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Cps",
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(dimEnergy/dimTemperature/dimMass, thermo_.Cp()),
|
||||||
|
zeroGradientFaPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const tmp<areaScalarField> thermalShell::rho() const
|
||||||
|
{
|
||||||
|
return tmp<areaScalarField>
|
||||||
|
(
|
||||||
|
new areaScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhos",
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(dimDensity, thermo_.rho()),
|
||||||
|
zeroGradientFaPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const tmp<areaScalarField> thermalShell::kappa() const
|
||||||
|
{
|
||||||
|
return tmp<areaScalarField>
|
||||||
|
(
|
||||||
|
new areaScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"kappas",
|
||||||
|
primaryMesh().time().timeName(),
|
||||||
|
primaryMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar
|
||||||
|
(
|
||||||
|
dimPower/dimLength/dimTemperature,
|
||||||
|
thermo_.kappa()
|
||||||
|
),
|
||||||
|
zeroGradientFaPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void thermalShell::info()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
208
src/regionFaModels/thermalShell/thermalShell.H
Normal file
208
src/regionFaModels/thermalShell/thermalShell.H
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::regionFaModels::thermalShell
|
||||||
|
|
||||||
|
Description
|
||||||
|
Thermal-shell finite-area model. It solves the energy
|
||||||
|
equation in 2D. The coupling with the 3D region is done through
|
||||||
|
the \c temperatureCoupledBase, plus \c faOption is available to
|
||||||
|
add extra sources on the shell such as \c externalHeatFluxSource etc.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<patchName>
|
||||||
|
{
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
thermalShellModel thermalShell;
|
||||||
|
thermo
|
||||||
|
{
|
||||||
|
// subdictionary entries
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mandatory/Optional (derived) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
thermalShellModel | Type name: thermalShell | word | yes | -
|
||||||
|
thermo | Solid thermal properties | dictionary | yes | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link thermalShellModel.H \endlink
|
||||||
|
|
||||||
|
See also
|
||||||
|
- Foam::regionModels::thermalShellModels::thermalShellModel
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
thermalShell.C
|
||||||
|
thermalShellI.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef thermalShell_H
|
||||||
|
#define thermalShell_H
|
||||||
|
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "thermalShellModel.H"
|
||||||
|
#include "solidProperties.H"
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "faCFD.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class thermalShell Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class thermalShell
|
||||||
|
:
|
||||||
|
public thermalShellModel
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Initialize thermalShell
|
||||||
|
void init();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
// Solution parameters
|
||||||
|
|
||||||
|
//- Number of non orthogonal correctors
|
||||||
|
label nNonOrthCorr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Thermo properties
|
||||||
|
|
||||||
|
//- Solid properties
|
||||||
|
solidProperties thermo_;
|
||||||
|
|
||||||
|
|
||||||
|
// Source term fields
|
||||||
|
|
||||||
|
//- External surface energy source / [J/m2/s]
|
||||||
|
areaScalarField qs_;
|
||||||
|
|
||||||
|
//- Thickness
|
||||||
|
areaScalarField h_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read control parameters from dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
// Equations
|
||||||
|
|
||||||
|
//- Solve energy equation
|
||||||
|
void solveEnergy();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("thermalShell");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components and dict
|
||||||
|
thermalShell
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
thermalShell(const thermalShell&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const thermalShell&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~thermalShell() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
|
||||||
|
//- Return the film specific heat capacity [J/kg/K]
|
||||||
|
const tmp<areaScalarField> Cp() const;
|
||||||
|
|
||||||
|
//- Return density [Kg/m3]
|
||||||
|
const tmp<areaScalarField> rho() const;
|
||||||
|
|
||||||
|
//- Return thermal conductivity [W/m/K]
|
||||||
|
const tmp<areaScalarField> kappa() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Evolution
|
||||||
|
|
||||||
|
//- Pre-evolve thermal baffle
|
||||||
|
virtual void preEvolveRegion();
|
||||||
|
|
||||||
|
//- Evolve the thermal baffle
|
||||||
|
virtual void evolveRegion();
|
||||||
|
|
||||||
|
|
||||||
|
// IO
|
||||||
|
|
||||||
|
//- Provide some feedback
|
||||||
|
virtual void info();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
121
src/regionFaModels/thermalShellModel/thermalShellModel.C
Normal file
121
src/regionFaModels/thermalShellModel/thermalShellModel.C
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalShellModel.H"
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(thermalShellModel, 0);
|
||||||
|
|
||||||
|
defineRunTimeSelectionTable(thermalShellModel, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool thermalShellModel::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (regionFaModel::read(dict))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermalShellModel::thermalShellModel
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionFaModel(p, "thermalShell", modelType, dict, true),
|
||||||
|
TName_(dict.get<word>("T")),
|
||||||
|
Tp_(p.boundaryMesh().mesh().lookupObject<volScalarField>(TName_)),
|
||||||
|
T_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Ts_" + regionName_,
|
||||||
|
p.boundaryMesh().mesh().time().timeName(),
|
||||||
|
p.boundaryMesh().mesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh()
|
||||||
|
),
|
||||||
|
faOptions_(Foam::fa::options::New(p))
|
||||||
|
{
|
||||||
|
if (!faOptions_.optionList::size())
|
||||||
|
{
|
||||||
|
Info << "No finite area options present" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void thermalShellModel::preEvolveRegion()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::volScalarField& thermalShellModel::Tp() const
|
||||||
|
{
|
||||||
|
return Tp_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::areaScalarField& thermalShellModel::T() const
|
||||||
|
{
|
||||||
|
return T_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fa::options& thermalShellModel::faOptions()
|
||||||
|
{
|
||||||
|
return faOptions_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
205
src/regionFaModels/thermalShellModel/thermalShellModel.H
Normal file
205
src/regionFaModels/thermalShellModel/thermalShellModel.H
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::regionModels::thermalShellModels::thermalShellModel
|
||||||
|
|
||||||
|
Description
|
||||||
|
Intermediate class for thermal-shell finite-area models.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<patchName>
|
||||||
|
{
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
T <Tname>;
|
||||||
|
|
||||||
|
// Optional entries (unmodifiable)
|
||||||
|
thermalShellModel <thermalShellModelName>;
|
||||||
|
|
||||||
|
// Mandatory/Optional (derived) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
T | Name of operand temperature field | word | yes | -
|
||||||
|
thermalShellModel | Name of thermal-shell model <!--
|
||||||
|
--> | word | no | thermalShell
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link regionFaModel.H \endlink
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
thermalShellModel.C
|
||||||
|
thermalShellModelNew.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef thermalShellModel_H
|
||||||
|
#define thermalShellModel_H
|
||||||
|
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "areaFieldsFwd.H"
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "regionFaModel.H"
|
||||||
|
#include "faOptions.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class thermalShellModel Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class thermalShellModel
|
||||||
|
:
|
||||||
|
public regionFaModel
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Initialize thermal Baffle
|
||||||
|
void init();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
//- Name of the temperature field
|
||||||
|
word TName_;
|
||||||
|
|
||||||
|
//- Primary region temperature
|
||||||
|
const volScalarField& Tp_;
|
||||||
|
|
||||||
|
//- Shell temperature
|
||||||
|
areaScalarField T_;
|
||||||
|
|
||||||
|
//- Pointer to faOptions
|
||||||
|
Foam::fa::options& faOptions_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read control parameters from dictionary
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("thermalShellModel");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare runtime constructor selection tables
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
thermalShellModel,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
),
|
||||||
|
(modelType, patch, dict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from type name and mesh and dict
|
||||||
|
thermalShellModel
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
thermalShellModel(const thermalShellModel&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const thermalShellModel&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected model using dictionary
|
||||||
|
static autoPtr<thermalShellModel> New
|
||||||
|
(
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~thermalShellModel() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return primary region temperature
|
||||||
|
const volScalarField& Tp() const;
|
||||||
|
|
||||||
|
//- Return shell temperature
|
||||||
|
const areaScalarField& T() const;
|
||||||
|
|
||||||
|
//- Return faOptions
|
||||||
|
Foam::fa::options& faOptions();
|
||||||
|
|
||||||
|
|
||||||
|
// Evolution
|
||||||
|
|
||||||
|
//- Pre-evolve region
|
||||||
|
virtual void preEvolveRegion();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
69
src/regionFaModels/thermalShellModel/thermalShellModelNew.C
Normal file
69
src/regionFaModels/thermalShellModel/thermalShellModelNew.C
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "thermalShellModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
autoPtr<thermalShellModel> thermalShellModel::New
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word modelType =
|
||||||
|
dict.getOrDefault<word>("thermalShellModel", "thermalShell");
|
||||||
|
|
||||||
|
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||||
|
|
||||||
|
if (!cstrIter.found())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unknown thermalShellModel type "
|
||||||
|
<< modelType << nl << nl
|
||||||
|
<< "Valid thermalShellModel types :" << nl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<thermalShellModel>(cstrIter()(modelType, p, dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
148
src/regionFaModels/vibrationShellModel/vibrationShellModel.C
Normal file
148
src/regionFaModels/vibrationShellModel/vibrationShellModel.C
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "vibrationShellModel.H"
|
||||||
|
#include "faMesh.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(vibrationShellModel, 0);
|
||||||
|
|
||||||
|
defineRunTimeSelectionTable(vibrationShellModel, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool vibrationShellModel::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (regionFaModel::read(dict))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
vibrationShellModel::vibrationShellModel
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
regionFaModel(p, "vibratingShell", modelType, dict, true),
|
||||||
|
pName_(dict.get<word>("p")),
|
||||||
|
pa_(p.boundaryMesh().mesh().lookupObject<volScalarField>(pName_)),
|
||||||
|
w_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"ws_" + regionName_,
|
||||||
|
p.boundaryMesh().mesh().time().timeName(),
|
||||||
|
p.boundaryMesh().mesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh()
|
||||||
|
),
|
||||||
|
a_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"as_" + regionName_,
|
||||||
|
p.boundaryMesh().mesh().time().timeName(),
|
||||||
|
p.boundaryMesh().mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
regionMesh(),
|
||||||
|
dimensionedScalar(dimAcceleration, Zero)
|
||||||
|
),
|
||||||
|
faOptions_(Foam::fa::options::New(p)),
|
||||||
|
solid_(dict.subDict("solid"))
|
||||||
|
{
|
||||||
|
if (!faOptions_.optionList::size())
|
||||||
|
{
|
||||||
|
Info << "No finite area options present" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void vibrationShellModel::preEvolveRegion()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::volScalarField& vibrationShellModel::pa() const
|
||||||
|
{
|
||||||
|
return pa_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::areaScalarField& vibrationShellModel::w() const
|
||||||
|
{
|
||||||
|
return w_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::areaScalarField& vibrationShellModel::a() const
|
||||||
|
{
|
||||||
|
return a_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::fa::options& vibrationShellModel::faOptions()
|
||||||
|
{
|
||||||
|
return faOptions_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::solidProperties& vibrationShellModel::solid() const
|
||||||
|
{
|
||||||
|
return solid_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
218
src/regionFaModels/vibrationShellModel/vibrationShellModel.H
Normal file
218
src/regionFaModels/vibrationShellModel/vibrationShellModel.H
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::regionModels::thermalShellModels::vibrationShellModel
|
||||||
|
|
||||||
|
Description
|
||||||
|
Intermediate class for vibration-shell finite-area models.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<patchName>
|
||||||
|
{
|
||||||
|
// Mandatory/Optional (inherited) entries
|
||||||
|
...
|
||||||
|
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
|
vibrationShellModel <thermalShellModelName>;
|
||||||
|
p <pName>;
|
||||||
|
|
||||||
|
solid
|
||||||
|
{
|
||||||
|
// subdictionary entries
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mandatory/Optional (derived) entries
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
where the entries mean:
|
||||||
|
\table
|
||||||
|
Property | Description | Type | Reqd | Dflt
|
||||||
|
vibrationShellModel | Name of vibration-shell model | word | yes | -
|
||||||
|
p | Name of the coupled field in the primary <!--
|
||||||
|
--> region | word | yes | -
|
||||||
|
solid | Solid properties | dictionary | yes | -
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
The inherited entries are elaborated in:
|
||||||
|
- \link regionFaModel.H \endlink
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
vibrationShellModel.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef thermalShellModel_H
|
||||||
|
#define thermalShellModel_H
|
||||||
|
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "areaFieldsFwd.H"
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "regionFaModel.H"
|
||||||
|
#include "faOptions.H"
|
||||||
|
#include "solidProperties.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class vibrationShellModel Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class vibrationShellModel
|
||||||
|
:
|
||||||
|
public regionFaModel
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
vibrationShellModel(const vibrationShellModel&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const vibrationShellModel&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
//- Name of the coupled field in the primary region
|
||||||
|
word pName_;
|
||||||
|
|
||||||
|
//- Primary region acoustic pressure
|
||||||
|
const volScalarField& pa_;
|
||||||
|
|
||||||
|
//- Shell displacement
|
||||||
|
areaScalarField w_;
|
||||||
|
|
||||||
|
//- Shell acceleration
|
||||||
|
areaScalarField a_;
|
||||||
|
|
||||||
|
//- Pointer to faOptions
|
||||||
|
Foam::fa::options& faOptions_;
|
||||||
|
|
||||||
|
//- Solid properties
|
||||||
|
solidProperties solid_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Read control parameters from dictionary
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("vibrationShellModel");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare runtime constructor selection tables
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
vibrationShellModel,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
),
|
||||||
|
(modelType, patch, dict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from type name and mesh and dict
|
||||||
|
vibrationShellModel
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected model using dictionary
|
||||||
|
static autoPtr<vibrationShellModel> New
|
||||||
|
(
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~vibrationShellModel() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return primary region pa
|
||||||
|
const volScalarField& pa() const;
|
||||||
|
|
||||||
|
//- Return shell displacement
|
||||||
|
const areaScalarField& w() const;
|
||||||
|
|
||||||
|
//- Return shell acceleration
|
||||||
|
const areaScalarField& a() const;
|
||||||
|
|
||||||
|
//- Return faOptions
|
||||||
|
Foam::fa::options& faOptions();
|
||||||
|
|
||||||
|
//- Return solid properties
|
||||||
|
const solidProperties& solid() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Evolution
|
||||||
|
|
||||||
|
//- Pre-evolve region
|
||||||
|
virtual void preEvolveRegion();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "vibrationShellModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
autoPtr<vibrationShellModel> vibrationShellModel::New
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word modelType = dict.get<word>("vibrationShellModel");
|
||||||
|
|
||||||
|
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||||
|
|
||||||
|
if (!cstrIter.found())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unknown vibrationShellModel type "
|
||||||
|
<< modelType << nl << nl
|
||||||
|
<< "Valid vibrationShellModel types :" << nl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<vibrationShellModel>(cstrIter()(modelType, p, dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -159,6 +159,9 @@ class boundaryDataWriter
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Write option (default: IOstream::ASCII)
|
||||||
|
IOstream::streamFormat writeFormat_;
|
||||||
|
|
||||||
//- Templated write field operation
|
//- Templated write field operation
|
||||||
template<class Type>
|
template<class Type>
|
||||||
fileName writeTemplate
|
fileName writeTemplate
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace Foam
|
|||||||
|
|
||||||
Foam::C::C()
|
Foam::C::C()
|
||||||
:
|
:
|
||||||
solidProperties(2010, 710, 0.04, 0.0, 1.0, 12.011)
|
solidProperties(2010, 710, 0.04, 0.0, 1.0, 12.011, 0.0, 0.0)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace Foam
|
|||||||
|
|
||||||
Foam::CaCO3::CaCO3()
|
Foam::CaCO3::CaCO3()
|
||||||
:
|
:
|
||||||
solidProperties(2710, 850, 1.3, 0.0, 1.0, 100.086)
|
solidProperties(2710, 850, 1.3, 0.0, 1.0, 100.086, 0.0, 0.0)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace Foam
|
|||||||
|
|
||||||
Foam::ash::ash()
|
Foam::ash::ash()
|
||||||
:
|
:
|
||||||
solidProperties(2010, 710, 0.04, 0.0, 1.0, 12.011)
|
solidProperties(2010, 710, 0.04, 0.0, 1.0, 12.011, 0.0, 0.0)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,7 +47,9 @@ Foam::solidProperties::solidProperties
|
|||||||
scalar kappa,
|
scalar kappa,
|
||||||
scalar Hf,
|
scalar Hf,
|
||||||
scalar emissivity,
|
scalar emissivity,
|
||||||
scalar W
|
scalar W,
|
||||||
|
scalar nu,
|
||||||
|
scalar E
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
rho_(rho),
|
rho_(rho),
|
||||||
@ -55,7 +57,9 @@ Foam::solidProperties::solidProperties
|
|||||||
kappa_(kappa),
|
kappa_(kappa),
|
||||||
Hf_(Hf),
|
Hf_(Hf),
|
||||||
emissivity_(emissivity),
|
emissivity_(emissivity),
|
||||||
W_(W)
|
W_(W),
|
||||||
|
nu_(nu),
|
||||||
|
E_(E)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +70,9 @@ Foam::solidProperties::solidProperties(const dictionary& dict)
|
|||||||
kappa_(dict.getCompat<scalar>("kappa", {{"K", 1612}})),
|
kappa_(dict.getCompat<scalar>("kappa", {{"K", 1612}})),
|
||||||
Hf_(dict.get<scalar>("Hf")),
|
Hf_(dict.get<scalar>("Hf")),
|
||||||
emissivity_(dict.get<scalar>("emissivity")),
|
emissivity_(dict.get<scalar>("emissivity")),
|
||||||
W_(dict.get<scalar>("W"))
|
W_(dict.get<scalar>("W")),
|
||||||
|
nu_(dict.getOrDefault<scalar>("nu", 0.0)),
|
||||||
|
E_(dict.getOrDefault<scalar>("E", 0.0))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -80,6 +86,8 @@ void Foam::solidProperties::readIfPresent(const dictionary& dict)
|
|||||||
dict.readIfPresent("Hf", Hf_);
|
dict.readIfPresent("Hf", Hf_);
|
||||||
dict.readIfPresent("emissivity", emissivity_);
|
dict.readIfPresent("emissivity", emissivity_);
|
||||||
dict.readIfPresent("W", W_);
|
dict.readIfPresent("W", W_);
|
||||||
|
dict.readIfPresent("nu", nu_);
|
||||||
|
dict.readIfPresent("E", E_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -90,7 +98,9 @@ void Foam::solidProperties::writeData(Ostream& os) const
|
|||||||
<< kappa_ << token::SPACE
|
<< kappa_ << token::SPACE
|
||||||
<< Hf_ << token::SPACE
|
<< Hf_ << token::SPACE
|
||||||
<< emissivity_ << token::SPACE
|
<< emissivity_ << token::SPACE
|
||||||
<< W_;
|
<< W_ << token::SPACE
|
||||||
|
<< nu_ << token::SPACE
|
||||||
|
<< E_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -74,6 +74,12 @@ class solidProperties
|
|||||||
//- Molar weight [Kg/Kmol]
|
//- Molar weight [Kg/Kmol]
|
||||||
scalar W_;
|
scalar W_;
|
||||||
|
|
||||||
|
//- Poisson ration
|
||||||
|
scalar nu_;
|
||||||
|
|
||||||
|
//- Young Modulus [N/m2]
|
||||||
|
scalar E_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -112,7 +118,9 @@ public:
|
|||||||
scalar kappa,
|
scalar kappa,
|
||||||
scalar Hf,
|
scalar Hf,
|
||||||
scalar emissivity,
|
scalar emissivity,
|
||||||
scalar W
|
scalar W,
|
||||||
|
scalar nu,
|
||||||
|
scalar E
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
@ -163,6 +171,12 @@ public:
|
|||||||
//- Molar weight [Kg/Kmol]
|
//- Molar weight [Kg/Kmol]
|
||||||
inline scalar W() const;
|
inline scalar W() const;
|
||||||
|
|
||||||
|
//- Poissons
|
||||||
|
inline scalar nu() const;
|
||||||
|
|
||||||
|
//- Young modulus [N/m2]
|
||||||
|
inline scalar E() const;
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
|
|||||||
@ -65,10 +65,23 @@ inline Foam::scalar Foam::solidProperties::emissivity() const
|
|||||||
return emissivity_;
|
return emissivity_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::scalar Foam::solidProperties::W() const
|
inline Foam::scalar Foam::solidProperties::W() const
|
||||||
{
|
{
|
||||||
return W_;
|
return W_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::solidProperties::nu() const
|
||||||
|
{
|
||||||
|
return nu_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::solidProperties::E() const
|
||||||
|
{
|
||||||
|
return E_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
10
tutorials/compressible/acousticFoam/obliqueAirJet/Allclean
Executable file
10
tutorials/compressible/acousticFoam/obliqueAirJet/Allclean
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(cd precursor && ./Allclean)
|
||||||
|
|
||||||
|
(cd main && ./Allclean)
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
13
tutorials/compressible/acousticFoam/obliqueAirJet/Allrun-parallel
Executable file
13
tutorials/compressible/acousticFoam/obliqueAirJet/Allrun-parallel
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Run a precursor init case
|
||||||
|
(cd main && ./Allrun.pre)
|
||||||
|
(cd precursor && ./Allrun-parallel)
|
||||||
|
|
||||||
|
# Run the main case
|
||||||
|
(cd main && ./Allrun-parallel)
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2011 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class areaScalarField;
|
||||||
|
object h_ceilingShell;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 0 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0.00485;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2011 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object pa;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
box
|
||||||
|
{
|
||||||
|
type acousticWaveTransmissive;
|
||||||
|
advectiveSpeed 340;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
window
|
||||||
|
{
|
||||||
|
type vibrationShell;
|
||||||
|
active true;
|
||||||
|
p pa;
|
||||||
|
|
||||||
|
solid
|
||||||
|
{
|
||||||
|
W 20; //Not used
|
||||||
|
rho 2500;
|
||||||
|
|
||||||
|
kappa 200;
|
||||||
|
Cp 600;
|
||||||
|
Hf 0;
|
||||||
|
emissivity 0;
|
||||||
|
|
||||||
|
E 7e10;
|
||||||
|
nu 0.22;
|
||||||
|
}
|
||||||
|
|
||||||
|
region vibrationShell;
|
||||||
|
vibrationShellModel KirchhoffShell;
|
||||||
|
|
||||||
|
f0 0.04;
|
||||||
|
f1 0;
|
||||||
|
f2 0;
|
||||||
|
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
|
||||||
|
wall
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2011 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class areaScalarField;
|
||||||
|
object ps;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2011 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class areaScalarField;
|
||||||
|
object wS;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 0 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0.0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
sealing
|
||||||
|
{
|
||||||
|
type clampedPlate;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
12
tutorials/compressible/acousticFoam/obliqueAirJet/main/Allclean
Executable file
12
tutorials/compressible/acousticFoam/obliqueAirJet/main/Allclean
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
cleanCase0
|
||||||
|
|
||||||
|
rm -rf constant/boundaryData
|
||||||
|
rm -f constant/faMesh/faceLabels
|
||||||
|
rm -f constant/faMesh/faBoundary
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
14
tutorials/compressible/acousticFoam/obliqueAirJet/main/Allrun-parallel
Executable file
14
tutorials/compressible/acousticFoam/obliqueAirJet/main/Allrun-parallel
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
restore0Dir
|
||||||
|
|
||||||
|
runApplication decomposePar -force
|
||||||
|
|
||||||
|
runParallel $(getApplication)
|
||||||
|
|
||||||
|
runApplication reconstructPar
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
12
tutorials/compressible/acousticFoam/obliqueAirJet/main/Allrun.pre
Executable file
12
tutorials/compressible/acousticFoam/obliqueAirJet/main/Allrun.pre
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
runApplication blockMesh
|
||||||
|
|
||||||
|
runApplication snappyHexMesh -overwrite
|
||||||
|
|
||||||
|
runApplication makeFaMesh
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2011 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object faMeshDefinition;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
polyMeshPatches 1(window);
|
||||||
|
|
||||||
|
boundary
|
||||||
|
{
|
||||||
|
sealing
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
ownerPolyPatch window;
|
||||||
|
neighbourPolyPatch fixedWall;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************** //
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user