Loading...
Searching...
No Matches
velocityComponentLaplacianFvMotionSolver.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) 2016 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 "motionInterpolation.H"
31#include "motionDiffusivity.H"
32#include "fvmLaplacian.H"
34#include "fvOptions.H"
36// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37
38namespace Foam
39{
41
43 (
47 );
48}
49
50
51// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52
53Foam::velocityComponentLaplacianFvMotionSolver::
54velocityComponentLaplacianFvMotionSolver
55(
56 const polyMesh& mesh,
57 const IOdictionary& dict
58)
59:
62 cellMotionU_
63 (
65 (
66 "cellMotionU" + cmptName_,
67 mesh.time().timeName(),
68 mesh,
69 IOobject::READ_IF_PRESENT,
70 IOobject::AUTO_WRITE
71 ),
72 fvMesh_,
73 dimensionedScalar(pointMotionU_.dimensions(), Zero),
74 cellMotionBoundaryTypes<scalar>(pointMotionU_.boundaryField())
75 ),
76 interpolationPtr_
77 (
78 coeffDict().found("interpolation")
79 ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation"))
80 : motionInterpolation::New(fvMesh_)
81 ),
82 diffusivityPtr_
83 (
85 )
86{}
87
88
89// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
90
93{}
94
95
96// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97
100{
101 interpolationPtr_->interpolate
102 (
103 cellMotionU_,
104 pointMotionU_
105 );
106
107 auto tcurPoints = tmp<pointField>::New(fvMesh_.points());
108
109 tcurPoints.ref().replace
110 (
111 cmpt_,
112 tcurPoints().component(cmpt_)
113 + fvMesh_.time().deltaTValue()*pointMotionU_.primitiveField()
114 );
116 twoDCorrectPoints(tcurPoints.ref());
117
118 return tcurPoints;
119}
120
121
123{
124 // The points have moved so before interpolation update
125 // the fvMotionSolver accordingly
126 movePoints(fvMesh_.points());
127
128 diffusivityPtr_->correct();
129 pointMotionU_.boundaryFieldRef().updateCoeffs();
130
132
133 // We explicitly do NOT want to interpolate the motion inbetween
134 // different regions so bypass all the matrix manipulation.
136 (
138 (
139 dimensionedScalar("viscosity", dimViscosity, 1.0)
140 *diffusivityPtr_->operator()(),
141 cellMotionU_,
142 "laplacian(diffusivity,cellMotionU)"
143 )
144 ==
145 fvOptions(cellMotionU_)
146 );
148 fvOptions.constrain(TEqn);
149 TEqn.solveSegregatedOrCoupled();
150 fvOptions.correct(cellMotionU_);
151}
152
153
155(
156 const mapPolyMesh& mpm
157)
158{
160
161 // Update diffusivity. Note two stage to make sure old one is de-registered
162 // before creating/registering new one.
163 diffusivityPtr_.reset(nullptr);
164 diffusivityPtr_ = motionDiffusivity::New
165 (
166 fvMesh_,
167 coeffDict().lookup("diffusivity")
168 );
169}
170
171
172// ************************************************************************* //
bool found
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
fv::options & fvOptions
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const Time & time() const noexcept
Return Time associated with the objectRegistry.
Definition IOobject.C:456
Virtual base class for velocity motion solver.
word cmptName_
The component name to solve for.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
direction cmpt_
The component to solve for.
pointScalarField pointMotionU_
Point motion field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Base class for fvMesh based motionSolvers.
const fvMesh & fvMesh_
The fvMesh to be moved.
wordList cellMotionBoundaryTypes(const typename GeometricField< Type, pointPatchField, pointMesh >::Boundary &pmUbf) const
Create the corresponding patch types for cellMotion from those.
fvMotionSolver(const polyMesh &)
Construct from polyMesh.
const fvMesh & mesh() const
Return reference to the fvMesh to be moved.
Finite-volume options, which is an IOdictionary of values and a fv::optionList.
Definition fvOptions.H:69
static options & New(const fvMesh &mesh)
Construct fvOptions and register to database if not present otherwise lookup and return.
Definition fvOptions.C:116
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Abstract base class for cell-centre mesh motion diffusivity.
static autoPtr< motionDiffusivity > New(const fvMesh &mesh, Istream &mdData)
Select null constructed.
Base class for interpolation of cell displacement fields, generated by fvMotionSolvers,...
Virtual base class for mesh motion solver.
static autoPtr< motionSolver > New(const polyMesh &)
Select constructed from polyMesh.
virtual void twoDCorrectPoints(pointField &) const
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Lookup type of boundary radiation properties.
Definition lookup.H:60
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
Mesh motion solver for an fvMesh. Based on solving the cell-centre Laplacian for the given component ...
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
virtual void updateMesh(const mapPolyMesh &)
Update topology.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
Calculate the matrix for the laplacian of the field.
fvScalarMatrix TEqn(fvm::ddt(T)+fvm::div(phi, T) - fvm::laplacian(alphaEff, T)==radiation->ST(rhoCpRef, T)+fvOptions(T))
word timeName
Definition getTimeIndex.H:3
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Namespace for OpenFOAM.
const dimensionSet dimViscosity
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
fvMatrix< scalar > fvScalarMatrix
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary dict