JutulDarcy

Documentation for JutulDarcy.

JutulDarcy.BlackOilXMethod
BlackOilX(sys::BlackOilVariableSwitchingSystem, p; sw = 0.0, so = 0.0, sg = 0.0, rs = 0.0, rv = 0.0)

High level initializer for the black oil unknown degree of freedom. Will try to fill in the gaps unless system is really underspecified.

JutulDarcy.DisabledControlType
DisabledControl()

Control that disables a well. If a well is disabled, it is disconnected from the surface network and no flow occurs between the well and the top side. Mass transfer can still occur inside the well, and between the well and the reservoir.

See also ProducerControl, InjectorControl.

JutulDarcy.FlowBoundaryConditionType
FlowBoundaryCondition(
cell,
pressure = DEFAULT_MINIMUM_PRESSURE, 
temperature = 298.15;
fractional_flow = nothing,
density = nothing,
trans_flow = 1e-12,
trans_thermal = 1e-6
)

Boundary condition for constant values (pressure/temperature)

JutulDarcy.ImmiscibleSaturationType

A single saturation that represents the "other" phase in a three phase compositional system where two phases are predicted by an EoS

JutulDarcy.InjectorControlType
InjectorControl(target, mix, [density])

Well control that specifies injection into the reservoir. target specifies the type of target and mix defines the injection mass fractions for all species in the model during injection.

For example, for a three-component system made up of CO2, H2O and H2, setting [0.1, 0.6, 0.3] would mean that the injection stream would contain 1 part CO2, 6 parts H2O and 3 parts H2 by mass. For an immiscible system (e.g. LiquidPhase(), VaporPhase()) the species corresponds to phases and [0.3, 0.7] would mean a 3 to 7 mixture of liquid and vapor by mass.

The density of the injected fluid at surface conditions is given by density which is defaulted to 1.0 if not given.

See also ProducerControl, DisabledControl.

JutulDarcy.MinimalTPFAGridType
MinimalTPFAGrid(ϕ, N)

Generate a minimal grid suitable only for two-point flux discretization (TPFA) for given pore-volumes ϕ and a neighborship matrix N with size (2, n) where n is the number of internal faces.

JutulDarcy.SinglePhaseRateTargetType
SinglePhaseRateTarget(q, phase)

Single-phase well target with value q specified for phase.

Examples

julia> SinglePhaseRateTarget(0.001, LiquidPhase())
SinglePhaseRateTarget of 0.001 [m^3/s] for LiquidPhase()
JutulDarcy.SurfaceLiquidRateTargetType
SurfaceLiquidRateTarget(q)

Well target of specified liquid rate with value q (liquid/oil and water, but not gas) at surface conditions.

JutulDarcy.TotalRateTargetType
TotalRateTarget(q)

Well target of specified total rate of all phases with value q at surface conditions.

JutulDarcy.full_well_outputsMethod
full_well_outputs(model, states, forces; targets = available_well_targets(model.models.Reservoir), shortname = false)

Get the full set of well outputs after a simulation has occured, for plotting or other post-processing.

JutulDarcy.replace_targetFunction
replace_target(ctrl, new_target)

Create new well control using ctrl as a template that operates under new_target.

JutulDarcy.reservoir_linsolveFunction
reservoir_linsolve(model, precond = :cpr; <keyword arguments>)

Set up iterative linear solver for a reservoir model from setup_reservoir_model.

Arguments

  • model: Reservoir model that will linearize the equations for the linear solver
  • precond=:cpr: Preconditioner type to use: Either :cpr (Constrained-Pressure-Residual) or :ilu0 (block-incomplete-LU) (no effect if solver = :direct).
  • v=0: verbosity (can lead to a large amount of output)
  • solver=:bicgstab: the symbol of a Krylov.jl solver (typically :gmres or :bicgstab)
  • update_interval=:once: how often the CPR AMG hierarchy is reconstructed (:once, :iteration, :ministep, :step)
  • update_interval_partial=:iteration: how often the pressure system is updated in CPR
  • max_coarse: max size of coarse level if using AMG
  • cpr_type=nothing: type of CPR (:true_impes, :quasi_impes or nothing for automatic)
  • partial_update=true: perform partial update of CPR preconditioner outside of AMG update (see above)
  • rtol=1e-3: relative tolerance for the linear solver
  • max_iterations=100: limit for linear solver iterations

