waveAtmBoundaryLayerSuperposition.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) 2017-2019 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 
28 #include "atmBoundaryLayer.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(waveAtmBoundaryLayerSuperposition, 0);
37  (
38  waveSuperposition,
39  waveAtmBoundaryLayerSuperposition,
40  objectRegistry
41  );
42 }
43 
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const objectRegistry& db
50 )
51 :
53  UGasRef_(lookup("UGasRef")),
54  hRef_(lookup<scalar>("hRef")),
55  hWaveMin_(lookup<scalar>("hWaveMin")),
56  hWaveMax_(lookup<scalar>("hWaveMax"))
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
61 
63 {}
64 
65 
66 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
67 
69 (
70  const scalar t,
71  const vectorField& p
72 ) const
73 {
74  const vector gHat =
76  (
77  db().lookupObject<uniformDimensionedVectorField>("g").value()
78  );
79 
80  const scalar h0 = - gHat & origin_;
81 
82  const vector UGasRefRel = UGasRef_ - UMean_->value(t);
83 
84  const scalar magUGasRefRel = mag(UGasRefRel);
85 
87 
88  if (magUGasRefRel > 0)
89  {
91  (
92  UGasRefRel/magUGasRefRel,
93  - gHat,
94  magUGasRefRel,
95  h0 + hRef_,
96  scalarField(p.size(), hWaveMax_ - hWaveMin_),
97  scalarField(p.size(), h0 + hWaveMin_)
98  );
99 
100  tU.ref() += atm.U(p);
101  }
102 
103  return tU;
104 }
105 
106 
108 {
110 
111  writeEntry(os, "UGasRef", UGasRef_);
112  writeEntry(os, "hRef", hRef_);
113  writeEntry(os, "hWaveMin", hWaveMin_);
114  writeEntry(os, "hWaveMax", hWaveMax_);
115 }
116 
117 
118 // ************************************************************************* //
A wrapper around a list of wave models. Superimposes the modelled values of elevation and velocity...
This class provides functions to evaluate the velocity and turbulence distributions appropriate for a...
virtual tmp< vectorField > UGas(const scalar t, const vectorField &p) const
Get the gas velocity at a given time and global positions.
void write(Ostream &) const
Write.
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
tmp< vectorField > U(const vectorField &p) const
Return the velocity distribution for the ATM.
Macros for easy insertion into run-time selection tables.
waveAtmBoundaryLayerSuperposition(const objectRegistry &db)
Construct from a database.
stressControl lookup("compactNormalStress") >> compactNormalStress
Form normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
Definition: VectorSpaceI.H:413
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual tmp< vectorField > UGas(const scalar t, const vectorField &p) const
Get the gas velocity at a given time and global positions.
const scalar h0
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dimensioned< scalar > mag(const dimensioned< Type > &)
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
Namespace for OpenFOAM.