31 #include "volFields.H"
32 #include "addToRunTimeSelectionTable.H"
38 const DimensionedField<scalar, volMesh>& iF)
39 : fixedValueFvPatchScalarField(
p, iF),
49 const DimensionedField<scalar, volMesh>& iF,
50 const dictionary& dict)
51 : fixedValueFvPatchScalarField(
p, iF),
52 refValue_(dict.lookupOrDefault<scalar>(
"refValue", 0.0)),
53 amplitudes_(dict.lookupOrDefault<scalarList>(
"amplitudes", {})),
54 frequencies_(dict.lookupOrDefault<scalarList>(
"frequencies", {})),
55 phases_(dict.lookupOrDefault<scalarList>(
"phases", {}))
58 if (dict.found(
"value"))
60 fvPatchScalarField::operator=(
61 scalarField(
"value", dict,
p.size()));
72 const DimensionedField<scalar, volMesh>& iF,
73 const fvPatchFieldMapper& mapper)
74 : fixedValueFvPatchScalarField(
p, iF),
75 refValue_(ptf.refValue_),
76 amplitudes_(ptf.amplitudes_),
77 frequencies_(ptf.frequencies_),
85 : fixedValueFvPatchScalarField(wbppsf),
86 refValue_(wbppsf.refValue_),
87 amplitudes_(wbppsf.amplitudes_),
88 frequencies_(wbppsf.frequencies_),
89 phases_(wbppsf.phases_)
96 const DimensionedField<scalar, volMesh>& iF)
97 : fixedValueFvPatchScalarField(wbppsf, iF),
98 refValue_(wbppsf.refValue_),
99 amplitudes_(wbppsf.amplitudes_),
100 frequencies_(wbppsf.frequencies_),
101 phases_(wbppsf.phases_)
110 const scalar t = this->db().time().timeOutputValue();
112 const label& nFreqs = frequencies_.size();
114 for (label i = 0; i < nFreqs; i++)
116 const scalar& a = amplitudes_[i];
117 const scalar& f = frequencies_[i];
118 const scalar&
p = phases_[i];
119 bcVal += a * sin(constant::mathematical::twoPi * f * t +
p);
122 scalarField& thisPatchRef = *
this;
123 scalarField thisPatch = thisPatchRef;
124 forAll(thisPatch, idxI) thisPatch[idxI] = refValue_;
125 forAll(thisPatch, idxI) thisPatch[idxI] += bcVal;
127 fvPatchScalarField::operator==(thisPatch);
129 fixedValueFvPatchScalarField::updateCoeffs();
134 fixedValueFvPatchScalarField::write(os);
135 os.writeEntry(
"refValue", refValue_);
136 os.writeEntry(
"amplitudes", amplitudes_);
137 os.writeEntry(
"frequencies", frequencies_);
138 os.writeEntry(
"phases", phases_);