pTatin to SeisSol
- class geoteqpy.pTatin2SeisSol(model: ModelData, uniform_mesh_size: ndarray, **fields_key)
Class to shape and export fields from pTatin to SeisSol using the format required by ASAGI.
- Parameters:
- Attributes:
- fields_key: dict
Dictionary of the fields keys to export. The keys are the names of the fields and the values are the keys in the model’s point data. Default:
None.
- R: np.ndarray
Rotation matrix constructed with the method
rotation_matrix.
- size: np.ndarray
1D array of the size of the uniform mesh. Shape
(3,).
- Methods:
- export_to_asagi(fname, fields_to_export: list[str] | None = None, pvoutput: str | None = None)
Export the required fields to the ASAGI format for SeisSol.
- Parameters:
fname (str) – The filename to which the data will be exported.
fields_to_export (list[str]) – A list of field names to export. If None, all fields specified in the class constructor will be exported.
pvoutput (str) – The filename for ParaView output. If None, no ParaView output will be generated.
Note
This method performs the following steps:
Creates a uniform mesh based on the model’s origin (O) and dimensions (L).
Computes the total stress and stores it in the model’s cell data.
Interpolates the specified fields from the ptatin mesh to the newly created uniform mesh.
Removes any NaN values introduced during interpolation.
Rotates the fields that require rotation based on the model’s referential.
Note
The 6 components of the stress tensor are exported using the following keys:
"s_xx","s_yy","s_zz","s_xy","s_xz", and"s_yz".
- get_1d_coordinates(coor)
Extract the 1D coordinates from the uniform coordinates.
- Parameters:
coor (np.ndarray) – Array of the coordinates. Shape
(npoints,3).- Returns:
1D arrays of the coordinates. Ordered as \(x\), \(y\), \(z\).
- Return type:
tuple[np.ndarray,np.ndarray,np.ndarray]
- rotate_stress(stress: ndarray) ndarray
Rotate stress tensor from coordinate system where \(y\) is the vertical direction to a coordinate system where \(z\) is the vertical direction. Uses the method
rotate_tensor.- Parameters:
stress (numpy.ndarray) – Stress tensor to rotate.
- Returns:
The rotated stress tensor.
- Return type:
numpy.ndarray
- uniform_reshape(field)
Reshape field to the uniform mesh size
(mz+1,my+1,mx+1)for ASAGI and swap axes to intervert the \(y\) and \(z\) directions for SeisSol.- Parameters:
field (np.ndarray) – 1D array of the field to reshape. Shape
(nx*ny*nz,).- Returns:
3D array of the field. Shape
(mz+1,my+1,mx+1).- Return type:
np.ndarray