Commit 80b8071e authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: add default control values to ease SIMPLE->PIMPLE transition

- add const-ness for control variables

- drop unused fluxGradp variable

- use lookupOrDefault instead of found/lookup combination
parent 0abf9b45
const dictionary& Bpiso = mesh.solutionDict().subDict("BPISO");
const dictionary& Bpiso = mesh.solutionDict().subDict("BPISO");
const int nBcorr = Bpiso.lookupOrDefault<int>("nCorrectors", 1);
int nBcorr(readInt(Bpiso.lookup("nCorrectors")));
dictionary simple = fluidRegions[i].solutionDict().subDict("SIMPLE");
const dictionary& simple = fluidRegions[i].solutionDict().subDict("SIMPLE");
int nNonOrthCorr = 0;
if (simple.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors"));
}
const int nNonOrthCorr =
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor = true;
if (simple.found("momentumPredictor"))
{
momentumPredictor = Switch(simple.lookup("momentumPredictor"));
}
const bool momentumPredictor =
simple.lookupOrDefault<bool>("momentumPredictor", true);
bool fluxGradp = false;
if (simple.found("fluxGradp"))
{
fluxGradp = Switch(simple.lookup("fluxGradp"));
}
const bool transonic =
simple.lookupOrDefault<bool>("transonic", false);
bool transonic = false;
if (simple.found("transonic"))
{
transonic = Switch(simple.lookup("transonic"));
}
dictionary simple = solidRegions[i].solutionDict().subDict("SIMPLE");
const dictionary& simple = solidRegions[i].solutionDict().subDict("SIMPLE");
const int nNonOrthCorr =
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
int nNonOrthCorr = 0;
if (simple.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors"));
}
const dictionary& pimple = mesh.solutionDict().subDict("PIMPLE");
int nCorr(readInt(pimple.lookup("nCorrectors")));
const int nCorr =
pimple.lookupOrDefault<int>("nCorrectors", 1);
int nNonOrthCorr =
const int nNonOrthCorr =
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor =
pimple.lookupOrDefault<Switch>("momentumPredictor", true);
const bool momentumPredictor =
pimple.lookupOrDefault<bool>("momentumPredictor", true);
dictionary piso = fluidRegions[i].solutionDict().subDict("PISO");
const dictionary& piso = fluidRegions[i].solutionDict().subDict("PISO");
int nCorr(readInt(piso.lookup("nCorrectors")));
const int nOuterCorr =
piso.lookupOrDefault<int>("nOuterCorrectors", 1);
int nNonOrthCorr = 0;
if (piso.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(piso.lookup("nNonOrthogonalCorrectors"));
}
const int nCorr =
piso.lookupOrDefault<int>("nCorrectors", 1);
bool momentumPredictor = true;
if (piso.found("momentumPredictor"))
{
momentumPredictor = Switch(piso.lookup("momentumPredictor"));
}
const int nNonOrthCorr =
piso.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool transonic = false;
if (piso.found("transonic"))
{
transonic = Switch(piso.lookup("transonic"));
}
const bool momentumPredictor =
piso.lookupOrDefault<bool>("momentumPredictor", true);
const bool transonic =
piso.lookupOrDefault<bool>("transonic", false);
int nOuterCorr = 1;
if (piso.found("nOuterCorrectors"))
{
nOuterCorr = readInt(piso.lookup("nOuterCorrectors"));
}
......@@ -4,4 +4,6 @@
const dictionary& pimple = solutionDict.subDict("PIMPLE");
int nOuterCorr(readInt(pimple.lookup("nOuterCorrectors")));
const int nOuterCorr =
pimple.lookupOrDefault<int>("nOuterCorrectors", 1);
const dictionary& piso = solidRegions[i].solutionDict().subDict("PISO");
int nNonOrthCorr = 0;
if (piso.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(piso.lookup("nNonOrthogonalCorrectors"));
}
const int nNonOrthCorr =
piso.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
# include "readTimeControls.H"
# include "readPIMPLEControls.H"
#include "readTimeControls.H"
#include "readPIMPLEControls.H"
bool correctPhi = false;
if (pimple.found("correctPhi"))
{
correctPhi = Switch(pimple.lookup("correctPhi"));
}
const bool correctPhi =
pimple.lookupOrDefault<bool>("correctPhi", false);
const bool checkMeshCourantNo =
pimple.lookupOrDefault<bool>("checkMeshCourantNo", false);
bool checkMeshCourantNo = false;
if (pimple.found("checkMeshCourantNo"))
{
checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo"));
}
#include "readPISOControls.H"
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "readTimeControls.H"
label nAlphaCorr
(
......@@ -19,14 +19,9 @@
<< exit(FatalError);
}
bool correctPhi = true;
if (piso.found("correctPhi"))
{
correctPhi = Switch(piso.lookup("correctPhi"));
}
const bool correctPhi =
piso.lookupOrDefault<bool>("correctPhi", true);
const bool checkMeshCourantNo =
piso.lookupOrDefault<bool>("checkMeshCourantNo", false);
bool checkMeshCourantNo = false;
if (piso.found("checkMeshCourantNo"))
{
checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo"));
}
# include "readTimeControls.H"
# include "readPISOControls.H"
bool correctPhi = true;
if (piso.found("correctPhi"))
{
correctPhi = Switch(piso.lookup("correctPhi"));
}
const bool correctPhi =
piso.lookupOrDefault<bool>("correctPhi", true);
const bool checkMeshCourantNo =
piso.lookupOrDefault<bool>("checkMeshCourantNo", false);
bool checkMeshCourantNo = false;
if (piso.found("checkMeshCourantNo"))
{
checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo"));
}
const dictionary& stressControl = mesh.solutionDict().subDict("stressAnalysis");
int nCorr(readInt(stressControl.lookup("nCorrectors")));
const int nCorr = stressControl.lookupOrDefault<int>("nCorrectors", 1);
scalar convergenceTolerance(readScalar(stressControl.lookup("D")));
Switch compactNormalStress(stressControl.lookup("compactNormalStress"));
dictionary pimple = mesh.solutionDict().subDict("PIMPLE");
const dictionary& pimple = mesh.solutionDict().subDict("PIMPLE");
int nOuterCorr(readInt(pimple.lookup("nOuterCorrectors")));
int nCorr(readInt(pimple.lookup("nCorrectors")));
const int nOuterCorr =
pimple.lookupOrDefault<int>("nOuterCorrectors", 1);
int nNonOrthCorr =
const int nCorr =
pimple.lookupOrDefault<int>("nCorrectors", 1);
const int nNonOrthCorr =
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor =
pimple.lookupOrDefault<Switch>("momentumPredictor", true);
const bool momentumPredictor =
pimple.lookupOrDefault<bool>("momentumPredictor", true);
const bool transonic =
pimple.lookupOrDefault<bool>("transonic", false);
bool transonic =
pimple.lookupOrDefault<Switch>("transonic", false);
dictionary piso = mesh.solutionDict().subDict("PISO");
const dictionary& piso = mesh.solutionDict().subDict("PISO");
int nCorr(readInt(piso.lookup("nCorrectors")));
const int nOuterCorr =
piso.lookupOrDefault<int>("nOuterCorrectors", 1);
const int nCorr =
piso.lookupOrDefault<int>("nCorrectors", 1);
int nNonOrthCorr =
const int nNonOrthCorr =
piso.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor =
piso.lookupOrDefault<Switch>("momentumPredictor", true);
const bool momentumPredictor =
piso.lookupOrDefault<bool>("momentumPredictor", true);
bool transonic =
piso.lookupOrDefault<Switch>("transonic", false);
const bool transonic =
piso.lookupOrDefault<bool>("transonic", false);
int nOuterCorr =
piso.lookupOrDefault<int>("nOuterCorrectors", 1);
dictionary simple = mesh.solutionDict().subDict("SIMPLE");
const dictionary& simple = mesh.solutionDict().subDict("SIMPLE");
int nNonOrthCorr =
const int nNonOrthCorr =
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor =
simple.lookupOrDefault<Switch>("momentumPredictor", true);
const bool momentumPredictor =
simple.lookupOrDefault<bool>("momentumPredictor", true);
bool fluxGradp =
simple.lookupOrDefault<Switch>("fluxGradp", false);
bool transonic =
simple.lookupOrDefault<Switch>("transonic", false);
const bool transonic =
simple.lookupOrDefault<bool>("transonic", false);
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -29,15 +29,11 @@ Description
\*---------------------------------------------------------------------------*/
Switch adjustTimeStep
(
runTime.controlDict().lookup("adjustTimeStep")
);
const bool adjustTimeStep =
runTime.controlDict().lookupOrDefault<bool>("adjustTimeStep", false);
scalar maxCo
(
readScalar(runTime.controlDict().lookup("maxCo"))
);
scalar maxCo =
runTime.controlDict().lookupOrDefault<scalar>("maxCo", 1.0);
scalar maxDeltaT =
runTime.controlDict().lookupOrDefault<scalar>("maxDeltaT", GREAT);
......
......@@ -46,7 +46,6 @@ PISO
nCorrectors 2;
nNonOrthogonalCorrectors 1;
momentumPredictor yes;
fluxGradp no;
}
......
......@@ -63,7 +63,6 @@ PISO
nCorrectors 2;
nNonOrthogonalCorrectors 0;
momentumPredictor yes;
fluxGradp no;
}
relaxationFactors
......
......@@ -71,7 +71,6 @@ PISO
nCorrectors 2;
nNonOrthogonalCorrectors 0;
momentumPredictor yes;
fluxGradp no;
}
relaxationFactors
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment