diff --git a/src/postProcessing/functionObjects/jobControl/Make/files b/src/postProcessing/functionObjects/jobControl/Make/files index 03a93b6bf162a19feadef94fd6f4666b12860a1a..c86cc727f689b657f05d9f02987279385353246e 100644 --- a/src/postProcessing/functionObjects/jobControl/Make/files +++ b/src/postProcessing/functionObjects/jobControl/Make/files @@ -1,7 +1,4 @@ abortCalculation/abortCalculation.C abortCalculation/abortCalculationFunctionObject.C -residualControl/residualControl.C -residualControl/residualControlFunctionObject.C - LIB = $(FOAM_LIBBIN)/libjobControl diff --git a/src/postProcessing/functionObjects/jobControl/residualControl/IOresidualControl.H b/src/postProcessing/functionObjects/jobControl/residualControl/IOresidualControl.H deleted file mode 100644 index 8a2b3bfed1396a2479cec1eae61113ba61fc14fb..0000000000000000000000000000000000000000 --- a/src/postProcessing/functionObjects/jobControl/residualControl/IOresidualControl.H +++ /dev/null @@ -1,49 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 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 3 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, see <http://www.gnu.org/licenses/>. - -Typedef - Foam::IOresidualControl - -Description - Instance of the generic IOOutputFilter for residualControl. - -\*---------------------------------------------------------------------------*/ - -#ifndef IOresidualControl_H -#define IOresidualControl_H - -#include "residualControl.H" -#include "IOOutputFilter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef IOOutputFilter<residualControl> IOresidualControl; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/jobControl/residualControl/controlDict b/src/postProcessing/functionObjects/jobControl/residualControl/controlDict deleted file mode 100644 index dcecfd0285325fc8f1ed7562a0099fb2e6e99bda..0000000000000000000000000000000000000000 --- a/src/postProcessing/functionObjects/jobControl/residualControl/controlDict +++ /dev/null @@ -1,68 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.com | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object controlDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -application icoFoam; - -startFrom startTime; - -startTime 0; - -stopAt endTime; - -endTime 0.5; - -deltaT 0.005; - -writeControl timeStep; - -writeInterval 20; - -purgeWrite 0; - -writeFormat ascii; - -writePrecision 6; - -writeCompression off; - -timeFormat general; - -timePrecision 6; - -runTimeModifiable true; - -functions -{ - convergenceChecks - { - type residualControl; - functionObjectLibs ( "libjobControl.so" ); - outputControl timeStep; - outputInterval 1; - - maxResiduals - { - p 5e-4; - U 1e-3; - - // possibly check turbulence fields - "(k|epsilon|omega)" 1e-3; - } - } -} - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/jobControl/residualControl/residualControl.C b/src/postProcessing/functionObjects/jobControl/residualControl/residualControl.C deleted file mode 100644 index b8205f86243407fb781910ab844e5e8d48d219aa..0000000000000000000000000000000000000000 --- a/src/postProcessing/functionObjects/jobControl/residualControl/residualControl.C +++ /dev/null @@ -1,173 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 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 3 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, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "residualControl.H" -#include "fvMesh.H" -#include "Time.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(Foam::residualControl, 0); - - -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -bool Foam::residualControl::checkCriteria(const bool verbose) const -{ - bool achieved = true; - const fvMesh& mesh = static_cast<const fvMesh&>(obr_); - const dictionary& solverDict = mesh.solverPerformanceDict(); - - forAllConstIter(dictionary, solverDict, iter) - { - const word& variableName = iter().keyword(); - scalar maxResidual; - - if (maxResiduals_.readIfPresent(variableName, maxResidual)) - { - // use the residual from the first solution - const scalar eqnResidual = - List<lduMatrix::solverPerformance> - ( - iter().stream() - ).first().initialResidual(); - - achieved = achieved && (eqnResidual < maxResidual); - - if (verbose) - { - Info<< " " << variableName - << ": requested max residual = " << maxResidual - << ", eqn residual = " << eqnResidual << nl; - } - } - } - - return achieved; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::residualControl::residualControl -( - const word& name, - const objectRegistry& obr, - const dictionary& dict, - const bool -) -: - name_(name), - obr_(obr), - active_(true), - maxResiduals_(), - criteriaSatisfied_(false) -{ - // Only active if a fvMesh is available - if (isA<fvMesh>(obr_)) - { - read(dict); - } - else - { - active_ = false; - WarningIn - ( - "residualControl::residualControl" - "(" - "const word&, " - "const objectRegistry&, " - "const dictionary&, " - "const bool" - ")" - ) << "No fvMesh available, deactivating." - << nl << endl; - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::residualControl::~residualControl() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::residualControl::read(const dictionary& dict) -{ - if (active_) - { - maxResiduals_ = dict.subDict("maxResiduals"); - } -} - - -void Foam::residualControl::execute() -{ - if (active_) - { - criteriaSatisfied_ = checkCriteria(false); - - if (criteriaSatisfied_) - { - Info<< "Convergence criteria satisfied - finalising run" << nl - << endl; - - checkCriteria(true); - - Info<< endl; - - const fvMesh& mesh = static_cast<const fvMesh&>(obr_); - Time& time = const_cast<Time&>(mesh.time()); - time.writeAndEnd(); - } - } -} - - -void Foam::residualControl::end() -{ - if (active_) - { - if (criteriaSatisfied_) - { - Info<< "Residual control criteria satisfied" << nl; - } - else - { - Info<< "Residual control criteria not satisfied" << nl; - } - } -} - - -void Foam::residualControl::write() -{ - // do nothing -} - - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/jobControl/residualControl/residualControl.H b/src/postProcessing/functionObjects/jobControl/residualControl/residualControl.H deleted file mode 100644 index 691fb089280ed90ab69a9a7f6ce6f2f5119812e9..0000000000000000000000000000000000000000 --- a/src/postProcessing/functionObjects/jobControl/residualControl/residualControl.H +++ /dev/null @@ -1,152 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 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 3 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, see <http://www.gnu.org/licenses/>. - -Class - Foam::residualControl - -Description - Function object that allows users to set target convergence criteria, and - stop the run if the conditions are satisfied. - -SourceFiles - residualControl.C - IOresidualControl.H - -\*---------------------------------------------------------------------------*/ - -#ifndef residualControl_H -#define residualControl_H - -#include "dictionary.H" -#include "pointFieldFwd.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class objectRegistry; -class dictionary; -class mapPolyMesh; - -/*---------------------------------------------------------------------------*\ - Class residualControl Declaration -\*---------------------------------------------------------------------------*/ - -class residualControl -{ -protected: - - // Private data - - //- Name of this object - word name_; - - //- Reference to object registry - const objectRegistry& obr_; - - //- On/off switch - on if obr_ is an fvMesh object - bool active_; - - //- Dictionary of variable names vs max residual - dictionary maxResiduals_; - - //- Flag to indicate whether convergence criteria have been met - bool criteriaSatisfied_; - - - // Protected Member Functions - - //- Perform residual control checks - bool checkCriteria(const bool verbose) const; - - //- Disallow default bitwise copy construct - residualControl(const residualControl&); - - //- Disallow default bitwise assignment - void operator=(const residualControl&); - - -public: - - //- Runtime type information - TypeName("residualControl"); - - - // Constructors - - //- Construct for given objectRegistry and dictionary. - // Allow the possibility to load fields from files - residualControl - ( - const word& name, - const objectRegistry& obr, - const dictionary& dict, - const bool loadFromFilesUnused = false - ); - - - //- Destructor - virtual ~residualControl(); - - - // Member Functions - - //- Return name of the residual criteria check name - virtual const word& name() const - { - return name_; - } - - //- Read the system calls - virtual void read(const dictionary&); - - //- Check the residual criteria at each time-step - virtual void execute(); - - //- Report residual criteria check at the final time-loop - virtual void end(); - - //- Write, not used - virtual void write(); - - //- Update for changes of mesh - virtual void updateMesh(const mapPolyMesh&) - {} - - //- Update for changes of mesh - virtual void movePoints(const pointField&) - {} -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/jobControl/residualControl/residualControlFunctionObject.C b/src/postProcessing/functionObjects/jobControl/residualControl/residualControlFunctionObject.C deleted file mode 100644 index 1813e2063ea5c42f7747c1c7f4802a6e7bc27c73..0000000000000000000000000000000000000000 --- a/src/postProcessing/functionObjects/jobControl/residualControl/residualControlFunctionObject.C +++ /dev/null @@ -1,42 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 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 3 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, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "residualControlFunctionObject.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineNamedTemplateTypeNameAndDebug(residualControlFunctionObject, 0); - - addToRunTimeSelectionTable - ( - functionObject, - residualControlFunctionObject, - dictionary - ); -} - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/jobControl/residualControl/residualControlFunctionObject.H b/src/postProcessing/functionObjects/jobControl/residualControl/residualControlFunctionObject.H deleted file mode 100644 index 19981b40f618657a94041fc189c07c2760a55180..0000000000000000000000000000000000000000 --- a/src/postProcessing/functionObjects/jobControl/residualControl/residualControlFunctionObject.H +++ /dev/null @@ -1,54 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 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 3 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, see <http://www.gnu.org/licenses/>. - -Typedef - Foam::residualControlFunctionObject - -Description - FunctionObject wrapper around residualControl to allow them to be created - via the functions entry within controlDict. - -SourceFiles - residualControlFunctionObject.C - -\*---------------------------------------------------------------------------*/ - -#ifndef residualControlFunctionObject_H -#define residualControlFunctionObject_H - -#include "residualControl.H" -#include "OutputFilterFunctionObject.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef OutputFilterFunctionObject<residualControl> - residualControlFunctionObject; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* //