uniformFixedValuePointPatchField.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) 2011-2023 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>
33 (
34  const pointPatch& p,
36  const dictionary& dict
37 )
38 :
39  fixedValuePointPatchField<Type>(p, iF, dict, false),
40  uniformValue_(Function1<Type>::New("uniformValue", dict))
41 {
42  if (dict.found("value"))
43  {
45  (
46  Field<Type>("value", dict, p.size())
47  );
48  }
49  else
50  {
51  const scalar t = this->db().time().userTimeValue();
52  fixedValuePointPatchField<Type>::operator=(uniformValue_->value(t));
53  }
54 }
55 
56 
57 template<class Type>
60 (
62  const pointPatch& p,
64  const pointPatchFieldMapper& mapper
65 )
66 :
67  fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
68  uniformValue_(ptf.uniformValue_, false)
69 {
70  // For safety re-evaluate
71  const scalar t = this->db().time().userTimeValue();
72  fixedValuePointPatchField<Type>::operator=(uniformValue_->value(t));
73 }
74 
75 
76 template<class Type>
79 (
82 )
83 :
84  fixedValuePointPatchField<Type>(ptf, iF),
85  uniformValue_(ptf.uniformValue_, false)
86 {
87  // For safety re-evaluate
88  const scalar t = this->db().time().userTimeValue();
89  fixedValuePointPatchField<Type>::operator==(uniformValue_->value(t));
90 }
91 
92 
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 
95 template<class Type>
97 {
98  if (this->updated())
99  {
100  return;
101  }
102 
103  const scalar t = this->db().time().userTimeValue();
104  fixedValuePointPatchField<Type>::operator==(uniformValue_->value(t));
105 
107 }
108 
109 
110 template<class Type>
112 write(Ostream& os) const
113 {
114  // Note: write value
116  writeEntry(os, uniformValue_());
117 }
118 
119 
120 // ************************************************************************* //
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:82
Run-time selectable general function of one variable.
Definition: Function1.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
scalar userTimeValue() const
Return current user time value.
Definition: Time.C:818
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A FixedValue boundary condition for pointField.
virtual void operator=(const Field< Type > &)
const Time & time() const
Return time.
Foam::pointPatchFieldMapper.
const objectRegistry & db() const
Return local objectRegistry.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:57
Enables the specification of a uniform fixed value boundary condition.
uniformFixedValuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void operator==(const valuePointPatchField< Type > &)
virtual void write(Ostream &) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dictionary dict
volScalarField & p