postprocess_fracture module

This file is part of PyFrac.

Created by Haseeb Zia on 12.06.17. Copyright (c) ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, Geo-Energy Laboratory, 2016-2020. All rights reserved. See the LICENSE.TXT file for more details.

postprocess_fracture.append_to_json_file(file_name, content, action, key=None, delete_existing_filename=False)[source]

This function appends data of a mesh as a json file.

Parameters
  • file_name (string) – – the name of the file to be written.

  • key (string) – – a string that describes the information you are passing.

  • content (list) – – a list of some informations

  • action (string) –

    – action to take. Current options are: ‘append2keyASnewlist’ This option means that you load the json file, you take the content of the key and then you append the new content as a new list in a list of lists if the existing content was not a list it will be put in a list

    ’append2keyAND2list’ This option means that you load the json file, you take the content of the key and, supposing that it is a key, you append the new content to it if the existing content was not a list it will be put in a list and the new content will be appended to it

    ’dump_this_dictionary’ You will dump only the content of the dictionary

postprocess_fracture.get_Ffront_as_vector(frac, inj_p)[source]
postprocess_fracture.get_HF_analytical_solution(regime, variable, mat_prop, inj_prop, mesh=None, fluid_prop=None, time_srs=None, length_srs=None, h=None, samp_cell=None, gamma=None)[source]
postprocess_fracture.get_HF_analytical_solution_at_point(regime, variable, point, mat_prop, inj_prop, fluid_prop=None, time_srs=None, length_srs=None, h=None, samp_cell=None, gamma=None)[source]
postprocess_fracture.get_extremities_cells(Fr_list)[source]

This function returns the extreme points for each of the fracture in the list.

Parameters

Fr_list (list) – – the fracture list

Returns

extremeties – the [left, rigth, bottom, top] extremeties of the each of the fracture in the list.

postprocess_fracture.get_fracture_dimensions_analytical_with_properties(regime, time_srs, mat_prop, inj_prop, fluid_prop=None, h=None, samp_cell=None, gamma=None)[source]
postprocess_fracture.get_fracture_fp(fr_list, properties)[source]
postprocess_fracture.get_fracture_geometric_parameters(fr_list, properties)[source]
postprocess_fracture.get_fracture_variable(fracture_list, variable, edge=4, return_time=False)[source]

This function returns the required variable from a fracture list.

Parameters
  • fracture_list (list) – – the fracture list from which the variable is to be extracted.

  • variable (string) – – the variable to be extracted. See labels.supported_variables of the labels module for a list of supported variables.

  • edge (int) – – the edge of the cell that will be plotted. This is for variables that are evaluated on the cell edges instead of cell center. It can have a value from 0 to 4 (0->left, 1->right, 2->bottom, 3->top, 4->average).

  • return_time (bool) – – if True, the times at which the fractures are stored will also be returned.

Returns

  • variable_list (list) – a list containing the extracted variable from each of the fracture. The dimension and type of each member of the list depends upon the variable type.

  • time_srs (list) – a list of times at which the fractures are stored.

postprocess_fracture.get_fracture_variable_at_point(fracture_list, variable, point, edge=4, return_time=True)[source]

This function returns the required variable from a fracture list at the given point.

Parameters
  • fracture_list (list) – – the fracture list from which the variable is to be extracted.

  • variable (string) – – the variable to be extracted. See supported_variables of the Labels module for a list of supported variables.

  • point (list or ndarray) – – the point at which the given variable is plotted against time [x, y].

  • edge (int) – – the edge of the cell that will be plotted. This is for variables that are evaluated on the cell edges instead of cell center. It can have a value from 0 to 4 (0->left, 1->right, 2->bottom, 3->top, 4->average).

  • return_time (bool) – – if True, the times at which the fractures are stored will also be returned.

Returns

  • variable_list (list) – a list containing the extracted variable from each of the fracture. The dimension and type of each member of the list depends upon the variable type.

  • time_srs (list) – a list of times at which the fractures are stored.

postprocess_fracture.get_fracture_variable_slice_cell_center(var_value, mesh, point=None, orientation='horizontal')[source]

This function returns the given fracture variable on a given slice of the domain. Two slice is constructed from the given point and the orientation. The values on the slice are taken from the cell centers.

Parameters
  • var_value (ndarray) – – the value of the variable on each cell of the domain.

  • mesh (CartesianMesh) – – the CartesianMesh object describing the mesh.

  • point (list or ndarray) – – the point from which the slice should pass [x, y]. If it does not lie on a cell center, the closest cell center will be taken. By default, [0., 0.] will be taken.

  • orientation (string) – – the orientation according to which the slice is made in the case the plotted values are not interpolated and are taken at the cell centers. Any of the four (‘vertical’, ‘horizontal’, ‘ascending’ and ‘descending’) orientation can be used.

Returns

  • var_value (ndarray) – the values of the variable at the sampling points given by sampling_line (see below).

  • sampling_line (ndarray) – the distance of the point where the value is provided from the center of the slice.

  • sampling_cells (ndarray) – the cells on the mesh along with the slice is made.

postprocess_fracture.get_fracture_variable_slice_interpolated(var_value, mesh, point1=None, point2=None)[source]

