FreeFOAM The Cross-Platform CFD Toolkit
fixedShearStressFvPatchVectorField.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) 2010-2010 OpenCFD Ltd.
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 the
13  Free Software Foundation; either version 3 of the License, or (at your
14  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, write to the Free Software Foundation,
23  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 \*---------------------------------------------------------------------------*/
26 
30 #include <finiteVolume/volFields.H>
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace incompressible
37 {
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
41 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
42 (
43  const fvPatch& p,
45 )
46 :
47  fixedValueFvPatchVectorField(p, iF),
48  tau0_(vector::zero)
49 {}
50 
51 
52 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
53 (
54  const fvPatch& p,
56  const dictionary& dict
57 )
58 :
59  fixedValueFvPatchVectorField(p, iF),
60  tau0_(dict.lookupOrDefault<vector>("tau", vector::zero))
61 {
62  fvPatchField<vector>::operator=(patchInternalField());
63 }
64 
65 
66 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
67 (
69  const fvPatch& p,
71  const fvPatchFieldMapper& mapper
72 )
73 :
74  fixedValueFvPatchVectorField(ptf, p, iF, mapper),
75  tau0_(ptf.tau0_)
76 {}
77 
78 
79 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
80 (
82 )
83 :
84  fixedValueFvPatchVectorField(ptf),
85  tau0_(ptf.tau0_)
86 {}
87 
88 
89 fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
90 (
93 )
94 :
95  fixedValueFvPatchVectorField(ptf, iF),
96  tau0_(ptf.tau0_)
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
102 void fixedShearStressFvPatchVectorField::updateCoeffs()
103 {
104  if (updated())
105  {
106  return;
107  }
108 
109  const label patchI = patch().index();
110 
111  const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
112 
113  const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
114 
115  const vectorField Ui = Uw.patchInternalField();
116 
117  vector tauHat = tau0_/(mag(tau0_) + ROOTVSMALL);
118 
119  const scalarField& ry = patch().deltaCoeffs();
120 
121  scalarField nuEffw = rasModel.nuEff()().boundaryField()[patchI];
122 
123  vectorField UwUpdated =
124  tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui));
125 
126  operator==(UwUpdated);
127 
128  if (debug)
129  {
130  vectorField nHat = this->patch().nf();
131  volSymmTensorField Reff = rasModel.devReff();
132  Info << "tau : " << (nHat & Reff.boundaryField()[patchI])() << endl;
133  }
134 
135  fixedValueFvPatchVectorField::updateCoeffs();
136 }
137 
138 
139 void fixedShearStressFvPatchVectorField::write(Ostream& os) const
140 {
141  fixedValueFvPatchVectorField::write(os);
142  os.writeKeyword("tau") << tau0_ << token::END_STATEMENT << nl;
143  writeEntry("value", os);
144 }
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
150 (
153 );
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace incompressible
158 } // End namespace Foam
159 
160 // ************************************************************************* //