BUG: Corrected behaviour of atmBoundaryLayerInletEpsilon BC

This commit is contained in:
andy
2012-03-07 11:06:58 +00:00
parent 4f0bcd9b22
commit c0be7dfcbd
2 changed files with 85 additions and 36 deletions

View File

@ -47,13 +47,13 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
Ustar_(0), z_(vector::zero),
z_(pTraits<vector>::zero),
z0_(0),
kappa_(0.41), kappa_(0.41),
Uref_(0), Uref_(0),
Href_(0), Href_(0),
zGround_(0) z0_(0),
zGround_(0),
Ustar_(0)
{} {}
@ -67,13 +67,13 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(ptf, p, iF, mapper), fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Ustar_(ptf.Ustar_),
z_(ptf.z_), z_(ptf.z_),
z0_(ptf.z0_),
kappa_(ptf.kappa_), kappa_(ptf.kappa_),
Uref_(ptf.Uref_), Uref_(ptf.Uref_),
Href_(ptf.Href_), Href_(ptf.Href_),
zGround_(ptf.zGround_) z0_(ptf.z0_),
zGround_(ptf.zGround_),
Ustar_(ptf.Ustar_)
{} {}
@ -86,13 +86,13 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
Ustar_(p.size()),
z_(dict.lookup("z")), z_(dict.lookup("z")),
z0_(readScalar(dict.lookup("z0"))),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
Uref_(readScalar(dict.lookup("Uref"))), Uref_(readScalar(dict.lookup("Uref"))),
Href_(readScalar(dict.lookup("Href"))), Href_(readScalar(dict.lookup("Href"))),
zGround_("zGround", dict, p.size()) z0_("z0", dict, p.size()),
zGround_("zGround", dict, p.size()),
Ustar_(p.size())
{ {
if (mag(z_) < SMALL) if (mag(z_) < SMALL)
{ {
@ -128,18 +128,47 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(blpsf, iF), fixedValueFvPatchScalarField(blpsf, iF),
Ustar_(blpsf.Ustar_),
z_(blpsf.z_), z_(blpsf.z_),
z0_(blpsf.z0_),
kappa_(blpsf.kappa_), kappa_(blpsf.kappa_),
Uref_(blpsf.Uref_), Uref_(blpsf.Uref_),
Href_(blpsf.Href_), Href_(blpsf.Href_),
zGround_(blpsf.zGround_) z0_(blpsf.z0_),
zGround_(blpsf.zGround_),
Ustar_(blpsf.Ustar_)
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void atmBoundaryLayerInletEpsilonFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
fixedValueFvPatchScalarField::autoMap(m);
z0_.autoMap(m);
zGround_.autoMap(m);
Ustar_.autoMap(m);
}
void atmBoundaryLayerInletEpsilonFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
fixedValueFvPatchScalarField::rmap(ptf, addr);
const atmBoundaryLayerInletEpsilonFvPatchScalarField& blptf =
refCast<const atmBoundaryLayerInletEpsilonFvPatchScalarField>(ptf);
z0_.rmap(blptf.z0_, addr);
zGround_.rmap(blptf.zGround_, addr);
Ustar_.rmap(blptf.Ustar_, addr);
}
void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs() void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs()
{ {
const vectorField& c = patch().Cf(); const vectorField& c = patch().Cf();
@ -153,16 +182,14 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("z") os.writeKeyword("z")
<< z_ << token::END_STATEMENT << nl; << z_ << token::END_STATEMENT << nl;
os.writeKeyword("z0")
<< z0_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") os.writeKeyword("kappa")
<< kappa_ << token::END_STATEMENT << nl; << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Uref") os.writeKeyword("Uref")
<< Uref_ << token::END_STATEMENT << nl; << Uref_ << token::END_STATEMENT << nl;
os.writeKeyword("Href") os.writeKeyword("Href")
<< Href_ << token::END_STATEMENT << nl; << Href_ << token::END_STATEMENT << nl;
os.writeKeyword("zGround") z0_.writeEntry("z0", os);
<< zGround_ << token::END_STATEMENT << nl; zGround_.writeEntry("zGround", os);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -87,15 +87,9 @@ class atmBoundaryLayerInletEpsilonFvPatchScalarField
{ {
// Private data // Private data
//- Frictional velocity
scalarField Ustar_;
//- Direction of the z-coordinate //- Direction of the z-coordinate
vector z_; vector z_;
//- Surface roughness lenght
scalarField z0_;
//- Von Karman constant //- Von Karman constant
const scalar kappa_; const scalar kappa_;
@ -105,8 +99,14 @@ class atmBoundaryLayerInletEpsilonFvPatchScalarField
//- Reference hight //- Reference hight
const scalar Href_; const scalar Href_;
//- Surface roughness length
scalarField z0_;
//- Minimum corrdinate value in z direction //- Minimum corrdinate value in z direction
const scalarField zGround_; scalarField zGround_;
//- Frictional velocity
scalarField Ustar_;
public: public:
@ -173,20 +173,42 @@ public:
// Member functions // Member functions
//- Return max value // Access
scalarField Ustar() const
{
return Ustar_;
}
//- Return z direction //- Return max value
const vector& z() const scalarField Ustar() const
{ {
return z_; return Ustar_;
} }
//- Return z direction
const vector& z() const
{
return z_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const fvPatchScalarField&,
const labelList&
);
// Evaluation functions
//- Update coefficients
virtual void updateCoeffs();
//- Update coefficients
virtual void updateCoeffs();
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream&) const;