Fixed read and mapping errors on turbulence boundary conditions

This commit is contained in:
Hrvoje Jasak 2019-06-17 11:11:49 +01:00
parent 7334b895fe
commit 1fd5416dfc
4 changed files with 115 additions and 14 deletions

View file

@ -62,14 +62,31 @@ immersedBoundaryEpsilonWallFunctionFvPatchScalarField
const dictionary& dict
)
:
epsilonWallFunctionFvPatchScalarField(p, iF, dict),
epsilonWallFunctionFvPatchScalarField(p, iF), // Do not read mixed data
immersedBoundaryFieldBase<scalar>
(
p,
Switch(dict.lookup("setDeadValue")),
readScalar(dict.lookup("deadValue"))
)
{}
{
// Since patch does not read a dictionary, the patch type needs to be read
// manually. HJ, 6/Sep/2018
this->readPatchType(dict);
if (!isType<immersedBoundaryFvPatch>(p))
{
FatalIOErrorInFunction(dict)
<< "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
scalarField::operator=(this->patchInternalField());
}
immersedBoundaryEpsilonWallFunctionFvPatchScalarField::
@ -81,14 +98,35 @@ immersedBoundaryEpsilonWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
epsilonWallFunctionFvPatchScalarField(p, iF), // Do not map mixed data. Set patchType later
immersedBoundaryFieldBase<scalar>
(
p,
ptf.setDeadValue(),
ptf.deadValue()
)
{}
{
// Note: NO MAPPING. Fields are created on the immersed boundary
// HJ, 12/Apr/2012
if (!isType<immersedBoundaryFvPatch>(p))
{
FatalErrorInFunction
<< "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
// Copy the patch type since mixed data was not mapped
this->setPatchType(ptf);
// On creation of the mapped field, the internal field is dummy and
// cannot be used. Initialise the value to avoid errors
// HJ, 1/Dec/2017
scalarField::operator=(SMALL);
}
immersedBoundaryEpsilonWallFunctionFvPatchScalarField::
@ -182,7 +220,6 @@ void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::updateCoeffs()
// HJ, 20/May/2018
if (db().foundObject<volScalarField>(GName()))
{
Info<< "Updating epsilon" << endl;
epsilonWallFunctionFvPatchScalarField::updateCoeffs();
}
}

View file

@ -82,7 +82,7 @@ immersedBoundaryKqRWallFunctionFvPatchField
const dictionary& dict
)
:
kqRWallFunctionFvPatchField<Type>(p, iF, dict),
kqRWallFunctionFvPatchField<Type>(p, iF), // Do not read mixed data
immersedBoundaryFieldBase<Type>
(
p,
@ -90,10 +90,10 @@ immersedBoundaryKqRWallFunctionFvPatchField
pTraits<Type>(dict.lookup("deadValue"))
)
{
this->checkType();
this->readPatchType(dict);
this->checkType();
*this == this->patchInternalField();
Field<Type>::operator=(this->patchInternalField());
}
@ -107,7 +107,7 @@ immersedBoundaryKqRWallFunctionFvPatchField
const fvPatchFieldMapper& mapper
)
:
kqRWallFunctionFvPatchField<Type>(ptf, p, iF, mapper),
kqRWallFunctionFvPatchField<Type>(p, iF), // Do not map mixed data. Set patchType later
immersedBoundaryFieldBase<Type>
(
p,
@ -117,6 +117,10 @@ immersedBoundaryKqRWallFunctionFvPatchField
{
this->setPatchType(ptf);
this->checkType();
// cannot be used. Initialise the value to avoid errors
// HJ, 1/Dec/2017
Field<Type>::operator=(pTraits<Type>::zero);
}

View file

@ -61,10 +61,23 @@ immersedBoundaryNutWallFunctionFvPatchScalarField
const dictionary& dict
)
:
nutkWallFunctionFvPatchScalarField(p, iF, dict),
nutkWallFunctionFvPatchScalarField(p, iF), // Do not read mixed data
immersedBoundaryFieldBase<scalar>(p, true, 1e-6)
{
this->readPatchType(dict);
if (!isType<immersedBoundaryFvPatch>(p))
{
FatalIOErrorInFunction(dict)
<< "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
scalarField::operator=(this->patchInternalField());
}
@ -77,10 +90,28 @@ immersedBoundaryNutWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
nutkWallFunctionFvPatchScalarField(p, iF), // Do not map mixed data. Set patchType later
immersedBoundaryFieldBase<scalar>(p, true, 1e-6)
{
// Note: NO MAPPING. Fields are created on the immersed boundary
// HJ, 12/Apr/2012
if (!isType<immersedBoundaryFvPatch>(p))
{
FatalErrorInFunction
<< "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
this->setPatchType(ptf);
// On creation of the mapped field, the internal field is dummy and
// cannot be used. Initialise the value to avoid errors
// HJ, 1/Dec/2017
scalarField::operator=(scalar(0));
}

View file

@ -60,7 +60,7 @@ immersedBoundaryOmegaWallFunctionFvPatchScalarField
const dictionary& dict
)
:
omegaWallFunctionFvPatchScalarField(p, iF, dict),
omegaWallFunctionFvPatchScalarField(p, iF), // Do not read mixed data
immersedBoundaryFieldBase<scalar>
(
p,
@ -70,7 +70,18 @@ immersedBoundaryOmegaWallFunctionFvPatchScalarField
{
this->readPatchType(dict);
*this == this->patchInternalField();
if (!isType<immersedBoundaryFvPatch>(p))
{
FatalIOErrorInFunction(dict)
<< "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
scalarField::operator=(this->patchInternalField());
}
@ -83,7 +94,7 @@ immersedBoundaryOmegaWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
omegaWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
omegaWallFunctionFvPatchScalarField(p, iF), // Do not map mixed data. Set patchType later
immersedBoundaryFieldBase<scalar>
(
p,
@ -91,7 +102,25 @@ immersedBoundaryOmegaWallFunctionFvPatchScalarField
ptf.deadValue()
)
{
// Note: NO MAPPING. Fields are created on the immersed boundary
// HJ, 12/Apr/2012
if (!isType<immersedBoundaryFvPatch>(p))
{
FatalErrorInFunction
<< "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
this->setPatchType(ptf);
// On creation of the mapped field, the internal field is dummy and
// cannot be used. Initialise the value to avoid errors
// HJ, 1/Dec/2017
scalarField::operator=(SMALL);
}