Loading...
Searching...
No Matches
Opm::FvBaseProblem< TypeTag > Class Template Reference

Base class for all problems which use a finite volume spatial discretization. More...

`#include <fvbaseproblem.hh>`

Inheritance diagram for Opm::FvBaseProblem< TypeTag >:

## Public Types

using | RestrictProlongOperator = EmptyRestrictProlong

## Public Member Functions

| FvBaseProblem (Simulator &simulator)
bool | recycleFirstIterationStorage () const
| Return if the storage term of the first iteration is identical to the storage term for the solution of the previous time step.
unsigned | intensiveQuantityHistorySize () const
| Returns the required history size for intensive quantities cache.
std::string | outputDir () const
| Determine the directory for simulation output.
void | finishInit ()
| Called by the Opm::Simulator in order to initialize the problem.
void | prefetch (const Element &) const
| Allows to improve the performance by prefetching all data which is associated with a given element.
void | gridChanged ()
| Handle changes of the grid.
template<class Context>
void | boundary (BoundaryRateVector &, const Context &, unsigned, unsigned) const
| Evaluate the boundary conditions for a boundary segment.
template<class Context>
void | constraints (Constraints &, const Context &, unsigned, unsigned) const
| Evaluate the constraints for a control volume.
template<class Context>
void | source (RateVector &, const Context &, unsigned, unsigned) const
| Evaluate the source term for all phases within a given sub-control-volume.
template<class Context>
void | initial (PrimaryVariables &, const Context &, unsigned, unsigned) const
| Evaluate the initial value for a control volume.
template<class Context>
Scalar | extrusionFactor (const Context &, unsigned, unsigned) const
| Return how much the domain is extruded at a given sub-control volume.
Scalar | extrusionFactor () const
void | initialSolutionApplied ()
| Callback used by the model to indicate that the initial solution has been determined for all degrees of freedom.
void | beginEpisode ()
| Called at the beginning of an simulation episode.
void | beginTimeStep ()
| Called by the simulator before each time integration.
void | beginIteration ()
| Called by the simulator before each Newton-Raphson iteration.
void | endIteration ()
| Called by the simulator after each Newton-Raphson update.
void | endTimeStep ()
| Called by the simulator after each time integration.
void | endEpisode ()
| Called when the end of an simulation episode is reached.
void | finalize ()
| Called after the simulation has been run sucessfully.
void | timeIntegration ()
| Called by Opm::Simulator in order to do a time integration on the model.
Scalar | minTimeStepSize () const
| Returns the minimum allowable size of a time step.
unsigned | maxTimeIntegrationFailures () const
| Returns the maximum number of subsequent failures for the time integration before giving up.
bool | continueOnConvergenceError () const
| Returns if we should continue with a non-converged solution instead of giving up if we encounter a time step size smaller than the minimum time step size.
void | setNextTimeStepSize (Scalar dt)
| Impose the next time step size to be used externally.
Scalar | nextTimeStepSize () const
| Called by Opm::Simulator whenever a solution for a time step has been computed and the simulation time has been updated.
bool | shouldWriteRestartFile () const
| Returns true if a restart file should be written to disk.
bool | shouldWriteOutput () const
| Returns true if the current solution should be written to disk (i.e.
void | advanceTimeLevel ()
| Called by the simulator after everything which can be done about the current time step is finished and the model should be prepared to do the next time integration.
std::string | name () const
| The problem name.
const GridView & | gridView () const
| The GridView which used by the problem.
const GlobalPosition & | boundingBoxMin () const
| The coordinate of the corner of the GridView's bounding box with the smallest values.
const GlobalPosition & | boundingBoxMax () const
| The coordinate of the corner of the GridView's bounding box with the largest values.
const VertexMapper & | vertexMapper () const
| Returns the mapper for vertices to indices.
const ElementMapper & | elementMapper () const
| Returns the mapper for elements to indices.
Simulator & | simulator ()
| Returns Simulator object used by the simulation.
const Simulator & | simulator () const
| Returns Simulator object used by the simulation.
Model & | model ()
| Returns numerical model used for the problem.
const Model & | model () const
| Returns numerical model used for the problem.
NewtonMethod & | newtonMethod ()
| Returns object which implements the Newton method.
const NewtonMethod & | newtonMethod () const
| Returns object which implements the Newton method.
RestrictProlongOperator | restrictProlongOperator ()
| return restriction and prolongation operator
unsigned | markForGridAdaptation ()
| Mark grid cells for refinement or coarsening.
template<class Restarter>
void | serialize (Restarter &res)
| This method writes the complete state of the problem to the harddisk.
template<class Restarter>
void | deserialize (Restarter &res)
| This method restores the complete state of the problem from disk.
void | writeOutput (bool verbose=true)
| Write the relevant secondary variables of the current solution into an VTK output file.
VtkMultiWriter & | defaultVtkWriter () const
| Method to retrieve the VTK writer which should be used to write the default ouput after each time step to disk.

## Static Public Member Functions

static void | registerParameters ()
| Registers all available parameters for the problem and the model.
static std::string | helpPreamble (int, const char **argv)
| Returns the string that is printed before the list of command line parameters in the help message.
static std::string | briefDescription ()
| Returns a human readable description of the problem for the help message.
static int | handlePositionalParameter (std::function< void(const std::string &, const std::string &)>, std::set< std::string > &, std::string &errorMsg, int, const char **argv, int paramIdx, int)
| Handles positional command line parameters.

## Protected Member Functions

bool | enableVtkOutput_ () const

## Protected Attributes

Scalar | nextTimeStepSize_

## Detailed Description

template<class TypeTag>
class Opm::FvBaseProblem< TypeTag >

Base class for all problems which use a finite volume spatial discretization.

Note
  All quantities are specified assuming a threedimensional world. Problems discretized using 2D grids are assumed to be extruded by and 1D grids are assumed to have a cross section of .

## Constructor & Destructor Documentation

## FvBaseProblem()

template<class TypeTag>

Opm::FvBaseProblem< TypeTag >::FvBaseProblem | ( | Simulator & | simulator | ) |

inline explicit

Parameters

  simulator | The time manager of the simulation
  gridView | The view on the DUNE grid which ought to be used (normally the leaf grid view)

## Member Function Documentation

## boundary()

template<class TypeTag>
template<class Context>

void Opm::FvBaseProblem< TypeTag >::boundary | ( | BoundaryRateVector & | ,
|  | const Context & | ,
|  | unsigned | ,
|  | unsigned | ) const

inline

Evaluate the boundary conditions for a boundary segment.

Parameters

  values | Stores the fluxes over the boundary segment.
  context | The object representing the execution context from which this method is called.
  spaceIdx | The local index of the spatial entity which represents the boundary segment.
  timeIdx | The index used for the time discretization

## briefDescription()

template<class TypeTag>

std::string Opm::FvBaseProblem< TypeTag >::briefDescription | ( |  | ) |

inline static

Returns a human readable description of the problem for the help message.

The problem description is printed as part of the –help message. It is optional and should not exceed one or two lines of text.

## constraints()

template<class TypeTag>
template<class Context>

void Opm::FvBaseProblem< TypeTag >::constraints | ( | Constraints & | ,
|  | const Context & | ,
|  | unsigned | ,
|  | unsigned | ) const

inline

Evaluate the constraints for a control volume.

Parameters

  constraints | Stores the values of the primary variables at a given spatial and temporal location.
  context | The object representing the execution context from which this method is called.
  spaceIdx | The local index of the spatial entity which represents the boundary segment.
  timeIdx | The index used for the time discretization

## deserialize()

template<class TypeTag>
template<class Restarter>

void Opm::FvBaseProblem< TypeTag >::deserialize | ( | Restarter & | res | ) |

inline

This method restores the complete state of the problem from disk.

It is the inverse of the serialize() method.

Template Parameters

  Restarter | The deserializer type

Parameters

  res | The deserializer object

## endEpisode()

template<class TypeTag>

void Opm::FvBaseProblem< TypeTag >::endEpisode | ( |  | ) |

inline

Called when the end of an simulation episode is reached.

Typically, a new episode is started in this method.

## endTimeStep()

template<class TypeTag>

void Opm::FvBaseProblem< TypeTag >::endTimeStep | ( |  | ) |

inline

Called by the simulator after each time integration.

This method is intended to do some post processing of the solution. (e.g., some additional output)

## extrusionFactor()

template<class TypeTag>
template<class Context>

Scalar Opm::FvBaseProblem< TypeTag >::extrusionFactor | ( | const Context & | ,
|  | unsigned | ,
|  | unsigned | ) const

inline

Return how much the domain is extruded at a given sub-control volume.

This means the factor by which a lower-dimensional (1D or 2D) entity needs to be expanded to get a full dimensional cell. The default is 1.0 which means that 1D problems are actually thought as pipes with a cross section of 1 m^2 and 2D problems are assumed to extend 1 m to the back.

Parameters

  context | The object representing the execution context from which this method is called.
  spaceIdx | The local index of the spatial entity which represents the boundary segment.
  timeIdx | The index used for the time discretization

## finishInit()

template<class TypeTag>

void Opm::FvBaseProblem< TypeTag >::finishInit | ( |  | ) |

inline

Called by the Opm::Simulator in order to initialize the problem.

If you overload this method don't forget to call ParentType::finishInit()

## handlePositionalParameter()

template<class TypeTag>

int Opm::FvBaseProblem< TypeTag >::handlePositionalParameter | ( | std::function< void(const std::string &, const std::string &)> | ,
|  | std::set< std::string > & | ,
|  | std::string & | errorMsg,
|  | int | ,
|  | const char ** | argv,
|  | int | paramIdx,
|  | int | )

inline static

Handles positional command line parameters.

Positional parameters are parameters that are not prefixed by any parameter name.

Parameters

  seenParams | The parameters which have already been seen in the current context
  errorMsg | If the positional argument cannot be handled, this is the reason why
  argc | The total number of command line parameters
  argv | The string value of the command line parameters
  paramIdx | The index of the positional parameter in the array of all parameters
  posParamIdx | The number of the positional parameter encountered so far

Returns
  The number of array entries which ought to be skipped before processing the next regular parameter. If this is less than 1, it indicated that the positional parameter was invalid.

## helpPreamble()

template<class TypeTag>

std::string Opm::FvBaseProblem< TypeTag >::helpPreamble | ( | int | ,
|  | const char ** | argv )

inline static

Returns the string that is printed before the list of command line parameters in the help message.

If the returned string is empty, no help message will be generated.

## initial()

template<class TypeTag>
template<class Context>

void Opm::FvBaseProblem< TypeTag >::initial | ( | PrimaryVariables & | ,
|  | const Context & | ,
|  | unsigned | ,
|  | unsigned | ) const

inline

Evaluate the initial value for a control volume.

Parameters

  values | Stores the primary variables.
  context | The object representing the execution context from which this method is called.
  spaceIdx | The local index of the spatial entity which represents the boundary segment.
  timeIdx | The index used for the time discretization

## intensiveQuantityHistorySize()

template<class TypeTag>

unsigned Opm::FvBaseProblem< TypeTag >::intensiveQuantityHistorySize | ( |  | ) | const

inline

Returns the required history size for intensive quantities cache.

If recycleFirstIterationStorage() is true and storage cache is enabled, only the current time step intensive quantities need to be cached (size = 1). Otherwise, both current and previous time step intensive quantities are needed (size = 2).

## markForGridAdaptation()

template<class TypeTag>

unsigned Opm::FvBaseProblem< TypeTag >::markForGridAdaptation | ( |  | ) |

inline

Mark grid cells for refinement or coarsening.

Note
  This method has to be overloaded in derived classes to proper implement marking of grid entities.

Returns
  number of marked cells (default is 0)

## model()

template<class TypeTag>

const Model & Opm::FvBaseProblem< TypeTag >::model | ( |  | ) | const

inline

Returns numerical model used for the problem.

## name()

template<class TypeTag>

std::string Opm::FvBaseProblem< TypeTag >::name | ( |  | ) | const

inline

The problem name.

This is used as a prefix for files generated by the simulation. It is highly recommend to overwrite this method in the concrete problem which is simulated.

## outputDir()

template<class TypeTag>

std::string Opm::FvBaseProblem< TypeTag >::outputDir | ( |  | ) | const

inline

Determine the directory for simulation output.

The actual problem may chose to transform the value of the OutputDir parameter and it can e.g. choose to create the directory on demand if it does not exist. The default behaviour is to just return the OutputDir parameter and to throw an exception if no directory with this name exists.

## recycleFirstIterationStorage()

template<class TypeTag>

bool Opm::FvBaseProblem< TypeTag >::recycleFirstIterationStorage | ( |  | ) | const

inline

Return if the storage term of the first iteration is identical to the storage term for the solution of the previous time step.

This is only relevant if the storage cache is enabled and is usually the case, i.e., this method only needs to be overwritten in rare corner cases.

## restrictProlongOperator()

template<class TypeTag>

RestrictProlongOperator Opm::FvBaseProblem< TypeTag >::restrictProlongOperator | ( |  | ) |

inline

return restriction and prolongation operator

Note
  This method has to be overloaded by the implementation.

## serialize()

template<class TypeTag>
template<class Restarter>

void Opm::FvBaseProblem< TypeTag >::serialize | ( | Restarter & | res | ) |

inline

This method writes the complete state of the problem to the harddisk.

The file will start with the prefix returned by the name() method, has the current time of the simulation clock in it's name and uses the extension .ers. (Ewoms ReStart file.) See Opm::Restart for details.

Template Parameters

  Restarter | The serializer type

Parameters

  res | The serializer object

## shouldWriteOutput()

template<class TypeTag>

bool Opm::FvBaseProblem< TypeTag >::shouldWriteOutput | ( |  | ) | const

inline

Returns true if the current solution should be written to disk (i.e.

as a VTK file)

The default behavior is to write out the solution for every time step. This method is should be overwritten by the implementation if the default behavior is deemed insufficient.

## shouldWriteRestartFile()

template<class TypeTag>

bool Opm::FvBaseProblem< TypeTag >::shouldWriteRestartFile | ( |  | ) | const

inline

Returns true if a restart file should be written to disk.

The default behavior is to write one restart file every 10 time steps. This method should be overwritten by the implementation if the default behavior is deemed insufficient.

## simulator()

template<class TypeTag>

const Simulator & Opm::FvBaseProblem< TypeTag >::simulator | ( |  | ) | const

inline

Returns Simulator object used by the simulation.

## source()

template<class TypeTag>
template<class Context>

void Opm::FvBaseProblem< TypeTag >::source | ( | RateVector & | ,
|  | const Context & | ,
|  | unsigned | ,
|  | unsigned | ) const

inline

Evaluate the source term for all phases within a given sub-control-volume.

Parameters

  rate | Stores the values of the volumetric creation/anihilition rates of the conserved quantities.
  context | The object representing the execution context from which this method is called.
  spaceIdx | The local index of the spatial entity which represents the boundary segment.
  timeIdx | The index used for the time discretization

## writeOutput()

template<class TypeTag>

void Opm::FvBaseProblem< TypeTag >::writeOutput | ( | bool | verbose = true | ) |

inline

Write the relevant secondary variables of the current solution into an VTK output file.

Parameters

  verbose | Specify if a message should be printed whenever a file is written

The documentation for this class was generated from the following file:

- opm/models/discretization/common/fvbaseproblem.hh