fastvpinns.data.datahandler module
The file datahandler.py is an abstract class for Datahandler.
Author : Thivin Anandh D
Date : 03/May/2024
History : 03/May/2024 - Initial implementation with basic data handling
- class fastvpinns.data.datahandler.DataHandler(fespace, domain, dtype)[source]
Bases:
object
This class is to handle data for 2D problems, convert them into tensors using custom tf functions. It is responsible for all type conversions and data handling.
Note
All inputs to these functions are generally numpy arrays with dtype np.float64. So we can either maintain the same dtype or convert them to tf.float32 ( for faster computation ).
- Parameters:
fespace (FESpace2D) – The FESpace2D object.
domain (Domain2D) – The Domain2D object.
shape_val_mat_list (list) – List of shape function values for each cell.
grad_x_mat_list (list) – List of shape function derivatives with respect to x for each cell.
grad_y_mat_list (list) – List of shape function derivatives with respect to y for each cell.
x_pde_list (list) – List of actual coordinates of the quadrature points for each cell.
forcing_function_list (list) – List of forcing function values for each cell.
dtype (tf.DType) – The tensorflow dtype to be used for all the tensors.
- abstract get_bilinear_params_dict_as_tensors(function)[source]
Accepts a function from example file and converts all the values into tensors of the given dtype
- Parameters:
function (function) – The function from the example file which returns the bilinear parameters dictionary
- Returns:
The bilinear parameters dictionary with all the values converted to tensors
- Return type:
dict
- abstract get_dirichlet_input()[source]
This function will return the input for the Dirichlet boundary data
- Returns:
input_dirichlet (tf.Tensor): The input for the Dirichlet boundary data
actual_dirichlet (tf.Tensor): The actual Dirichlet boundary data
- abstract get_inverse_params(inverse_params_dict_function)[source]
Accepts a function from example file and converts all the values into tensors of the given dtype
- Parameters:
inverse_params_dict_function (function) – The function from the example file which returns the inverse parameters dictionary
- Returns:
The inverse parameters dictionary with all the values converted to tensors
- Return type:
dict
- abstract get_sensor_data(exact_sol, num_sensor_points, mesh_type, file_name=None)[source]
Accepts a function from example file and converts all the values into tensors of the given dtype
- Parameters:
exact_sol (function) – The function from the example file which returns the exact solution
num_sensor_points (int) – The number of sensor points to be generated
mesh_type (str) – The type of mesh to be used for sensor data generation
file_name (str, optional) – The name of the file to be used for external mesh generation, defaults to None
- Returns:
The sensor points and sensor values as tensors
- Return type:
tuple[tf.Tensor, tf.Tensor]