diff --git a/applications/modules/fluidSolver/fluidSolver.C b/applications/modules/fluidSolver/fluidSolver.C index 1355dce211..810ab3fca2 100644 --- a/applications/modules/fluidSolver/fluidSolver.C +++ b/applications/modules/fluidSolver/fluidSolver.C @@ -42,9 +42,23 @@ namespace solvers // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::solvers::fluidSolver::readControls() +void Foam::solvers::fluidSolver::readControls(const bool construct) { - if (mesh.solution().modified()) + if (construct || runTime.controlDict().modified()) + { + maxCo = + runTime.controlDict().lookupOrDefault("maxCo", vGreat); + + maxDeltaT_ = + runTime.controlDict().found("maxDeltaT") + ? runTime.userTimeToTime + ( + runTime.controlDict().lookup("maxDeltaT") + ) + : vGreat; + } + + if (construct || mesh.solution().modified()) { correctPhi = pimple.dict().lookupOrDefault ( @@ -189,20 +203,14 @@ void Foam::solvers::fluidSolver::continuityErrors Foam::solvers::fluidSolver::fluidSolver(fvMesh& mesh) : solver(mesh), - maxCo - ( - mesh.time().controlDict().lookupOrDefault("maxCo", vGreat) - ), - maxDeltaT_ - ( - mesh.time().controlDict().lookupOrDefault("maxDeltaT", vGreat) - ), + maxCo(0), + maxDeltaT_(0), cumulativeContErr(0), CoNum_(0), CoNum(CoNum_) { // Read the controls - readControls(); + readControls(true); } diff --git a/applications/modules/fluidSolver/fluidSolver.H b/applications/modules/fluidSolver/fluidSolver.H index 61d2764344..db48b9b387 100644 --- a/applications/modules/fluidSolver/fluidSolver.H +++ b/applications/modules/fluidSolver/fluidSolver.H @@ -99,7 +99,7 @@ protected: scalar CoNum_; //- Read controls - void readControls(); + void readControls(const bool construct = false); //- Check mesh Courant numbers for moving mesh cases void meshCourantNo() const; diff --git a/applications/modules/isothermalFilm/isothermalFilm.C b/applications/modules/isothermalFilm/isothermalFilm.C index 0e2488de78..03773fd0ae 100644 --- a/applications/modules/isothermalFilm/isothermalFilm.C +++ b/applications/modules/isothermalFilm/isothermalFilm.C @@ -51,13 +51,21 @@ namespace solvers // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::solvers::isothermalFilm::readControls() +void Foam::solvers::isothermalFilm::readControls(const bool construct) { - maxCo = - runTime.controlDict().lookupOrDefault("maxCo", 1.0); + if (construct || runTime.controlDict().modified()) + { + maxCo = + runTime.controlDict().lookupOrDefault("maxCo", vGreat); - maxDeltaT_ = - runTime.controlDict().lookupOrDefault("maxDeltaT", vGreat); + maxDeltaT_ = + runTime.controlDict().found("maxDeltaT") + ? runTime.userTimeToTime + ( + runTime.controlDict().lookup("maxDeltaT") + ) + : vGreat; + } } @@ -394,7 +402,7 @@ Foam::solvers::isothermalFilm::isothermalFilm ) { // Read the controls - readControls(); + readControls(true); mesh.schemes().setFluxRequired(alpha.name()); momentumTransport->validate(); diff --git a/applications/modules/isothermalFilm/isothermalFilm.H b/applications/modules/isothermalFilm/isothermalFilm.H index 41a9d6b99c..30720e96d9 100644 --- a/applications/modules/isothermalFilm/isothermalFilm.H +++ b/applications/modules/isothermalFilm/isothermalFilm.H @@ -244,7 +244,7 @@ protected: // Protected Member Functions //- Read controls - void readControls(); + void readControls(const bool construct = false); public: diff --git a/applications/modules/isothermalFluid/isothermalFluid.C b/applications/modules/isothermalFluid/isothermalFluid.C index 04c5ed53fa..24116474d6 100644 --- a/applications/modules/isothermalFluid/isothermalFluid.C +++ b/applications/modules/isothermalFluid/isothermalFluid.C @@ -187,7 +187,7 @@ Foam::solvers::isothermalFluid::isothermalFluid phi(phi_) { // Read the controls - readControls(); + readControls(true); mesh.schemes().setFluxRequired(p.name()); momentumTransport->validate(); diff --git a/applications/modules/movingMesh/movingMesh.C b/applications/modules/movingMesh/movingMesh.C index b8cb8e266e..8a32a0d968 100644 --- a/applications/modules/movingMesh/movingMesh.C +++ b/applications/modules/movingMesh/movingMesh.C @@ -45,7 +45,12 @@ Foam::solvers::movingMesh::movingMesh(fvMesh& mesh) solver(mesh), maxDeltaT_ ( - runTime.controlDict().lookupOrDefault("maxDeltaT", vGreat) + runTime.controlDict().found("maxDeltaT") + ? runTime.userTimeToTime + ( + runTime.controlDict().lookup("maxDeltaT") + ) + : vGreat ) {} diff --git a/applications/modules/multiphaseEuler/multiphaseEuler/multiphaseEuler.C b/applications/modules/multiphaseEuler/multiphaseEuler/multiphaseEuler.C index 4316df8725..56cac2dbb9 100644 --- a/applications/modules/multiphaseEuler/multiphaseEuler/multiphaseEuler.C +++ b/applications/modules/multiphaseEuler/multiphaseEuler/multiphaseEuler.C @@ -45,21 +45,24 @@ namespace solvers // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::solvers::multiphaseEuler::readControls() +void Foam::solvers::multiphaseEuler::readControls(const bool construct) { - fluidSolver::readControls(); + fluidSolver::readControls(construct); - faceMomentum = - pimple.dict().lookupOrDefault("faceMomentum", false); + if (construct || mesh.solution().modified()) + { + faceMomentum = + pimple.dict().lookupOrDefault("faceMomentum", false); - dragCorrection = - pimple.dict().lookupOrDefault("dragCorrection", false); + dragCorrection = + pimple.dict().lookupOrDefault("dragCorrection", false); - partialElimination = - pimple.dict().lookupOrDefault("partialElimination", false); + partialElimination = + pimple.dict().lookupOrDefault("partialElimination", false); - nEnergyCorrectors = - pimple.dict().lookupOrDefault("nEnergyCorrectors", 1); + nEnergyCorrectors = + pimple.dict().lookupOrDefault("nEnergyCorrectors", 1); + } } @@ -184,7 +187,7 @@ Foam::solvers::multiphaseEuler::multiphaseEuler(fvMesh& mesh) phi(phi_) { // Read the controls - readControls(); + readControls(true); mesh.schemes().setFluxRequired(p_rgh.name()); diff --git a/applications/modules/multiphaseEuler/multiphaseEuler/multiphaseEuler.H b/applications/modules/multiphaseEuler/multiphaseEuler/multiphaseEuler.H index 1bed6ce246..bb0d19ad4f 100644 --- a/applications/modules/multiphaseEuler/multiphaseEuler/multiphaseEuler.H +++ b/applications/modules/multiphaseEuler/multiphaseEuler/multiphaseEuler.H @@ -156,7 +156,7 @@ protected: autoPtr divU; //- Read controls - void readControls(); + void readControls(const bool construct = false); private: diff --git a/applications/modules/shockFluid/shockFluid.C b/applications/modules/shockFluid/shockFluid.C index 5d5718abb3..6a10753d0f 100644 --- a/applications/modules/shockFluid/shockFluid.C +++ b/applications/modules/shockFluid/shockFluid.C @@ -184,7 +184,7 @@ Foam::solvers::shockFluid::shockFluid(fvMesh& mesh) phi(phi_) { // Read the controls - readControls(); + readControls(true); thermo.validate(type(), "e"); diff --git a/applications/modules/solid/solid.C b/applications/modules/solid/solid.C index 68eb611de0..68493b777d 100644 --- a/applications/modules/solid/solid.C +++ b/applications/modules/solid/solid.C @@ -43,13 +43,21 @@ namespace solvers // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::solvers::solid::readControls() +void Foam::solvers::solid::readControls(const bool construct) { - maxDi = - runTime.controlDict().lookupOrDefault("maxDi", 1.0); + if (construct || runTime.controlDict().modified()) + { + maxDi = + runTime.controlDict().lookupOrDefault("maxDi", 1.0); - maxDeltaT_ = - runTime.controlDict().lookupOrDefault("maxDeltaT", vGreat); + maxDeltaT_ = + runTime.controlDict().found("maxDeltaT") + ? runTime.userTimeToTime + ( + runTime.controlDict().lookup("maxDeltaT") + ) + : vGreat; + } } @@ -128,7 +136,7 @@ Foam::solvers::solid::solid(fvMesh& mesh) solid(mesh, solidThermo::New(mesh)) { // Read the controls - readControls(); + readControls(true); } diff --git a/applications/modules/solid/solid.H b/applications/modules/solid/solid.H index 5a92ce5d6c..c4f4d34e77 100644 --- a/applications/modules/solid/solid.H +++ b/applications/modules/solid/solid.H @@ -88,7 +88,7 @@ protected: // Protected Member Functions //- Read controls - virtual void readControls(); + virtual void readControls(const bool construct = false); private: diff --git a/applications/modules/solidDisplacement/solidDisplacement.C b/applications/modules/solidDisplacement/solidDisplacement.C index 24086fe25a..b8893ef4db 100644 --- a/applications/modules/solidDisplacement/solidDisplacement.C +++ b/applications/modules/solidDisplacement/solidDisplacement.C @@ -45,14 +45,17 @@ namespace solvers // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::solvers::solidDisplacement::readControls() +void Foam::solvers::solidDisplacement::readControls(const bool construct) { - solid::readControls(); + solid::readControls(construct); - nCorr = pimple.dict().lookupOrDefault("nCorrectors", 1); - convergenceTolerance = pimple.dict().lookupOrDefault("D", 0); - pimple.dict().lookup("compactNormalStress") >> compactNormalStress; - accFac = pimple.dict().lookupOrDefault("accelerationFactor", 1); + if (construct || mesh.solution().modified()) + { + nCorr = pimple.dict().lookupOrDefault("nCorrectors", 1); + convergenceTolerance = pimple.dict().lookupOrDefault("D", 0); + pimple.dict().lookup("compactNormalStress") >> compactNormalStress; + accFac = pimple.dict().lookupOrDefault("accelerationFactor", 1); + } } @@ -137,7 +140,7 @@ Foam::solvers::solidDisplacement::solidDisplacement(fvMesh& mesh) mesh.schemes().setFluxRequired(D.name()); // Read the controls - readControls(); + readControls(true); } diff --git a/applications/modules/solidDisplacement/solidDisplacement.H b/applications/modules/solidDisplacement/solidDisplacement.H index ff73d84e65..2449b8d2f5 100644 --- a/applications/modules/solidDisplacement/solidDisplacement.H +++ b/applications/modules/solidDisplacement/solidDisplacement.H @@ -124,7 +124,7 @@ protected: // Protected Member Functions //- Read controls - virtual void readControls(); + virtual void readControls(const bool construct = false); public: diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 75ad786f3a..98c7532af8 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -263,7 +263,7 @@ public: using TimePaths::path; //- Return the control dict - const dictionary& controlDict() const + const IOdictionary& controlDict() const { return controlDict_; }