uniformFixedGradientFvPatchField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
32 (
33  const fvPatch& p,
35  const Field<Type>& fld
36 )
37 :
38  fixedGradientFvPatchField<Type>(p, iF, fld),
39  uniformGradient_()
40 {}
41 
42 
43 template<class Type>
45 (
46  const fvPatch& p,
48  const dictionary& dict
49 )
50 :
51  fixedGradientFvPatchField<Type>(p, iF),
52  uniformGradient_
53  (
54  Function1<Type>::New
55  (
56  "uniformGradient",
57  this->db().time().userUnits(),
58  iF.dimensions()/dimLength,
59  dict
60  )
61  )
62 {
63  this->evaluate();
64 }
65 
66 
67 template<class Type>
69 (
71  const fvPatch& p,
73  const fieldMapper& mapper
74 )
75 :
76  fixedGradientFvPatchField<Type>(ptf, p, iF, mapper),
77  uniformGradient_(ptf.uniformGradient_, false)
78 {}
79 
80 
81 template<class Type>
83 (
86 )
87 :
88  fixedGradientFvPatchField<Type>(ptf, iF),
89  uniformGradient_(ptf.uniformGradient_, false)
90 {
91  // Evaluate the profile if defined
92  if (ptf.uniformGradient_.valid())
93  {
94  this->evaluate();
95  }
96 }
97 
98 
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 
101 template<class Type>
103 {
104  if (this->updated())
105  {
106  return;
107  }
108 
109  this->gradient() = uniformGradient_->value(this->db().time().value());
110 
112 }
113 
114 
115 template<class Type>
117 {
119  writeEntry
120  (
121  os,
122  this->db().time().userUnits(),
123  this->internalField().dimensions()/dimLength,
124  uniformGradient_()
125  );
126  writeEntry(os, "value", *this);
127 }
128 
129 
130 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:83
Run-time selectable general function of one variable.
Definition: Function1.H:125
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
This boundary condition supplies a fixed gradient condition, such that the patch values are calculate...
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
virtual void write(Ostream &) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:202
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
This boundary condition provides a uniform fixed gradient condition.
uniformFixedGradientFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const Field< Type > &fld)
Construct from patch and internal field and patch field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
Definition: dimensionSets.C:96
const dimensionSet dimLength
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
dictionary dict
volScalarField & p