initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / transportModels / interfaceProperties / alphaContactAngle / timeVaryingAlphaContactAngle / timeVaryingAlphaContactAngleFvPatchScalarField.C
blobd950201871190e285fbe609ed508f86d07b5cc3e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 2 of the License, or (at your
14     option) any later version.
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.
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
25 \*---------------------------------------------------------------------------*/
27 #include "timeVaryingAlphaContactAngleFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "volMesh.H"
31 #include "Time.H"
33 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
35 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
36 timeVaryingAlphaContactAngleFvPatchScalarField
38     const fvPatch& p,
39     const DimensionedField<scalar, volMesh>& iF
42     alphaContactAngleFvPatchScalarField(p, iF),
43     t0_(0.0),
44     thetaT0_(0.0),
45     te_(0.0),
46     thetaTe_(0.0)
50 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
51 timeVaryingAlphaContactAngleFvPatchScalarField
53     const timeVaryingAlphaContactAngleFvPatchScalarField& gcpsf,
54     const fvPatch& p,
55     const DimensionedField<scalar, volMesh>& iF,
56     const fvPatchFieldMapper& mapper
59     alphaContactAngleFvPatchScalarField(gcpsf, p, iF, mapper),
60     t0_(gcpsf.t0_),
61     thetaT0_(gcpsf.thetaT0_),
62     te_(gcpsf.te_),
63     thetaTe_(gcpsf.te_)
67 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
68 timeVaryingAlphaContactAngleFvPatchScalarField
70     const fvPatch& p,
71     const DimensionedField<scalar, volMesh>& iF,
72     const dictionary& dict
75     alphaContactAngleFvPatchScalarField(p, iF),
76     t0_(readScalar(dict.lookup("t0"))),
77     thetaT0_(readScalar(dict.lookup("thetaT0"))),
78     te_(readScalar(dict.lookup("te"))),
79     thetaTe_(readScalar(dict.lookup("thetaTe")))
81     evaluate();
85 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::
86 timeVaryingAlphaContactAngleFvPatchScalarField
88     const timeVaryingAlphaContactAngleFvPatchScalarField& gcpsf,
89     const DimensionedField<scalar, volMesh>& iF
92     alphaContactAngleFvPatchScalarField(gcpsf, iF),
93     t0_(gcpsf.t0_),
94     thetaT0_(gcpsf.thetaT0_),
95     te_(gcpsf.te_),
96     thetaTe_(gcpsf.thetaTe_)
100 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
102 Foam::tmp<Foam::scalarField>
103 Foam::timeVaryingAlphaContactAngleFvPatchScalarField::theta
105     const fvPatchVectorField&,
106     const fvsPatchVectorField&
107 ) const
109     scalar t = patch().boundaryMesh().mesh().time().value();
110     scalar theta0 = thetaT0_;
112     if (t < t0_)
113     {
114         theta0 = thetaT0_;
115     }
116     else if (t > te_)
117     {
118         theta0 = thetaTe_;
119     }
120     else
121     {
122         theta0 = thetaT0_ + (t - t0_)*(thetaTe_ - thetaT0_)/(te_ - t0_);
123     }
125     return tmp<scalarField>(new scalarField(size(), theta0));
129 void Foam::timeVaryingAlphaContactAngleFvPatchScalarField::write
131     Ostream& os
132 ) const
134     fvPatchScalarField::write(os);
135     os.writeKeyword("t0") << t0_ << token::END_STATEMENT << nl;
136     os.writeKeyword("thetaT0") << thetaT0_ << token::END_STATEMENT << nl;
137     os.writeKeyword("te") << te_ << token::END_STATEMENT << nl;
138     os.writeKeyword("thetaTe") << thetaTe_ << token::END_STATEMENT << nl;
139     writeEntry("value", os);
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 namespace Foam
147     makePatchTypeField
148     (
149         fvPatchScalarField,
150         timeVaryingAlphaContactAngleFvPatchScalarField
151     );
154 // ************************************************************************* //