FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

alphaFixedPressureFvPatchScalarField.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "alphaFixedPressureFvPatchScalarField.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <finiteVolume/fvPatchFieldMapper.H>
00029 #include <finiteVolume/volFields.H>
00030 #include <finiteVolume/surfaceFields.H>
00031 #include <OpenFOAM/uniformDimensionedFields.H>
00032 
00033 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00034 
00035 Foam::alphaFixedPressureFvPatchScalarField::
00036 alphaFixedPressureFvPatchScalarField
00037 (
00038     const fvPatch& p,
00039     const DimensionedField<scalar, volMesh>& iF
00040 )
00041 :
00042     fixedValueFvPatchScalarField(p, iF),
00043     p_(p.size(), 0.0)
00044 {}
00045 
00046 
00047 Foam::alphaFixedPressureFvPatchScalarField::
00048 alphaFixedPressureFvPatchScalarField
00049 (
00050     const alphaFixedPressureFvPatchScalarField& ptf,
00051     const fvPatch& p,
00052     const DimensionedField<scalar, volMesh>& iF,
00053     const fvPatchFieldMapper& mapper
00054 )
00055 :
00056     fixedValueFvPatchScalarField(ptf, p, iF, mapper),
00057     p_(ptf.p_, mapper)
00058 {}
00059 
00060 
00061 Foam::alphaFixedPressureFvPatchScalarField::
00062 alphaFixedPressureFvPatchScalarField
00063 (
00064     const fvPatch& p,
00065     const DimensionedField<scalar, volMesh>& iF,
00066     const dictionary& dict
00067 )
00068 :
00069     fixedValueFvPatchScalarField(p, iF),
00070     p_("p", dict, p.size())
00071 {
00072     if (dict.found("value"))
00073     {
00074         fvPatchField<scalar>::operator=
00075         (
00076             scalarField("value", dict, p.size())
00077         );
00078     }
00079     else
00080     {
00081         fvPatchField<scalar>::operator=(p_);
00082     }
00083 }
00084 
00085 
00086 Foam::alphaFixedPressureFvPatchScalarField::
00087 alphaFixedPressureFvPatchScalarField
00088 (
00089     const alphaFixedPressureFvPatchScalarField& tppsf
00090 )
00091 :
00092     fixedValueFvPatchScalarField(tppsf),
00093     p_(tppsf.p_)
00094 {}
00095 
00096 
00097 Foam::alphaFixedPressureFvPatchScalarField::
00098 alphaFixedPressureFvPatchScalarField
00099 (
00100     const alphaFixedPressureFvPatchScalarField& tppsf,
00101     const DimensionedField<scalar, volMesh>& iF
00102 )
00103 :
00104     fixedValueFvPatchScalarField(tppsf, iF),
00105     p_(tppsf.p_)
00106 {}
00107 
00108 
00109 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00110 
00111 void Foam::alphaFixedPressureFvPatchScalarField::autoMap
00112 (
00113     const fvPatchFieldMapper& m
00114 )
00115 {
00116     scalarField::autoMap(m);
00117     p_.autoMap(m);
00118 }
00119 
00120 
00121 void Foam::alphaFixedPressureFvPatchScalarField::rmap
00122 (
00123     const fvPatchScalarField& ptf,
00124     const labelList& addr
00125 )
00126 {
00127     fixedValueFvPatchScalarField::rmap(ptf, addr);
00128 
00129     const alphaFixedPressureFvPatchScalarField& tiptf =
00130         refCast<const alphaFixedPressureFvPatchScalarField>(ptf);
00131 
00132     p_.rmap(tiptf.p_, addr);
00133 }
00134 
00135 
00136 void Foam::alphaFixedPressureFvPatchScalarField::updateCoeffs()
00137 {
00138     if (updated())
00139     {
00140         return;
00141     }
00142 
00143     const uniformDimensionedVectorField& g =
00144         db().lookupObject<uniformDimensionedVectorField>("g");
00145 
00146     const fvPatchField<scalar>& rho =
00147         patch().lookupPatchField<volScalarField, scalar>("rho");
00148 
00149     operator==(p_ - rho*(g.value() & patch().Cf()));
00150 
00151     fixedValueFvPatchScalarField::updateCoeffs();
00152 }
00153 
00154 
00155 void Foam::alphaFixedPressureFvPatchScalarField::write
00156 (
00157     Ostream& os
00158 ) const
00159 {
00160     fvPatchScalarField::write(os);
00161     p_.writeEntry("p", os);
00162     writeEntry("value", os);
00163 }
00164 
00165 
00166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00167 
00168 namespace Foam
00169 {
00170     makePatchTypeField
00171     (
00172         fvPatchScalarField,
00173         alphaFixedPressureFvPatchScalarField
00174     );
00175 }
00176 
00177 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines