oscillatingVelocityPointPatchVectorField.C
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
00027 #include "oscillatingVelocityPointPatchVectorField.H"
00028 #include "pointPatchFields.H"
00029 #include "addToRunTimeSelectionTable.H"
00030 #include "Time.H"
00031 #include "polyMesh.H"
00032
00033
00034
00035 namespace Foam
00036 {
00037
00038
00039
00040 oscillatingVelocityPointPatchVectorField::
00041 oscillatingVelocityPointPatchVectorField
00042 (
00043 const pointPatch& p,
00044 const DimensionedField<vector, pointMesh>& iF
00045 )
00046 :
00047 fixedValuePointPatchField<vector>(p, iF),
00048 amplitude_(vector::zero),
00049 omega_(0.0),
00050 p0_(p.localPoints())
00051 {}
00052
00053
00054 oscillatingVelocityPointPatchVectorField::
00055 oscillatingVelocityPointPatchVectorField
00056 (
00057 const pointPatch& p,
00058 const DimensionedField<vector, pointMesh>& iF,
00059 const dictionary& dict
00060 )
00061 :
00062 fixedValuePointPatchField<vector>(p, iF, dict),
00063 amplitude_(dict.lookup("amplitude")),
00064 omega_(readScalar(dict.lookup("omega")))
00065 {
00066 if (!dict.found("value"))
00067 {
00068 updateCoeffs();
00069 }
00070
00071 if (dict.found("p0"))
00072 {
00073 p0_ = vectorField("p0", dict , p.size());
00074 }
00075 else
00076 {
00077 p0_ = p.localPoints();
00078 }
00079 }
00080
00081
00082 oscillatingVelocityPointPatchVectorField::
00083 oscillatingVelocityPointPatchVectorField
00084 (
00085 const oscillatingVelocityPointPatchVectorField& ptf,
00086 const pointPatch& p,
00087 const DimensionedField<vector, pointMesh>& iF,
00088 const pointPatchFieldMapper& mapper
00089 )
00090 :
00091 fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
00092 amplitude_(ptf.amplitude_),
00093 omega_(ptf.omega_),
00094 p0_(ptf.p0_)
00095 {}
00096
00097
00098 oscillatingVelocityPointPatchVectorField::
00099 oscillatingVelocityPointPatchVectorField
00100 (
00101 const oscillatingVelocityPointPatchVectorField& ptf,
00102 const DimensionedField<vector, pointMesh>& iF
00103 )
00104 :
00105 fixedValuePointPatchField<vector>(ptf, iF),
00106 amplitude_(ptf.amplitude_),
00107 omega_(ptf.omega_),
00108 p0_(ptf.p0_)
00109 {}
00110
00111
00112
00113
00114 void oscillatingVelocityPointPatchVectorField::updateCoeffs()
00115 {
00116 if (this->updated())
00117 {
00118 return;
00119 }
00120
00121 const polyMesh& mesh = this->dimensionedInternalField().mesh()();
00122 const Time& t = mesh.time();
00123 const pointPatch& p = this->patch();
00124
00125 Field<vector>::operator=
00126 (
00127 (p0_ + amplitude_*sin(omega_*t.value()) - p.localPoints())
00128 /t.deltaT().value()
00129 );
00130
00131 fixedValuePointPatchField<vector>::updateCoeffs();
00132 }
00133
00134
00135 void oscillatingVelocityPointPatchVectorField::write(Ostream& os) const
00136 {
00137 pointPatchField<vector>::write(os);
00138 os.writeKeyword("amplitude")
00139 << amplitude_ << token::END_STATEMENT << nl;
00140 os.writeKeyword("omega")
00141 << omega_ << token::END_STATEMENT << nl;
00142 p0_.writeEntry("p0", os);
00143 writeEntry("value", os);
00144 }
00145
00146
00147
00148
00149 makePointPatchTypeField
00150 (
00151 pointPatchVectorField,
00152 oscillatingVelocityPointPatchVectorField
00153 );
00154
00155
00156
00157 }
00158
00159
Copyright © 2000-2009 OpenCFD Ltd