ogstools.studies.convergence.convergence module#
- ogstools.studies.convergence.convergence.resample(topology, meshes)[source]#
- Return type:
list[UnstructuredGrid]
- ogstools.studies.convergence.convergence.add_grid_spacing(mesh)[source]#
- Return type:
UnstructuredGrid
- ogstools.studies.convergence.convergence.grid_convergence(meshes, variable, 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.
variable (Variable) – The variable 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 variable.
- ogstools.studies.convergence.convergence.richardson_extrapolation(meshes, variable, topology, refinement_ratio)[source]#
Estimate a better approximation of a variable 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.
variable (Variable) – The variable 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 variable.
- Return type:
UnstructuredGrid
- ogstools.studies.convergence.convergence.convergence_metrics(meshes, reference, variable, timestep_sizes)[source]#
Calculate convergence metrics for a given reference and variable.
- Parameters:
meshes (list[UnstructuredGrid]) – The List of meshes to be analyzed for convergence.
reference (UnstructuredGrid) – The reference mesh to compare against.
variable (Variable) – The variable of interest.
- Returns:
A pandas Dataframe containing all metrics.
- Return type:
DataFrame
- ogstools.studies.convergence.convergence.convergence_order(metrics)[source]#
Calculates the convergence order for given convergence metrics.
- Return type:
DataFrame
- ogstools.studies.convergence.convergence.plot_convergence(metrics, variable)[source]#
Plot the absolute values of the convergence metrics.
- Return type:
Figure
- ogstools.studies.convergence.convergence.plot_convergence_errors(metrics)[source]#
Plot the relative errors of the convergence metrics in loglog scale.
- Return type:
Figure
- ogstools.studies.convergence.convergence.convergence_metrics_evolution(mesh_series, variable, 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 variable
- Parameters:
meshes_series – The List of mesh series to be analyzed.
variable (Variable) – The variable of interest.
refinement_ratio (float) – Refinement ratio between the discretizations.
- Returns:
A pandas Dataframe containing all metrics.
- Return type:
DataFrame