fixedShearStressFvPatchVectorField.C 4.48 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6
7
8
9
10
11
12
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software; you can redistribute it and/or modify it
    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
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM; if not, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

\*---------------------------------------------------------------------------*/

#include "fixedShearStressFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "RASModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace incompressible
{

// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

41
fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
42
43
44
45
46
47
48
49
50
51
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF
)
:
    fixedValueFvPatchVectorField(p, iF),
    tau0_(vector::zero)
{}


52
fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
53
54
55
56
57
58
59
60
61
62
63
64
65
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchVectorField(p, iF),
    tau0_(dict.lookupOrDefault<vector>("tau", vector::zero))
{
    fvPatchField<vector>::operator=(patchInternalField());
}


66
fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
67
68
69
70
71
72
73
74
75
76
77
78
(
    const fixedShearStressFvPatchVectorField& ptf,
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const fvPatchFieldMapper& mapper
)
:
    fixedValueFvPatchVectorField(ptf, p, iF, mapper),
    tau0_(ptf.tau0_)
{}


79
fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
80
81
82
83
84
85
86
87
88
(
    const fixedShearStressFvPatchVectorField& ptf
)
:
    fixedValueFvPatchVectorField(ptf),
    tau0_(ptf.tau0_)
{}


89
fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
(
    const fixedShearStressFvPatchVectorField& ptf,
    const DimensionedField<vector, volMesh>& iF
)
:
    fixedValueFvPatchVectorField(ptf, iF),
    tau0_(ptf.tau0_)
{}


// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

void fixedShearStressFvPatchVectorField::updateCoeffs()
{
    if (updated())
    {
        return;
    }

    const label patchI = patch().index();

    const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");

    const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];

115
    const vectorField Ui(Uw.patchInternalField());
116

117
    vector tauHat = tau0_/(mag(tau0_) + ROOTVSMALL);
118
119
120

    const scalarField& ry = patch().deltaCoeffs();

121
122
123
    tmp<volScalarField> tnuEff = rasModel.nuEff();
    const volScalarField& nuEff = tnuEff();
    const scalarField& nuEffw = nuEff.boundaryField()[patchI];
124

125
    tmp<vectorField> UwUpdated =
126
127
128
129
130
131
        tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui));

    operator==(UwUpdated);

    if (debug)
    {
132
133
        tmp<vectorField> nHat = this->patch().nf();
        volSymmTensorField Reff(rasModel.devReff());
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
        Info << "tau : " << (nHat & Reff.boundaryField()[patchI])() << endl;
    }

    fixedValueFvPatchVectorField::updateCoeffs();
}


void fixedShearStressFvPatchVectorField::write(Ostream& os) const
{
    fixedValueFvPatchVectorField::write(os);
    os.writeKeyword("tau") << tau0_ << token::END_STATEMENT << nl;
    writeEntry("value", os);
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

151
makePatchTypeField
152
153
154
155
156
157
158
159
160
(
    fvPatchVectorField,
    fixedShearStressFvPatchVectorField
);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace incompressible
} // End namespace Foam
161

162
// ************************************************************************* //