i.e., the simulator does not deal with any output operations
anymore. This makes sense because report steps are handled by
Opm::TimeMap and the constructor for the simulator already needs more
arguments than appropriate even without this...
With this, constantState() just calls variableState() and throws away
the derivatives. This might be a bit slower than necessary, but it
makes these two methods automatically consistent and constantState()
is only called once per timestep anyway...
thanks to @atgeirr for the suggestion!
Now the well state is consulted for the controls to use when assembling
the well control equations, instead of the (immutable) wells_ struct.
Also, added dummy implementation of updateWellControls().
This is done since the solver will need to be able to switch well controls
during Newton iterations. The current control specified in the Wells struct
will be used as default and initial value for currentControls().
Manually resolved conficts in the following files
examples/sim_fibo_ad.cpp
opm/autodiff/FullyImplicitBlackoilSolver_impl.hpp
opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp
In additions examples/sim_fibo_ad_cp.cpp was adapted to compile again.
Conflicts:
opm/autodiff/FullyImplicitBlackoilSolver.cpp
To resolve conflicts, WellState was changed to WellStateFullyImplicitBlackoil
in multiple places, and perfRate() changed to perfPhaseRate() in
WellDensitySegmented.
This is intended to be used instead of the WellState class in the fully
implicit blackoil simulator. It contains a WellState to reuse the init()
method and to enable users to call functions requiring a WellState.
This is done with containment and an access member function,
basicWellState(), instead of with inheritance to minimize surprises.
This implements a superset of the interface as proposed in pull request
opm-core#496 for use with CpGrid.
It also adds some additional functionality needed in opm-autodiff.
Todo: incorporate WellDensitySegment. Currently values of the pressure
drop is hardcoded to make the rest of the code work
Todo: make it possible to shut perforation with crossflow.
if done the other way round we would make an assertation in TimeMap
false and also the values returned by SimulationTimer would be for the
next time step and not the current one...
This includes:
- Using the class FullyImplicitBlackoilResidual instead of
in-class definition for the residual object.
- Changing residual field name mass_balance to material_balance_eq.
- Letting the simulator and solver classes accept a
FullyImplicitSystemSolverInterface instead of a LinearSolverInterface.
- In sim_fibo_ad and test_implicit_ad, instantiate class
FullyImplicitSystemSolverSimple, replicating existing behaviour.
This is done in preparation for adding a cpr-preconditioning solver
for the fully implicit black-oil system. The existing implementation
that concatenates the whole system and passes it to some linear solver
has been moved from a private function of FullyImplicitBlackoilSolver
to the class FullyImplicitSolverSimple.
To enable this decoupling, the residual struct has been copied out
of the FullyImplicitBlackoilSolver class and is now an independent
struct: FullyImplicitBlackoilResidual. The opportunity has been used
to replace the field mass_balance with material_balance_eq, which is
more precise.
The code was partially kept as a reminder to implement
proper well reporting and mass balance reporting. Now
well reporting has been taken care of, so we remove
the code.
This computes pressure differences with respect to the bottom-hole pressure
for each well perforation, based on the well flows. It is explicit and not
implicit, using the previous time step's flow rates to calculate the necessary
densities.
The simulator now handles live gas as well as live oil.
The primary variables are Po,Sw and Rs,Rv or Sg depending on fluid
condition
State 1 Gas only (Undersaturated gas): Po, Sw and Rv
State 2 Gas and oil: Po, Sw and Sg
State 3 Oil only (Undersaturated oil): Po, Sw and Rs
This commit includes:
1. New interfaces for the vapor oil/gas ratios (Rv)
2. Modifications in the equations to handle rvs
3. New definition of ADI variable to handle changing primary variables
4. Modifications in the solution updates to handle changing primary
variable
5. Some changes in the appleyard process to sync with Mrsts livegas
implementation.
NOTE:
The implementation is tested on the liveoil cases SPE1 and a simplified
SPE9 and produces the same results as the old code.
The simulator is not yet able to converge on SPE3 with livegas present.
For SPE3 to converge a more robust well implementation is needed. The
current simulator reproduce the results of Mrst when a similar well
model is used in Mrst as is currently implemented OPM.
The pvt interface is extened to handle wet gas
1. A function for rvSat is added to the interface
2. An interface that takes rv and the fluid condition as an input for
the gas properties is added. The old interface without rv and the fluid
condition is kept in the file.
3. The new interface is implemented in BlackoilPropsAd and
BlackoilPropsAdFromDeck.
A simulator that tests wet gas is not yet implemented.
I'm neither sure that this is fully correct nor that I found all
occurences (so far, the output writing code is missing in this patch),
but it seems to work for SPE1...
Commit 4aa0eaf introduced density and viscosity evaluators into the
BlackoilPropsAdInterface that accepted an externally assignable
condition to distinguish saturated from unsaturated cases. As a
result of a few low-level technical problems with that approach,
this commit changes those affected interfaces to use the black-oil
specific 'PhasePresence' facility of opm-core's commit a033329.
Update callers accordingly.
The criteria for whether the fluid is saturated or not is moved from the
within the pvt calculations to the solver, and passed to the pvt
calculations as a array of boolean values.
The most severe change probably is the removal of the AutoDiff
debugging helper functions which were useful from within a debugger
but unfortunately had to rely on a presumed linker bug in order not to
be removed in the final binary.
Also, some private attributes were unused. These have been removed and
the constructors of their respective classes have been adapted. Once
their intended functionality is actually implemented, they should be
brought back on an as-needed basis.
Thanks to @bska for the review!
This should simplify some uses of the autodiff code. The internals
have been changed to allow for objects to have an empty vector of
Jacobians, always treating that object as a constant.
CLang and recent GCC warn about the "typedef" 'OneColInt' in
AutoDiffHelpers.hpp being unused. Similarly, GCC warns about unused
parameters in various place at level "-Wunused". This change-set
either removes ('OneColInt') or suppresses those messages.
There is some code in place now to create wells for the no-deck case,
but since it does not work correctly yet, the simulator intercepts this
and throws.
Not all implementations support the TR1, and if they do, the type
might not be in a namespace called std::tr1 . Favour the
implementation from Boost for reasons of portability.
This is inspired (and necessitated) by commit OPM/opm-core@68eb3fb
which, incidentally, cleaned up some header pollution on which we
inadvertently depended.
- Using x/x.abs() instead of a proper sign function led to problems
when x = 0. Solved by using new sign() utility.
- Pass pressure instead of rs as parameter to fluidRsMax().
- updateState() is a new method that modifies the state object after solution,
this was formerly done in solveJacobianSystem().
- Implemented Appleyard chop (not verified yet) for handling variable switching.
- Added rs as input to fluid interfaces to include rs-derivatives.
Notes:
- Interface was already present, just disabled.
- Class BlackoilPropsAd cannot properly implement rsMax() with derivatives,
and implements only a throw statement.