OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "alphaFixedPressureFvPatchScalarField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "volFields.H"
00031 #include "surfaceFields.H"
00032 #include "uniformDimensionedFields.H"
00033 
00034 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00035 
00036 Foam::alphaFixedPressureFvPatchScalarField::
00037 alphaFixedPressureFvPatchScalarField
00038 (
00039     const fvPatch& p,
00040     const DimensionedField<scalar, volMesh>& iF
00041 )
00042 :
00043     fixedValueFvPatchScalarField(p, iF),
00044     p_(p.size(), 0.0)
00045 {}
00046 
00047 
00048 Foam::alphaFixedPressureFvPatchScalarField::
00049 alphaFixedPressureFvPatchScalarField
00050 (
00051     const alphaFixedPressureFvPatchScalarField& ptf,
00052     const fvPatch& p,
00053     const DimensionedField<scalar, volMesh>& iF,
00054     const fvPatchFieldMapper& mapper
00055 )
00056 :
00057     fixedValueFvPatchScalarField(ptf, p, iF, mapper),
00058     p_(ptf.p_, mapper)
00059 {}
00060 
00061 
00062 Foam::alphaFixedPressureFvPatchScalarField::
00063 alphaFixedPressureFvPatchScalarField
00064 (
00065     const fvPatch& p,
00066     const DimensionedField<scalar, volMesh>& iF,
00067     const dictionary& dict
00068 )
00069 :
00070     fixedValueFvPatchScalarField(p, iF),
00071     p_("p", dict, p.size())
00072 {
00073     if (dict.found("value"))
00074     {
00075         fvPatchField<scalar>::operator=
00076         (
00077             scalarField("value", dict, p.size())
00078         );
00079     }
00080     else
00081     {
00082         fvPatchField<scalar>::operator=(p_);
00083     }
00084 }
00085 
00086 
00087 Foam::alphaFixedPressureFvPatchScalarField::
00088 alphaFixedPressureFvPatchScalarField
00089 (
00090     const alphaFixedPressureFvPatchScalarField& tppsf
00091 )
00092 :
00093     fixedValueFvPatchScalarField(tppsf),
00094     p_(tppsf.p_)
00095 {}
00096 
00097 
00098 Foam::alphaFixedPressureFvPatchScalarField::
00099 alphaFixedPressureFvPatchScalarField
00100 (
00101     const alphaFixedPressureFvPatchScalarField& tppsf,
00102     const DimensionedField<scalar, volMesh>& iF
00103 )
00104 :
00105     fixedValueFvPatchScalarField(tppsf, iF),
00106     p_(tppsf.p_)
00107 {}
00108 
00109 
00110 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00111 
00112 void Foam::alphaFixedPressureFvPatchScalarField::autoMap
00113 (
00114     const fvPatchFieldMapper& m
00115 )
00116 {
00117     scalarField::autoMap(m);
00118     p_.autoMap(m);
00119 }
00120 
00121 
00122 void Foam::alphaFixedPressureFvPatchScalarField::rmap
00123 (
00124     const fvPatchScalarField& ptf,
00125     const labelList& addr
00126 )
00127 {
00128     fixedValueFvPatchScalarField::rmap(ptf, addr);
00129 
00130     const alphaFixedPressureFvPatchScalarField& tiptf =
00131         refCast<const alphaFixedPressureFvPatchScalarField>(ptf);
00132 
00133     p_.rmap(tiptf.p_, addr);
00134 }
00135 
00136 
00137 void Foam::alphaFixedPressureFvPatchScalarField::updateCoeffs()
00138 {
00139     if (updated())
00140     {
00141         return;
00142     }
00143 
00144     const uniformDimensionedVectorField& g =
00145         db().lookupObject<uniformDimensionedVectorField>("g");
00146 
00147     const fvPatchField<scalar>& rho =
00148         patch().lookupPatchField<volScalarField, scalar>("rho");
00149 
00150     operator==(p_ - rho*(g.value() & patch().Cf()));
00151 
00152     fixedValueFvPatchScalarField::updateCoeffs();
00153 }
00154 
00155 
00156 void Foam::alphaFixedPressureFvPatchScalarField::write
00157 (
00158     Ostream& os
00159 ) const
00160 {
00161     fvPatchScalarField::write(os);
00162     p_.writeEntry("p", os);
00163     writeEntry("value", os);
00164 }
00165 
00166 
00167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00168 
00169 namespace Foam
00170 {
00171     makePatchTypeField
00172     (
00173         fvPatchScalarField,
00174         alphaFixedPressureFvPatchScalarField
00175     );
00176 }
00177 
00178 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd