From bc430ccdef7512eec45fff604016583b1ccf362c Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 29 Jan 2019 11:06:35 -0800 Subject: [PATCH] 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 --- .../solvers/acoustic/acousticFoam/Make/files | 3 + .../acoustic/acousticFoam/Make/options | 14 + .../acoustic/acousticFoam/acousticFoam.C | 99 ++++ .../acoustic/acousticFoam/createFields.H | 15 + .../acousticFoam/createRegionControls.H | 8 + .../solvers/acoustic/acousticFoam/paEqn.H | 15 + .../acousticFoam/readTransportProperties.H | 23 + .../chtMultiRegionSimpleFoam/Make/options | 10 +- src/Allwmake | 4 +- src/OpenFOAM/algorithms/subCycle/subCycle.H | 31 +- src/OpenFOAM/db/Time/subCycleTime.C | 18 +- src/faOptions/Make/files | 16 + src/faOptions/Make/options | 22 + src/faOptions/faOption/faOption.C | 291 ++++++++++++ src/faOptions/faOption/faOption.H | 441 ++++++++++++++++++ src/faOptions/faOption/faOptionI.H | 108 +++++ src/faOptions/faOption/faOptionIO.C | 64 +++ src/faOptions/faOption/faOptionList.C | 178 +++++++ src/faOptions/faOption/faOptionList.H | 250 ++++++++++ .../faOption/faOptionListTemplates.C | 290 ++++++++++++ src/faOptions/faOption/faOptions.C | 144 ++++++ src/faOptions/faOption/faOptions.H | 112 +++++ src/faOptions/faOption/makeFaOption.H | 54 +++ src/faOptions/faceSetOption/faceSetOption.C | 246 ++++++++++ src/faOptions/faceSetOption/faceSetOption.H | 241 ++++++++++ src/faOptions/faceSetOption/faceSetOptionI.H | 93 ++++ .../contactHeatFluxSource.C | 204 ++++++++ .../contactHeatFluxSource.H | 196 ++++++++ .../externalFileSource/externalFileSource.C | 130 ++++++ .../externalFileSource/externalFileSource.H | 169 +++++++ .../externalHeatFluxSource.C | 208 +++++++++ .../externalHeatFluxSource.H | 241 ++++++++++ .../jouleHeatingSource/jouleHeatingSource.C | 193 ++++++++ .../jouleHeatingSource/jouleHeatingSource.H | 265 +++++++++++ .../jouleHeatingSourceTemplates.C | 140 ++++++ src/finiteArea/Make/files | 4 +- .../faMesh/faPatches/faPatch/faPatch.C | 23 +- .../faMesh/faPatches/faPatch/faPatch.H | 22 +- .../clampedPlate/clampedPlateFaPatchField.C | 179 +++++++ .../clampedPlate/clampedPlateFaPatchField.H | 214 +++++++++ .../clampedPlateFaPatchFields.C} | 6 +- .../clampedPlateFaPatchFields.H} | 10 +- .../clampedPlateFaPatchFieldsFwd.H | 52 +++ ...imeVaryingUniformFixedValueFaPatchField.C} | 55 ++- ...imeVaryingUniformFixedValueFaPatchField.H} | 112 +++-- ...imeVaryingUniformFixedValueFaPatchFields.C | 46 ++ ...imeVaryingUniformFixedValueFaPatchFields.H | 52 +++ ...VaryingUniformFixedValueFaPatchFieldsFwd.H | 54 +++ .../faPatchFields/faPatchField/faPatchField.H | 39 +- .../faPatchField/faPatchFieldNew.C | 9 +- src/finiteArea/finiteArea/fam/famSup.C | 14 +- .../edgeInterpolation/edgeInterpolate.C | 1 + .../edgeInterpolation/edgeInterpolation.C | 38 +- .../skewCorrectedEdgeInterpolation.H | 219 +++++++++ .../skewCorrectedEdgeInterpolationMake.C | 39 ++ .../volSurfaceMapping/volSurfaceMapping.C | 72 ++- .../volSurfaceMapping/volSurfaceMapping.H | 38 +- src/finiteVolume/Make/files | 1 + .../acousticWaveTransmissiveFvPatchField.C | 119 +++++ .../acousticWaveTransmissiveFvPatchField.H | 192 ++++++++ .../acousticWaveTransmissiveFvPatchFields.C | 46 ++ .../acousticWaveTransmissiveFvPatchFields.H | 51 ++ ...cousticWaveTransmissiveFvPatchFieldsFwd.H} | 9 +- .../KirchhoffShell/KirchhoffShell.C | 319 +++++++++++++ .../KirchhoffShell/KirchhoffShell.H | 217 +++++++++ src/regionFaModels/Make/files | 16 + src/regionFaModels/Make/options | 16 + .../doc/thermalBaffleBoundaryConditionsDoc.H | 34 ++ .../thermalShellFvPatchScalarField.C | 152 ++++++ .../thermalShellFvPatchScalarField.H | 184 ++++++++ .../vibrationShellFvPatchScalarField.C | 169 +++++++ .../vibrationShellFvPatchScalarField.H | 172 +++++++ .../regionFaModel/regionFaModel.C | 172 +++++++ .../regionFaModel/regionFaModel.H | 256 ++++++++++ .../regionFaModel/regionFaModelI.H | 118 +++++ .../thermalShell/thermalShell.C | 232 +++++++++ .../thermalShell/thermalShell.H | 208 +++++++++ .../thermalShellModel/thermalShellModel.C | 121 +++++ .../thermalShellModel/thermalShellModel.H | 205 ++++++++ .../thermalShellModel/thermalShellModelNew.C | 69 +++ .../vibrationShellModel/vibrationShellModel.C | 148 ++++++ .../vibrationShellModel/vibrationShellModel.H | 218 +++++++++ .../vibrationShellModelNew.C | 68 +++ .../boundaryData/boundaryDataSurfaceWriter.H | 3 + .../solidProperties/C/C.C | 2 +- .../solidProperties/CaCO3/CaCO3.C | 2 +- .../solidProperties/ash/ash.C | 2 +- .../solidProperties/solidProperties.C | 18 +- .../solidProperties/solidProperties.H | 16 +- .../solidProperties/solidPropertiesI.H | 13 + .../acousticFoam/obliqueAirJet/Allclean | 10 + .../obliqueAirJet/Allrun-parallel | 13 + .../main/0.orig/h_vibrationShell | 30 ++ .../acousticFoam/obliqueAirJet/main/0.orig/pa | 67 +++ .../main/0.orig/ps_vibrationShell | 30 ++ .../main/0.orig/ws_vibrationShell | 31 ++ .../acousticFoam/obliqueAirJet/main/Allclean | 12 + .../obliqueAirJet/main/Allrun-parallel | 14 + .../obliqueAirJet/main/Allrun.pre | 12 + .../main/constant/faMesh/faMeshDefinition | 30 ++ .../main/constant/transportProperties | 21 + .../constant/triSurface/window_box.stl.gz | Bin 0 -> 51747 bytes .../obliqueAirJet/main/system/blockMeshDict | 46 ++ .../obliqueAirJet/main/system/controlDict | 48 ++ .../main/system/decomposeParDict | 22 + .../obliqueAirJet/main/system/faOptions | 31 ++ .../obliqueAirJet/main/system/faSchemes | 54 +++ .../obliqueAirJet/main/system/faSolution | 37 ++ .../obliqueAirJet/main/system/fvSchemes | 59 +++ .../obliqueAirJet/main/system/fvSolution | 43 ++ .../main/system/snappyHexMeshDict | 136 ++++++ .../obliqueAirJet/precursor/0.orig/T | 45 ++ .../obliqueAirJet/precursor/0.orig/U | 42 ++ .../obliqueAirJet/precursor/0.orig/alphat | 43 ++ .../obliqueAirJet/precursor/0.orig/nuTilda | 44 ++ .../obliqueAirJet/precursor/0.orig/nut | 43 ++ .../obliqueAirJet/precursor/0.orig/p | 43 ++ .../obliqueAirJet/precursor/Allclean | 12 + .../obliqueAirJet/precursor/Allrun-parallel | 20 + .../obliqueAirJet/precursor/Allrun.pre | 14 + .../constant/thermophysicalProperties | 52 +++ .../precursor/constant/turbulenceProperties | 36 ++ .../precursor/system/blockMeshDict | 231 +++++++++ .../precursor/system/changeDictionaryDict | 27 ++ .../precursor/system/controlDict | 86 ++++ .../precursor/system/createPatchDict | 41 ++ .../precursor/system/decomposeParDict | 22 + .../precursor/system/extrudeMeshDict | 44 ++ .../obliqueAirJet/precursor/system/fvSchemes | 63 +++ .../obliqueAirJet/precursor/system/fvSolution | 65 +++ .../precursor/system/topoSetDict | 29 ++ 131 files changed, 10959 insertions(+), 191 deletions(-) create mode 100644 applications/solvers/acoustic/acousticFoam/Make/files create mode 100644 applications/solvers/acoustic/acousticFoam/Make/options create mode 100644 applications/solvers/acoustic/acousticFoam/acousticFoam.C create mode 100644 applications/solvers/acoustic/acousticFoam/createFields.H create mode 100644 applications/solvers/acoustic/acousticFoam/createRegionControls.H create mode 100644 applications/solvers/acoustic/acousticFoam/paEqn.H create mode 100644 applications/solvers/acoustic/acousticFoam/readTransportProperties.H create mode 100644 src/faOptions/Make/files create mode 100644 src/faOptions/Make/options create mode 100644 src/faOptions/faOption/faOption.C create mode 100644 src/faOptions/faOption/faOption.H create mode 100644 src/faOptions/faOption/faOptionI.H create mode 100644 src/faOptions/faOption/faOptionIO.C create mode 100644 src/faOptions/faOption/faOptionList.C create mode 100644 src/faOptions/faOption/faOptionList.H create mode 100644 src/faOptions/faOption/faOptionListTemplates.C create mode 100644 src/faOptions/faOption/faOptions.C create mode 100644 src/faOptions/faOption/faOptions.H create mode 100644 src/faOptions/faOption/makeFaOption.H create mode 100644 src/faOptions/faceSetOption/faceSetOption.C create mode 100644 src/faOptions/faceSetOption/faceSetOption.H create mode 100644 src/faOptions/faceSetOption/faceSetOptionI.H create mode 100644 src/faOptions/sources/derived/contactHeatFluxSource/contactHeatFluxSource.C create mode 100644 src/faOptions/sources/derived/contactHeatFluxSource/contactHeatFluxSource.H create mode 100644 src/faOptions/sources/derived/externalFileSource/externalFileSource.C create mode 100644 src/faOptions/sources/derived/externalFileSource/externalFileSource.H create mode 100644 src/faOptions/sources/derived/externalHeatFluxSource/externalHeatFluxSource.C create mode 100644 src/faOptions/sources/derived/externalHeatFluxSource/externalHeatFluxSource.H create mode 100644 src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C create mode 100644 src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.H create mode 100644 src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C create mode 100755 src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C create mode 100755 src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.H rename src/finiteArea/fields/faPatchFields/derived/{uniformFixedValue/uniformFixedValueFaPatchFields.C => clampedPlate/clampedPlateFaPatchFields.C} (95%) mode change 100644 => 100755 rename src/finiteArea/fields/faPatchFields/derived/{uniformFixedValue/uniformFixedValueFaPatchFields.H => clampedPlate/clampedPlateFaPatchFields.H} (90%) mode change 100644 => 100755 create mode 100755 src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchFieldsFwd.H rename src/finiteArea/fields/faPatchFields/derived/{uniformFixedValue/uniformFixedValueFaPatchField.C => timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.C} (65%) rename src/finiteArea/fields/faPatchFields/derived/{uniformFixedValue/uniformFixedValueFaPatchField.H => timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchField.H} (56%) create mode 100644 src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C create mode 100644 src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H create mode 100644 src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFieldsFwd.H create mode 100644 src/finiteArea/interpolation/edgeInterpolation/schemes/skewCorrected/skewCorrectedEdgeInterpolation.H create mode 100644 src/finiteArea/interpolation/edgeInterpolation/schemes/skewCorrected/skewCorrectedEdgeInterpolationMake.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/acousticWaveTransmissive/acousticWaveTransmissiveFvPatchField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/acousticWaveTransmissive/acousticWaveTransmissiveFvPatchField.H create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/acousticWaveTransmissive/acousticWaveTransmissiveFvPatchFields.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/acousticWaveTransmissive/acousticWaveTransmissiveFvPatchFields.H rename src/{finiteArea/fields/faPatchFields/derived/uniformFixedValue/uniformFixedValueFaPatchFieldsFwd.H => finiteVolume/fields/fvPatchFields/derived/acousticWaveTransmissive/acousticWaveTransmissiveFvPatchFieldsFwd.H} (88%) create mode 100644 src/regionFaModels/KirchhoffShell/KirchhoffShell.C create mode 100644 src/regionFaModels/KirchhoffShell/KirchhoffShell.H create mode 100644 src/regionFaModels/Make/files create mode 100644 src/regionFaModels/Make/options create mode 100644 src/regionFaModels/derivedFvPatchFields/doc/thermalBaffleBoundaryConditionsDoc.H create mode 100644 src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.C create mode 100644 src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.H create mode 100644 src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.C create mode 100644 src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.H create mode 100644 src/regionFaModels/regionFaModel/regionFaModel.C create mode 100644 src/regionFaModels/regionFaModel/regionFaModel.H create mode 100644 src/regionFaModels/regionFaModel/regionFaModelI.H create mode 100644 src/regionFaModels/thermalShell/thermalShell.C create mode 100644 src/regionFaModels/thermalShell/thermalShell.H create mode 100644 src/regionFaModels/thermalShellModel/thermalShellModel.C create mode 100644 src/regionFaModels/thermalShellModel/thermalShellModel.H create mode 100644 src/regionFaModels/thermalShellModel/thermalShellModelNew.C create mode 100644 src/regionFaModels/vibrationShellModel/vibrationShellModel.C create mode 100644 src/regionFaModels/vibrationShellModel/vibrationShellModel.H create mode 100644 src/regionFaModels/vibrationShellModel/vibrationShellModelNew.C create mode 100755 tutorials/compressible/acousticFoam/obliqueAirJet/Allclean create mode 100755 tutorials/compressible/acousticFoam/obliqueAirJet/Allrun-parallel create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/0.orig/h_vibrationShell create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/0.orig/pa create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/0.orig/ps_vibrationShell create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/0.orig/ws_vibrationShell create mode 100755 tutorials/compressible/acousticFoam/obliqueAirJet/main/Allclean create mode 100755 tutorials/compressible/acousticFoam/obliqueAirJet/main/Allrun-parallel create mode 100755 tutorials/compressible/acousticFoam/obliqueAirJet/main/Allrun.pre create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/constant/faMesh/faMeshDefinition create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/constant/transportProperties create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/constant/triSurface/window_box.stl.gz create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/system/blockMeshDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/system/controlDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/system/decomposeParDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/system/faOptions create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/system/faSchemes create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/system/faSolution create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/system/fvSchemes create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/system/fvSolution create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/main/system/snappyHexMeshDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/0.orig/T create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/0.orig/U create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/0.orig/alphat create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/0.orig/nuTilda create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/0.orig/nut create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/0.orig/p create mode 100755 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/Allclean create mode 100755 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/Allrun-parallel create mode 100755 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/Allrun.pre create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/constant/thermophysicalProperties create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/constant/turbulenceProperties create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/system/blockMeshDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/system/changeDictionaryDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/system/controlDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/system/createPatchDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/system/decomposeParDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/system/extrudeMeshDict create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/system/fvSchemes create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/system/fvSolution create mode 100644 tutorials/compressible/acousticFoam/obliqueAirJet/precursor/system/topoSetDict 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(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