oscillatingDisplacementPointPatchVectorField.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 "oscillatingDisplacementPointPatchVectorField.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 oscillatingDisplacementPointPatchVectorField::
00041 oscillatingDisplacementPointPatchVectorField
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 {}
00051
00052
00053 oscillatingDisplacementPointPatchVectorField::
00054 oscillatingDisplacementPointPatchVectorField
00055 (
00056 const pointPatch& p,
00057 const DimensionedField<vector, pointMesh>& iF,
00058 const dictionary& dict
00059 )
00060 :
00061 fixedValuePointPatchField<vector>(p, iF, dict),
00062 amplitude_(dict.lookup("amplitude")),
00063 omega_(readScalar(dict.lookup("omega")))
00064 {
00065 if (!dict.found("value"))
00066 {
00067 updateCoeffs();
00068 }
00069 }
00070
00071
00072 oscillatingDisplacementPointPatchVectorField::
00073 oscillatingDisplacementPointPatchVectorField
00074 (
00075 const oscillatingDisplacementPointPatchVectorField& ptf,
00076 const pointPatch& p,
00077 const DimensionedField<vector, pointMesh>& iF,
00078 const pointPatchFieldMapper& mapper
00079 )
00080 :
00081 fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
00082 amplitude_(ptf.amplitude_),
00083 omega_(ptf.omega_)
00084 {}
00085
00086
00087 oscillatingDisplacementPointPatchVectorField::
00088 oscillatingDisplacementPointPatchVectorField
00089 (
00090 const oscillatingDisplacementPointPatchVectorField& ptf,
00091 const DimensionedField<vector, pointMesh>& iF
00092 )
00093 :
00094 fixedValuePointPatchField<vector>(ptf, iF),
00095 amplitude_(ptf.amplitude_),
00096 omega_(ptf.omega_)
00097 {}
00098
00099
00100
00101
00102 void oscillatingDisplacementPointPatchVectorField::updateCoeffs()
00103 {
00104 if (this->updated())
00105 {
00106 return;
00107 }
00108
00109 const polyMesh& mesh = this->dimensionedInternalField().mesh()();
00110 const Time& t = mesh.time();
00111
00112 Field<vector>::operator=(amplitude_*sin(omega_*t.value()));
00113
00114 fixedValuePointPatchField<vector>::updateCoeffs();
00115 }
00116
00117
00118 void oscillatingDisplacementPointPatchVectorField::write(Ostream& os) const
00119 {
00120 pointPatchField<vector>::write(os);
00121 os.writeKeyword("amplitude")
00122 << amplitude_ << token::END_STATEMENT << nl;
00123 os.writeKeyword("omega")
00124 << omega_ << token::END_STATEMENT << nl;
00125 writeEntry("value", os);
00126 }
00127
00128
00129
00130
00131 makePointPatchTypeField
00132 (
00133 pointPatchVectorField,
00134 oscillatingDisplacementPointPatchVectorField
00135 );
00136
00137
00138
00139 }
00140
00141
Copyright © 2000-2009 OpenCFD Ltd