All Classes Namespaces Files Functions Variables Typedefs Friends Macros Groups
fvscStencil.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) 2019 OpenCFD Ltd.
10  Copyright (C) 2016-2019 ISP RAS (www.ispras.ru) UniCFD Group (www.unicfd.ru)
11 -------------------------------------------------------------------------------
12 License
13  This file is part of QGDsolver library, based on OpenFOAM+.
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  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  You should have received a copy of the GNU General Public License
23  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 Class
25  Foam::fvsc::fvscStencil
26 Description
27  This is a method for calculation the differential operators without
28  tangential derivatives. They are further used in the calculation of
29  the QGD terms.
30 \*---------------------------------------------------------------------------*/
31 
32 #include "fvscStencil.H"
33 #include "volFields.H"
34 #include "fvMesh.H"
35 #include "Time.H"
36 #include "addToRunTimeSelectionTable.H"
37 #include "coupledFvsPatchFields.H"
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 namespace fvsc
44 {
47 }
48 }
49 
50 namespace Foam
51 {
52 namespace fvsc
53 {
54 
55 PtrList<fvscStencil> fvscStencil::stencils_(0);
56 
57 autoPtr<fvscStencil> fvscStencil::New
58 (
59  const word& fvscType,
60  const fvMesh& mesh
61 )
62 {
63  Info<< "Selecting finite volume surface calculus stencil type " << fvscType << endl;
64 
65  componentsConstructorTable::iterator cstrIter =
66  componentsConstructorTablePtr_->find(fvscType);
67 
68  if (cstrIter == componentsConstructorTablePtr_->end())
69  {
70  FatalErrorIn
71  (
72  "fvscStencil::New(const word&, const fvMesh&)"
73  ) << "Unknown Model type " << fvscType << nl << nl
74  << "Valid model types are:" << nl
75  << componentsConstructorTablePtr_->sortedToc()
76  << exit(FatalError);
77  }
78 
79  return autoPtr<fvscStencil>
80  (
81  cstrIter()
82  (
83  IOobject
84  (
85  fvscType,
86  mesh.time().timeName(),
87  mesh,
88  IOobject::NO_READ,
89  IOobject::NO_WRITE
90  )
91  )
92  );
93 }
94 
95 //tmp<fvscStencil> fvscStencil::lookupOrNew
97 (
98  const word& name,
99  const fvMesh& mesh
100 )
101 {
102  if (!mesh.thisDb().foundObject<fvscStencil>(name))
103  {
104  stencils_.append
105  (
106  fvscStencil::New(name,mesh)
107  );
108  stencils_.last().checkIn();
109  }
110 
111  return
112  const_cast<fvscStencil&>
113  (
114  mesh.thisDb().lookupObject<fvscStencil>(name)
115  );
116 }
117 //
118 fvscStencil::fvscStencil(const IOobject& io)
119 :
120  regIOobject(io, false),
121  refCount(),
122  mesh_(refCast<const fvMesh>(io.db())),
123  runTime_(mesh_.time()),
124  nf_
125  (
126  mesh_.Sf() / mesh_.magSf()
127  )
128 {
129  nf_.rename("nf");
130 }
131 
133 {
134 }
135 
136 }; //namespace fvsc
137 
138 }; //namespace Foam
139 
140 
141 //END-OF-FILE
142 
static PtrList< fvscStencil > stencils_
Definition: fvscStencil.H:59
defineRunTimeSelectionTable(fvscStencil, components)
surfaceVectorField nf_
Definition: fvscStencil.H:54
static autoPtr< fvscStencil > New(const word &name, const fvMesh &mesh)
Return a reference to the selected fvscStencil model.
const fvMesh & mesh_
Definition: fvscStencil.H:44
static fvscStencil & lookupOrNew(const word &nname, const fvMesh &mesh)
static tmp&lt;fvscStencil&gt; lookupOrNew
fvscStencil(const IOobject &io)
Construct from components.
virtual ~fvscStencil()
const Time & runTime_
Definition: fvscStencil.H:49
defineTypeNameAndDebug(fvscStencil, 0)