Dynamic refinement with immersed boundary wall function: fixes

This commit is contained in:
Hrvoje Jasak 2018-09-06 18:23:21 +01:00
parent e97fa4ed9e
commit aa5131b114
8 changed files with 273 additions and 15 deletions

View file

@ -63,7 +63,12 @@ immersedBoundaryEpsilonWallFunctionFvPatchScalarField
)
:
epsilonWallFunctionFvPatchScalarField(p, iF, dict),
immersedBoundaryFieldBase<scalar>(p, true, 0.09)
immersedBoundaryFieldBase<scalar>
(
p,
Switch(dict.lookup("setDeadValue")),
readScalar(dict.lookup("deadValue"))
)
{}
@ -77,7 +82,12 @@ immersedBoundaryEpsilonWallFunctionFvPatchScalarField
)
:
epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
immersedBoundaryFieldBase<scalar>(p, true, 0.09)
immersedBoundaryFieldBase<scalar>
(
p,
ptf.setDeadValue(),
ptf.deadValue()
)
{}
@ -88,7 +98,12 @@ immersedBoundaryEpsilonWallFunctionFvPatchScalarField
)
:
epsilonWallFunctionFvPatchScalarField(ptf),
immersedBoundaryFieldBase<scalar>(ptf.ibPatch(), true, 0.09)
immersedBoundaryFieldBase<scalar>
(
ptf.ibPatch(),
ptf.setDeadValue(),
ptf.deadValue()
)
{}
@ -100,12 +115,37 @@ immersedBoundaryEpsilonWallFunctionFvPatchScalarField
)
:
epsilonWallFunctionFvPatchScalarField(ptf, iF),
immersedBoundaryFieldBase<scalar>(ptf.ibPatch(), true, 0.09)
immersedBoundaryFieldBase<scalar>
(
ptf.ibPatch(),
ptf.setDeadValue(),
ptf.deadValue()
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper&
)
{
scalarField::operator=(this->patchInternalField());
// Resize refValue as well. HJ, 10/Jul/2018
refValue() = this->patchInternalField();
}
void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList&
)
{}
void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::updateOnMotion()
{
if (size() != ibPatch().size())
@ -163,6 +203,12 @@ void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::evaluate
refValue() = patchInternalField();
}
// Get non-constant reference to internal field
scalarField& intField = const_cast<scalarField&>(this->internalField());
// Set dead value
this->setDeadValues(intField);
epsilonWallFunctionFvPatchScalarField::evaluate(commsType);
}
@ -174,6 +220,7 @@ void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::write
{
fvPatchScalarField::write(os);
writeLocalEntries(os);
this->writeDeadData(os);
// The value entry needs to be written with zero size
scalarField::null().writeEntry("value", os);

View file

@ -142,6 +142,19 @@ public:
// 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&
);
//- Update on mesh motion
virtual void updateOnMotion();

View file

@ -83,7 +83,12 @@ immersedBoundaryKqRWallFunctionFvPatchField
)
:
kqRWallFunctionFvPatchField<Type>(p, iF),
immersedBoundaryFieldBase<Type>(p, true, pTraits<Type>::one*SMALL)
immersedBoundaryFieldBase<Type>
(
p,
Switch(dict.lookup("setDeadValue")),
pTraits<Type>(dict.lookup("deadValue"))
)
{
this->checkType();
@ -102,7 +107,12 @@ immersedBoundaryKqRWallFunctionFvPatchField
)
:
kqRWallFunctionFvPatchField<Type>(ptf, p, iF, mapper),
immersedBoundaryFieldBase<Type>(p, true, pTraits<Type>::one*SMALL)
immersedBoundaryFieldBase<Type>
(
p,
ptf.setDeadValue(),
ptf.deadValue()
)
{
this->checkType();
}
@ -119,8 +129,8 @@ immersedBoundaryKqRWallFunctionFvPatchField
immersedBoundaryFieldBase<Type>
(
ptf.ibPatch(),
true,
pTraits<Type>::one*SMALL
ptf.setDeadValue(),
ptf.deadValue()
)
{
this->checkType();
@ -139,8 +149,8 @@ immersedBoundaryKqRWallFunctionFvPatchField
immersedBoundaryFieldBase<Type>
(
ptf.ibPatch(),
true,
pTraits<Type>::one*SMALL
ptf.setDeadValue(),
ptf.deadValue()
)
{
this->checkType();
@ -149,6 +159,25 @@ immersedBoundaryKqRWallFunctionFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void immersedBoundaryKqRWallFunctionFvPatchField<Type>::autoMap
(
const fvPatchFieldMapper&
)
{
Field<Type>::operator=(this->patchInternalField());
}
template<class Type>
void immersedBoundaryKqRWallFunctionFvPatchField<Type>::rmap
(
const fvPatchField<Type>& ptf,
const labelList&
)
{}
template<class Type>
void immersedBoundaryKqRWallFunctionFvPatchField<Type>::updateOnMotion()
{
@ -173,6 +202,12 @@ void immersedBoundaryKqRWallFunctionFvPatchField<Type>::evaluate
Field<Type>::operator=(this->patchInternalField());
}
// Get non-constant reference to internal field
Field<Type>& intField = const_cast<Field<Type>&>(this->internalField());
// Set dead value
this->setDeadValues(intField);
kqRWallFunctionFvPatchField<Type>::evaluate(commsType);
}
@ -181,6 +216,8 @@ template<class Type>
void immersedBoundaryKqRWallFunctionFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
this->writeDeadData(os);
// The value entry needs to be written with zero size
Field<Type>::null().writeEntry("value", os);
// this->writeEntry("value", os);

View file

@ -142,6 +142,19 @@ public:
// 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 fvPatchField<Type>&,
const labelList&
);
//- Update on mesh motion
virtual void updateOnMotion();

