improvedNoSlipFvPatchVectorField.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 | Copyright (C) 2016 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 "volFields.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const fvPatch& p,
36 )
37 :
38  fixedValueFvPatchVectorField(p, iF)
39 {
40  Info <<"init boundary NO.1 constructor" << endl;
41 }
42 
43 
45 (
46  const fvPatch& p,
48  const dictionary& dict
49 )
50 :
51  fixedValueFvPatchVectorField(p, iF, dict)
52 {
53  Info <<"init boundary NO.2 constructor" << endl;
54 }
55 
56 
58 (
60  const fvPatch& p,
62  const fvPatchFieldMapper& mapper
63 )
64 :
65  fixedValueFvPatchVectorField(p, iF)
66 {
67 
68  Info <<"init boundary NO.3 constructor" << endl;
69 }
70 
71 
72 
74 (
76 )
77 :
78  fixedValueFvPatchVectorField(mwvpvf)
79 {
80  Info <<"init boundary NO.4 constructor" << endl;
81 }
82 
83 
85 (
88 )
89 :
90  fixedValueFvPatchVectorField(mwvpvf, iF)
91 {
92 
93  Info <<"init boundary NO.5 constructor" << endl;
94 }
95 
96 
97 
98 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99 
100 
102 {
103  Info << "calc the gradientINternalCoeffs for noslip" << endl;
104  Info << "============================" <<endl;
105  vectorField n = this->patch().nf();
106  vectorField impCoeffs(this->size(), pTraits<vector>::zero);
107 
108  forAll(impCoeffs, faceI)
109  {
110  impCoeffs[faceI][0] = scalar(1.0) - n[faceI][0] * n[faceI][0];
111  impCoeffs[faceI][1] = scalar(1.0) - n[faceI][1] * n[faceI][1];
112  impCoeffs[faceI][2] = scalar(1.0) - n[faceI][2] * n[faceI][2];
113  }
114 
115  return -impCoeffs*this->patch().deltaCoeffs();
116 }
117 
119 {
120  Info << "calc the gradientBoundaryCoeffs for noslip" << endl;
121  Info << "============================" <<endl;
122  vectorField n = this->patch().nf();
123  vectorField expCoeffs(this->size(), pTraits<vector>::zero);
124  vectorField vt = *this - ((*this & n)) * n;
125  vectorField iF = this->patchInternalField();
126 
127  forAll(expCoeffs, faceI)
128  {
129  expCoeffs[faceI][0] = vt[faceI][0] +
130  n[faceI][0]*n[faceI][1]*iF[faceI][1] +
131  n[faceI][0]*n[faceI][2]*iF[faceI][2];
132  expCoeffs[faceI][1] = vt[faceI][1] +
133  n[faceI][0]*n[faceI][1]*iF[faceI][0] +
134  n[faceI][1]*n[faceI][2]*iF[faceI][2];
135  expCoeffs[faceI][2] = vt[faceI][2] +
136  n[faceI][0]*n[faceI][2]*iF[faceI][0] +
137  n[faceI][1]*n[faceI][2]*iF[faceI][1];
138  }
139 
140  return expCoeffs*this->patch().deltaCoeffs();
141 }
142 
143 
144 
146 {
148  this->writeEntry("value", os);
149 }
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 namespace Foam
155 {
157  (
160  );
161 }
162 
163 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
volFields.H
Foam::fvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:349
p
p
Definition: pEqn.H:62
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::improvedNoSlipFvPatchVectorField::gradientBoundaryCoeffs
virtual tmp< Field< vector > > gradientBoundaryCoeffs() const
Definition: improvedNoSlipFvPatchVectorField.C:118
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Info
messageStream Info
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::improvedNoSlipFvPatchVectorField
This boundary condition fixes the velocity to zero at walls.
Definition: improvedNoSlipFvPatchVectorField.H:63
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::makePatchTypeField
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
Foam::improvedNoSlipFvPatchVectorField::improvedNoSlipFvPatchVectorField
improvedNoSlipFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: improvedNoSlipFvPatchVectorField.C:33
Foam::improvedNoSlipFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: improvedNoSlipFvPatchVectorField.C:145
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:50
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::improvedNoSlipFvPatchVectorField::gradientInternalCoeffs
virtual tmp< Field< vector > > gradientInternalCoeffs() const
Definition: improvedNoSlipFvPatchVectorField.C:101
improvedNoSlipFvPatchVectorField.H
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51