motionSolver.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "motionSolverList.H"
27 #include "polyMesh.H"
28 #include "dictionaryEntry.H"
29 #include "twoDPointCorrector.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
37 }
38 
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 (
44  const word& name,
45  const polyMesh& mesh,
46  const dictionary& dict,
47  const word& type
48 )
49 :
50  name_(name),
51  mesh_(mesh),
52  coeffDict_(dict.optionalSubDict(type + "Coeffs"))
53 {}
54 
55 
57 {
59  return autoPtr<motionSolver>(nullptr);
60 }
61 
62 
63 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
64 
66 (
67  const word& name,
68  const polyMesh& mesh,
69  const dictionary& solverDict
70 )
71 {
72  const word solverTypeName = solverDict.lookup<word>("motionSolver");
73 
74  Info<< "Selecting motion solver: " << solverTypeName << endl;
75 
76  libs.open
77  (
78  solverDict,
79  "motionSolverLibs",
80  dictionaryConstructorTablePtr_
81  );
82 
83  if (!dictionaryConstructorTablePtr_)
84  {
86  << "solver table is empty"
87  << exit(FatalError);
88  }
89 
90  dictionaryConstructorTable::iterator cstrIter =
91  dictionaryConstructorTablePtr_->find(solverTypeName);
92 
93  if (cstrIter == dictionaryConstructorTablePtr_->end())
94  {
96  << "Unknown solver type "
97  << solverTypeName << nl << nl
98  << "Valid solver types are:" << endl
99  << dictionaryConstructorTablePtr_->sortedToc()
100  << exit(FatalError);
101  }
102 
103  return autoPtr<motionSolver>(cstrIter()(name, mesh, solverDict));
104 }
105 
106 
107 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
108 
110 {}
111 
112 
113 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 
116 {
117  solve();
118  return curPoints();
119 }
120 
121 
123 {
125 }
126 
127 
129 {
130  return true;
131 }
132 
133 
134 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:860
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:57
virtual ~motionSolver()
Destructor.
Definition: motionSolver.C:109
virtual tmp< pointField > newPoints()
Provide new points for motion. Solves for motion.
Definition: motionSolver.C:115
virtual void twoDCorrectPoints(pointField &) const
Correct point field for reduced-dimensionality cases.
Definition: motionSolver.C:122
static autoPtr< motionSolver > New(const word &name, const polyMesh &, const dictionary &)
Select constructed from polyMesh and dictionary.
Definition: motionSolver.C:66
virtual bool write() const
Optionally write motion state information for restart.
Definition: motionSolver.C:128
virtual autoPtr< motionSolver > clone() const
Clone function.
Definition: motionSolver.C:56
motionSolver(const word &name, const polyMesh &mesh, const dictionary &, const word &type)
Construct from polyMesh and dictionary and type.
Definition: motionSolver.C:43
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A class for managing temporary objects.
Definition: tmp.H:55
void correctPoints(pointField &p) const
Correct motion points.
A class for handling words, derived from string.
Definition: word.H:62
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
dlLibraryTable libs
Table of loaded dynamic libraries.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
messageStream Info
defineTypeNameAndDebug(combustionModel, 0)
error FatalError
static const char nl
Definition: Ostream.H:260
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
SolverPerformance< Type > solve(fvMatrix< Type > &, const word &)
Solve returning the solution statistics given convergence tolerance.
dictionary dict
volScalarField & p