mappedInternalCoupled.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 
26 #include "mappedInternalCoupled.H"
28 #include "volFields.H"
29 #include "mappedPatchBase.H"
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const fvPatch& p,
36 )
37 :
38  fixedValueFvPatchVectorField(p, iF)
39 {}
40 
41 
43 (
44  const fvPatch& p,
46  const dictionary& dict
47 )
48 :
49  fixedValueFvPatchVectorField(p, iF, dict)
50 {}
51 
52 
54 (
55  const mappedInternalCoupled& ptf,
56  const fvPatch& p,
58  const fvPatchFieldMapper& mapper
59 )
60 :
61  fixedValueFvPatchVectorField(p, iF)
62 {}
63 
64 
66 (
67  const mappedInternalCoupled& mwvpvf
68 )
69 :
70  fixedValueFvPatchVectorField(mwvpvf)
71 {}
72 
73 
75 (
76  const mappedInternalCoupled& mwvpvf,
78 )
79 :
80  fixedValueFvPatchVectorField(mwvpvf, iF)
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
86 
88 {
89  Info << "calc the gradientINternalCoeffs for noslip" << endl;
90  Info << "============================" <<endl;
91  vectorField n = this->patch().nf();
92  vectorField impCoeffs(this->size(), pTraits<vector>::zero);
93 
94  forAll(impCoeffs, faceI)
95  {
96  impCoeffs[faceI][0] = scalar(1.0) - n[faceI][0] * n[faceI][0];
97  impCoeffs[faceI][1] = scalar(1.0) - n[faceI][1] * n[faceI][1];
98  impCoeffs[faceI][2] = scalar(1.0) - n[faceI][2] * n[faceI][2];
99  }
100 
101  return -impCoeffs*this->patch().deltaCoeffs();
102 }
103 
105 {
106  Info << "calc the gradientBoundaryCoeffs for noslip" << endl;
107  Info << "============================" <<endl;
108  vectorField n = this->patch().nf();
109  vectorField expCoeffs(this->size(), pTraits<vector>::zero);
110  vectorField vt = *this - ((*this & n)) * n;
111  vectorField iF = this->patchInternalField();
112 
113  forAll(expCoeffs, faceI)
114  {
115  expCoeffs[faceI][0] = vt[faceI][0] +
116  n[faceI][0]*n[faceI][1]*iF[faceI][1] +
117  n[faceI][0]*n[faceI][2]*iF[faceI][2];
118  expCoeffs[faceI][1] = vt[faceI][1] +
119  n[faceI][0]*n[faceI][1]*iF[faceI][0] +
120  n[faceI][1]*n[faceI][2]*iF[faceI][2];
121  expCoeffs[faceI][2] = vt[faceI][2] +
122  n[faceI][0]*n[faceI][2]*iF[faceI][0] +
123  n[faceI][1]*n[faceI][2]*iF[faceI][1];
124  }
125 
126  return expCoeffs*this->patch().deltaCoeffs();
127 }
128 
129 
130 
132 {
134  this->writeEntry("value", os);
135 }
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 namespace Foam
141 {
143  (
146  );
147 }
148 
149 // ************************************************************************* //
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::mappedInternalCoupled::write
virtual void write(Ostream &) const
Write.
Definition: mappedInternalCoupled.C:131
Foam::fvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:349
p
p
Definition: pEqn.H:62
Foam::mappedInternalCoupled::gradientBoundaryCoeffs
virtual tmp< Field< vector > > gradientBoundaryCoeffs() const
Definition: mappedInternalCoupled.C:104
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
Foam::mappedInternalCoupled
This boundary condition fixes the velocity to zero at walls.
Definition: mappedInternalCoupled.H:63
n
label n
Definition: TABSMDCalcMethod2.H:31
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
mappedInternalCoupled.H
dict
dictionary dict
Definition: searchingEngine.H:14
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::mappedInternalCoupled::mappedInternalCoupled
mappedInternalCoupled(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: mappedInternalCoupled.C:33
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::mappedInternalCoupled::gradientInternalCoeffs
virtual tmp< Field< vector > > gradientInternalCoeffs() const
Definition: mappedInternalCoupled.C:87
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51
mappedPatchBase.H