diff --git a/applications/solvers/acoustic/acousticFoam/Make/files b/applications/solvers/acoustic/acousticFoam/Make/files
new file mode 100644
index 0000000000..897caa0f26
--- /dev/null
+++ b/applications/solvers/acoustic/acousticFoam/Make/files
@@ -0,0 +1,3 @@
+acousticFoam.C
+
+EXE = $(FOAM_APPBIN)/acousticFoam
diff --git a/applications/solvers/acoustic/acousticFoam/Make/options b/applications/solvers/acoustic/acousticFoam/Make/options
new file mode 100644
index 0000000000..c12930f5c0
--- /dev/null
+++ b/applications/solvers/acoustic/acousticFoam/Make/options
@@ -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
diff --git a/applications/solvers/acoustic/acousticFoam/acousticFoam.C b/applications/solvers/acoustic/acousticFoam/acousticFoam.C
new file mode 100644
index 0000000000..ab12a827f2
--- /dev/null
+++ b/applications/solvers/acoustic/acousticFoam/acousticFoam.C
@@ -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 .
+
+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;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/solvers/acoustic/acousticFoam/createFields.H b/applications/solvers/acoustic/acousticFoam/createFields.H
new file mode 100644
index 0000000000..3a1eaa069f
--- /dev/null
+++ b/applications/solvers/acoustic/acousticFoam/createFields.H
@@ -0,0 +1,15 @@
+
+Info << "\nReading pa" << endl;
+
+volScalarField pa
+(
+ IOobject
+ (
+ "pa",
+ runTime.timeName(),
+ mesh,
+ IOobject::MUST_READ,
+ IOobject::AUTO_WRITE
+ ),
+ mesh
+);
diff --git a/applications/solvers/acoustic/acousticFoam/createRegionControls.H b/applications/solvers/acoustic/acousticFoam/createRegionControls.H
new file mode 100644
index 0000000000..a1888eead7
--- /dev/null
+++ b/applications/solvers/acoustic/acousticFoam/createRegionControls.H
@@ -0,0 +1,8 @@
+fvSolution solutionDict(runTime);
+
+const dictionary& pimpleDict = solutionDict.subDict("PIMPLE");
+
+bool solvePrimaryRegion
+(
+ pimpleDict.getOrDefault("solvePrimaryRegion", true)
+);
diff --git a/applications/solvers/acoustic/acousticFoam/paEqn.H b/applications/solvers/acoustic/acousticFoam/paEqn.H
new file mode 100644
index 0000000000..d80eb80929
--- /dev/null
+++ b/applications/solvers/acoustic/acousticFoam/paEqn.H
@@ -0,0 +1,15 @@
+
+fvScalarMatrix paEqn
+(
+ fvm::d2dt2(pa) - sqr(c0)*fvc::laplacian(pa)
+);
+
+if (solvePrimaryRegion)
+{
+ paEqn.relax();
+ paEqn.solve();
+}
+else
+{
+ pa.correctBoundaryConditions();
+}
diff --git a/applications/solvers/acoustic/acousticFoam/readTransportProperties.H b/applications/solvers/acoustic/acousticFoam/readTransportProperties.H
new file mode 100644
index 0000000000..5ff526af53
--- /dev/null
+++ b/applications/solvers/acoustic/acousticFoam/readTransportProperties.H
@@ -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;
diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options
index 14bbcc2cee..241a4ff1a6 100644
--- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options
+++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options
@@ -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
diff --git a/src/Allwmake b/src/Allwmake
index 15a09cdc0a..a2109cae24 100755
--- a/src/Allwmake
+++ b/src/Allwmake
@@ -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 $*
diff --git a/src/OpenFOAM/algorithms/subCycle/subCycle.H b/src/OpenFOAM/algorithms/subCycle/subCycle.H
index 6de416d94b..5024c7d8d6 100644
--- a/src/OpenFOAM/algorithms/subCycle/subCycle.H
+++ b/src/OpenFOAM/algorithms/subCycle/subCycle.H
@@ -59,7 +59,12 @@ class subCycleField
GeometricField& gf0_;
//- Copy of the "real" old-time value of the field
- GeometricField gf_0_;
+ tmp gf_0_;
+
+ GeometricField& gf00_;
+
+ //- Copy of the "real" old-old-time value of the field
+ tmp 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;
}
};
diff --git a/src/OpenFOAM/db/Time/subCycleTime.C b/src/OpenFOAM/db/Time/subCycleTime.C
index fc21130645..32dee00915 100644
--- a/src/OpenFOAM/db/Time/subCycleTime.C
+++ b/src/OpenFOAM/db/Time/subCycleTime.C
@@ -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_);
diff --git a/src/faOptions/Make/files b/src/faOptions/Make/files
new file mode 100644
index 0000000000..cd8c59745d
--- /dev/null
+++ b/src/faOptions/Make/files
@@ -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
diff --git a/src/faOptions/Make/options b/src/faOptions/Make/options
new file mode 100644
index 0000000000..46c960d614
--- /dev/null
+++ b/src/faOptions/Make/options
@@ -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
diff --git a/src/faOptions/faOption/faOption.C b/src/faOptions/faOption/faOption.C
new file mode 100644
index 0000000000..708f738851
--- /dev/null
+++ b/src/faOptions/faOption/faOption.C
@@ -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 .
+
+\*---------------------------------------------------------------------------*/
+
+#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("active", true)),
+ fieldNames_(),
+ applied_(),
+ regionName_(dict.get("region")),
+ regionMeshPtr_(nullptr),
+ vsmPtr_(nullptr)
+{
+ constructMeshObjects();
+
+ Info<< incrIndent << indent << "Source: " << name_ << endl << decrIndent;
+}
+
+
+// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
+
+Foam::autoPtr Foam::fa::option::New
+(
+ const word& name,
+ const dictionary& coeffs,
+ const fvPatch& patch
+)
+{
+ const word modelType(coeffs.get("type"));
+
+ Info<< indent
+ << "Selecting finite area options type " << modelType << endl;
+
+ const_cast