Previously, local averages were calculated and used in the
well equations. With this commit we add versions of defineState and
calcAverages that take into account the parallel domain decomposition
and calculate correct averages.
Function calcAverages has a boolean template parameter
indicating whether this is a parallel run. Additionally we introduce
AverageIncrementCalculator with the same boolean template parameter.
In a parallel run we check whether the cell is owned by the process and
only in this case return an increment bigger than zero. In a sequential run
(no MPI or just one process -> empty boost::any parameter) no overhead is
introduced.
In the process, generalise the notion of region properties. We
introduce a new helper class
Details::RegionAttributes<RegionId, Attributes>
that provides lookup from a RegionId, typically an int, to a
user-defined set of Attributes--in this case pressure and
temperature.
While here, mark 'SurfaceToReservoirVoidage::calcCoeff()' as 'const'
because it doesn't need to modify any internal state and refactor
the implementation to eliminate repeated calculations of
ADB::constant(X)
Remaining method is the one taking AD objects. This modification
required changes to a few more places than anticipated:
- RateConverter
- FullyImplicitBlackoilSolver::computeWellConnectionPressures()
In these places, the call now is a little more complex and there
might be a very minor performance loss, until we optimize the
bX() functions to check for the no-derivatives case.
Note that this patch does not introduce any real temperature
dependence but only changes the APIs for the viscosity and for the
density related methods. Note that I also don't like the fact that
this requires so many changes to so many files, but with the current
design of the property classes I cannot see a way to avoid this...
This commit adds a simple facility for converting component rates at
surface conditions to voidage rates at reservoir conditions. It is
intentionally limited in scope and meant to be employed only in the
context of class FullyImplicitBlackoilSolver<> or something very
similar. In particular, class SurfaceToReservoirVoidage<> assumes
that it will be used to compute conversion coefficients for
component rates to voidage rates, and that those coefficients will
typically be entered into the coefficient matrix of a linearised
residual.
Add a trivial test just to demonstrate the setup and calling
process. This is not a feature or correctness test.