30 #include "addToRunTimeSelectionTable.H"
31 #include "fvPatchFieldMapper.H"
32 #include "volFields.H"
33 #include "surfaceFields.H"
41 const DimensionedField<vector, volMesh>& iF
44 mixedFvPatchVectorField(p, iF),
47 Hdirection_(0.0, 0.0, 0.0),
52 this->refValue() = pTraits<vector>::zero;
53 this->refGrad() = pTraits<vector>::zero;
54 this->valueFraction() = 0.0;
57 Info <<
"Executing cosVelocityFvPatchVectorField(fvPatch, DimensionedField) " << endl;
65 const DimensionedField<vector, volMesh>& iF,
66 const fvPatchFieldMapper& mapper
69 mixedFvPatchField<vector>(ptf, p, iF, mapper),
72 Hdirection_(ptf.Hdirection_),
78 mixedFvPatchVectorField::updateCoeffs();
80 Info <<
"Executing cosVelocityFvPatchVectorField(cosVelocity, fvPatch, DimensionedField, fvPatchFieldMapper) " << endl;
87 const DimensionedField<vector, volMesh>& iF,
88 const dictionary& dict
91 mixedFvPatchField<vector>(p, iF)
94 dict.lookup(
"A") >>
A_;
95 dict.lookup(
"H") >>
H_;
97 dict.lookup(
"omega0") >>
omega0_;
98 dict.lookup(
"phi0") >>
phi0_;
99 dict.lookup(
"minZ") >>
minZ_;
101 if (dict.found(
"value"))
103 fvPatchField<vector>::operator=
105 Field<vector>(
"value", dict, p.size())
110 fvPatchField<vector>::operator=(this->patchInternalField());
113 this->refValue() = pTraits<vector>::zero;
114 this->refGrad() = pTraits<vector>::zero;
115 this->valueFraction() = 1.0;
117 mixedFvPatchVectorField::updateCoeffs();
119 Info <<
"Executing cosVelocityFvPatchVectorField(fvPatch, DimensionedField, dictionary) " << endl;
128 mixedFvPatchVectorField(ptpsf),
131 Hdirection_(ptpsf.Hdirection_),
132 omega0_(ptpsf.omega0_),
136 this->setPatchVelocities(this->refValue());
137 Info <<
"Executing cosVelocityFvPatchVectorField(const cosVelocity&) " << endl;
144 const DimensionedField<vector, volMesh>& iF
147 mixedFvPatchVectorField(ptpsf, iF),
150 Hdirection_(ptpsf.Hdirection_),
151 omega0_(ptpsf.omega0_),
157 Info <<
"Executing cosVelocityFvPatchVectorField(const cosVelocity, const DimensionedField) " << endl;
165 mixedFvPatchField<vector>::autoMap(m);
167 Info <<
"Executing autoMap " << endl;
172 mixedFvPatchField<vector>::rmap(pf, ll);
173 Info <<
"Executing rmap " << endl;
178 scalarField z = (this->patch().Cf() & Hdirection_) - minZ_;
182 scalar t = this->patch().boundaryMesh().mesh().time().value();
183 this->refGrad()[iFace] = vector (0.0, 0.0, 0.0);
184 this->valueFraction()[iFace] = 1.0;
186 A_ * cos(Foam::constant::mathematical::pi * z[iFace] / H_) * (-omega0_) * sin(omega0_ * t + phi0_);
187 if (z[iFace] < 0.0 || z[iFace] > H_)
201 this->setPatchVelocities(this->refValue());
203 Info <<
"max/min velocity: " << gMax(this->refValue()) <<
"/" << gMin(this->refValue()) << endl;
205 mixedFvPatchField<vector>::updateCoeffs();
212 mixedFvPatchVectorField::write(os);
214 os.writeKeyword(
"A") << A_ << token::END_STATEMENT << nl;
216 os.writeKeyword(
"H") << H_ << token::END_STATEMENT << nl;
218 os.writeKeyword(
"minZ") << minZ_ << token::END_STATEMENT << nl;
220 os.writeKeyword(
"Hdirection") << Hdirection_ << token::END_STATEMENT << nl;
222 os.writeKeyword(
"omega0") << omega0_ << token::END_STATEMENT << nl;
224 os.writeKeyword(
"phi0") << phi0_ << token::END_STATEMENT << nl;
233 cosVelocityFvPatchVectorField
makePatchTypeField(fvPatchVectorField, cosVelocityFvPatchVectorField)
virtual void rmap(const fvPatchVectorField &pf, const labelList &ll)
This boundary condition sets the pressure gradient to the provided value such that the flux on the bo...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
void setPatchVelocities(vectorField &pV)
virtual void write(Ostream &) const
Write.
cosVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
virtual void autoMap(const fvPatchFieldMapper &)