Mondaic

salvus.flow.simple_config.receiver.cartesian

salvus.flow.simple_config.receiver.cartesian salvus flow simple_config receiver cartesian

Receivers in a cartesian reference system.

Functions

parse()

def parse(
    dict_receivers: list[dict] | dict,
) -> typing.Sequence[Point2D | Point3D]: ...

Parse a dictionary or a list of dictionaries to receiver objects.

Parameters
  • dict_receivers list[dict] | dict — Parse a list of receivers (or just a single receivers) as a dictionary to the proper objects.
Returns typing.Sequence[Point2D | Point3D]

Classes

Point2D

class Point2D(salvus.flow.simple_config.receiver._BaseReceiver):
    def __init__(
        self,
        x: float,
        y: float,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: list[str],
        rotation_on_output: dict | None = None,
    ): ...

Receiver in a 2-D Cartesian domain.

Initialize the spatial locations and metadata.

Parameters
  • x float — X-coordinate of receiver.
  • y float — Y-coordinate of receiver.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields list[str] — Fields to record.
  • rotation_on_output dict | None — Optional rotation matrix to be applied on output.
Attributes
name str

Full receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.

Methods
from_json()
def from_json(d: dict, skip_validation: bool = False) -> _BaseReceiver: ...

Initialize a receiver object from a dictionary.

Parameters
  • d dict — Dictionary containing the init parameters and a few other things.
  • skip_validation bool — For the cartesian Point2D and Point3D this method contains a special fast implementation that skips all validation steps. Useful for reading large quantities of pre-validated receivers.
Returns _BaseReceiver
apply()
def apply(self, d: dict | _DeepSetter) -> None: ...

Set the contents with a dictionary.

Parameters
  • d dict | _DeepSetter — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter: ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> dict: ...

Get the contents of this object as a dictionary.

Returns dict
to_json()
def to_json(
    self,
    external_file_hash: types = None,
    timer: types = None,
    log_to_logger: bool = False,
    comm: types = None,
) -> builtins.dict: ...

Serialize the object to a dictionary that can be written to JSON.

Parameters
  • external_file_hash types — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
  • timer types — Execution timer.
  • log_to_logger bool — Log timings to the logger.
  • comm types — MPI communicator, if any.
Returns builtins.dict
validate()
def validate(self) -> None: ...

Validates the current state of the configuration against its schema.

Returns None

Point3D

class Point3D(salvus.flow.simple_config.receiver._BaseReceiver):
    def __init__(
        self,
        x: float,
        y: float,
        z: float,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: list[str],
        rotation_on_output: dict | None = None,
    ): ...

Receiver in a 3-D Cartesian domain.

Initialize the spatial locations and metadata.

Parameters
  • x float — X-coordinate of receiver.
  • y float — Y-coordinate of receiver.
  • z float — Z-coordinate of receiver.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields list[str] — Fields to record.
  • rotation_on_output dict | None — Optional rotation matrix to be applied on output.
Attributes
name str

Full receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.

Methods
from_json()
def from_json(d: dict, skip_validation: bool = False) -> _BaseReceiver: ...

Initialize a receiver object from a dictionary.

Parameters
  • d dict — Dictionary containing the init parameters and a few other things.
  • skip_validation bool — For the cartesian Point2D and Point3D this method contains a special fast implementation that skips all validation steps. Useful for reading large quantities of pre-validated receivers.
Returns _BaseReceiver
apply()
def apply(self, d: dict | _DeepSetter) -> None: ...

Set the contents with a dictionary.

Parameters
  • d dict | _DeepSetter — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter: ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> dict: ...

Get the contents of this object as a dictionary.

Returns dict
to_json()
def to_json(
    self,
    external_file_hash: types = None,
    timer: types = None,
    log_to_logger: bool = False,
    comm: types = None,
) -> builtins.dict: ...

Serialize the object to a dictionary that can be written to JSON.

Parameters
  • external_file_hash types — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
  • timer types — Execution timer.
  • log_to_logger bool — Log timings to the logger.
  • comm types — MPI communicator, if any.
Returns builtins.dict
validate()
def validate(self) -> None: ...

Validates the current state of the configuration against its schema.

Returns None

SideSetHorizontalPointCollection2D

class SideSetHorizontalPointCollection2D(
    salvus.flow.simple_config.receiver.cartesian._CartesianSideSet2DLine
):
    def __init__(
        self,
        x: list[float] | np.ndarray,
        offset: float = 0.0,
        side_set_name: str,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: list[str],
    ): ...

Base class for all cartesian 2D lines.

Specialized version of CartesianSideSetReceiver2D only requiring one or more x coordinates and a side set.

It will vertically project the receiver up or down along the y-axis until it finds the intersection with the given side set.

The station codes will be suffixed by 0…N, thus a station code of “AB” would turn into “AB0” to “ABN”.

Parameters
  • x list[float] | np.ndarray — x coordinates.
  • offset float — Offset the final receivers along the y-axis. Allows placing receivers above/below side sets.
  • side_set_name str — Name of the side set at which to attach the receivers.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields list[str] — Fields to record.
Methods
to_list()
def to_list(self) -> list[_Base]: ...

Convert to a list of receivers.

Returns list[_Base]

SideSetPoint2D

class SideSetPoint2D(
    salvus.flow.simple_config.side_set_base._SideSetBase,
    salvus.flow.simple_config.receiver._SideSetReceiver,
):
    def __init__(
        self,
        point: np.ndarray,
        direction: Union[np.ndarray, str],
        offset: float = 0.0,
        side_set_name: str,
        network_code: "str" = "XX",
        station_code: "str",
        location_code: "str" = "",
        fields: "list[str]",
        rotation_on_output: "dict | None" = None,
    ): ...

