Commit bc430ccd authored by sergio's avatar sergio Committed by Andrew Heather
Browse files

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's avatarKutalmis Bercin <kutalmis.bercin@esi-group.com>
parent 25246f22
acousticFoam.C
EXE = $(FOAM_APPBIN)/acousticFoam
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
/*---------------------------------------------------------------------------*\
========= |
\\ / 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;
}
// ************************************************************************* //
Info << "\nReading pa" << endl;
volScalarField pa
(
IOobject
(
"pa",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
fvSolution solutionDict(runTime);
const dictionary& pimpleDict = solutionDict.subDict("PIMPLE");
bool solvePrimaryRegion
(
pimpleDict.getOrDefault("solvePrimaryRegion", true)
);
fvScalarMatrix paEqn
(
fvm::d2dt2(pa) - sqr(c0)*fvc::laplacian(pa)
);
if (solvePrimaryRegion)
{
paEqn.relax();
paEqn.solve();
}
else
{
pa.correctBoundaryConditions();
}
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)/TurbulenceModels/turbulenceModels/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 = \
-lfiniteVolume \
......@@ -28,4 +30,8 @@ EXE_LIBS = \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-lradiationModels \
-lregionModels
-lfvOptions \
-lfaOptions \
-lregionModels \
-lsampling \
-lregionFaModels
......@@ -49,6 +49,7 @@ wmake $targetType fileFormats
wmake $targetType surfMesh
wmake $targetType meshTools
wmake $targetType finiteArea
wmake $targetType finiteVolume
wmake $targetType mesh/blockMesh
......@@ -85,7 +86,9 @@ regionModels/Allwmake $targetType $*
lagrangian/Allwmake $targetType $*
wmake $targetType fvOptions
wmake $targetType faOptions
wmake $targetType fvMotionSolver
wmake $targetType regionFaModels
wmake $targetType overset
......@@ -97,7 +100,6 @@ wmake $targetType waveModels
wmake $targetType engine
wmake $targetType finiteArea
wmake $targetType genericPatchFields
conversion/Allwmake $targetType $*
......
......@@ -59,7 +59,12 @@ class subCycleField
GeometricField& gf0_;
//- 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:
......@@ -71,19 +76,28 @@ public:
:
gf_(gf),
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
~subCycleField()
{
// Reset the old-time field
gf0_ = gf_0_;
if (gf_0_.valid())
{
// Reset the old-time field
gf0_ = gf_0_;
gf00_ = gf_00_;
// Correct the time index of the field to correspond to the global time
gf_.timeIndex() = gf_.time().timeIndex();
gf0_.timeIndex() = gf_.time().timeIndex();
gf_.timeIndex() = gf_.time().timeIndex();
}
}
......@@ -96,7 +110,8 @@ public:
void updateTimeIndex()
{
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)
{
// Could avoid 0 or 1 nCycles here on construction
time_.subCycle(nCycles);
if (nCycles > 1)
{
time_.subCycle(nCycles);
}
}
......@@ -64,7 +67,10 @@ bool Foam::subCycleTime::end() const
void Foam::subCycleTime::endSubCycle()
{
time_.endSubCycle();
if (total_ > 1)
{
time_.endSubCycle();
}
// If called manually, ensure status() will return false
......@@ -89,8 +95,12 @@ bool Foam::subCycleTime::loop()
Foam::subCycleTime& Foam::subCycleTime::operator++()
{
++time_;
++index_;
if (total_ > 1)
{
time_++;
}
index_++;
// Register index change with Time, in case someone wants this information
time_.subCycleIndex(index_);
......
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
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
/*---------------------------------------------------------------------------*\
========= |
\\ / 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)
{}