This function returns the given fracture variable on a given slice of the domain. Two points are to be given that will be joined to form the slice. The values on the slice are interpolated from the values available on the cell centers.

Parameters
  • var_value (ndarray) – – the value of the variable on each cell of the domain.

  • mesh (CartesianMesh) – – the CartesianMesh object describing the mesh.

  • point1 (list or ndarray) – – the left point from which the slice should pass [x, y].

  • point2 (list or ndarray) – – the right point from which the slice should pass [x, y].

Returns

  • value_samp_points (ndarray) – the values of the variable at the sampling points given by sampling_line (see below).

  • sampling_line (ndarray) – the distance of the point where the value is provided from the center of the slice.

postprocess_fracture.get_front_intercepts(fr_list, point)[source]

This function returns the top, bottom, left and right intercepts on the front of the horizontal and vertical lines drawn from the given point.

Parameters
  • fr_list (list) – – the given fracture list.

  • point (list or ndarray) –

Returns

– list of top, bottom, left and right intercepts for each fracture in the list

Return type

intercepts (list)

postprocess_fracture.get_velocity_as_vector(Solid, Fluid, Fr_list)[source]

This function gets the velocity components of the fluid flux for a given list of fractures

Parameters
  • Solid – Instance of the class MaterialProperties - see related documentation

  • Fluid – Instance of the class FluidProperties - see related documentation

  • Fr_list – List of Instances of the class Fracture - see related documentation

Returns

List containing a matrix with the information about the fluid velocity for each of the edges of any mesh element, List of time stations

postprocess_fracture.get_velocity_slice(Solid, Fluid, Fr_list, initial_point, vel_direction='ux', orientation='horizontal')[source]

This function returns, at each time station, the velocity component in x or y direction along a horizontal or vertical section passing through a given point.

WARNING: ASSUMING NO MESH COARSENING OR REMESHING WITH DOMAIN COMPRESSION

Parameters
  • Solid – Instance of the class MaterialProperties - see related documentation

  • Fluid – Instance of the class FluidProperties - see related documentation

  • Fr_list – List of Instances of the class Fracture - see related documentation

  • initial_point – coordinates of the point where to draw the slice

  • vel_direction – component of the velocity vector, it can be ‘ux’ or ‘uy’

  • orientation – it can be ‘horizontal’ or ‘vertical’

Returns

set of velocities set of times set of points along the slice, where the velocity is given

postprocess_fracture.load_fractures(address=None, sim_name='simulation', time_period=0.0, time_srs=None, step_size=1)[source]

This function returns a list of the fractures. If address and simulation name are not provided, results from the default address and having the default name will be loaded.

Parameters
  • address (string) – – the folder address containing the saved files. If it is not provided, simulation from the default folder (_simulation_data_PyFrac) will be loaded.

  • sim_name (string) – – the simulation name from which the fractures are to be loaded. If not provided, simulation with the default name (Simulation) will be loaded.

  • time_period (float) – – time period between two successive fractures to be loaded. if not provided, all fractures will be loaded.

  • time_srs (ndarray) – – if provided, the fracture stored at the closest time after the given times will be loaded.

  • step_size (int) – – the number of time steps to skip before loading the next fracture. If not provided, all of the fractures will be loaded.

Returns

– a list of fractures.

Return type

fracture_list(list)

postprocess_fracture.read_fracture_variable_csv_file(file_name)[source]

This function returns the required variable from the csv file.

Parameters

file_name (string) – – the name of the file to be written.

Returns

  • variable_list (list) – a list containing the extracted variable from each of the fracture. The dimension and type of each member of the list depends upon the variable type.

postprocess_fracture.write_fracture_mesh_csv_file(file_name, mesh_list)[source]

This function writes important data of a mesh as a csv file. The csv contains (in a row vector) the number of elements, hx, hy, nx, ny, the flattened connectivity matrix and the flattened node coordinates. Each row of the csv corresponds to an entry in the mesh_list

Args:

file_name (string): – the name of the file to be written. mesh_list (list): – the fracture list from which the variable is to be extracted.

postprocess_fracture.write_fracture_variable_csv_file(file_name, fracture_list, variable, point=None, edge=4)[source]

This function writes fracture variable from each fracture in the list as a csv file. The variable from each of the fracture in the list will saved in a row of the csv file. If a variable is bi-dimensional, a point can be given at which the variable is to be saved.

Parameters
  • file_name (string) – – the name of the file to be written.

  • fracture_list (list) – – the fracture list from which the variable is to be extracted.

  • variable (string) – – the variable to be saved. See supported_variables of the Labels module for a list of supported variables.

  • point (list or ndarray) – – the point in the mesh at which the given variable is saved [x, y]. If the point is not given, the variable will be saved on the whole mesh.

  • edge (int) – – the edge of the cell that will be saved. This is for variables that are evaluated on the cell edges instead of cell center. It can have a value from 0 to 4 (0->left, 1->right, 2->bottom, 3->top, 4->average).

postprocess_fracture.write_properties_csv_file(file_name, properties)[source]

This function writes the properties of a simulatio as a csv file. The csv contains (in a row vector) Eprime, K1c , Cl, mu, rho_f, Q and t_inj

Args:

file_name (string): – the name of the file to be written. properties (tuple): – the properties of the fracture loaded