1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "nearWallFields.H"
27 #include "wordReList.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 defineTypeNameAndDebug(Foam::nearWallFields, 0);
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 Foam::nearWallFields::nearWallFields
39 const objectRegistry& obr,
40 const dictionary& dict,
41 const bool loadFromFiles
49 // Check if the available mesh is an fvMesh otherise deactivate
50 if (!isA<fvMesh>(obr_))
55 "nearWallFields::nearWallFields"
58 "const objectRegistry&, "
62 ) << "No fvMesh available, deactivating."
70 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
72 Foam::nearWallFields::~nearWallFields()
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 void Foam::nearWallFields::read(const dictionary& dict)
82 const fvMesh& mesh = refCast<const fvMesh>(obr_);
84 dict.lookup("fields") >> fieldSet_;
85 patchSet_ = mesh.boundaryMesh().patchSet
87 wordReList(dict.lookup("patches"))
89 distance_ = readScalar(dict.lookup("distance"));
92 // Clear out any previously loaded fields
99 reverseFieldMap_.clear();
102 // Generate fields with selfContainedDirectMapped bc.
104 // Convert field to map
105 fieldMap_.resize(2*fieldSet_.size());
106 reverseFieldMap_.resize(2*fieldSet_.size());
107 forAll(fieldSet_, setI)
109 const word& fldName = fieldSet_[setI].first();
110 const word& sampleFldName = fieldSet_[setI].second();
112 fieldMap_.insert(fldName, sampleFldName);
113 reverseFieldMap_.insert(sampleFldName, fldName);
118 createFields(vSpheretf_);
119 createFields(vSymmtf_);
125 void Foam::nearWallFields::execute()
131 sampleFields(vSpheretf_);
132 sampleFields(vSymmtf_);
138 void Foam::nearWallFields::end()
144 void Foam::nearWallFields::write()
149 Info<< "Writing sampled fields to " << obr_.time().timeName()
161 forAll(vSpheretf_, i)
163 vSpheretf_[i].write();
177 // ************************************************************************* //