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

fixedPressureCompressibleDensityFvPatchScalarField.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 "fixedPressureCompressibleDensityFvPatchScalarField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "surfaceFields.H"
00031 #include "volFields.H"
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037 
00038 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00039 
00040 fixedPressureCompressibleDensityFvPatchScalarField::
00041 fixedPressureCompressibleDensityFvPatchScalarField
00042 (
00043     const fvPatch& p,
00044     const DimensionedField<scalar, volMesh>& iF
00045 )
00046 :
00047     fixedValueFvPatchField<scalar>(p, iF),
00048     pName_("pNameIsUndefined")
00049 {}
00050 
00051 
00052 fixedPressureCompressibleDensityFvPatchScalarField::
00053 fixedPressureCompressibleDensityFvPatchScalarField
00054 (
00055     const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
00056     const fvPatch& p,
00057     const DimensionedField<scalar, volMesh>& iF,
00058     const fvPatchFieldMapper& mapper
00059 )
00060 :
00061     fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
00062     pName_(ptf.pName_)
00063 {}
00064 
00065 
00066 fixedPressureCompressibleDensityFvPatchScalarField::
00067 fixedPressureCompressibleDensityFvPatchScalarField
00068 (
00069     const fvPatch& p,
00070     const DimensionedField<scalar, volMesh>& iF,
00071     const dictionary& dict
00072 )
00073 :
00074     fixedValueFvPatchField<scalar>(p, iF, dict),
00075     pName_(dict.lookup("p"))
00076 {}
00077 
00078 
00079 fixedPressureCompressibleDensityFvPatchScalarField::
00080 fixedPressureCompressibleDensityFvPatchScalarField
00081 (
00082     const fixedPressureCompressibleDensityFvPatchScalarField& ptf
00083 )
00084 :
00085     fixedValueFvPatchField<scalar>(ptf),
00086     pName_(ptf.pName_)
00087 {}
00088 
00089 
00090 fixedPressureCompressibleDensityFvPatchScalarField::
00091 fixedPressureCompressibleDensityFvPatchScalarField
00092 (
00093     const fixedPressureCompressibleDensityFvPatchScalarField& ptf,
00094     const DimensionedField<scalar, volMesh>& iF
00095 )
00096 :
00097     fixedValueFvPatchField<scalar>(ptf, iF),
00098     pName_(ptf.pName_)
00099 {}
00100 
00101 
00102 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00103 
00104 void fixedPressureCompressibleDensityFvPatchScalarField::updateCoeffs()
00105 {
00106     if (updated())
00107     {
00108         return;
00109     }
00110 
00111     const fvPatchField<scalar>& pp =
00112         patch().lookupPatchField<volScalarField, scalar>(pName_);
00113 
00114     const dictionary& thermoProps =
00115         db().lookupObject<IOdictionary>("thermodynamicProperties");
00116 
00117     const scalar rholSat =
00118         dimensionedScalar(thermoProps.lookup("rholSat")).value();
00119 
00120     const scalar pSat =
00121         dimensionedScalar(thermoProps.lookup("pSat")).value();
00122 
00123     const scalar psil = dimensionedScalar(thermoProps.lookup("psil")).value();
00124 
00125     operator==(rholSat + psil*(pp - pSat));
00126 
00127     fixedValueFvPatchField<scalar>::updateCoeffs();
00128 }
00129 
00130 
00131 void fixedPressureCompressibleDensityFvPatchScalarField::write
00132 (
00133     Ostream& os
00134 ) const
00135 {
00136     fvPatchField<scalar>::write(os);
00137     os.writeKeyword("p") << pName_ << token::END_STATEMENT << nl;
00138     writeEntry("value", os);
00139 }
00140 
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 makePatchTypeField
00145 (
00146     fvPatchScalarField,
00147     fixedPressureCompressibleDensityFvPatchScalarField
00148 );
00149 
00150 
00151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00152 
00153 } // End namespace Foam
00154 
00155 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd