Unified residual norm calculations in flow/well solvers
This PR unifies the calculation of the residual norms in the flow and well solvers.
It works using the following approach:
- In
SolverBaseKernels, the classResidualNormKernelBasedefines two kernels: one for the $L^\infty$ norm and one for the $L^2$ norm. In these two kernels, thecomputefunctions are pure virtual and have to be implemented in derived classes. - In the kernel file of each flow solver, the class
ResidualNormKernelimplements the twocomputefunctions to define how the $L^\infty$ norm and the $L^2$ norm should be computed for each physics. - Each flow solver has a new xml attribute
normTypethat the user can use to choose between the $L^\infty$ norm (default) and the $L^2$ norm.
In this PR, the $L^\infty$ norm is computed as: $|| R ||_{\infty} = max_i \bigg( \displaystyle \frac{|R_i|}{(\rho_t)_i \phi_i V_i} \bigg)$ and the $L^2$ norm is computed as: $|| R ||_2 = \displaystyle \frac{ \sqrt{ \sum_i R_i \times R_i }}{ \sqrt{\sum_i (\rho_t)_i \phi_i V_i}}$
- [X] SinglePhaseFVM
- [X] ThermalSinglePhaseFVM
- [X] SinglePhaseHybridFVM
- [X] SinglePhaseWell
- [X] CompositionalMultiphaseFVM
- [X] ThermalCompositionalMultiphaseFVM
- [X] CompositionalMultiphaseHybridFVM
- [X] CompositionalMultiphaseWell
- [X] ProppantTransport
The PR works for all the integrated tests but will probably introduce some small diffs (particularly, $L^2$ is now very different from what is was in SinglePhaseFVM for large meshes because I removed the multiplier).
The PR is ready for review. There are many small things that may make it difficult to review, like:
- Removed
m_inputFluxEstimatefrom flow solvers - Removed
m_currentTimeandm_currentDtfrom wells - Passed
time_nanddtas arguments ofcalculateResidualNorm(for normalization in wells and mimetic)
but if necessary, we can break the PR into smaller ones
Resolves #1936
If someone has a little bit of time in the next weeks, this (low-priority) PR is ready to be reviewed. It implements the option to choose between the $L^2$ and $L^\infty$ norms for all flow/well solvers. The main file to review in the PR is this kernel file, used here for single-phase flow for instance.