Template functions must be defined in the header since the library
cannot contain generic code. To keep only the interface in the main
header, all such function bodies are put in a separate _impl file.
Specifically,
- #include <config.h> where appropriate (all .cpp files)
- Adjust include statements to account for sub-directory locations
of .hpp files.
GCC's flag -Wmissing-declarations requires that a valid prototype
exist for non-template (global) functions prior to the corresponding
function definition.
The reverse of subset(), superset() takes a sparse representation of a vector
and makes a full representation of it.
Also added a little documentation.
Specifically,
- Extract method solveJacobianSystem() for solving a single,
system of linear equations (i.e., the Newton step).
- Extract method residualNorm() for computing the residual norm.
Used in loop control.
- Stub out a method for computing fluxes.
Compile and run-tested on a linear, gravity-driven flow problem.
Otherwise, we will use the transposed Jacobian as a coefficient
matrix in the 'linsolver_'. This is wrong when solving compressible
problems for which the Jacobian matrix is not symmetric.
When run as
./test_impestfpa_ad permeability=1.01325e15 ref_pressure=1.0e-5 \
mu1=1000 mu2=1000 rho1=1 rho2=1
this example reproduces the expected solution (a one-Pascal pressure
increase per cell).
Note that this is an incompressible case, so 'test_impestpfa_ad' must
be compiled with the pre-processor symbol
HACK_INCOMPRESSIBLE_GRAVITY
defined to a true value (e.g., -DHACK_INCOMPRESSIBLE_GRAVITY=1)
Since a definition of the class is not in the header, no other
compilation units can safely access the internals of the Impl class
anyway, so it may as well be a regular struct so that the outer class
(SimulatorIncompTwophase) can access it.
The gravity flux of phase 'i' across an (internal) interface is then
given by
gflux = mob_i * (G * rho_i)
assuming 'rho_i' contains the phase density (at reservoir conditions)
of phase 'i' and 'mob_i' is the phase mobility of phase 'i' at the
interface.