Cartesian side set receiver in 2D.

The intersection between the specified line and the side set in the mesh will be the location of the receiver. The line is specified by a point and a direction.

If the line intersects the side set multiple times, the closest intersection to the specified point will be chosen, assuming all intersections are in different elements. If multiple intersections occur within one element the gradient based optimization will only manage to find one. Please choose a different line in that case.

This will be evaluated at the time it is added to a simulation object as it needs access to a mesh.

Parameters
  • point np.ndarray — A point on the line.
  • direction Union[np.ndarray, str] — The direction from the point finishing the definition of the line. Can be specified either as a 2D vector or as a string containing "x" or "y", denoting the coordinate axes.
  • offset float — Offset the final receiver along the chosen direction. Allows placing receivers above/below side sets.
  • side_set_name str — The name of the side set to intersect the line with.
  • network_code 'str' — Network code.
  • station_code 'str' — Station code.
  • location_code 'str' — Location code.
  • fields 'list[str]' — Fields to record.
  • rotation_on_output 'dict | None' — Optional rotation matrix to be applied on output.
Attributes
name str

Full receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.

Methods
from_json()
def from_json(d: builtins.dict) -> Any: ...

Recreate the object from a dictionary serialization of its initialization parameters.

Parameters
  • d builtins.dict — Dictionary containing its init parameters and a few other things.
Returns Any
to_json()
def to_json(
    self,
    external_file_hash: types = None,
    timer: types = None,
    log_to_logger: bool = False,
    comm: types = None,
) -> builtins.dict: ...

Serialize the object to a dictionary that can be written to JSON.

Parameters
  • external_file_hash types — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
  • timer types — Execution timer.
  • log_to_logger bool — Log timings to the logger.
  • comm types — MPI communicator, if any.
Returns builtins.dict

SideSetPoint3D

class SideSetPoint3D(
    salvus.flow.simple_config.side_set_base._SideSetBase,
    salvus.flow.simple_config.receiver._SideSetReceiver,
):
    def __init__(
        self,
        point: np.ndarray,
        direction: Union[np.ndarray, str],
        offset: float = 0.0,
        side_set_name: str,
        network_code: "str" = "XX",
        station_code: "str",
        location_code: "str" = "",
        fields: "list[str]",
        rotation_on_output: "dict | None" = None,
    ): ...

Cartesian side set receiver in 3D.

The intersection between the specified line and the side set in the mesh will be the location of the receiver. The line is specified by a point and a direction.

If the line intersects the side set multiple times, the closest intersection to the specified point will be chosen, assuming all intersections are in different elements. If multiple intersections occur within one element the gradient based optimization will only manage to find one. Please choose a different line in that case.

This will be evaluated at the time it is added to a simulation object as it needs access to a mesh.

Parameters
  • point np.ndarray — A point on the line.
  • direction Union[np.ndarray, str] — The direction from the point finishing the definition of the line. Can be specified either as a 3D vector or as a string containing "x", "y", or "z", denoting the coordinate axes.
  • offset float — Offset the final receiver along the chosen direction. Allows placing receivers above/below side sets.
  • side_set_name str — The name of the side set to intersect the line with.
  • network_code 'str' — Network code.
  • station_code 'str' — Station code.
  • location_code 'str' — Location code.
  • fields 'list[str]' — Fields to record.
  • rotation_on_output 'dict | None' — Optional rotation matrix to be applied on output.
Attributes
name str

Full receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.

Methods
from_json()
def from_json(d: builtins.dict) -> Any: ...

Recreate the object from a dictionary serialization of its initialization parameters.

Parameters
  • d builtins.dict — Dictionary containing its init parameters and a few other things.
Returns Any
to_json()
def to_json(
    self,
    external_file_hash: types = None,
    timer: types = None,
    log_to_logger: bool = False,
    comm: types = None,
) -> builtins.dict: ...

Serialize the object to a dictionary that can be written to JSON.

Parameters
  • external_file_hash types — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
  • timer types — Execution timer.
  • log_to_logger bool — Log timings to the logger.
  • comm types — MPI communicator, if any.
Returns builtins.dict

SideSetVerticalPointCollection2D

class SideSetVerticalPointCollection2D(
    salvus.flow.simple_config.receiver.cartesian._CartesianSideSet2DLine
):
    def __init__(
        self,
        y: list[float] | np.ndarray,
        offset: float = 0.0,
        side_set_name: str,
        network_code: str = "XX",
        station_code: str,
        location_code: str = "",
        fields: list[str],
    ): ...

Base class for all cartesian 2D lines.

Specialized version of CartesianSideSetReceiver2D only requiring one or more y coordinates and a side set.

It will horizontally project the receiver left or right along the x-axis until it finds the intersection with the given side set.

The station codes will be suffixed by 0…N, thus a station code of “AB” would turn into “AB0” to “ABN”.

Parameters
  • y list[float] | np.ndarray — y coordinates.
  • offset float — Offset the final receivers along the y-axis. Allows placing receivers above/below side sets.
  • side_set_name str — Name of the side set at which to attach the receivers.
  • network_code str — Network code.
  • station_code str — Station code.
  • location_code str — Location code.
  • fields list[str] — Fields to record.
Methods
to_list()
def to_list(self) -> list[_Base]: ...

Convert to a list of receivers.

Returns list[_Base]

Submodules

Used in tutorials