New modular solver framework for single- and multi-region simulations
in which different solver modules can be selected in each region to for complex
conjugate heat-transfer and other combined physics problems such as FSI
(fluid-structure interaction).
For single-region simulations the solver module is selected, instantiated and
executed in the PIMPLE loop in the new foamRun application.
For multi-region simulations the set of solver modules, one for each region, are
selected, instantiated and executed in the multi-region PIMPLE loop of new the
foamMultiRun application.
This provides a very general, flexible and extensible framework for complex
coupled problems by creating more solver modules, either by converting existing
solver applications or creating new ones.
The current set of solver modules provided are:
isothermalFluid
Solver module for steady or transient turbulent flow of compressible
isothermal fluids with optional mesh motion and mesh topology changes.
Created from the rhoSimpleFoam, rhoPimpleFoam and buoyantFoam solvers but
without the energy equation, hence isothermal. The buoyant pressure
formulation corresponding to the buoyantFoam solver is selected
automatically by the presence of the p_rgh pressure field in the start-time
directory.
fluid
Solver module for steady or transient turbulent flow of compressible fluids
with heat-transfer for HVAC and similar applications, with optional
mesh motion and mesh topology changes.
Derived from the isothermalFluid solver module with the addition of the
energy equation from the rhoSimpleFoam, rhoPimpleFoam and buoyantFoam
solvers, thus providing the equivalent functionality of these three solvers.
multicomponentFluid
Solver module for steady or transient turbulent flow of compressible
reacting fluids with optional mesh motion and mesh topology changes.
Derived from the isothermalFluid solver module with the addition of
multicomponent thermophysical properties energy and specie mass-fraction
equations from the reactingFoam solver, thus providing the equivalent
functionality in reactingFoam and buoyantReactingFoam. Chemical reactions
and/or combustion modelling may be optionally selected to simulate reacting
systems including fires, explosions etc.
solid
Solver module for turbulent flow of compressible fluids for conjugate heat
transfer, HVAC and similar applications, with optional mesh motion and mesh
topology changes.
The solid solver module may be selected in solid regions of a CHT case, with
either the fluid or multicomponentFluid solver module in the fluid regions
and executed with foamMultiRun to provide functionality equivalent
chtMultiRegionFoam but in a flexible and extensible framework for future
extension to more complex coupled problems.
All the usual fvModels, fvConstraints, functionObjects etc. are available with
these solver modules to support simulations including body-forces, local sources,
Lagrangian clouds, liquid films etc. etc.
Converting compressibleInterFoam and multiphaseEulerFoam into solver modules
would provide a significant enhancement to the CHT capability and incompressible
solvers like pimpleFoam run in conjunction with solidDisplacementFoam in
foamMultiRun would be useful for a range of FSI problems. Many other
combinations of existing solvers converted into solver modules could prove
useful for a very wide range of complex combined physics simulations.
All tutorials from the rhoSimpleFoam, rhoPimpleFoam, buoyantFoam, reactingFoam,
buoyantReactingFoam and chtMultiRegionFoam solver applications replaced by
solver modules have been updated and moved into the tutorials/modules directory:
modules
├── CHT
│ ├── coolingCylinder2D
│ ├── coolingSphere
│ ├── heatedDuct
│ ├── heatExchanger
│ ├── reverseBurner
│ └── shellAndTubeHeatExchanger
├── fluid
│ ├── aerofoilNACA0012
│ ├── aerofoilNACA0012Steady
│ ├── angledDuct
│ ├── angledDuctExplicitFixedCoeff
│ ├── angledDuctLTS
│ ├── annularThermalMixer
│ ├── BernardCells
│ ├── blockedChannel
│ ├── buoyantCavity
│ ├── cavity
│ ├── circuitBoardCooling
│ ├── decompressionTank
│ ├── externalCoupledCavity
│ ├── forwardStep
│ ├── helmholtzResonance
│ ├── hotRadiationRoom
│ ├── hotRadiationRoomFvDOM
│ ├── hotRoom
│ ├── hotRoomBoussinesq
│ ├── hotRoomBoussinesqSteady
│ ├── hotRoomComfort
│ ├── iglooWithFridges
│ ├── mixerVessel2DMRF
│ ├── nacaAirfoil
│ ├── pitzDaily
│ ├── prism
│ ├── shockTube
│ ├── squareBend
│ ├── squareBendLiq
│ └── squareBendLiqSteady
└── multicomponentFluid
├── aachenBomb
├── counterFlowFlame2D
├── counterFlowFlame2D_GRI
├── counterFlowFlame2D_GRI_TDAC
├── counterFlowFlame2DLTS
├── counterFlowFlame2DLTS_GRI_TDAC
├── cylinder
├── DLR_A_LTS
├── filter
├── hotBoxes
├── membrane
├── parcelInBox
├── rivuletPanel
├── SandiaD_LTS
├── simplifiedSiwek
├── smallPoolFire2D
├── smallPoolFire3D
├── splashPanel
├── verticalChannel
├── verticalChannelLTS
└── verticalChannelSteady
Also redirection scripts are provided for the replaced solvers which call
foamRun -solver <solver module name> or foamMultiRun in the case of
chtMultiRegionFoam for backward-compatibility.
Documentation for foamRun and foamMultiRun:
Application
foamRun
Description
Loads and executes an OpenFOAM solver module either specified by the
optional \c solver entry in the \c controlDict or as a command-line
argument.
Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
pseudo-transient and steady simulations.
Usage
\b foamRun [OPTION]
- \par -solver <name>
Solver name
- \par -libs '(\"lib1.so\" ... \"libN.so\")'
Specify the additional libraries loaded
Example usage:
- To run a \c rhoPimpleFoam case by specifying the solver on the
command line:
\verbatim
foamRun -solver fluid
\endverbatim
- To update and run a \c rhoPimpleFoam case add the following entries to
the controlDict:
\verbatim
application foamRun;
solver fluid;
\endverbatim
then execute \c foamRun
Application
foamMultiRun
Description
Loads and executes an OpenFOAM solver modules for each region of a
multiregion simulation e.g. for conjugate heat transfer.
The region solvers are specified in the \c regionSolvers dictionary entry in
\c controlDict, containing a list of pairs of region and solver names,
e.g. for a two region case with one fluid region named
liquid and one solid region named tubeWall:
\verbatim
regionSolvers
{
liquid fluid;
tubeWall solid;
}
\endverbatim
The \c regionSolvers entry is a dictionary to support name substitutions to
simplify the specification of a single solver type for a set of
regions, e.g.
\verbatim
fluidSolver fluid;
solidSolver solid;
regionSolvers
{
tube1 $fluidSolver;
tubeWall1 solid;
tube2 $fluidSolver;
tubeWall2 solid;
tube3 $fluidSolver;
tubeWall3 solid;
}
\endverbatim
Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
pseudo-transient and steady simulations.
Usage
\b foamMultiRun [OPTION]
- \par -libs '(\"lib1.so\" ... \"libN.so\")'
Specify the additional libraries loaded
Example usage:
- To update and run a \c chtMultiRegion case add the following entries to
the controlDict:
\verbatim
application foamMultiRun;
regionSolvers
{
fluid fluid;
solid solid;
}
\endverbatim
then execute \c foamMultiRun
This commit is contained in:
@ -68,7 +68,6 @@ See also
|
||||
|
||||
#include "argList.H"
|
||||
#include "fvMesh.H"
|
||||
#include "regionProperties.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "ReadFields.H"
|
||||
@ -191,7 +190,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createTransforms.H"
|
||||
|
||||
const wordList regionNames(selectRegionNames(args, runTime));
|
||||
#include "setRegionNames.H"
|
||||
|
||||
const bool doRotateFields = args.optionFound("rotateFields");
|
||||
|
||||
@ -209,9 +208,13 @@ int main(int argc, char *argv[])
|
||||
forAll(regionNames, regioni)
|
||||
{
|
||||
const word& regionName = regionNames[regioni];
|
||||
const word& regionDir = Foam::regionDir(regionName);
|
||||
|
||||
fileName meshDir(regionDir/polyMesh::meshSubDir);
|
||||
const word& regionDir =
|
||||
regionName == polyMesh::defaultRegion
|
||||
? word::null
|
||||
: regionName;
|
||||
|
||||
const fileName meshDir(regionDir/polyMesh::meshSubDir);
|
||||
|
||||
pointIOField points
|
||||
(
|
||||
|
||||
@ -40,7 +40,7 @@ Usage
|
||||
Decompose named region. Does not check for existence of processor*.
|
||||
|
||||
- \par -allRegions \n
|
||||
Decompose all regions in regionProperties. Does not check for
|
||||
Decompose all regions in regionSolvers. Does not check for
|
||||
existence of processor*.
|
||||
|
||||
- \par -copyZero \n
|
||||
@ -76,7 +76,6 @@ Usage
|
||||
#include "decompositionMethod.H"
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "regionProperties.H"
|
||||
|
||||
#include "labelIOField.H"
|
||||
#include "labelFieldIOField.H"
|
||||
@ -275,9 +274,9 @@ int main(int argc, char *argv[])
|
||||
// Allow override of time
|
||||
const instantList times = runTimes.selectComplete(args);
|
||||
|
||||
// Get region names
|
||||
const wordList regionNames =
|
||||
selectRegionNames(args, runTimes.completeTime());
|
||||
const Time& runTime = runTimes.completeTime();
|
||||
|
||||
#include "setRegionNames.H"
|
||||
|
||||
// Remove existing processor directories if requested
|
||||
if (forceOverwrite)
|
||||
@ -362,7 +361,11 @@ int main(int argc, char *argv[])
|
||||
forAll(regionNames, regioni)
|
||||
{
|
||||
const word& regionName = regionNames[regioni];
|
||||
const word& regionDir = Foam::regionDir(regionName);
|
||||
|
||||
const word& regionDir =
|
||||
regionName == polyMesh::defaultRegion
|
||||
? word::null
|
||||
: regionName;
|
||||
|
||||
Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
|
||||
|
||||
|
||||
@ -36,7 +36,6 @@ Description
|
||||
#include "IOobjectList.H"
|
||||
#include "processorRunTimes.H"
|
||||
#include "domainDecomposition.H"
|
||||
#include "regionProperties.H"
|
||||
#include "fvFieldReconstructor.H"
|
||||
#include "pointFieldReconstructor.H"
|
||||
#include "reconstructLagrangian.H"
|
||||
@ -205,13 +204,19 @@ int main(int argc, char *argv[])
|
||||
// Allow override of time
|
||||
const instantList times = runTimes.selectProc(args);
|
||||
|
||||
// Get region names
|
||||
const wordList regionNames =
|
||||
selectRegionNames(args, runTimes.procTimes()[0]);
|
||||
const Time& runTime = runTimes.procTimes()[0];
|
||||
|
||||
#include "setRegionNames.H"
|
||||
|
||||
// Determine the processor count
|
||||
const label nProcs =
|
||||
fileHandler().nProcs(args.path(), regionDir(regionNames[0]));
|
||||
const label nProcs = fileHandler().nProcs
|
||||
(
|
||||
args.path(),
|
||||
regionNames[0] == polyMesh::defaultRegion
|
||||
? word::null
|
||||
: regionNames[0]
|
||||
);
|
||||
|
||||
if (!nProcs)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -261,7 +266,11 @@ int main(int argc, char *argv[])
|
||||
forAll(regionNames, regioni)
|
||||
{
|
||||
const word& regionName = regionNames[regioni];
|
||||
const word& regionDir = Foam::regionDir(regionName);
|
||||
|
||||
const word& regionDir =
|
||||
regionName == polyMesh::defaultRegion
|
||||
? word::null
|
||||
: regionName;
|
||||
|
||||
// Create meshes
|
||||
Info<< "\n\nReconstructing mesh " << regionName << nl << endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,15 +28,14 @@ Description
|
||||
This utility sets up a multi-region case using template files for
|
||||
material properties, field and system files.
|
||||
|
||||
The utility reads constant/materialProperties to create a
|
||||
regionProperties file and to create region directories containing
|
||||
required files within the 0, system and constant directories. The
|
||||
materialProperties file contains mesh region names with an
|
||||
associated physical region type and a material:
|
||||
The utility reads constant/materialProperties to create a regionSolvers list
|
||||
and to create region directories containing required files within the 0,
|
||||
system and constant directories. The materialProperties file contains mesh
|
||||
region names with an associated solver and a material:
|
||||
|
||||
bottomAir
|
||||
{
|
||||
type fluid;
|
||||
solver fluid;
|
||||
material air;
|
||||
}
|
||||
|
||||
@ -61,6 +60,8 @@ Description
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "dictionaryEntry.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -87,58 +88,35 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
IOdictionary regionProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"regionProperties",
|
||||
runTime.constant(),
|
||||
runTime
|
||||
),
|
||||
dictionary::null
|
||||
);
|
||||
|
||||
const fileName currentDir(runTime.path());
|
||||
const fileName materialsDir(currentDir/"templates"/"materials");
|
||||
const fileName systemDir(currentDir/"templates"/"system");
|
||||
const fileName constantDir(currentDir/"templates"/"constant");
|
||||
const fileName timeDir(currentDir/"templates"/"0");
|
||||
|
||||
HashTable<wordList> regionInfo;
|
||||
dictionaryEntry regionSolvers
|
||||
(
|
||||
"regionSolvers",
|
||||
dictionary::null,
|
||||
dictionary::null
|
||||
);
|
||||
|
||||
forAllConstIter(dictionary, materialProperties, regionIter)
|
||||
{
|
||||
// Read region subdict name, then its type and material entries
|
||||
const word& regionName = regionIter().keyword();
|
||||
const dictionary& regionDict = regionIter().dict();
|
||||
const word regionType(regionDict.lookup("type"));
|
||||
const word regionSolver(regionDict.lookup("solver"));
|
||||
const word regionMaterial(regionDict.lookup("material"));
|
||||
|
||||
Info<< "\nRegion " << regionName << ":\n"
|
||||
<< "\tCreating 0/" << regionName
|
||||
<< " directory" << endl;
|
||||
|
||||
// Create fluid and solid lists for regionProperties, e.g.
|
||||
// fluid ( bottomAir ... )
|
||||
HashTable<wordList>::iterator iter = regionInfo.find(regionType);
|
||||
|
||||
if (iter == regionInfo.end())
|
||||
{
|
||||
// Add fluid or solid list if does not exist
|
||||
regionInfo.insert(regionType, wordList(1, regionName));
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList& regionNames = iter();
|
||||
if (findIndex(regionNames, regionName) == -1)
|
||||
{
|
||||
// Append region name to fluid/solid list
|
||||
regionNames.append(regionName);
|
||||
}
|
||||
}
|
||||
regionSolvers.add(regionName, regionSolver);
|
||||
|
||||
// 0/<region>: from fluid/solid template
|
||||
const fileName sourceDir(timeDir/regionType);
|
||||
const fileName sourceDir(timeDir/regionSolver);
|
||||
if (isDir(sourceDir))
|
||||
{
|
||||
cpFiles(sourceDir, currentDir/"0"/regionName);
|
||||
@ -156,13 +134,13 @@ int main(int argc, char *argv[])
|
||||
Info<< "\tCreating constant/" << regionName
|
||||
<< " directory with " << regionMaterial
|
||||
<< " material" << endl;
|
||||
cpFiles(constantDir/regionType, currentDir/"constant"/regionName);
|
||||
cpFiles(constantDir/regionSolver, currentDir/"constant"/regionName);
|
||||
cpFiles(matDir, currentDir/"constant"/regionName);
|
||||
|
||||
// system/<region>: from fluid or solid template
|
||||
Info<< "\tCreating system/" << regionName
|
||||
<< " directory" << endl;
|
||||
cpFiles(systemDir/regionType, currentDir/"system"/regionName);
|
||||
cpFiles(systemDir/regionSolver, currentDir/"system"/regionName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -172,11 +150,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
regionProperties.add("regions", regionInfo);
|
||||
|
||||
Info<< "\nWriting region properties\n" << endl;
|
||||
|
||||
regionProperties.regIOobject::write();
|
||||
Info<< "\nWriting regionSolvers\n" << endl;
|
||||
{
|
||||
OFstream regionSolversFile(currentDir/runTime.system()/"regionSolvers");
|
||||
regionSolvers.write(regionSolversFile);
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user