1 /*---------------------------------------------------------------------------* \
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "SRFVelocityFvPatchVectorField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "volFields.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
43 const DimensionedField<vector, volMesh>& iF
46 fixedValueFvPatchVectorField(p, iF),
48 inletValue_(p.size(), vector::zero)
52 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
54 const SRFVelocityFvPatchVectorField& ptf,
56 const DimensionedField<vector, volMesh>& iF,
57 const fvPatchFieldMapper& mapper
60 fixedValueFvPatchVectorField(ptf, p, iF, mapper),
61 relative_(ptf.relative_),
62 inletValue_(ptf.inletValue_, mapper)
66 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
69 const DimensionedField<vector, volMesh>& iF,
70 const dictionary& dict
73 fixedValueFvPatchVectorField(p, iF),
74 relative_(dict.lookup("relative")),
75 inletValue_("inletValue", dict, p.size())
77 fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
81 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
83 const SRFVelocityFvPatchVectorField& srfvpvf
86 fixedValueFvPatchVectorField(srfvpvf),
87 relative_(srfvpvf.relative_),
88 inletValue_(srfvpvf.inletValue_)
92 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
94 const SRFVelocityFvPatchVectorField& srfvpvf,
95 const DimensionedField<vector, volMesh>& iF
98 fixedValueFvPatchVectorField(srfvpvf, iF),
99 relative_(srfvpvf.relative_),
100 inletValue_(srfvpvf.inletValue_)
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 void SRFVelocityFvPatchVectorField::autoMap
108 const fvPatchFieldMapper& m
111 vectorField::autoMap(m);
112 inletValue_.autoMap(m);
116 void SRFVelocityFvPatchVectorField::rmap
118 const fvPatchVectorField& ptf,
119 const labelList& addr
122 fixedValueFvPatchVectorField::rmap(ptf, addr);
124 const SRFVelocityFvPatchVectorField& tiptf =
125 refCast<const SRFVelocityFvPatchVectorField>(ptf);
127 inletValue_.rmap(tiptf.inletValue_, addr);
131 void SRFVelocityFvPatchVectorField::updateCoeffs()
138 // If relative, include the effect of the SRF
141 // Get reference to the SRF model
142 const SRF::SRFModel& srf =
143 db().lookupObject<SRF::SRFModel>("SRFProperties");
145 // Determine patch velocity due to SRF
146 const vectorField SRFVelocity = srf.velocity(patch().Cf());
148 operator==(-SRFVelocity + inletValue_);
150 // If absolute, simply supply the inlet value as a fixed value
153 operator==(inletValue_);
156 fixedValueFvPatchVectorField::updateCoeffs();
160 void SRFVelocityFvPatchVectorField::write(Ostream& os) const
162 fvPatchVectorField::write(os);
163 os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
164 inletValue_.writeEntry("inletValue", os);
165 writeEntry("value", os);
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 SRFVelocityFvPatchVectorField
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 } // End namespace Foam
181 // ************************************************************************* //