tabulatedAccelerationSourceTemplates.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) 2015 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
30#include "fvMesh.H"
31#include "fvMatrices.H"
33
34// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35
36template<class RhoFieldType>
37void Foam::fv::tabulatedAccelerationSource::addSup
38(
39 const RhoFieldType& rho,
40 fvMatrix<vector>& eqn,
41 const label fieldi
42)
43{
44 Vector<vector> acceleration(motion_.acceleration());
45
46 // If gravitational force is present combine with the linear acceleration
48 {
49 auto& g =
51
52 const auto& hRef =
54
55 g = g0_ - dimensionedVector("a", dimAcceleration, acceleration.x());
56
58 (
59 mag(g.value()) > SMALL
60 ? g & (cmptMag(g.value())/mag(g.value()))*hRef
62 );
63
65 = (g & mesh_.C()) - ghRef;
66
68 = (g & mesh_.Cf()) - ghRef;
69 }
70 // ... otherwise include explicitly in the momentum equation
71 else
72 {
73 eqn -= rho*dimensionedVector("a", dimAcceleration, acceleration.x());
74 }
75
77 (
78 "Omega",
79 dimensionSet(0, 0, -1, 0, 0),
80 acceleration.y()
81 );
82
83 dimensionedVector dOmegaDT
84 (
85 "dOmegaDT",
86 dimensionSet(0, 0, -2, 0, 0),
87 acceleration.z()
88 );
89
90 eqn -=
91 (
92 rho*(2*Omega ^ eqn.psi()) // Coriolis force
93 + rho*(Omega ^ (Omega ^ mesh_.C())) // Centrifugal force
94 + rho*(dOmegaDT ^ mesh_.C()) // Angular tabulatedAcceleration force
95 );
96}
97
98
99// ************************************************************************* //
const uniformDimensionedVectorField & g
const dimensionSet & dimensions() const
Return const reference to dimensions.
const Type & value() const
Return const reference to value.
const volVectorField & C() const
Return cell centres as volVectorField.
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
const surfaceVectorField & Cf() const
Return face centres as surfaceVectorField.
const fvMesh & mesh_
Reference to the mesh database.
Definition: fvOption.H:139
dimensionedVector g0_
Gravitational accelaration.
tabulated6DoFAcceleration motion_
Run-time selectable acceleration model.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
Type & lookupObjectRef(const word &name, const bool recursive=false) const
const Type & lookupObject(const word &name, const bool recursive=false) const
virtual Vector< vector > acceleration() const
Return the solid-body accelerations.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
UniformDimensionedField< scalar > uniformDimensionedScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
UniformDimensionedField< vector > uniformDimensionedVectorField
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
const dimensionSet dimAcceleration
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)