View file

@ -105,6 +105,23 @@ immersedBoundaryNutWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void immersedBoundaryNutWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper&
)
{
scalarField::operator=(this->patchInternalField());
}
void immersedBoundaryNutWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList&
)
{}
void immersedBoundaryNutWallFunctionFvPatchScalarField::updateOnMotion()
{
if (size() != ibPatch().size())
@ -115,6 +132,30 @@ void immersedBoundaryNutWallFunctionFvPatchScalarField::updateOnMotion()
}
void immersedBoundaryNutWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes commsType
)
{
// Resize fields
if (size() != patch().size())
{
Info<< "Resizing immersedBoundaryNutWallFunction in evaluate"
<< endl;
*this == patchInternalField();
}
// Get non-constant reference to internal field
scalarField& intField = const_cast<scalarField&>(this->internalField());
// Set dead value
this->setDeadValues(intField);
nutkWallFunctionFvPatchScalarField::evaluate(commsType);
}
void immersedBoundaryNutWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);

View file

@ -136,10 +136,32 @@ public:
// 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&
);
//- Update on mesh motion
virtual void updateOnMotion();
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes = Pstream::blocking
);
// I-O
//- Write

View file

@ -61,7 +61,12 @@ immersedBoundaryOmegaWallFunctionFvPatchScalarField
)
:
omegaWallFunctionFvPatchScalarField(p, iF, dict),
immersedBoundaryFieldBase<scalar>(p, true, 90)
immersedBoundaryFieldBase<scalar>
(
p,
Switch(dict.lookup("setDeadValue")),
readScalar(dict.lookup("deadValue"))
)
{}
@ -75,7 +80,12 @@ immersedBoundaryOmegaWallFunctionFvPatchScalarField
)
:
omegaWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
immersedBoundaryFieldBase<scalar>(p, true, 90)
immersedBoundaryFieldBase<scalar>
(
p,
ptf.setDeadValue(),
ptf.deadValue()
)
{}
@ -86,7 +96,12 @@ immersedBoundaryOmegaWallFunctionFvPatchScalarField
)
:
omegaWallFunctionFvPatchScalarField(ptf),
immersedBoundaryFieldBase<scalar>(ptf.ibPatch(), true, 90)
immersedBoundaryFieldBase<scalar>
(
ptf.ibPatch(),
ptf.setDeadValue(),
ptf.deadValue()
)
{}
@ -98,12 +113,37 @@ immersedBoundaryOmegaWallFunctionFvPatchScalarField
)
:
omegaWallFunctionFvPatchScalarField(ptf, iF),
immersedBoundaryFieldBase<scalar>(ptf.ibPatch(), true, 90)
immersedBoundaryFieldBase<scalar>
(
ptf.ibPatch(),
ptf.setDeadValue(),
ptf.deadValue()
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void immersedBoundaryOmegaWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper&
)
{
scalarField::operator=(this->patchInternalField());
// Resize refValue as well. HJ, 10/Jul/2018
refValue() = this->patchInternalField();
}
void immersedBoundaryOmegaWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList&
)
{}
void immersedBoundaryOmegaWallFunctionFvPatchScalarField::updateOnMotion()
{
if (size() != ibPatch().size())
@ -127,7 +167,7 @@ void immersedBoundaryOmegaWallFunctionFvPatchScalarField::updateCoeffs()
// Resize fields
if (size() != patch().size())
{
Info<< "Resizing immersedBoundaryEpsilonWallFunction in evaluate: "
Info<< "Resizing immersedBoundaryOmegaWallFunction in evaluate: "
<< "patch: " << patch().size() << " field: " << size()
<< endl;
@ -145,6 +185,31 @@ void immersedBoundaryOmegaWallFunctionFvPatchScalarField::updateCoeffs()
}
void immersedBoundaryOmegaWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes commsType
)
{
// Resize fields
if (size() != patch().size())
{
Info<< "Resizing immersedBoundaryOmegaWallFunction in evaluate"
<< endl;
*this == patchInternalField();
refValue() = patchInternalField();
}
// Get non-constant reference to internal field
scalarField& intField = const_cast<scalarField&>(this->internalField());
// Set dead value
this->setDeadValues(intField);
omegaWallFunctionFvPatchScalarField::evaluate(commsType);
}
void immersedBoundaryOmegaWallFunctionFvPatchScalarField::write
(
Ostream& os
@ -152,6 +217,7 @@ void immersedBoundaryOmegaWallFunctionFvPatchScalarField::write
{
fvPatchScalarField::write(os);
writeLocalEntries(os);
this->writeDeadData(os);
// The value entry needs to be written with zero size
scalarField::null().writeEntry("value", os);

View file

@ -156,6 +156,19 @@ public:
// 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&
);
//- Update on mesh motion
virtual void updateOnMotion();
@ -165,6 +178,12 @@ public:
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes = Pstream::blocking
);
// I-O