mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Jump conditions - added optional minimum jump value
Example:
plane
{
type fan;
patchType cyclic;
jump uniform 0;
value uniform 0;
uniformJump false;
relax 0.2;
jumpTable ( (1000 0) (-200 1) (20 2) (-0.75 3) );
// Optional minimum jump value
minJump 0;
}
This commit is contained in:
committed by
Andrew Heather
parent
05e0749d0e
commit
f54b190f31
@ -162,21 +162,26 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
|
|||||||
const scalar D = D_->value(t);
|
const scalar D = D_->value(t);
|
||||||
const scalar I = I_->value(t);
|
const scalar I = I_->value(t);
|
||||||
|
|
||||||
jump_ =
|
setJump
|
||||||
|
(
|
||||||
-sign(Un)
|
-sign(Un)
|
||||||
*(
|
*(
|
||||||
D*turbModel.nu(patch().index())
|
D*turbModel.nu(patch().index())
|
||||||
+ I*0.5*magUn
|
+ I*0.5*magUn
|
||||||
)*magUn*length_;
|
)*magUn*length_
|
||||||
|
);
|
||||||
|
|
||||||
if (internalField().dimensions() == dimPressure)
|
if (internalField().dimensions() == dimPressure)
|
||||||
{
|
{
|
||||||
jump_ *= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
setJump
|
||||||
|
(
|
||||||
|
jump()*patch().lookupPatchField<volScalarField, scalar>(rhoName_)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
scalar avePressureJump = gAverage(jump_);
|
scalar avePressureJump = gAverage(jump());
|
||||||
scalar aveVelocity = gAverage(Un);
|
scalar aveVelocity = gAverage(Un);
|
||||||
|
|
||||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||||
|
|||||||
@ -74,11 +74,11 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
|
|||||||
deltap*pow4(constant::mathematical::pi)*sqr(dm_*rpm_)/1800.0
|
deltap*pow4(constant::mathematical::pi)*sqr(dm_*rpm_)/1800.0
|
||||||
);
|
);
|
||||||
|
|
||||||
this->jump_ = pdFan;
|
this->setJump(pdFan);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->jump_ = this->jumpTable_->value(Un);
|
this->setJump(jumpTable_->value(Un));
|
||||||
}
|
}
|
||||||
|
|
||||||
this->relax();
|
this->relax();
|
||||||
|
|||||||
@ -40,6 +40,7 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
|||||||
jumpCyclicFvPatchField<Type>(p, iF),
|
jumpCyclicFvPatchField<Type>(p, iF),
|
||||||
jump_(this->size(), Zero),
|
jump_(this->size(), Zero),
|
||||||
jump0_(this->size(), Zero),
|
jump0_(this->size(), Zero),
|
||||||
|
minJump_(pTraits<Type>::min),
|
||||||
relaxFactor_(-1),
|
relaxFactor_(-1),
|
||||||
timeIndex_(-1)
|
timeIndex_(-1)
|
||||||
{}
|
{}
|
||||||
@ -57,6 +58,7 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
|||||||
jumpCyclicFvPatchField<Type>(ptf, p, iF, mapper),
|
jumpCyclicFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
jump_(ptf.jump_, mapper),
|
jump_(ptf.jump_, mapper),
|
||||||
jump0_(ptf.jump0_, mapper),
|
jump0_(ptf.jump0_, mapper),
|
||||||
|
minJump_(ptf.minJump_),
|
||||||
relaxFactor_(ptf.relaxFactor_),
|
relaxFactor_(ptf.relaxFactor_),
|
||||||
timeIndex_(ptf.timeIndex_)
|
timeIndex_(ptf.timeIndex_)
|
||||||
{}
|
{}
|
||||||
@ -73,6 +75,7 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
|||||||
jumpCyclicFvPatchField<Type>(p, iF, dict),
|
jumpCyclicFvPatchField<Type>(p, iF, dict),
|
||||||
jump_(p.size(), Zero),
|
jump_(p.size(), Zero),
|
||||||
jump0_(p.size(), Zero),
|
jump0_(p.size(), Zero),
|
||||||
|
minJump_(dict.getOrDefault<Type>("minJump", pTraits<Type>::min)),
|
||||||
relaxFactor_(dict.getOrDefault<scalar>("relax", -1)),
|
relaxFactor_(dict.getOrDefault<scalar>("relax", -1)),
|
||||||
timeIndex_(this->db().time().timeIndex())
|
timeIndex_(this->db().time().timeIndex())
|
||||||
{
|
{
|
||||||
@ -109,6 +112,7 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
|||||||
jumpCyclicFvPatchField<Type>(ptf),
|
jumpCyclicFvPatchField<Type>(ptf),
|
||||||
jump_(ptf.jump_),
|
jump_(ptf.jump_),
|
||||||
jump0_(ptf.jump0_),
|
jump0_(ptf.jump0_),
|
||||||
|
minJump_(ptf.minJump_),
|
||||||
relaxFactor_(ptf.relaxFactor_),
|
relaxFactor_(ptf.relaxFactor_),
|
||||||
timeIndex_(ptf.timeIndex_)
|
timeIndex_(ptf.timeIndex_)
|
||||||
{}
|
{}
|
||||||
@ -124,6 +128,7 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
|||||||
jumpCyclicFvPatchField<Type>(ptf, iF),
|
jumpCyclicFvPatchField<Type>(ptf, iF),
|
||||||
jump_(ptf.jump_),
|
jump_(ptf.jump_),
|
||||||
jump0_(ptf.jump0_),
|
jump0_(ptf.jump0_),
|
||||||
|
minJump_(ptf.minJump_),
|
||||||
relaxFactor_(ptf.relaxFactor_),
|
relaxFactor_(ptf.relaxFactor_),
|
||||||
timeIndex_(ptf.timeIndex_)
|
timeIndex_(ptf.timeIndex_)
|
||||||
{}
|
{}
|
||||||
@ -131,6 +136,26 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fixedJumpFvPatchField<Type>::setJump(const Field<Type>& jump)
|
||||||
|
{
|
||||||
|
if (this->cyclicPatch().owner())
|
||||||
|
{
|
||||||
|
jump_ = max(jump, minJump_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fixedJumpFvPatchField<Type>::setJump(const Type& jump)
|
||||||
|
{
|
||||||
|
if (this->cyclicPatch().owner())
|
||||||
|
{
|
||||||
|
jump_ = max(jump, minJump_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type>> Foam::fixedJumpFvPatchField<Type>::jump() const
|
Foam::tmp<Foam::Field<Type>> Foam::fixedJumpFvPatchField<Type>::jump() const
|
||||||
{
|
{
|
||||||
@ -240,6 +265,11 @@ void Foam::fixedJumpFvPatchField<Type>::write(Ostream& os) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (minJump_ != pTraits<Type>::min)
|
||||||
|
{
|
||||||
|
os.writeEntry("minJump", minJump_);
|
||||||
|
}
|
||||||
|
|
||||||
this->writeEntry("value", os);
|
this->writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,7 @@ Usage
|
|||||||
patchType | underlying patch type should be \c cyclic| yes |
|
patchType | underlying patch type should be \c cyclic| yes |
|
||||||
jump | current jump value | yes |
|
jump | current jump value | yes |
|
||||||
relax | under-relaxation factor | no |
|
relax | under-relaxation factor | no |
|
||||||
|
minJump | Minimum jump value | no |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
@ -88,9 +89,7 @@ class fixedJumpFvPatchField
|
|||||||
public jumpCyclicFvPatchField<Type>
|
public jumpCyclicFvPatchField<Type>
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
// Private data
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
//- "jump" field
|
//- "jump" field
|
||||||
Field<Type> jump_;
|
Field<Type> jump_;
|
||||||
@ -98,6 +97,10 @@ protected:
|
|||||||
//- "jump" field at old time level
|
//- "jump" field at old time level
|
||||||
Field<Type> jump0_;
|
Field<Type> jump0_;
|
||||||
|
|
||||||
|
//- Minimum allowable jump value
|
||||||
|
Type minJump_;
|
||||||
|
|
||||||
|
|
||||||
//- Under-relaxation factor
|
//- Under-relaxation factor
|
||||||
scalar relaxFactor_;
|
scalar relaxFactor_;
|
||||||
|
|
||||||
@ -176,6 +179,12 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- Set the jump field
|
||||||
|
virtual void setJump(const Field<Type>& jump);
|
||||||
|
|
||||||
|
//- Set the jump field (uniform value)
|
||||||
|
virtual void setJump(const Type& jump);
|
||||||
|
|
||||||
//- Return the "jump" across the patch
|
//- Return the "jump" across the patch
|
||||||
virtual tmp<Field<Type>> jump() const;
|
virtual tmp<Field<Type>> jump() const;
|
||||||
|
|
||||||
|
|||||||
@ -104,7 +104,7 @@ void Foam::swirlFanVelocityFvPatchField::calcFanJump()
|
|||||||
// Calculate the tangential velocity
|
// Calculate the tangential velocity
|
||||||
const vectorField tangentialVelocity(magTangU*tanDir);
|
const vectorField tangentialVelocity(magTangU*tanDir);
|
||||||
|
|
||||||
this->jump_ = tangentialVelocity;
|
this->setJump(tangentialVelocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -120,7 +120,7 @@ void Foam::uniformJumpFvPatchField<Type>::updateCoeffs()
|
|||||||
|
|
||||||
if (this->cyclicPatch().owner())
|
if (this->cyclicPatch().owner())
|
||||||
{
|
{
|
||||||
this->jump_ = jumpTable_->value(this->db().time().value());
|
this->setJump(jumpTable_->value(this->db().time().value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedJumpFvPatchField<Type>::updateCoeffs();
|
fixedJumpFvPatchField<Type>::updateCoeffs();
|
||||||
|
|||||||
@ -125,7 +125,7 @@ void Foam::energyJumpFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
const labelUList& faceCells = this->patch().faceCells();
|
const labelUList& faceCells = this->patch().faceCells();
|
||||||
|
|
||||||
jump_ = thermo.he(pp, Tbp.jump(), faceCells);
|
setJump(thermo.he(pp, Tbp.jump(), faceCells));
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedJumpFvPatchField<scalar>::updateCoeffs();
|
fixedJumpFvPatchField<scalar>::updateCoeffs();
|
||||||
|
|||||||
Reference in New Issue
Block a user