Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #include "SRFVelocityFvPatchVectorField.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <finiteVolume/volFields.H>
00029 
00030 #include <finiteVolume/SRFModel.H>
00031 
00032 
00033 
00034 namespace Foam
00035 {
00036 
00037 
00038 
00039 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
00040 (
00041     const fvPatch& p,
00042     const DimensionedField<vector, volMesh>& iF
00043 )
00044 :
00045     fixedValueFvPatchVectorField(p, iF),
00046     relative_(0),
00047     inletValue_(p.size(), vector::zero)
00048 {}
00049 
00050 
00051 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
00052 (
00053     const SRFVelocityFvPatchVectorField& ptf,
00054     const fvPatch& p,
00055     const DimensionedField<vector, volMesh>& iF,
00056     const fvPatchFieldMapper& mapper
00057 )
00058 :
00059     fixedValueFvPatchVectorField(ptf, p, iF, mapper),
00060     relative_(ptf.relative_),
00061     inletValue_(ptf.inletValue_, mapper)
00062 {}
00063 
00064 
00065 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
00066 (
00067     const fvPatch& p,
00068     const DimensionedField<vector, volMesh>& iF,
00069     const dictionary& dict
00070 )
00071 :
00072     fixedValueFvPatchVectorField(p, iF),
00073     relative_(dict.lookup("relative")),
00074     inletValue_("inletValue", dict, p.size())
00075 {
00076     fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
00077 }
00078 
00079 
00080 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
00081 (
00082     const SRFVelocityFvPatchVectorField& srfvpvf
00083 )
00084 :
00085     fixedValueFvPatchVectorField(srfvpvf),
00086     relative_(srfvpvf.relative_),
00087     inletValue_(srfvpvf.inletValue_)
00088 {}
00089 
00090 
00091 SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
00092 (
00093     const SRFVelocityFvPatchVectorField& srfvpvf,
00094     const DimensionedField<vector, volMesh>& iF
00095 )
00096 :
00097     fixedValueFvPatchVectorField(srfvpvf, iF),
00098     relative_(srfvpvf.relative_),
00099     inletValue_(srfvpvf.inletValue_)
00100 {}
00101 
00102 
00103 
00104 
00105 void SRFVelocityFvPatchVectorField::autoMap
00106 (
00107     const fvPatchFieldMapper& m
00108 )
00109 {
00110     vectorField::autoMap(m);
00111     inletValue_.autoMap(m);
00112 }
00113 
00114 
00115 void SRFVelocityFvPatchVectorField::rmap
00116 (
00117     const fvPatchVectorField& ptf,
00118     const labelList& addr
00119 )
00120 {
00121     fixedValueFvPatchVectorField::rmap(ptf, addr);
00122 
00123     const SRFVelocityFvPatchVectorField& tiptf =
00124         refCast<const SRFVelocityFvPatchVectorField>(ptf);
00125 
00126     inletValue_.rmap(tiptf.inletValue_, addr);
00127 }
00128 
00129 
00130 void SRFVelocityFvPatchVectorField::updateCoeffs()
00131 {
00132     if (updated())
00133     {
00134         return;
00135     }
00136 
00137     
00138     if (!relative_)
00139     {
00140         
00141         const SRF::SRFModel& srf =
00142             db().lookupObject<SRF::SRFModel>("SRFProperties");
00143 
00144         
00145         const vectorField SRFVelocity = srf.velocity(patch().Cf());
00146 
00147         operator==(-SRFVelocity + inletValue_);
00148     }
00149     
00150     
00151     else
00152     {
00153         operator==(inletValue_);
00154     }
00155 
00156     fixedValueFvPatchVectorField::updateCoeffs();
00157 }
00158 
00159 
00160 void SRFVelocityFvPatchVectorField::write(Ostream& os) const
00161 {
00162     fvPatchVectorField::write(os);
00163     os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
00164     inletValue_.writeEntry("inletValue", os);
00165     writeEntry("value", os);
00166 }
00167 
00168 
00169 
00170 
00171 makePatchTypeField
00172 (
00173     fvPatchVectorField,
00174     SRFVelocityFvPatchVectorField
00175 );
00176 
00177 
00178 
00179 } 
00180 
00181