mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -9,8 +9,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/RAS/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
basicSubGrid
|
||||
Foam::XiEqModels::basicSubGrid
|
||||
|
||||
Description
|
||||
Basic sub-grid obstacle flame-wrinking enhancement factor model.
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
basicSubGrid
|
||||
Foam::XiGModel::basicSubGrid
|
||||
|
||||
|
||||
Description
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
PDRDragModel
|
||||
Foam::PDRDragModel
|
||||
|
||||
Description
|
||||
Base-class for sub-grid obstacle drag models.
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
basic
|
||||
Foam::PDRDragModels::basic
|
||||
|
||||
Description
|
||||
Basic sub-grid obstacle drag model.
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
PDRkEpsilon
|
||||
Foam::compressible::RASModels::PDRkEpsilon
|
||||
|
||||
Description
|
||||
Standard k-epsilon turbulence model with additional source terms
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Gulder
|
||||
Foam::XiEqModels::Gulder
|
||||
|
||||
Description
|
||||
Simple Gulder model for XiEq based on Gulders correlation
|
||||
|
||||
@ -23,10 +23,10 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
SCOPEBlend
|
||||
Foam::XiEqModels::SCOPEBlend
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
SCOPEBlend.C
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
SCOPEXiEq
|
||||
Foam::XiEqModel::SCOPEXiEq
|
||||
|
||||
Description
|
||||
Simple SCOPEXiEq model for XiEq based on SCOPEXiEqs correlation
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
XiEqModel
|
||||
Foam::XiEqModel
|
||||
|
||||
Description
|
||||
Base-class for all XiEq models used by the b-XiEq combustion model.
|
||||
|
||||
@ -23,10 +23,10 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
instability
|
||||
Foam::XiEqModels::instability
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
instability.C
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
KTS
|
||||
Foam::XiGModels::KTS
|
||||
|
||||
Description
|
||||
Simple Kolmogorov time-scale model for the flame-wrinling generation rate.
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
XiGModel
|
||||
Foam::XiGModel
|
||||
|
||||
Description
|
||||
Base-class for all Xi generation models used by the b-Xi combustion model.
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
instabilityG
|
||||
Foam::XiGModels::instabilityG
|
||||
|
||||
Description
|
||||
Flame-surface instabilityG flame-wrinking generation rate coefficient model.
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
XiModel
|
||||
Foam::XiModel
|
||||
|
||||
Description
|
||||
Base-class for all Xi models used by the b-Xi combustion model.
|
||||
@ -102,8 +102,6 @@ namespace Foam
|
||||
Class XiModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
class XiModel
|
||||
{
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
algebraic
|
||||
Foam::XiModels::algebraic
|
||||
|
||||
Description
|
||||
Simple algebraic model for Xi based on Gulders correlation
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
fixed
|
||||
Foam::XiModels::fixed
|
||||
|
||||
Description
|
||||
Fixed value model for Xi.
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
transport
|
||||
Foam::XiModels::transport
|
||||
|
||||
Description
|
||||
Simple transport model for Xi based on Gulders correlation
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
SCOPE
|
||||
Foam::laminarFlameSpeedModels::SCOPE
|
||||
|
||||
Description
|
||||
Laminar flame speed obtained from the SCOPE correlation.
|
||||
|
||||
@ -74,24 +74,26 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
// Store divU from the previous mesh for the correctPhi
|
||||
volScalarField divU = fvc::div(phi);
|
||||
|
||||
gh = g & mesh.C();
|
||||
ghf = g & mesh.Cf();
|
||||
}
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
//***HGW#include "correctPhi.H"
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
@ -102,6 +104,12 @@ int main(int argc, char *argv[])
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
gh = g & mesh.C();
|
||||
ghf = g & mesh.Cf();
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
// --- Outer-corrector loop
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
{
|
||||
#include "continuityErrs.H"
|
||||
|
||||
volScalarField pcorr
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pcorr",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("pcorr", pd.dimensions(), 0.0),
|
||||
pcorrTypes
|
||||
);
|
||||
|
||||
dimensionedScalar rAUf("(1|A(U))", dimTime/rho.dimensions(), 1.0);
|
||||
|
||||
adjustPhi(phi, U, pcorr);
|
||||
|
||||
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(rAUf, pcorr) == fvc::div(phi) - divU
|
||||
);
|
||||
|
||||
pcorrEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pcorrEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
}
|
||||
@ -150,3 +150,14 @@
|
||||
(
|
||||
incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
|
||||
);
|
||||
|
||||
|
||||
wordList pcorrTypes(pd.boundaryField().types());
|
||||
|
||||
for (label i=0; i<pd.boundaryField().size(); i++)
|
||||
{
|
||||
if (pd.boundaryField()[i].fixesValue())
|
||||
{
|
||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
namedEnumTest.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/NamedEnum
|
||||
EXE = $(FOAM_USER_APPBIN)/NamedEnum
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
callbackTest.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/callbackTest
|
||||
EXE = $(FOAM_USER_APPBIN)/callbackTest
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
testDataEntry.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/testDataEntry
|
||||
EXE = $(FOAM_USER_APPBIN)/testDataEntry
|
||||
|
||||
@ -30,6 +30,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOstreams.H"
|
||||
#include "IOobject.H"
|
||||
#include "IFstream.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
@ -40,18 +41,12 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
IFstream dictStream("testDict");
|
||||
dictionary testDict(dictStream);
|
||||
Info<< dictionary(IFstream("testDict")()) << endl;
|
||||
|
||||
Info<< testDict << endl;
|
||||
IOobject::writeDivider(Info);
|
||||
|
||||
{
|
||||
dictionary someDict;
|
||||
someDict.add(keyType("a.*", true), "subdictValue");
|
||||
|
||||
dictionary dict;
|
||||
dict.add("someDict", someDict);
|
||||
dict.add(keyType(".*", true), "parentValue");
|
||||
dictionary dict(IFstream("testDictRegex")());
|
||||
|
||||
Info<< "dict:" << dict << endl;
|
||||
|
||||
@ -64,6 +59,18 @@ int main(int argc, char *argv[])
|
||||
Info<< "Recursive wildcard find \"def\" in sub directory : "
|
||||
<< dict.subDict("someDict").lookup("def", true)
|
||||
<< endl;
|
||||
Info<< "Recursive wildcard find \"foo\" in sub directory : "
|
||||
<< dict.subDict("someDict").lookup("foo", true)
|
||||
<< endl;
|
||||
Info<< "Recursive wildcard find \"fooz\" in sub directory : "
|
||||
<< dict.subDict("someDict").lookup("fooz", true)
|
||||
<< endl;
|
||||
Info<< "Recursive wildcard find \"bar\" in sub directory : "
|
||||
<< dict.subDict("someDict").lookup("bar", true)
|
||||
<< endl;
|
||||
Info<< "Recursive wildcard find \"xxx\" in sub directory : "
|
||||
<< dict.subDict("someDict").lookup("xxx", true)
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
34
applications/test/dictionary/testDictRegex
Normal file
34
applications/test/dictionary/testDictRegex
Normal file
@ -0,0 +1,34 @@
|
||||
/*-------------------------------*- C++ -*---------------------------------*\
|
||||
| ========= |
|
||||
| \\ / OpenFOAM |
|
||||
| \\ / |
|
||||
| \\ / The Open Source CFD Toolbox |
|
||||
| \\/ http://www.OpenFOAM.org |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object testDictRegex;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#inputMode merge
|
||||
|
||||
".*" parentValue1;
|
||||
"[n-z].*" parentValue2;
|
||||
"f.*" parentValue3;
|
||||
|
||||
someDict
|
||||
{
|
||||
foo subdictValue0;
|
||||
bar $f.*; // should this really match 'foo'?
|
||||
|
||||
// result is dependent on insert order!
|
||||
"a.*c" subdictValue3;
|
||||
"ab.*" subdictValue2;
|
||||
"a.*" subdictValue1;
|
||||
abcd subdictValue4;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -28,6 +28,7 @@ Description
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "timeSelector.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -36,13 +37,19 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
// timeSelector::addOptions();
|
||||
timeSelector::addOptions(true, true);
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
|
||||
Info<< runTime.times() << endl;
|
||||
Info<< "Times found:" << runTime.times() << endl;
|
||||
|
||||
Info << "End\n" << endl;
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
Info<< "Times selected:" << timeDirs << endl;
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
3
applications/test/regex/Make/files
Normal file
3
applications/test/regex/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
regexTest.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/regexTest
|
||||
3
applications/test/regex/Make/options
Normal file
3
applications/test/regex/Make/options
Normal file
@ -0,0 +1,3 @@
|
||||
EXE_LIBS = \
|
||||
$(FOAM_LIBBIN)/libOSspecific.o
|
||||
|
||||
85
applications/test/regex/regexTest.C
Normal file
85
applications/test/regex/regexTest.C
Normal file
@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOstreams.H"
|
||||
#include "IOobject.H"
|
||||
#include "IFstream.H"
|
||||
#include "regExp.H"
|
||||
#include "List.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
List<Tuple2<string, string> > rawList(IFstream("testRegexps")());
|
||||
Info<< "input list:" << rawList << endl;
|
||||
IOobject::writeDivider(Info);
|
||||
Info<< endl;
|
||||
|
||||
List<string> groups;
|
||||
|
||||
// report matches:
|
||||
forAll(rawList, elemI)
|
||||
{
|
||||
const string& pat = rawList[elemI].first();
|
||||
const string& str = rawList[elemI].second();
|
||||
regExp re(pat);
|
||||
|
||||
Info<< str << " =~ m/" << pat.c_str() << "/ == ";
|
||||
|
||||
if (re.match(str, groups))
|
||||
{
|
||||
Info<< "true";
|
||||
if (re.ngroups())
|
||||
{
|
||||
Info<< groups;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "false";
|
||||
if (re.match(str, true))
|
||||
{
|
||||
Info<< " partial match";
|
||||
}
|
||||
}
|
||||
Info << endl;
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
20
applications/test/regex/testRegexps
Normal file
20
applications/test/regex/testRegexps
Normal file
@ -0,0 +1,20 @@
|
||||
/*-------------------------------*- C++ -*---------------------------------*\
|
||||
| ========= |
|
||||
| \\ / OpenFOAM |
|
||||
| \\ / |
|
||||
| \\ / The Open Source CFD Toolbox |
|
||||
| \\/ http://www.OpenFOAM.org |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// pattern, string
|
||||
(
|
||||
( "a.*" "abc" )
|
||||
( "a.*" "bac" )
|
||||
( "a.*" "abcd" )
|
||||
( "a.*" "def" )
|
||||
( "d(.*)f" "def" )
|
||||
)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -26,7 +26,7 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "stringList.H"
|
||||
#include "stringListOps.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
xferListTest.C
|
||||
|
||||
/* EXE = $(FOAM_USER_APPBIN)/xferListTest */
|
||||
EXE = ./xferListTest
|
||||
EXE = $(FOAM_USER_APPBIN)/xferListTest
|
||||
|
||||
@ -45,8 +45,10 @@ Description
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// enable -constant ... if someone really wants it
|
||||
// enable -zeroTime to prevent accidentally trashing the initial fields
|
||||
timeSelector::addOptions(true, true);
|
||||
argList::noParallel();
|
||||
timeSelector::addOptions();
|
||||
# include "addRegionOption.H"
|
||||
argList::validOptions.insert("fields", "\"(list of fields)\"");
|
||||
|
||||
|
||||
@ -74,7 +74,9 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// with -constant and -zeroTime
|
||||
// enable -constant
|
||||
// probably don't need -zeroTime though, since the fields are vetted
|
||||
// afterwards anyhow
|
||||
timeSelector::addOptions(true, false);
|
||||
argList::noParallel();
|
||||
argList::validOptions.insert("ascii", "");
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
foamUpgradeFvSolution.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/foamUpgradeFvSolution
|
||||
@ -0,0 +1,109 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
foamUpgradeFvSolution
|
||||
|
||||
Description
|
||||
Simple tool to upgrade the syntax of system/fvSolution::solvers
|
||||
|
||||
Usage
|
||||
|
||||
- foamUpgradeFvSolution [OPTION]
|
||||
|
||||
@param -test \n
|
||||
Suppress writing the updated fvSolution file
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "solution.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
argList::validOptions.insert("test", "");
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
|
||||
IOdictionary solutionDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"fvSolution",
|
||||
runTime.system(),
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
label nChanged = 0;
|
||||
entry* e = solutionDict.lookupEntryPtr("solvers", false, false);
|
||||
if (e && e->isDict())
|
||||
{
|
||||
nChanged = solution::upgradeSolverDict(e->dict(), true);
|
||||
}
|
||||
|
||||
Info<< nChanged << " solver settings changed" << nl << endl;
|
||||
if (nChanged)
|
||||
{
|
||||
if (args.options().found("test"))
|
||||
{
|
||||
Info<< "-test option: no changes made" << nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
mv
|
||||
(
|
||||
solutionDict.objectPath(),
|
||||
solutionDict.objectPath() + ".old"
|
||||
);
|
||||
|
||||
solutionDict.writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED
|
||||
);
|
||||
|
||||
Info<< "Backup to " << (solutionDict.objectPath() + ".old") << nl
|
||||
<< "Write to " << solutionDict.objectPath() << nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user