GEOS icon indicating copy to clipboard operation
GEOS copied to clipboard

Producing residual maps

Open jafranc opened this issue 9 months ago • 4 comments

This PR intends at implementing a mechanism to produce residual maps in addition to other fields produce by the CompositionalMultiphaseFVM solver. The desirable features are:

  • Storing residual systematically at each output step for a particular newton iteration (here the last one)
  • Storing residual when the non-linear convergence struggles at an exceptional output step

First point is tacked in:

Residual are for now store through the call at SolverBase::updateResidualField() 's overload in CompositionalMultiphaseFVM if m_logLevel is greater that level 0 and at the last iteration.

Second point is tacked in:

~~An extra event ResidualDumpEvent that inherits from PeriodicEvent with an extra m_secondaryTarget is introduced. It also conditional triggering of second target on a flag from the (main) target, i.e. solver. A n-tree struct templated (BitNodes<T>) on an enum flag (SolverBase::SolverGroupFlags) is used to tack nonlinear convergence history and then trigger exceptional output.~~

A new ResidualTask is added to be triggered from a PeriodicEvent. It has an extra m_secondaryTarget is introduced and set to vtkOutput. The (main) target, i.e. solver, is holding a flag m_hasNonLinearIssues to trigger this secondary target if needed and to dump the residual when convergence is struggling.

Limitations/To go further:

  • The residual formula might need some rework, for instance to fit spe11 prescription
  • The output fields (apart from residual) are the fields at convergence. It might be more meaningfull to output the fields at the residual struggle

jafranc avatar May 03 '24 07:05 jafranc