From e273893a50df6be777f6a66b7f871bcbe89e5ae3 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 7 Apr 2010 14:19:11 +0200 Subject: [PATCH 01/36] ENH: add separate printNotes() method to argList --- src/OpenFOAM/global/argList/argList.C | 34 ++++++++++++++++----------- src/OpenFOAM/global/argList/argList.H | 3 +++ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index fb567c113b..0640d3d731 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -750,6 +750,25 @@ Foam::argList::~argList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void Foam::argList::printNotes() const +{ + // output notes directly - no automatic text wrapping + if (!notes.empty()) + { + Info<< nl; + for + ( + SLList::const_iterator iter = notes.begin(); + iter != notes.end(); + ++iter + ) + { + Info<< iter().c_str() << nl; + } + } +} + + void Foam::argList::printUsage() const { Info<< "\nUsage: " << executable_ << " [OPTIONS]"; @@ -819,20 +838,7 @@ void Foam::argList::printUsage() const ); - // output notes directly - no automatic text wrapping - if (!notes.empty()) - { - Info<< nl; - for - ( - SLList::const_iterator iter = notes.begin(); - iter != notes.end(); - ++iter - ) - { - Info<< iter().c_str() << nl; - } - } + printNotes(); Info<< nl <<"Using OpenFOAM-" << Foam::FOAMversion diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index 3e9785ebe4..c36955d5ce 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -329,6 +329,9 @@ public: // Print + //- Print notes (if any) + void printNotes() const; + //- Print usage void printUsage() const; From ec284e38187ba6695c2c2af47294f0d20349cad8 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 7 Apr 2010 14:24:18 +0200 Subject: [PATCH 02/36] BUG: DynamicList copy constructor was explicit --- src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H index 2e70a2c4f8..0efe82bed6 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H @@ -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 @@ -101,7 +101,7 @@ public: explicit inline DynamicList(const label); //- Construct copy. - explicit inline DynamicList + inline DynamicList ( const DynamicList& ); @@ -116,7 +116,7 @@ public: //- Construct by transferring the parameter contents explicit inline DynamicList(const Xfer >&); - //- Construct from Istream. Size set to size of read list. + //- Construct from Istream. Size set to size of list read. explicit DynamicList(Istream&); From b2b3e8d25bedc1cd868a4d2cc44940953c660029 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 8 Apr 2010 10:06:41 +0100 Subject: [PATCH 03/36] ENH: Added residualControl function object - allows users to specify target maximum equation intial residuals, and stop the run if the conditions are achieved --- .../residualControl/IOresidualControl.H | 49 +++++ .../residualControl/Make/files | 4 + .../residualControl/Make/options | 9 + .../residualControl/controlDict | 67 +++++++ .../residualControl/residualControl.C | 174 ++++++++++++++++++ .../residualControl/residualControl.H | 152 +++++++++++++++ .../residualControlFunctionObject.C | 42 +++++ .../residualControlFunctionObject.H | 54 ++++++ 8 files changed, 551 insertions(+) create mode 100644 src/postProcessing/functionObjects/residualControl/IOresidualControl.H create mode 100644 src/postProcessing/functionObjects/residualControl/Make/files create mode 100644 src/postProcessing/functionObjects/residualControl/Make/options create mode 100644 src/postProcessing/functionObjects/residualControl/controlDict create mode 100644 src/postProcessing/functionObjects/residualControl/residualControl.C create mode 100644 src/postProcessing/functionObjects/residualControl/residualControl.H create mode 100644 src/postProcessing/functionObjects/residualControl/residualControlFunctionObject.C create mode 100644 src/postProcessing/functionObjects/residualControl/residualControlFunctionObject.H diff --git a/src/postProcessing/functionObjects/residualControl/IOresidualControl.H b/src/postProcessing/functionObjects/residualControl/IOresidualControl.H new file mode 100644 index 0000000000..8a2b3bfed1 --- /dev/null +++ b/src/postProcessing/functionObjects/residualControl/IOresidualControl.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +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 IOresidualControl; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/residualControl/Make/files b/src/postProcessing/functionObjects/residualControl/Make/files new file mode 100644 index 0000000000..c3bc44fe41 --- /dev/null +++ b/src/postProcessing/functionObjects/residualControl/Make/files @@ -0,0 +1,4 @@ +residualControl.C +residualControlFunctionObject.C + +LIB = $(FOAM_LIBBIN)/libresidualControl diff --git a/src/postProcessing/functionObjects/residualControl/Make/options b/src/postProcessing/functionObjects/residualControl/Make/options new file mode 100644 index 0000000000..5166bcc9e3 --- /dev/null +++ b/src/postProcessing/functionObjects/residualControl/Make/options @@ -0,0 +1,9 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -lsampling diff --git a/src/postProcessing/functionObjects/residualControl/controlDict b/src/postProcessing/functionObjects/residualControl/controlDict new file mode 100644 index 0000000000..0af8ff7c9a --- /dev/null +++ b/src/postProcessing/functionObjects/residualControl/controlDict @@ -0,0 +1,67 @@ +*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ 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 uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + + +functions +( + convergenceChecks + { + type residualControl; + functionObjectLibs ( "libresidualControl.so" ); + outputControl timeStep; + outputInterval 1; + + maxResiduals + ( + (p 5e-4) + (U 1e-3) + ); + } +); + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/residualControl/residualControl.C b/src/postProcessing/functionObjects/residualControl/residualControl.C new file mode 100644 index 0000000000..aed8e38dc1 --- /dev/null +++ b/src/postProcessing/functionObjects/residualControl/residualControl.C @@ -0,0 +1,174 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#include "residualControl.H" +#include "dictionary.H" +#include "fvMesh.H" +#include "Time.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(residualControl, 0); +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +bool Foam::residualControl::checkCriteria(const bool output) const +{ + bool achieved = true; + const fvMesh& mesh = static_cast(obr_); + const dictionary& solverDict = mesh.solverPerformanceDict(); + forAll(maxResiduals_, i) + { + const word& variableName = maxResiduals_[i].first(); + if (solverDict.found(variableName)) + { + const scalar maxResidual = maxResiduals_[i].second(); + + const lduMatrix::solverPerformance + sp(solverDict.lookup(variableName)); + + const scalar eqnResidual = sp.initialResidual(); + + achieved = achieved && (eqnResidual < maxResidual); + + if (output) + { + 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(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_) + { + dict.lookup("maxResiduals") >> 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(obr_); + Time& time = const_cast(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/residualControl/residualControl.H b/src/postProcessing/functionObjects/residualControl/residualControl.H new file mode 100644 index 0000000000..c222019298 --- /dev/null +++ b/src/postProcessing/functionObjects/residualControl/residualControl.H @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +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 "pointFieldFwd.H" +#include "Tuple2.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_; + + //- List of variable name vs max residual + List > maxResiduals_; + + //- Flag to indicate whether convergence criteria have been met + bool criteriaSatisfied_; + + + // Protected Member Functions + + //- Perform residual control checks + bool checkCriteria(const bool output) 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 system call set + virtual const word& name() const + { + return name_; + } + + //- Read the system calls + virtual void read(const dictionary&); + + //- Execute the "executeCalls" at each time-step + virtual void execute(); + + //- Execute the "endCalls" at the final time-loop + virtual void end(); + + //- Write, execute the "writeCalls" + 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/residualControl/residualControlFunctionObject.C b/src/postProcessing/functionObjects/residualControl/residualControlFunctionObject.C new file mode 100644 index 0000000000..1813e2063e --- /dev/null +++ b/src/postProcessing/functionObjects/residualControl/residualControlFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#include "residualControlFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(residualControlFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + residualControlFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/residualControl/residualControlFunctionObject.H b/src/postProcessing/functionObjects/residualControl/residualControlFunctionObject.H new file mode 100644 index 0000000000..19981b40f6 --- /dev/null +++ b/src/postProcessing/functionObjects/residualControl/residualControlFunctionObject.H @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +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 + residualControlFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 99fa564bef440e048d91091478b5bead3b05d11a Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 8 Apr 2010 10:31:33 +0100 Subject: [PATCH 04/36] solverPerformance: added a "max" function Improves the handling of residuals from the segregated solution of vectors and tensors. --- .../matrices/lduMatrix/lduMatrix/lduMatrix.H | 10 ++++++++++ .../lduMatrix/lduMatrix/lduMatrixTests.C | 20 +++++++++++++++++++ .../fvMatrices/fvMatrix/fvMatrixSolve.C | 9 +-------- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index b96925a91b..860a593b83 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -210,6 +210,16 @@ public: void print() const; + // Friend functions + + //- Return the element-wise maximum of two solverPerformances + friend solverPerformance max + ( + const solverPerformance&, + const solverPerformance& + ); + + // Ostream Operator friend Ostream& operator<<(Ostream&, const solverPerformance&); diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTests.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTests.C index c1fafc95ec..c4c8774098 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTests.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTests.C @@ -118,6 +118,25 @@ void Foam::lduMatrix::solverPerformance::print() const } +Foam::lduMatrix::solverPerformance::solverPerformance Foam::max +( + const lduMatrix::solverPerformance& sp1, + const lduMatrix::solverPerformance& sp2 +) +{ + return lduMatrix::solverPerformance + ( + sp1.solverName(), + sp1.fieldName_, + max(sp1.initialResidual(), sp2.initialResidual()), + max(sp1.finalResidual(), sp2.finalResidual()), + max(sp1.nIterations(), sp2.nIterations()), + sp1.converged() && sp2.converged(), + sp1.singular() || sp2.singular() + ); +} + + Foam::Ostream& Foam::operator<< ( Ostream& os, @@ -137,4 +156,5 @@ Foam::Ostream& Foam::operator<< return os; } + // ************************************************************************* // diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index aa3fe8dd3f..e1984ef878 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -149,14 +149,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve solverPerf.print(); - if - ( - solverPerf.initialResidual() > solverPerfVec.initialResidual() - && !solverPerf.singular() - ) - { - solverPerfVec = solverPerf; - } + solverPerfVec = max(solverPerfVec, solverPerf); psi.internalField().replace(cmpt, psiCmpt); diag() = saveDiag; From 5d754679946151a6b159cdec219d4029022bb57b Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 8 Apr 2010 12:10:51 +0100 Subject: [PATCH 05/36] ENH: Added residualControl to functionObjects Allwmake script --- src/postProcessing/functionObjects/Allwmake | 1 + 1 file changed, 1 insertion(+) diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake index 6c642dfe7b..980a308557 100755 --- a/src/postProcessing/functionObjects/Allwmake +++ b/src/postProcessing/functionObjects/Allwmake @@ -6,6 +6,7 @@ wmake libso field wmake libso forces wmake libso IO wmake libso utilities +wmake libso residualControl wmake libso systemCall # ----------------------------------------------------------------- end-of-file From 22717f323ff24f346e1c974baf3cf5f891646fe3 Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 8 Apr 2010 13:01:28 +0100 Subject: [PATCH 06/36] Time: Handle side-effects from functionObjects when checking the "running" status. --- src/OpenFOAM/db/Time/Time.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index dd0c02ddbc..8e18dc7861 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -519,6 +519,10 @@ bool Foam::Time::loop() if (running) { operator++(); + + // Check update the "running" status following the "++" operation + // to take into account possible side-effects from functionObjects + running = run(); } return running; From 00015a749ced3d5303801c288c436ed81bfdbada Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 8 Apr 2010 16:36:28 +0100 Subject: [PATCH 07/36] ENH: Initial commit of surface film modelling functionality - film approximated as single layer mesh, generated using extrudeToRegionMesh utility - library implemented in a hierarchy similar to lagrangian/intermediate: - currently includes kinematic and thermodynamic variants - sub-models include: - film detachment/dripping - phase change (place holder only) - works in parallel - currently in beta status --- src/surfaceFilmModels/Make/files | 26 + src/surfaceFilmModels/Make/options | 7 + ...rectMappedFixedInternalValueFvPatchField.C | 162 +++ ...rectMappedFixedInternalValueFvPatchField.H | 150 +++ ...ectMappedFixedInternalValueFvPatchFields.C | 43 + ...ectMappedFixedInternalValueFvPatchFields.H | 49 + ...MappedFixedInternalValueFvPatchFieldsFwd.H | 50 + ...ppedFixedPushedInternalValueFvPatchField.C | 133 +++ ...ppedFixedPushedInternalValueFvPatchField.H | 157 +++ ...pedFixedPushedInternalValueFvPatchFields.C | 43 + ...pedFixedPushedInternalValueFvPatchFields.H | 49 + ...FixedPushedInternalValueFvPatchFieldsFwd.H | 50 + ...ilmHeightInletVelocityFvPatchVectorField.C | 167 +++ ...ilmHeightInletVelocityFvPatchVectorField.H | 198 +++ .../injectionModel/injectionModel.C | 71 ++ .../injectionModel/injectionModel.H | 160 +++ .../injectionModel/injectionModelI.H | 44 + .../injectionModel/newInjectionModel.C | 59 + .../injectionModel/noInjection/noInjection.C | 72 ++ .../injectionModel/noInjection/noInjection.H | 104 ++ .../removeInjection/removeInjection.C | 71 ++ .../removeInjection/removeInjection.H | 104 ++ .../noPhaseChange/noPhaseChange.C | 67 ++ .../noPhaseChange/noPhaseChange.H | 100 ++ .../phaseChangeModel/newPhaseChangeModel.C | 59 + .../phaseChangeModel/phaseChangeModel.C | 81 ++ .../phaseChangeModel/phaseChangeModel.H | 155 +++ .../phaseChangeModel/phaseChangeModelI.H | 44 + .../kinematicSingleLayer.C | 1062 +++++++++++++++++ .../kinematicSingleLayer.H | 482 ++++++++ .../kinematicSingleLayerI.H | 221 ++++ .../kinematicSingleLayerTemplates.C | 62 + .../surfaceFilmModel/noFilm/noFilm.C | 209 ++++ .../surfaceFilmModel/noFilm/noFilm.H | 173 +++ .../surfaceFilmModel/newSurfaceFilmModel.C | 78 ++ .../surfaceFilmModel/surfaceFilmModel.C | 166 +++ .../surfaceFilmModel/surfaceFilmModel.H | 250 ++++ .../surfaceFilmModel/surfaceFilmModelI.H | 44 + .../thermoSingleLayer/thermoSingleLayer.C | 394 ++++++ .../thermoSingleLayer/thermoSingleLayer.H | 280 +++++ .../thermoSingleLayer/thermoSingleLayerI.H | 113 ++ 41 files changed, 6009 insertions(+) create mode 100644 src/surfaceFilmModels/Make/files create mode 100644 src/surfaceFilmModels/Make/options create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C create mode 100644 src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H create mode 100644 src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C create mode 100644 src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H create mode 100644 src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelI.H create mode 100644 src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/newInjectionModel.C create mode 100644 src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C create mode 100644 src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.H create mode 100644 src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C create mode 100644 src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H create mode 100644 src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C create mode 100644 src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H create mode 100644 src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/newPhaseChangeModel.C create mode 100644 src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C create mode 100644 src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H create mode 100644 src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelI.H create mode 100644 src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C create mode 100644 src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.H create mode 100644 src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayerI.H create mode 100644 src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayerTemplates.C create mode 100644 src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.C create mode 100644 src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.H create mode 100644 src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/newSurfaceFilmModel.C create mode 100644 src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.C create mode 100644 src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.H create mode 100644 src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModelI.H create mode 100644 src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C create mode 100644 src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.H create mode 100644 src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayerI.H diff --git a/src/surfaceFilmModels/Make/files b/src/surfaceFilmModels/Make/files new file mode 100644 index 0000000000..aecce33191 --- /dev/null +++ b/src/surfaceFilmModels/Make/files @@ -0,0 +1,26 @@ +/* Surface film models */ +surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.C +surfaceFilmModel/surfaceFilmModel/newSurfaceFilmModel.C +surfaceFilmModel/noFilm/noFilm.C +surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C +surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C + + +/* Sub-models */ +submodels/kinematic/injectionModel/injectionModel/injectionModel.C +submodels/kinematic/injectionModel/injectionModel/newInjectionModel.C +submodels/kinematic/injectionModel/noInjection/noInjection.C +submodels/kinematic/injectionModel/removeInjection/removeInjection.C + +submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C +submodels/thermo/phaseChangeModel/phaseChangeModel/newPhaseChangeModel.C +submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C + + +/* Boundary conditions */ +derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C +derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C +derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C + + +LIB = $(FOAM_LIBBIN)/libsurfaceFilmModels diff --git a/src/surfaceFilmModels/Make/options b/src/surfaceFilmModels/Make/options new file mode 100644 index 0000000000..d27c95d033 --- /dev/null +++ b/src/surfaceFilmModels/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C new file mode 100644 index 0000000000..9c84101d85 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFixedInternalValueFvPatchField.H" +#include "UIndirectList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + directMappedFixedValueFvPatchField(p, iF) +{} + + +template +directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const directMappedFixedInternalValueFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + directMappedFixedValueFvPatchField(ptf, p, iF, mapper) +{} + + +template +directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + directMappedFixedValueFvPatchField(p, iF, dict) +{} + + +template +directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const directMappedFixedInternalValueFvPatchField& ptf +) +: + directMappedFixedValueFvPatchField(ptf) +{} + + +template +directMappedFixedInternalValueFvPatchField:: +directMappedFixedInternalValueFvPatchField +( + const directMappedFixedInternalValueFvPatchField& ptf, + const DimensionedField& iF +) +: + directMappedFixedValueFvPatchField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void directMappedFixedInternalValueFvPatchField::updateCoeffs() +{ + typedef GeometricField FieldType; + + if (this->updated()) + { + return; + } + + // Retrieve the neighbour values and assign to this patch boundary field + directMappedFixedValueFvPatchField::updateCoeffs(); + + // Get the coupling information from the directMappedPatchBase + const directMappedPatchBase& mpp = + refCast(this->patch().patch()); + const polyMesh& nbrMesh = mpp.sampleMesh(); + const fvPatch& nbrPatch = + refCast + ( + nbrMesh + ).boundary()[mpp.samplePolyPatch().index()]; + + // Force recalculation of mapping and schedule + const mapDistribute& distMap = mpp.map(); + + // Retrieve the neighbour field + const fvPatchField& nbrField = + nbrPatch.lookupPatchField + ( + this->dimensionedInternalField().name() + ); + + // Retrieve the neighbour patch internal field + Field nbrIntFld = nbrField.patchInternalField(); + mapDistribute::distribute + ( + Pstream::defaultCommsType, + distMap.schedule(), + distMap.constructSize(), + distMap.subMap(), // what to send + distMap.constructMap(), // what to receive + nbrIntFld + ); + + // Assign (this) patch internal field to its neighbour values + Field& intFld = const_cast&>(this->internalField()); + UIndirectList(intFld, this->patch().faceCells()) = nbrIntFld; +} + + +template +void directMappedFixedInternalValueFvPatchField::write(Ostream& os) const +{ + directMappedFixedValueFvPatchField::write(os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H new file mode 100644 index 0000000000..4aef5ebd2c --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H @@ -0,0 +1,150 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +Class + Foam::directMappedFixedInternalValueFvPatchField + +Description + Recycles the boundary and internal values of a neighbour patch field to + the boundary and internal values of *this. + +SourceFiles + directMappedFixedInternalValueFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedInternalValueFvPatchField_H +#define directMappedFixedInternalValueFvPatchField_H + +#include "directMappedFixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class directMappedFixedInternalValueFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class directMappedFixedInternalValueFvPatchField +: + public directMappedFixedValueFvPatchField +{ + +public: + + //- Runtime type information + TypeName("directMappedFixedInternalValue"); + + + // Constructors + + //- Construct from patch and internal field + directMappedFixedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + directMappedFixedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // directMappedFixedInternalValueFvPatchField onto a new patch + directMappedFixedInternalValueFvPatchField + ( + const directMappedFixedInternalValueFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + directMappedFixedInternalValueFvPatchField + ( + const directMappedFixedInternalValueFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new directMappedFixedInternalValueFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + directMappedFixedInternalValueFvPatchField + ( + const directMappedFixedInternalValueFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new directMappedFixedInternalValueFvPatchField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "directMappedFixedInternalValueFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C new file mode 100644 index 0000000000..11a290c3c1 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFixedInternalValueFvPatchFields.H" +#include "volMesh.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(directMappedFixedInternalValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H new file mode 100644 index 0000000000..29301f9f0d --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedInternalValueFvPatchFields_H +#define directMappedFixedInternalValueFvPatchFields_H + +#include "directMappedFixedInternalValueFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(directMappedFixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000..55ee7d1ab6 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedInternalValueFvPatchFieldsFwd_H +#define directMappedFixedInternalValueFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class directMappedFixedInternalValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedFixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C new file mode 100644 index 0000000000..c9230d8adf --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFixedPushedInternalValueFvPatchField.H" +#include "UIndirectList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + directMappedFixedValueFvPatchField(p, iF) +{} + + +template +directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const directMappedFixedPushedInternalValueFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + directMappedFixedValueFvPatchField(ptf, p, iF, mapper) +{} + + +template +directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + directMappedFixedValueFvPatchField(p, iF, dict) +{} + + +template +directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const directMappedFixedPushedInternalValueFvPatchField& ptf +) +: + directMappedFixedValueFvPatchField(ptf) +{} + + +template +directMappedFixedPushedInternalValueFvPatchField:: +directMappedFixedPushedInternalValueFvPatchField +( + const directMappedFixedPushedInternalValueFvPatchField& ptf, + const DimensionedField& iF +) +: + directMappedFixedValueFvPatchField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void directMappedFixedPushedInternalValueFvPatchField::updateCoeffs() +{ + typedef GeometricField FieldType; + + if (this->updated()) + { + return; + } + + // Retrieve the neighbour values and assign to this patch boundary field + directMappedFixedValueFvPatchField::updateCoeffs(); + + // Assign the patch internal field to its boundary value + Field& intFld = const_cast&>(this->internalField()); + UIndirectList(intFld, this->patch().faceCells()) = *this; +} + + +template +void directMappedFixedPushedInternalValueFvPatchField::write +( + Ostream& os +) const +{ + directMappedFixedValueFvPatchField::write(os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H new file mode 100644 index 0000000000..3074b80896 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +Class + Foam::directMappedFixedPushedInternalValueFvPatchField + +Description + Recycles the boundary values of a neighbour patch field to the boundary + and internal values of *this. + +SourceFiles + directMappedFixedPushedInternalValueFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedPushedInternalValueFvPatchField_H +#define directMappedFixedPushedInternalValueFvPatchField_H + +#include "directMappedFixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class directMappedFixedPushedInternalValueFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class directMappedFixedPushedInternalValueFvPatchField +: + public directMappedFixedValueFvPatchField +{ + +public: + + //- Runtime type information + TypeName("directMappedFixedPushedInternalValue"); + + + // Constructors + + //- Construct from patch and internal field + directMappedFixedPushedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + directMappedFixedPushedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given a + // directMappedFixedPushedInternalValueFvPatchField onto a new patch + directMappedFixedPushedInternalValueFvPatchField + ( + const directMappedFixedPushedInternalValueFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + directMappedFixedPushedInternalValueFvPatchField + ( + const directMappedFixedPushedInternalValueFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new directMappedFixedPushedInternalValueFvPatchField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + directMappedFixedPushedInternalValueFvPatchField + ( + const directMappedFixedPushedInternalValueFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new directMappedFixedPushedInternalValueFvPatchField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "directMappedFixedPushedInternalValueFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C new file mode 100644 index 0000000000..b7ab210106 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFixedPushedInternalValueFvPatchFields.H" +#include "volMesh.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(directMappedFixedPushedInternalValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H new file mode 100644 index 0000000000..9d5a800af5 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedPushedInternalValueFvPatchFields_H +#define directMappedFixedPushedInternalValueFvPatchFields_H + +#include "directMappedFixedPushedInternalValueFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(directMappedFixedPushedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000..5ef59b5645 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedPushedInternalValueFvPatchFieldsFwd_H +#define directMappedFixedPushedInternalValueFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class directMappedFixedPushedInternalValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedFixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C b/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C new file mode 100644 index 0000000000..576d48d663 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#include "filmHeightInletVelocityFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF), + phiName_("phi"), + rhoName_("rho"), + deltafName_("deltaf") +{} + + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const filmHeightInletVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + phiName_(ptf.phiName_), + rhoName_(ptf.rhoName_), + deltafName_(ptf.deltafName_) +{} + + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + phiName_(dict.lookupOrDefault("phi", "phi")), + rhoName_(dict.lookupOrDefault("rho", "rho")), + deltafName_(dict.lookupOrDefault("deltaf", "deltaf")) +{ + fvPatchVectorField::operator=(vectorField("value", dict, p.size())); +} + + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const filmHeightInletVelocityFvPatchVectorField& fhivpvf +) +: + fixedValueFvPatchVectorField(fhivpvf), + phiName_(fhivpvf.phiName_), + rhoName_(fhivpvf.rhoName_), + deltafName_(fhivpvf.deltafName_) +{} + + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const filmHeightInletVelocityFvPatchVectorField& fhivpvf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(fhivpvf, iF), + phiName_(fhivpvf.phiName_), + rhoName_(fhivpvf.rhoName_), + deltafName_(fhivpvf.deltafName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::filmHeightInletVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const fvsPatchField& phip = + patch().lookupPatchField(phiName_); + + const fvPatchField& rhop = + patch().lookupPatchField(rhoName_); + + const fvPatchField& deltafp = + patch().lookupPatchField(deltafName_); + + vectorField n = patch().nf(); + const scalarField& magSf = patch().magSf(); + + operator==(deltafp*n*phip/(rhop*magSf*sqr(deltafp) + ROOTVSMALL)); + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +void Foam::filmHeightInletVelocityFvPatchVectorField::write(Ostream& os) const +{ + fvPatchVectorField::write(os); + writeEntryIfDifferent(os, "phi", "phi", phiName_); + writeEntryIfDifferent(os, "rho", "rho", rhoName_); + writeEntryIfDifferent(os, "deltaf", "deltaf", deltafName_); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void Foam::filmHeightInletVelocityFvPatchVectorField::operator= +( + const fvPatchField& pvf +) +{ + fvPatchField::operator=(patch().nf()*(patch().nf() & pvf)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + filmHeightInletVelocityFvPatchVectorField + ); +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H b/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H new file mode 100644 index 0000000000..3c6132cd6c --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H @@ -0,0 +1,198 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Class + Foam::filmHeightInletVelocityFvPatchVectorField + +Description + Velocity inlet boundary condition for patches where the film height is + specified. The inflow velocity is obtained from the flux with a direction + normal to the patch faces. + +SourceFiles + filmHeightInletVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef filmHeightInletVelocityFvPatchVectorField_H +#define filmHeightInletVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class filmHeightInletVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class filmHeightInletVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Name of flux field + word phiName_; + + //- Name of density field + word rhoName_; + + //- Name of film height field + word deltafName_; + + +public: + + //- Runtime type information + TypeName("filmHeightInletVelocity"); + + + // Constructors + + //- Construct from patch and internal field + filmHeightInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + filmHeightInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given filmHeightInletVelocityFvPatchVectorField + // onto a new patch + filmHeightInletVelocityFvPatchVectorField + ( + const filmHeightInletVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + filmHeightInletVelocityFvPatchVectorField + ( + const filmHeightInletVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new filmHeightInletVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + filmHeightInletVelocityFvPatchVectorField + ( + const filmHeightInletVelocityFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new filmHeightInletVelocityFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the name of phi + const word& phiName() const + { + return phiName_; + } + + //- Return reference to the name of phi to allow adjustment + word& phiName() + { + return phiName_; + } + + //- Return the name of rho + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the name of rho to allow adjustment + word& rhoName() + { + return rhoName_; + } + + //- Return the name of deltaf + const word& deltafName() const + { + return deltafName_; + } + + //- Return reference to the name of df to allow adjustment + word& deltafName() + { + return deltafName_; + } + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; + + + // Member operators + + virtual void operator=(const fvPatchField& pvf); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C new file mode 100644 index 0000000000..96d59420ca --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(injectionModel, 0); + defineRunTimeSelectionTable(injectionModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::injectionModel::injectionModel +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + owner_(owner), + coeffs_(dictionary::null) +{} + + +Foam::surfaceFilmModels::injectionModel::injectionModel +( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict +) +: + owner_(owner), + coeffs_(dict.subDict(type + "Coeffs")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::injectionModel::~injectionModel() +{} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H new file mode 100644 index 0000000000..bc140539bf --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +Class + Foam::injectionModel + +Description + +SourceFiles + injectionModelI.H + injectionModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef injectionModel_H +#define injectionModel_H + +#include "surfaceFilmModel.H" +#include "runTimeSelectionTables.H" +#include "scalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class injectionModel Declaration +\*---------------------------------------------------------------------------*/ + +class injectionModel +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + injectionModel(const injectionModel&); + + //- Disallow default bitwise assignment + void operator=(const injectionModel&); + + +protected: + + // Protected data + + //- Reference to the owner surface film model + const surfaceFilmModel& owner_; + + //- Model coefficients dictionary + dictionary coeffs_; + + +public: + + //- Runtime type information + TypeName("injectionModel"); + + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + injectionModel, + dictionary, + ( + const surfaceFilmModel& owner, + const dictionary& dict + ), + (owner, dict) + ); + + // Constructors + + //- Construct null + injectionModel(const surfaceFilmModel& owner, const dictionary& dict); + + //- Construct from type name, dictionary and surface film model + injectionModel + ( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + // Selectors + + //- Return a reference to the selected phase change model + static autoPtr New + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~injectionModel(); + + + // Member Functions + + // Access + + //- Return the reference to the owner surface film model + inline const surfaceFilmModel& owner() const; + + //- Return the model coefficients dictionary + inline const dictionary& coeffs() const; + + + // Evolution + + //- Correct + virtual void correct + ( + scalarField& massToInject, + scalarField& diameterToInject + ) = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "injectionModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelI.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelI.H new file mode 100644 index 0000000000..2f3bf02ef1 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelI.H @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline const Foam::surfaceFilmModels::surfaceFilmModel& +Foam::surfaceFilmModels::injectionModel::owner() const +{ + return owner_; +} + + +inline const Foam::dictionary& +Foam::surfaceFilmModels::injectionModel::coeffs() const +{ + return coeffs_; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/newInjectionModel.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/newInjectionModel.C new file mode 100644 index 0000000000..7bddebcc8e --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/newInjectionModel.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::surfaceFilmModels::injectionModel::New +( + const surfaceFilmModel& model, + const dictionary& dict +) +{ + word modelType(dict.lookup("injectionModel")); + + Info<< " Selecting injectionModel " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "injectionModel::New(const surfaceFilmModel&, const dictionary&)" + ) << "Unknown injectionModel type " << modelType + << nl << nl << "Valid injectionModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(model, dict)); +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C new file mode 100644 index 0000000000..39d2c34706 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "noInjection.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(noInjection, 0); + addToRunTimeSelectionTable(injectionModel, noInjection, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noInjection::noInjection +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + injectionModel(owner, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noInjection::~noInjection() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::surfaceFilmModels::noInjection::correct +( + scalarField& massToInject, + scalarField& diameterToInject +) +{ + // no mass injected + massToInject = 0.0; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.H new file mode 100644 index 0000000000..7b1446ebab --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +Class + Foam::noInjection + +Description + Dummy injection model for 'none' + +SourceFiles + noInjection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noInjection_H +#define noInjection_H + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class noInjection Declaration +\*---------------------------------------------------------------------------*/ + +class noInjection +: + public injectionModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + noInjection(const noInjection&); + + //- Disallow default bitwise assignment + void operator=(const noInjection&); + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from surface film model + noInjection(const surfaceFilmModel& owner, const dictionary& dict); + + + //- Destructor + virtual ~noInjection(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct + ( + scalarField& massToInject, + scalarField& diameterToInject + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C new file mode 100644 index 0000000000..58fbd9fe5a --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#include "removeInjection.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(removeInjection, 0); + addToRunTimeSelectionTable(injectionModel, removeInjection, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::removeInjection::removeInjection +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + injectionModel(owner, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::removeInjection::~removeInjection() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::surfaceFilmModels::removeInjection::correct +( + scalarField&, + scalarField& +) +{ + // do nothing - all mass available to be removed +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H new file mode 100644 index 0000000000..4fc4a63fc4 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +Class + Foam::removeInjection + +Description + All mass available to be removed from the system is removed. + +SourceFiles + removeInjection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef removeInjection_H +#define removeInjection_H + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class removeInjection Declaration +\*---------------------------------------------------------------------------*/ + +class removeInjection +: + public injectionModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + removeInjection(const removeInjection&); + + //- Disallow default bitwise assignment + void operator=(const removeInjection&); + + +public: + + //- Runtime type information + TypeName("remove"); + + + // Constructors + + //- Construct from surface film model + removeInjection(const surfaceFilmModel& owner, const dictionary& dict); + + + //- Destructor + virtual ~removeInjection(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct + ( + scalarField& massToInject, + scalarField& diameterToInject + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C new file mode 100644 index 0000000000..551bfb2a44 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "noPhaseChange.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(noPhaseChange, 0); + addToRunTimeSelectionTable(phaseChangeModel, noPhaseChange, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noPhaseChange::noPhaseChange +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + phaseChangeModel(owner, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noPhaseChange::~noPhaseChange() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::surfaceFilmModels::noPhaseChange::correct() +{ + // do nothing +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H new file mode 100644 index 0000000000..487e3c2b3c --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +Class + Foam::noPhaseChange + +Description + Dummy phase change model for 'none' + +SourceFiles + noPhaseChange.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noPhaseChange_H +#define noPhaseChange_H + +#include "phaseChangeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class noPhaseChange Declaration +\*---------------------------------------------------------------------------*/ + +class noPhaseChange +: + public phaseChangeModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + noPhaseChange(const noPhaseChange&); + + //- Disallow default bitwise assignment + void operator=(const noPhaseChange&); + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from surface film model + noPhaseChange(const surfaceFilmModel& owner, const dictionary& dict); + + + //- Destructor + virtual ~noPhaseChange(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/newPhaseChangeModel.C b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/newPhaseChangeModel.C new file mode 100644 index 0000000000..7cc04c0027 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/newPhaseChangeModel.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "phaseChangeModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::surfaceFilmModels::phaseChangeModel::New +( + const surfaceFilmModel& model, + const dictionary& dict +) +{ + word modelType(dict.lookup("phaseChangeModel")); + + Info<< " Selecting phaseChangeModel " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "phaseChangeModel::New(const surfaceFilmModel&, const dictionary&)" + ) << "Unknown phaseChangeModel type " << modelType + << nl << nl << "Valid phaseChangeModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(model, dict)); +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C new file mode 100644 index 0000000000..e2a0b93a75 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "phaseChangeModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(phaseChangeModel, 0); + defineRunTimeSelectionTable(phaseChangeModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::phaseChangeModel::phaseChangeModel +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + owner_(owner), + coeffs_(dictionary::null) +{} + + +Foam::surfaceFilmModels::phaseChangeModel::phaseChangeModel +( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict +) +: + owner_(owner), + coeffs_(dict.subDict(type + "Coeffs")) +{ + WarningIn + ( + "phaseChangeModel::phaseChangeModel" + "(" + "const word&, " + "const surfaceFilmModel&, " + "const dictionary&" + ")" + ) << "Phase change models not implemented!" << endl; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::phaseChangeModel::~phaseChangeModel() +{} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H new file mode 100644 index 0000000000..87a08b1016 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +Class + Foam::phaseChangeModel + +Description + +SourceFiles + phaseChangeModelI.H + phaseChangeModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseChangeModel_H +#define phaseChangeModel_H + +#include "surfaceFilmModel.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class phaseChangeModel Declaration +\*---------------------------------------------------------------------------*/ + +class phaseChangeModel +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + phaseChangeModel(const phaseChangeModel&); + + //- Disallow default bitwise assignment + void operator=(const phaseChangeModel&); + + +protected: + + // Protected data + + //- Reference to the owner surface film model + const surfaceFilmModel& owner_; + + //- Model coefficients dictionary + dictionary coeffs_; + + +public: + + //- Runtime type information + TypeName("phaseChangeModel"); + + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + phaseChangeModel, + dictionary, + ( + const surfaceFilmModel& owner, + const dictionary& dict + ), + (owner, dict) + ); + + // Constructors + + //- Construct null + phaseChangeModel(const surfaceFilmModel& owner, const dictionary& dict); + + //- Construct from type name, dictionary and surface film model + phaseChangeModel + ( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + // Selectors + + //- Return a reference to the selected phase change model + static autoPtr New + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~phaseChangeModel(); + + + // Member Functions + + // Access + + //- Return the reference to the owner surface film model + inline const surfaceFilmModel& owner() const; + + //- Return the model coefficients dictionary + inline const dictionary& coeffs() const; + + + // Evolution + + //- Correct // TODO + virtual void correct() = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "phaseChangeModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelI.H b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelI.H new file mode 100644 index 0000000000..f893bbbfa7 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelI.H @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "phaseChangeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline const Foam::surfaceFilmModels::surfaceFilmModel& +Foam::surfaceFilmModels::phaseChangeModel::owner() const +{ + return owner_; +} + + +inline const Foam::dictionary& +Foam::surfaceFilmModels::phaseChangeModel::coeffs() const +{ + return coeffs_; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C new file mode 100644 index 0000000000..376d2cd199 --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C @@ -0,0 +1,1062 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +\*---------------------------------------------------------------------------*/ + +#include "kinematicSingleLayer.H" +#include "fvm.H" +#include "fvcDiv.H" +#include "fvcLaplacian.H" +#include "fvcSnGrad.H" +#include "fvcReconstruct.H" +#include "fvcVolumeIntegrate.H" +#include "addToRunTimeSelectionTable.H" +#include "directMappedWallPolyPatch.H" + +// Sub-models +#include "injectionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(kinematicSingleLayer, 0); + addToRunTimeSelectionTable + ( + surfaceFilmModel, + kinematicSingleLayer, + mesh + ); + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +bool Foam::surfaceFilmModels::kinematicSingleLayer::read() +{ + if (surfaceFilmModel::read()) + { + const dictionary& solution = filmRegion_.solutionDict().subDict("PISO"); + solution.lookup("momentumPredictor") >> momentumPredictor_; + solution.lookup("nOuterCorr") >> nOuterCorr_; + solution.lookup("nCorr") >> nCorr_; + solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; + + coeffs_.lookup("Cf") >> Cf_; + coeffs_.lookup("deltaStable") >> deltaStable_; + + return true; + } + else + { + return false; + } +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer::initialise() +{ + if (debug) + { + Pout<< "kinematicSingleLayer::initialise()" << endl; + } + + label nBoundaryFaces = 0; + DynamicList