31 #include "volFields.H"
32 #include "addToRunTimeSelectionTable.H"
38 const DimensionedField<vector, volMesh>& iF)
39 : fixedValueFvPatchVectorField(
p, iF),
40 refValue_(vector::zero),
51 const DimensionedField<vector, volMesh>& iF,
52 const dictionary& dict)
53 : fixedValueFvPatchVectorField(
p, iF),
54 refValue_(dict.lookupOrDefault<vector>(
"refValue", vector::zero)),
55 amplitudes_(dict.lookupOrDefault<scalarList>(
"amplitudes", {})),
56 frequencies_(dict.lookupOrDefault<scalarList>(
"frequencies", {})),
57 phases_(dict.lookupOrDefault<scalarList>(
"phases", {})),
58 component_(dict.lookupOrDefault<label>(
"component", 0)),
59 endTime_(dict.lookupOrDefault<scalar>(
"endTime", 1.0e8))
61 if (dict.found(
"value"))
63 fvPatchVectorField::operator=(
64 vectorField(
"value", dict,
p.size()));
75 const DimensionedField<vector, volMesh>& iF,
76 const fvPatchFieldMapper& mapper)
77 : fixedValueFvPatchVectorField(
p, iF),
78 refValue_(ptf.refValue_),
79 amplitudes_(ptf.amplitudes_),
80 frequencies_(ptf.frequencies_),
82 component_(ptf.component_),
83 endTime_(ptf.endTime_)
90 : fixedValueFvPatchVectorField(wbppsf),
91 refValue_(wbppsf.refValue_),
92 amplitudes_(wbppsf.amplitudes_),
93 frequencies_(wbppsf.frequencies_),
94 phases_(wbppsf.phases_),
95 component_(wbppsf.component_),
96 endTime_(wbppsf.endTime_)
103 const DimensionedField<vector, volMesh>& iF)
104 : fixedValueFvPatchVectorField(wbppsf, iF),
105 refValue_(wbppsf.refValue_),
106 amplitudes_(wbppsf.amplitudes_),
107 frequencies_(wbppsf.frequencies_),
108 phases_(wbppsf.phases_),
109 component_(wbppsf.component_),
110 endTime_(wbppsf.endTime_)
119 const scalar t = this->db().time().timeOutputValue();
121 const label& nFreqs = frequencies_.size();
123 for (label i = 0; i < nFreqs; i++)
125 const scalar& a = amplitudes_[i];
126 const scalar& f = frequencies_[i];
127 const scalar&
p = phases_[i];
128 bcVal += a * sin(constant::mathematical::twoPi * f * t +
p);
131 vectorField& thisPatchRef = *
this;
132 vectorField thisPatch = thisPatchRef;
133 forAll(thisPatch, idxI) thisPatch[idxI] = refValue_;
136 forAll(thisPatch, idxI) thisPatch[idxI][component_] += bcVal;
139 fvPatchVectorField::operator==(thisPatch);
141 fixedValueFvPatchVectorField::updateCoeffs();
146 fixedValueFvPatchVectorField::write(os);
147 os.writeEntry(
"refValue", refValue_);
148 os.writeEntry(
"amplitudes", amplitudes_);
149 os.writeEntry(
"frequencies", frequencies_);
150 os.writeEntry(
"phases", phases_);
151 os.writeEntry(
"component", component_);
152 os.writeEntry(
"endTime", endTime_);