pressureReference.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) 2017-2021 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 "pressureReference.H"
27 #include "findRefCell.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
32 (
33  const volScalarField& p,
34  const volScalarField& pRef,
35  const dictionary& dict,
36  const bool pRefRequired
37 )
38 :
39  refCell_(-1),
40  refValue_(0)
41 {
42  // Set the reference cell and value for closed domain simulations
43  if (pRefRequired)
44  {
45  setRefCell(p, pRef, dict, refCell_, refValue_);
46  }
47 
48  // Print update message fvSolution -> fvConstraints
49  if
50  (
51  dict.found("pMin")
52  || dict.found("pMax")
53  || dict.found("pMinFactor")
54  || dict.found("pMaxFactor")
55  || dict.found("rhoMin")
56  || dict.found("rhoMax")
57  )
58  {
60  << "Pressure limits should now be specified in fvConstraints:\n\n"
61  "limitp\n"
62  "{\n"
63  " type limitPressure;\n"
64  "\n";
65 
66  if (dict.found("pMin"))
67  {
69  << " min " << dict.lookup<scalar>("pMin")
70  << ";\n";
71  }
72 
73  if (dict.found("pMax"))
74  {
76  << " max " << dict.lookup<scalar>("pMax")
77  << ";\n";
78  }
79 
80  if (dict.found("pMinFactor"))
81  {
83  << " minFactor " << dict.lookup<scalar>("pMinFactor")
84  << ";\n";
85  }
86 
87  if (dict.found("pMaxFactor"))
88  {
90  << " maxFactor " << dict.lookup<scalar>("pMaxFactor")
91  << ";\n";
92  }
93 
94  FatalIOError << "}\n";
95 
96  if
97  (
98  dict.found("rhoMin")
99  || dict.found("rhoMax")
100  )
101  {
102  FatalIOError
103  << "\nrhoMin and rhoMax are no longer supported.\n";
104  }
105 
106  FatalIOError << exit(FatalIOError);
107  }
108 }
109 
110 
112 (
113  const volScalarField& p,
114  const dictionary& dict,
115  const bool pRefRequired
116 )
117 :
118  pressureReference(p, p, dict, pRefRequired)
119 {}
120 
121 
122 // ************************************************************************* //
pressureReference & pressureReference
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:663
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Find the reference cell nearest (in index) to the given cell but which is not on a cyclic...
pressureReference(const volScalarField &p, const volScalarField &pRef, const dictionary &dict, const bool pRefRequired=true)
Construct from the simple/pimple sub-dictionary.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:318
bool setRefCell(const volScalarField &field, const volScalarField &fieldRef, const dictionary &dict, label &refCelli, scalar &refValue, const bool forceReference=false)
If the field fieldRef needs referencing find the reference cell nearest.
Definition: findRefCell.C:31
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864
IOerror FatalIOError