solutionControlTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2013 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "GeometricField.H"
30 #include "volMesh.H"
31 #include "fvPatchField.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 template<class Type>
37 {
39 
40  HashTable<GeoField*> flds(mesh_.objectRegistry::lookupClass<GeoField>());
41 
42  forAllIters(flds, iter)
43  {
44  GeoField& fld = *iter();
45 
46  const word& fldName = fld.name();
47 
48  if
49  (
50  (fldName.find("PrevIter") == std::string::npos)
51  && mesh_.relaxField(fldName)
52  )
53  {
54  DebugInfo
55  << algorithmName_ << ": storing previous iter for "
56  << fldName << endl;
57 
58  fld.storePrevIter();
59  }
60  }
61 }
62 
63 
64 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
volMesh.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::solutionControl::algorithmName_
const word algorithmName_
The dictionary name, e.g. SIMPLE, PIMPLE.
Definition: solutionControl.H:90
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
forAllIters
#define forAllIters(container, iter)
Iterate across all elements in the container object.
Definition: stdFoam.H:223
Foam::HashTable
A HashTable similar to std::unordered_map.
Definition: HashTable.H:105
GeometricField.H
DebugInfo
#define DebugInfo
Report an information message using Foam::Info.
Definition: messageStream.H:382
Foam::solutionControl::mesh_
fvMesh & mesh_
Reference to the mesh database.
Definition: solutionControl.H:84
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::solution::relaxField
bool relaxField(const word &name) const
Return true if the relaxation factor is given for the field.
Definition: solution.C:269
Foam::solutionControl::storePrevIter
void storePrevIter() const
Store previous iteration field for vol<Type>Fields.
Definition: solutionControlTemplates.C:36
fvPatchField.H