ENH: cyclicPeriodicAMI: improved warning message

This commit is contained in:
mattijs
2015-11-19 10:33:43 +00:00
parent 031de9c4ab
commit ff6b550206

View File

@ -493,6 +493,14 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI
// Check that the match is complete // Check that the match is complete
if (iter == maxIter_) if (iter == maxIter_)
{ {
// The matching algorithm has exited without getting the
// srcSum and tgtSum above 1. This can happen because
// - of an incorrect setup
// - or because of non-exact meshes and truncation errors
// (transformation, accumulation of cutting errors)
// so for now this situation is flagged as a SeriousError instead of
// a FatalError since the default matchTolerance is quite strict
// (0.001) and can get triggered far into the simulation.
SeriousErrorIn SeriousErrorIn
( (
"void Foam::cyclicPeriodicAMIPolyPatch::resetPeriodicAMI" "void Foam::cyclicPeriodicAMIPolyPatch::resetPeriodicAMI"
@ -505,11 +513,13 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI
<< matchTolerance() << matchTolerance()
<< " when transformed according to the periodic patch " << " when transformed according to the periodic patch "
<< periodicPatch.name() << "." << nl << periodicPatch.name() << "." << nl
<< "The current sum of weights are for owner " << name()
<< " : " << srcSum << " and for neighbour "
<< neighbPatch().name() << " : " << tgtSum << nl
<< "This is only acceptable during post-processing" << "This is only acceptable during post-processing"
<< "; not during running. Improve your mesh or increase" << "; not during running. Improve your mesh or increase"
<< " the 'matchTolerance' setting in the patch specification." << " the 'matchTolerance' setting in the patch specification."
<< endl; << endl;
// << exit(FatalError);
} }
// Check that both patches have replicated an integer number of times // Check that both patches have replicated an integer number of times
@ -519,6 +529,11 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI
|| mag(tgtSum - floor(tgtSum + 0.5)) > tgtSum*matchTolerance() || mag(tgtSum - floor(tgtSum + 0.5)) > tgtSum*matchTolerance()
) )
{ {
// This condition is currently enforced until there is more
// experience with the matching algorithm and numerics.
// This check means that e.g. different numbers of stator and
// rotor partitions are not allowed.
// Again see the section above about tolerances.
SeriousErrorIn SeriousErrorIn
( (
"void Foam::cyclicPeriodicAMIPolyPatch::resetPeriodicAMI" "void Foam::cyclicPeriodicAMIPolyPatch::resetPeriodicAMI"
@ -530,10 +545,14 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI
<< " do not overlap an integer number of times when transformed" << " do not overlap an integer number of times when transformed"
<< " according to the periodic patch " << " according to the periodic patch "
<< periodicPatch.name() << "." << nl << periodicPatch.name() << "." << nl
<< "The current matchTolerance : " << matchTolerance()
<< ", sum of owner weights : " << srcSum
<< ", sum of neighbour weights : " << tgtSum
<< "." << nl
<< "This is only acceptable during post-processing" << "This is only acceptable during post-processing"
<< "; not during running. Improve your mesh or increase" << "; not during running. Improve your mesh or increase"
<< " the 'matchTolerance' setting in the patch specification." << " the 'matchTolerance' setting in the patch specification."
<< endl; //<< exit(FatalError); << endl;
} }
// Normalise the weights // Normalise the weights