Additional keywords are passed onto the linear solver constructor.

JutulDarcy.setup_reservoir_forcesMethod
setup_reservoir_forces(model; control = nothing, limits = nothing, set_default_limits = true, <keyword arguments>)

Set up driving forces for a reservoir model with wells

JutulDarcy.setup_reservoir_modelMethod
setup_reservoir_model(reservoir, system; wells = [], <keyword arguments>)
setup_reservoir_model(reservoir, system; wells = [], context = DefaultContext(), reservoir_context = nothing, backend = :csc, <keyword arguments>)

Set up a reservoir MultiModel for a given reservoir SimulationModel and an optional vector of wells.

The routine automatically sets up a facility and couples the wells with the reservoir and that facility.

JutulDarcy.setup_reservoir_simulatorFunction
setup_reservoir_simulator(models, initializer, parameters = nothing; <keyword arguments>)

Arguments

  • models: either a single model or a Dict with the key :Reservoir for multimodels
  • initializer: used to setup state0, must be compatible with model
  • parameters: initialized parameters, must be compatible with model if provided
  • linear_solver=:bicgstab: iterative solver to use (provided model supports it)
  • precond=:cpr: preconditioner for iterative solver: Either :cpr or :ilu0.
  • rtol=1e-3: relative tolerance for linear solver
  • initial_dt=3600*24.0: initial time-step in seconds (one day by default)
  • target_its=8: target number of nonlinear iterations per time step
  • offset_its=1: dampening parameter for time step selector where larger values lead to more pessimistic estimates.
  • tol_cnv=1e-3: maximum allowable point-wise error (volume-balance)
  • tol_mb=1e-7: maximum alllowable integrated error (mass-balance)
  • specialize=false: use deep specialization of storage for faster execution, but significantly more compile time

Additional keyword arguments are passed onto simulator_config.

JutulDarcy.setup_reservoir_stateMethod
setup_reservoir_state(model, <keyword arguments>)
# Ex: For immiscible two-phase
setup_reservoir_state(model, Pressure = 1e5, Saturations = [0.2, 0.8])

Convenience constructor that initializes a state for a MultiModel set up using setup_reservoir_model. The main convenience over setup_state is only the reservoir initialization values need be provided: wells are automatically initialized from the connected reservoir cells.

JutulDarcy.simulate_mrst_caseMethod
simulate_mrst_case(file_name; kwarg...)

Simulate a MRST case from file_name as exported by writeJutulInput in MRST.

Arguments

  • file_name::String: The path to a .mat file that is to be simulated.
  • extra_outputs::Vector{Symbol} = [:Saturations]: Additional variables to output from the simulation.
  • write_output::Bool = true: Write output (in the default JLD2 format)
  • output_path = nothing: Directory for output files. Files will be written under this directory. Defaults to the folder of file_name.
  • write_mrst = true: Write MRST compatible output after completed simulation that can be read by readJutulOutput in MRST.
  • backend=:csc: choice of backend for linear systems. :csc for default Julia sparse, :csr for experimental parallel CSR.
  • verbose=true: print some extra information specific to this routine upon calling
  • nthreads=Threads.nthreads(): number of threads to use
  • linear_solver=:bicgstab: name of Krylov.jl solver to use, or :direct (for small cases only)
  • info_level=0: standard Jutul info_level. 0 for minimal printing, -1 for no printing, 1-5 for various levels of verbosity

Additional input arguments are passed onto setup_reservoir_simulator and simulator_config if applicable.

JutulDarcy.well_mismatchMethod
well_mismatch(qoi, wells, model_f, states_f, model_c, state_c, dt, step_no, forces; <keyword arguments>)

Compute well mismatch for a set of qoi's (well targets) and a set of well symbols.

JutulDarcy.well_outputFunction
well_output(model, states, well_symbol, forces, target = BottomHolePressureTarget)

Get a specific well output from a valid operational target once a simulation is completed an states are available.