Muscat.Containers.FieldTransferOpPython module

CheckIntegrity(GUI: bool = False)[source]
ComputeBarycentricCoordinateOnElement(coordAtDofs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], localspace, targetPoint: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], elementType: str | ElementType)[source]

Newton to compute the best baricentric coordinates on an element for the target point Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)

Parameters:
  • coordAtDofs (ArrayLike) – Coordinates of the node of the element

  • localspace (_type_) – _description_

  • targetPoint (ArrayLike) – Target Point

  • elementType (str) – Element type

Returns:

_description_

Return type:

_type_

ComputeInterpolationCoefficients(mask: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], TP: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], elementsdata, coordAtDofs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], posspace, localspace)[source]

Compute the interpolation coefficients for the element. Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)

ComputeInterpolationExtrapolationsBarycentricCoordinates(TP: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], elementType: str | ElementType, coordAtDofs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], posspace)[source]

Function to compute the interpolation extrapolation shape function for an element for the target point This function is not intended to be used by the final users

Parameters:
  • TP (ArrayLike) – the target point

  • elementType (str) – the element type

  • coordAtDofs (_type_) – The coordinate in the real space for all the nodes of the element

  • posspace (_type_) – The space used to interpolate the position

Returns:

True : if the target point is inside the element (None if error in the computation) numpy.ndarray : the distance vector between the best point using the barycentric coordinates and the target point numpy.ndarray : the closes barycentric coordinates of the target point using the shape function of the elements numpy.ndarray : the clamped barycentric coordinates of the target point using the shape function of the elements ()

Return type:

tuple of len 4

ComputeShapeFunctionsOnElement(coordAtDofs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], localspace, localnumbering, point: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], faceElementType)[source]
GetFieldTransferOpPython(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][source]

Compute the transfer operator from the inputField to the target points 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

Returns:

a tuple with 3 object containing:
  • op, sparse matrix with the operator to make the transfer

  • status: vector of ints with the status transfer for each target point:

  • entitiesIds: vector of ints with the node or element number of the closes entitie (in function of status)

return op, status, entitiesIds

Return type:

Tuple [np.ndarray,np.ndarray]

ddf(f, xiEtaPhi, dN, GetShapeFuncDerDer, coordAtDofs, linear, x)[source]

Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)

df(f, dN, coordAtDofs)[source]

Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)

hdinv(A: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) ndarray[source]

Compute the inverse of a 3x3 matrix Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)

Parameters:

A (ArrayLike) – a 3x3 matrix

Returns:

the inverse of A

Return type:

np.ndarray

inv22(A: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) ndarray[source]

Compute the inverse of a 2x2 matrix Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)

Parameters:

A (ArrayLike) – a 2x2 matrix

Returns:

the inverse of A

Return type:

np.ndarray

normsquared(v: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) number[source]

sqared norm of a vector

Parameters:

v (ArrayLike) – a vector

Returns:

the squared norm

Return type:

np.number

vdet(A: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) float64[source]

Compute the determinant of a 3x3 matrix Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)

Parameters:

A (ArrayLike) – a 3x3 matrix

Returns:

the determinant

Return type:

MuscatFloat