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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "fvMesh.H"
30 #include "fvMatrices.H"
32 
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 
35 template<class RhoFieldType>
36 void Foam::fv::tabulatedAccelerationSource::addSup
37 (
38  const RhoFieldType& rho,
39  fvMatrix<vector>& eqn,
40  const label fieldi
41 )
42 {
43  Vector<vector> acceleration(motion_.acceleration());
44 
45  // If gravitational force is present combine with the linear acceleration
47  {
50 
51  const uniformDimensionedScalarField& hRef =
53 
54  g = g0_ - dimensionedVector("a", dimAcceleration, acceleration.x());
55 
56  dimensionedScalar ghRef
57  (
58  mag(g.value()) > SMALL
59  ? g & (cmptMag(g.value())/mag(g.value()))*hRef
60  : dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
61  );
62 
64  = (g & mesh_.C()) - ghRef;
65 
67  = (g & mesh_.Cf()) - ghRef;
68  }
69  // ... otherwise include explicitly in the momentum equation
70  else
71  {
72  eqn -= rho*dimensionedVector("a", dimAcceleration, acceleration.x());
73  }
74 
75  dimensionedVector Omega
76  (
77  "Omega",
78  dimensionSet(0, 0, -1, 0, 0),
79  acceleration.y()
80  );
81 
82  dimensionedVector dOmegaDT
83  (
84  "dOmegaDT",
85  dimensionSet(0, 0, -2, 0, 0),
86  acceleration.z()
87  );
88 
89  eqn -=
90  (
91  rho*(2*Omega ^ eqn.psi()) // Coriolis force
92  + rho*(Omega ^ (Omega ^ mesh_.C())) // Centrifugal force
93  + rho*(dOmegaDT ^ mesh_.C()) // Angular tabulatedAcceleration force
94  );
95 }
96 
97 
98 // ************************************************************************* //
tabulatedAccelerationSource.H
Foam::tabulated6DoFAcceleration::acceleration
virtual Vector< vector > acceleration() const
Return the solid-body accelerations.
Definition: tabulated6DoFAcceleration.C:60
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:53
rho
rho
Definition: readInitialConditions.H:88
Foam::objectRegistry::foundObject
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
Definition: objectRegistryTemplates.C:379
Foam::fv::option::mesh_
const fvMesh & mesh_
Reference to the mesh database.
Definition: fvOption.H:82
Foam::dimensionedVector
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Definition: dimensionedVector.H:50
fvMatrices.H
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Foam::cmptMag
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:400
Foam::fv::tabulatedAccelerationSource::g0_
dimensionedVector g0_
Definition: tabulatedAccelerationSource.H:83
Foam::uniformDimensionedVectorField
UniformDimensionedField< vector > uniformDimensionedVectorField
Definition: uniformDimensionedFields.H:50
Foam::uniformDimensionedScalarField
UniformDimensionedField< scalar > uniformDimensionedScalarField
Definition: uniformDimensionedFields.H:49
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:434
Foam::fvMesh::C
const volVectorField & C() const
Return cell centres as volVectorField.
Definition: fvMeshGeometry.C:341
fvMesh.H
g
const uniformDimensionedVectorField & g
Definition: createFluidFields.H:24
Foam::dimAcceleration
const dimensionSet dimAcceleration
Foam::objectRegistry::lookupObjectRef
Type & lookupObjectRef(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:478
uniformDimensionedFields.H
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:248
Foam::fv::tabulatedAccelerationSource::motion_
tabulated6DoFAcceleration motion_
Run-time selectable acceleration model.
Definition: tabulatedAccelerationSource.H:78
Foam::fvMesh::Cf
const surfaceVectorField & Cf() const
Return face centres as surfaceVectorField.
Definition: fvMeshGeometry.C:352