Currently, the derivatives in this codebase are hard-coded as direct differentiations of their original functions, most of which are taken from the original MATLAB implementation nmmoc_surf_nuemann.m. This approach introduces maintainability issues, increases the risk of errors, and makes extending or modifying the code difficult.
Affected Derivatives
The derivatives that are currently hard-coded include:
-
σ (the IFT equation)
-
IFT with respect to surfactant concentration
-
Residual saturations with respect to surfactant concentration
-
Normalized saturations with respect to surfactant concentration
-
Relative permeability with respect to surfactant concentration
-
Relative permeability with respect to saturation
-
Fractional flow with respect to saturation and concentrations
-
Capillary pressure with respect to saturation and concentrations
Suggested Improvement
Consider replacing these hard-coded derivatives with automatic differentiation where possible. This would:
-
Reduce maintenance overhead when modifying underlying functions.
-
Minimize human error in derivative calculations.
-
Facilitate extension to new functional forms or additional variables.
Currently, the derivatives in this codebase are hard-coded as direct differentiations of their original functions, most of which are taken from the original MATLAB implementation
nmmoc_surf_nuemann.m. This approach introduces maintainability issues, increases the risk of errors, and makes extending or modifying the code difficult.Affected Derivatives
The derivatives that are currently hard-coded include:
σ (the IFT equation)
IFT with respect to surfactant concentration
Residual saturations with respect to surfactant concentration
Normalized saturations with respect to surfactant concentration
Relative permeability with respect to surfactant concentration
Relative permeability with respect to saturation
Fractional flow with respect to saturation and concentrations
Capillary pressure with respect to saturation and concentrations
Suggested Improvement
Consider replacing these hard-coded derivatives with automatic differentiation where possible. This would:
Reduce maintenance overhead when modifying underlying functions.
Minimize human error in derivative calculations.
Facilitate extension to new functional forms or additional variables.