Muscat.Containers.MeshFieldOperations module¶
- ApplyRotationMatrixTensorField(fields: Dict, fieldsToTreat: List[List], baseNames: List = ['v1', 'v2'], inPlace: bool = False, prefix: str = 'new_', inverse: bool = False) Dict [source]¶
Apply a rotation operation on the fields
- Parameters:
fields (dict[ArrayLike]) – dictionary of field. Keys are names, values are data
fieldsToTreat (ArrayLike) – is a 3x3 list of list with the names of the fields to create the local tensor. For example [[“S00”,”S01”,”S02”][“S01”,”S11”,”S12”][“S02”,”S12”,”S22”]]
baseNames (List, optional) – the names of the fields to extract the direction (each field must be on size (nb entries, 3) ), by default [“v1”,”v2”]
inPlace (bool, optional) – True to put the output back to the field dictionary, by default False
prefix (str, optional) – prefix to prepend to the new field, by default new_
inverse (bool, optional) – True to apply the inverse transform, by default False
- Returns:
a dictionary containing the field after the rotation operation
- Return type:
dict
- CheckIntegrityQuadFieldToLinField(GUI: bool = False) str [source]¶
Check done in Muscat.Containers.MeshCreationTools.CheckIntegrity_QuadToLin
- CopyFieldsFromOriginalMeshToTargetMesh(inMesh: Mesh, outMesh: Mesh) None [source]¶
- Function to copy fields (nodeFields and elemFields) for the original mesh to the
derived mesh ( f(inMesh) -> outMesh )
- GetFieldTransferOp(inputField: FEField, targetPoints: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], method: str | None = None, verbose: bool = False, elementFilter: ElementFilter | None = None) Tuple[ndarray, ndarray, ndarray] [source]¶
- GetFieldTransferOpCpp(inputField: FEField, targetPoints: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], method: str | None = None, verbose: bool = False, elementFilter: ElementFilter | None = None, options: Dict | None = None, nbThreads=None) Tuple[ndarray, ndarray, ndarray] [source]¶
Compute the transfer operator from the inputField to the target points so, Using the cpp implementation: valueAtTargetPoints = op.dot(FEField.data)
The methods available are:
“Interp/Nearest”
“Nearest/Nearest”
“Interp/Clamp”
“Interp/Extrap”
“Interp/ZeroFill”
Possible values (int) for the returned status are:
0: “Nearest”
1: “Interp”
2: “Extrap”
3: “Clamp”
4: “ZeroFill”
5: “MultipleExtrapPoint”
- Parameters:
inputField (FEField) – the FEField to be transferred
targetPoints (ArrayLike) – Numpy array of the target points. Position to extract the values
method (Union[str,None], optional) –
A couple for the algorithm used when the point is inside/outside the mesh
”Interp” -> to use the interpolation of the FEField to extract the values
”Nearest” -> to use the closest node to extract the values
”Clamp” -> to use the closest point to the surface if the point is outside
”Extrap” -> to use shape function of the closest element to compute a extrapolation
”ZeroFill” -> fill with zero in the case the point is outside
If None is provided then “Interp/Clamp” is used
verbose (bool, optional) – Print a progress bar, by default False
elementFilter (Optional[ElementFilter], optional) – ElementFilter to extract the information from only a subdomain, by default None
options (Optional[Dict], optional) –
- Dictionary containing the one or more key:values pairs:
”usePointSearch”: bool , to activate the research of potential element by point, default (True)
”useElementSearch”: bool , to activate the research of potential element by a center of the closest element and it neighbors, default (False)
”useElementSearchFast”: bool , to activate the research of potential element by a center of the closest element only (option useElementSearch must be true) default (False)
”useEdgeSearch”: bool , to activate the research of potential element using the closest edge. default (True)
”DifferentialOperator”: int, to activate the computation of the derivative of the field (not the value), default -1. possible values are; -1 for value transfer; 0 to compute the d/dx; 1 to compute d/dy; 2 to compute d/dz
nbThreads (Optional[int], optional) – Set the maximum number of thread to use
- Returns:
- a tuple with 2 object containing:
op, sparse matrix with the operator to make the transfer
status: vector of ints with the status transfer for each target point:
entities: vector of the ids of the entities (node or element) used to compute the transfer operator. If status = 0, then entity is a node id. if status \(\in [1,2,3,5]\) the status is an element id.
return op, status, entities
- Return type:
Tuple [np.ndarray,np.ndarray]
- PointToCellData(mesh: Mesh, pointfield: ndarray, dim: int64 | None = None) ndarray [source]¶
Convert a point field to cell field. the cell values are compute the average of the values on the nodes for each element
- Parameters:
mesh (Mesh) – mesh support of the field
pointfield (np.ndarray) – a field defined on the points
dim (int, optional) – dimensionality filter. if dim != the result array contain only values for the selected element ( len(result) is smaller than mesh.GetNumberOfElements() ) , by default None
- Returns:
a numpy array with the field on the elements
- Return type:
np.ndarray
- QuadFieldToLinField(quadMesh: Mesh, quadField: ndarray, linMesh: Mesh | None = None) ndarray [source]¶
Extract the linear part of the field quadField.
- Parameters:
- Returns:
_description_
- Return type:
np.ndarray
- RunTransfer(inputFEField, data, outmesh, methods=['Interp/Nearest', 'Nearest/Nearest', 'Interp/Clamp', 'Interp/Extrap']) None [source]¶
- TransportPos(imesh: Mesh, tmesh: Mesh, tspace, tnumbering, method: str = 'Interp/Clamp', verbose: bool = False) ndarray [source]¶
Function to transport the position from the input mesh (imesh) to a target FEField target mesh, target space, tnumbering
- Parameters:
imesh (Mesh) – input mesh
tmesh (Mesh) – target mesh
tspace (_type_) – target space
tnumbering (_type_) – target numbering
method (str, optional) – method for the interpolation/extrapolation, by default “Interp/Clamp”
verbose (bool, optional) – True to print more output during the computation of the transfer operator, by default None
- Returns:
a numpy.array with 3 FEField for each component of the position
- Return type:
np.ndarray
- TransportPosToPoints(mesh: Mesh, points: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], method: str = 'Interp/Clamp', verbose: bool = False) ndarray [source]¶
For each point in points compute the position of the source data by transporting the position field
- Parameters:
mesh (Mesh) – the input mesh from where we
points (ArrayLike) – the target points
method (str, optional) – Transfer method, by default “Interp/Clamp”
verbose (bool, optional) – True to print more output during the computation of the transfer operator, by default None
- Returns:
for each point in points the position of the source data
- Return type:
np.ndarray