Updated I/O handling of fixed gradient and mixed FV patches for DLB. Vuko Vukcevic

This commit is contained in:
Hrvoje Jasak 2019-04-30 15:44:09 +01:00
parent e63cc43dfa
commit f97c0f81ab
3 changed files with 32 additions and 9 deletions

View file

@ -67,11 +67,20 @@ fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
const dictionary& dict const dictionary& dict
) )
: :
// HR 15.12.18: Must not call evaluate during construction. Read value fvPatchField<Type>(p, iF, dict),
// instead. This is needed for PLB.
fvPatchField<Type>(p, iF, dict, true),
gradient_("gradient", dict, p.size()) gradient_("gradient", dict, p.size())
{} {
// Call evaluate only if the value is not found. Used to avoid evaluating
// when we have incomplete meshes during Parallel Load Balancing. When
// shipping the field over to another processor, we first call write, making
// sure that the value is written and read it on the other side (see
// write member function). If this proves to be problematic, we can always
// initialize with patch internal field for the start-up. VV, 12/Apr/2019.
if (!dict.found("value"))
{
evaluate();
}
}
template<class Type> template<class Type>
@ -190,6 +199,11 @@ void fixedGradientFvPatchField<Type>::write(Ostream& os) const
{ {
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
gradient_.writeEntry("gradient", os); gradient_.writeEntry("gradient", os);
// Write value along with the gradient in order to avoid calling evaluate
// on construction (from dictionary constructor) for Parallel Load Balancing
// runs. See dictionary constructor for details. VV, 12/Apr/2019.
this->writeEntry("value", os);
} }

View file

@ -54,13 +54,22 @@ mixedFvPatchField<Type>::mixedFvPatchField
const dictionary& dict const dictionary& dict
) )
: :
// HR 15.12.18: Must not call evaluate during construction. Read value fvPatchField<Type>(p, iF, dict),
// instead. This is needed for PLB.
fvPatchField<Type>(p, iF, dict, true),
refValue_("refValue", dict, p.size()), refValue_("refValue", dict, p.size()),
refGrad_("refGradient", dict, p.size()), refGrad_("refGradient", dict, p.size()),
valueFraction_("valueFraction", dict, p.size()) valueFraction_("valueFraction", dict, p.size())
{} {
// Call evaluate only if the value is not found. Used to avoid evaluating
// when we have incomplete meshes during Parallel Load Balancing. When
// shipping the field over to another processor, we first call write, making
// sure that the value is written and read it on the other side (see
// write member function). If this proves to be problematic, we can always
// initialize with patch internal field for the start-up. VV, 12/Apr/2019.
if (!dict.found("value"))
{
evaluate();
}
}
template<class Type> template<class Type>