rotatingTotalPressureFvPatchScalarField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
31 #include "fvPatchFieldMapper.H"
32 #include "volFields.H"
33 #include "surfaceFields.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
39 (
40  const fvPatch& p,
42 )
43 :
45  omega_()
46 {}
47 
48 
51 (
53  const fvPatch& p,
55  const fvPatchFieldMapper& mapper
56 )
57 :
58  totalPressureFvPatchScalarField(ptf, p, iF, mapper),
59  omega_(ptf.omega_.clone())
60 {}
61 
62 
65 (
66  const fvPatch& p,
68  const dictionary& dict
69 )
70 :
72  omega_(Function1<vector>::New("omega", dict, &db()))
73 {}
74 
75 
78 (
80 )
81 :
83  omega_(rtppsf.omega_.clone())
84 {}
85 
86 
89 (
92 )
93 :
95  omega_(rtppsf.omega_.clone())
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 
102 {
103  if (updated())
104  {
105  return;
106  }
107 
108  const scalar t = this->db().time().timeOutputValue();
109  const vector om = omega_->value(t);
110 
111  vector axisHat = om/mag(om);
112  tmp<vectorField> rotationVelocity =
113  om ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()));
114 
115  const vectorField Up
116  (
117  patch().lookupPatchField<volVectorField, vector>(UName())
118  + rotationVelocity
119  );
120 
122 }
123 
124 
126 {
128  omega_->writeData(os);
129 }
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 namespace Foam
135 {
137  (
140  );
141 }
142 
143 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
volFields.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
rotatingTotalPressureFvPatchScalarField.H
surfaceFields.H
Foam::surfaceFields.
fvPatchFieldMapper.H
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: propellerInfo.H:291
Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: rotatingTotalPressureFvPatchScalarField.C:101
Foam::rotatingTotalPressureFvPatchScalarField
This boundary condition provides a total pressure condition for patches in a rotating frame.
Definition: rotatingTotalPressureFvPatchScalarField.H:129
Foam::totalPressureFvPatchScalarField
This boundary condition provides a total pressure condition. Four variants are possible:
Definition: totalPressureFvPatchScalarField.H:256
Foam::Field< vector >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::totalPressureFvPatchScalarField::UName
const word & UName() const
Return the name of the velocity field.
Definition: totalPressureFvPatchScalarField.H:355
Foam::rotatingTotalPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: rotatingTotalPressureFvPatchScalarField.C:125
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
om
optimisationManager & om
Definition: createFields.H:6
os
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::totalPressureFvPatchScalarField::p0
const scalarField & p0() const
Return the total pressure.
Definition: totalPressureFvPatchScalarField.H:419
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::totalPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: totalPressureFvPatchScalarField.C:236
Foam::rotatingTotalPressureFvPatchScalarField::rotatingTotalPressureFvPatchScalarField
rotatingTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: rotatingTotalPressureFvPatchScalarField.C:39
Foam::totalPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: totalPressureFvPatchScalarField.C:246
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54