foamRun, foamMultiRun: Pre-load the solver libraries before the mesh/meshes are constructed

to ensure that any solver-specific patch types are available before mesh construction.
This commit is contained in:
Henry Weller
2023-03-07 13:18:33 +00:00
parent cbd9903de4
commit 67e692b5a8
5 changed files with 26 additions and 5 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -37,7 +37,13 @@ Foam::regionSolvers::regionSolvers(const Time& runTime)
forAllConstIter(dictionary, regionSolversDict, iter)
{
append(Pair<word>(iter().keyword(), iter().stream()));
const word regionName(iter().keyword());
const word solverName(iter().stream());
// Load the solver library
solver::load(solverName);
append(Pair<word>(regionName, solverName));
}
}
else
@ -45,6 +51,7 @@ Foam::regionSolvers::regionSolvers(const Time& runTime)
// Partial backward-compatibility
// Converts the regions entry in the regionProperties dictionary into
// the regionSolvers list
// Only supports fluid and solid regions
typeIOobject<IOdictionary> regionPropertiesHeader
(

View File

@ -98,6 +98,11 @@ int main(int argc, char *argv[])
<< "solver not specified in the controlDict or on the command-line"
<< exit(FatalError);
}
else
{
// Load the solver library
solver::load(solverName);
}
// Create the default single region mesh
#include "createMesh.H"

View File

@ -8,7 +8,7 @@ EXE_INC = \
EXE_LIBS = \
-lfileFormats \
-lfiniteVolume \
-lgenericPatchFields \
-lmeshTools \
-lgenericPatches \
-ldynamicMesh \
-lextrudeModel

View File

@ -135,6 +135,9 @@ public:
fvMesh& mesh
);
//- Load the specified solver library
static void load(const word& solverName);
//- Destructor
virtual ~solver();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,6 +27,12 @@ License
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
void Foam::solver::load(const word& solverName)
{
libs.open("lib" + solverName + ".so");
}
Foam::autoPtr<Foam::solver> Foam::solver::New
(
const word& solverName,
@ -35,7 +41,7 @@ Foam::autoPtr<Foam::solver> Foam::solver::New
{
Info<< "Selecting solver " << solverName << endl;
libs.open("lib" + solverName + ".so");
load(solverName);
if (!fvMeshConstructorTablePtr_)
{