ogstools.studies.convergence.convergence module#

ogstools.studies.convergence.convergence.resample(topology, meshes)[source]#
Parameters:
  • topology (UnstructuredGrid)

  • meshes (list[UnstructuredGrid])

Return type:

list[UnstructuredGrid]

ogstools.studies.convergence.convergence.add_grid_spacing(mesh)[source]#
Parameters:

mesh (UnstructuredGrid)

Return type:

UnstructuredGrid

ogstools.studies.convergence.convergence.grid_convergence(meshes, mesh_property, topology, refinement_ratio)[source]#

Calculate the grid convergence field for the given meshes on the topology.

The calculation is based on the last three of the given meshes. For more information on this topic see <https://www.grc.nasa.gov/www/wind/valid/tutorial/spatconv.html> or <https://curiosityfluids.com/2016/09/09/establishing-grid-convergence/>.

Parameters:
  • meshes (list[UnstructuredGrid]) – At least three meshes with constant refinement.

  • mesh_property (Property) – The property to be extrapolated.

  • topology (UnstructuredGrid) – The topology to evaluate.

  • refinement_ratio (float) – If not given, it is calculated automatically

Return type:

UnstructuredGrid

returns: Grid convergence field of the given property.

ogstools.studies.convergence.convergence.richardson_extrapolation(meshes, mesh_property, topology, refinement_ratio)[source]#

Estimate a better approximation of a property on a mesh.

This function calculates the Richardson Extrapolation based on the change in results in the last three of the given meshes. For more information on this topic see <https://www.grc.nasa.gov/www/wind/valid/tutorial/spatconv.html> or <https://curiosityfluids.com/2016/09/09/establishing-grid-convergence/>.

Parameters:
  • meshes (list[UnstructuredGrid]) – At least three meshes with constant refinement.

  • mesh_property (Property) – The property to be extrapolated.

  • topology (UnstructuredGrid) – The topology on which the extrapolation is done.

  • refinement_ratio (float) – Refinement ratio (spatial or temporal).

Returns:

Richardson extrapolation of the given property.

Return type:

UnstructuredGrid

ogstools.studies.convergence.convergence.convergence_metrics(meshes, reference, mesh_property, timestep_sizes)[source]#

Calculate convergence metrics for a given reference and property.

Parameters:
  • meshes (list[UnstructuredGrid]) – The List of meshes to be analyzed for convergence.

  • reference (UnstructuredGrid) – The reference mesh to compare against.

  • mesh_property (Property) – The property of interest.

  • timestep_sizes (list[float])

Returns:

A pandas Dataframe containing all metrics.

Return type:

DataFrame

ogstools.studies.convergence.convergence.log_fit(x, y)[source]#
Parameters:
  • x (ndarray)

  • y (ndarray)

Return type:

tuple[float, ndarray]

ogstools.studies.convergence.convergence.convergence_order(metrics)[source]#

Calculates the convergence order for given convergence metrics.

Parameters:

metrics (DataFrame)

Return type:

DataFrame

ogstools.studies.convergence.convergence.plot_convergence(metrics, mesh_property)[source]#

Plot the absolute values of the convergence metrics.

Parameters:
  • metrics (DataFrame)

  • mesh_property (Property)

Return type:

Figure

ogstools.studies.convergence.convergence.plot_convergence_errors(metrics)[source]#

Plot the relative errors of the convergence metrics in loglog scale.

Parameters:

metrics (DataFrame)

Return type:

Figure

ogstools.studies.convergence.convergence.convergence_metrics_evolution(mesh_series, mesh_property, refinement_ratio=2.0, units=('s', 's'))[source]#

Calculate convergence evolution metrics for given mesh series.

Contains convergence order and the relative error to the Richardson extrapolation for each timestep of the coarsest mesh series. and a property

Parameters:
  • meshes_series – The List of mesh series to be analyzed.

  • mesh_property (Property) – The property of interest.

  • refinement_ratio (float) – Refinement ratio between the discretizations.

  • mesh_series (list[MeshSeries])

  • units (tuple[str, str])

Returns:

A pandas Dataframe containing all metrics.

Return type:

DataFrame

ogstools.studies.convergence.convergence.plot_convergence_error_evolution(evolution_metrics, error_type='relative')[source]#

Plot the evolution of relative errors.

Parameters:
  • evolution_metrics (DataFrame)

  • error_type (Literal['relative', 'absolute'])

Return type:

Figure

ogstools.studies.convergence.convergence.plot_convergence_order_evolution(evolution_metrics)[source]#

Plot the evolution of convergence orders.

Parameters:

evolution_metrics (DataFrame)

Return type:

Figure