33 const DimensionedField<vector, volMesh>& iF)
34 : mixedFvPatchField<vector>(
p, iF),
43 forAll(this->refValue(), idxI)
45 this->refValue()[idxI] = pTraits<vector>::zero;
47 this->refGrad() = pTraits<vector>::zero;
48 this->valueFraction() = 0.0;
55 const DimensionedField<vector, volMesh>& iF,
56 const fvPatchFieldMapper& mapper)
57 : mixedFvPatchField<vector>(ptf,
p, iF, mapper),
58 phiName_(ptf.phiName_),
61 flowComponent_(ptf.flowComponent_),
62 normalComponent_(ptf.normalComponent_),
64 alphaRate_(ptf.alphaRate_)
71 const DimensionedField<vector, volMesh>& iF,
72 const dictionary& dict)
73 : mixedFvPatchField<vector>(
p, iF),
74 phiName_(dict.lookupOrDefault<word>(
"phi",
"phi")),
75 U0_(dict.lookupOrDefault<scalar>(
"U0", 0.0)),
76 URate_(dict.lookupOrDefault<scalar>(
"URate", 0.0)),
77 flowComponent_(dict.lookupOrDefault<label>(
"flowComponent", 0)),
78 normalComponent_(dict.lookupOrDefault<label>(
"normalComponent", 1)),
79 alpha0_(dict.lookupOrDefault<scalar>(
"alpha0", 0.0)),
80 alphaRate_(dict.lookupOrDefault<scalar>(
"alphaRate", 0.0))
82 this->patchType() = dict.lookupOrDefault<word>(
"patchType", word::null);
84 vector UInit = vector::zero;
85 UInit[flowComponent_] = U0_ * cos(alpha0_);
86 UInit[normalComponent_] = U0_ * sin(alpha0_);
87 forAll(this->refValue(), idxI)
89 this->refValue()[idxI] = UInit;
92 if (dict.found(
"value"))
94 fvPatchField<vector>::operator=(
95 vectorField(
"value", dict,
p.size()));
99 fvPatchField<vector>::operator=(this->refValue());
102 this->refGrad() = pTraits<vector>::zero;
103 this->valueFraction() = 0.0;
109 : mixedFvPatchField<vector>(ptf),
110 phiName_(ptf.phiName_),
113 flowComponent_(ptf.flowComponent_),
114 normalComponent_(ptf.normalComponent_),
115 alpha0_(ptf.alpha0_),
116 alphaRate_(ptf.alphaRate_)
123 const DimensionedField<vector, volMesh>& iF)
124 : mixedFvPatchField<vector>(ptf, iF),
125 phiName_(ptf.phiName_),
128 flowComponent_(ptf.flowComponent_),
129 normalComponent_(ptf.normalComponent_),
130 alpha0_(ptf.alpha0_),
131 alphaRate_(ptf.alphaRate_)
144 const scalar t = this->db().time().timeOutputValue();
145 scalar alpha = alpha0_ + t * alphaRate_;
146 scalar
U = U0_ + t * URate_;
148 const Field<scalar>& phip =
149 this->patch().template lookupPatchField<surfaceScalarField, scalar>(phiName_);
151 forAll(this->refValue(), faceI)
153 this->refValue()[faceI][flowComponent_] =
U * cos(alpha) * (1.0 - pos0(phip[faceI]));
154 this->refValue()[faceI][normalComponent_] =
U * sin(alpha) * (1.0 - pos0(phip[faceI]));
157 this->valueFraction() = 1.0 - pos0(phip);
159 mixedFvPatchField<vector>::updateCoeffs();
165 fvPatchVectorField::write(os);
166 os.writeEntry(
"phiName", phiName_);
167 os.writeEntry(
"U0", U0_);
168 os.writeEntry(
"URate", URate_);
169 os.writeEntry(
"flowComponent", flowComponent_);
170 os.writeEntry(
"normalComponent", normalComponent_);
171 os.writeEntry(
"alpha0", alpha0_);
172 os.writeEntry(
"alphaRate", alphaRate_);
179 const fvPatchVectorField& ptf)
181 fvPatchVectorField::operator=(
182 this->valueFraction() * this->refValue()
183 + (1 - this->valueFraction()) * ptf);