fixedJumpFvPatchField.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-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 
26 #include "fixedJumpFvPatchField.H"
27 
28 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
29 
30 template<class Type>
32 {
33  if (!this->cyclicPatch().owner())
34  {
36  << "The jump field is not available on the neighbour patch"
37  << exit(FatalError);
38  }
39 
40  return jump_;
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
46 template<class Type>
48 (
49  const fvPatch& p,
51  const dictionary& dict,
52  const bool jumpRequired
53 )
54 :
55  jumpCyclicFvPatchField<Type>(p, iF, dict),
56  jump_(p.size())
57 {
58  if (jumpRequired)
59  {
60  if (this->cyclicPatch().owner())
61  {
62  jump_ = Field<Type>("jump", iF.dimensions(), dict, p.size());
63  }
64 
65  this->evaluateNoUpdateCoeffs();
66  }
67 }
68 
69 
70 template<class Type>
72 (
73  const fixedJumpFvPatchField<Type>& ptf,
74  const fvPatch& p,
76  const fieldMapper& mapper
77 )
78 :
79  jumpCyclicFvPatchField<Type>(ptf, p, iF, mapper),
80  jump_(mapper(ptf.jump_))
81 {}
82 
83 
84 template<class Type>
86 (
87  const fixedJumpFvPatchField<Type>& ptf,
89 )
90 :
91  jumpCyclicFvPatchField<Type>(ptf, iF),
92  jump_(ptf.jump_)
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
98 template<class Type>
100 {
101  if (this->cyclicPatch().owner())
102  {
103  return -jump_;
104  }
105  else
106  {
107  const fixedJumpFvPatchField<Type>& nbrField =
108  refCast<const fixedJumpFvPatchField<Type>>(this->nbrPatchField());
109 
110  return nbrField.jump_;
111  }
112 }
113 
114 
115 template<class Type>
117 (
118  const fvPatchField<Type>& ptf,
119  const fieldMapper& mapper
120 )
121 {
123 
124  const fixedJumpFvPatchField<Type>& tiptf =
125  refCast<const fixedJumpFvPatchField<Type>>(ptf);
126  mapper(jump_, tiptf.jump_);
127 }
128 
129 
130 template<class Type>
132 (
133  const fvPatchField<Type>& ptf
134 )
135 {
137 
138  const fixedJumpFvPatchField<Type>& tiptf =
139  refCast<const fixedJumpFvPatchField<Type>>(ptf);
140  jump_.reset(tiptf.jump_);
141 }
142 
143 
144 template<class Type>
146 {
148 
149  if (this->cyclicPatch().owner())
150  {
151  writeEntry(os, "jump", jump_);
152  }
153 }
154 
155 
156 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet & dimensions() const
Return dimensions.
Pre-declare SubField and related Field type.
Definition: Field.H:83
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
void evaluateNoUpdateCoeffs()
Evaluate the patch field, but don't update the coeffs.
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
const cyclicFvPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
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 provides a jump condition, using the cyclic condition as a base....
virtual void write(Ostream &) const
Write.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
fixedJumpFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const dictionary &, const bool jumpRequired=true)
Construct from patch, internal field and dictionary.
virtual tmp< Field< Type > > jump() const
Return the "jump".
Field< Type > & jumpRef()
Access the jump to modify it.
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:229
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
Definition: fvPatchField.C:195
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
This boundary condition provides a base class for cyclic conditions with a specified "jump" (or offse...
A class for managing temporary objects.
Definition: tmp.H:55
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
error FatalError
dictionary dict
volScalarField & p