salvus.flow.simple_config.receiver.cartesian
Receivers in a cartesian reference system.
Functions
parse()
parse()def parse(
dict_receivers: Union[List[Dict], Dict]
) -> Sequence[
Union[
salvus.flow.simple_config.receiver.cartesian.Point2D,
salvus.flow.simple_config.receiver.cartesian.Point3D,
]
]:
...Parse a dictionary or a list of dictionaries to receiver objects.
dict_receiversUnion[List[Dict], Dict] — Parse a list of receivers (or just a single receivers) as a dictionary to the proper objects.
Classes
Point2D
Point2Dclass 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],
):
...Receiver in a 2-D Cartesian domain.
Initialize the spatial locations and metadata.
xfloat — X-coordinate of receiver.yfloat — Y-coordinate of receiver.network_codestr — Network code.station_codestr — Station code.location_codestr — Location code.fieldsList[str] — Fields to record.
name str
name strFull receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.
from_json()
from_json()def from_json(d: Dict, skip_validation: bool = False) -> _BaseReceiver:
...Initialize a receiver object from a dictionary.
dDict — Dictionary containing the init parameters and a few other things.skip_validationbool — 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.
apply()
apply()def apply(self, d: Union[Dict, _DeepSetter]) -> None:
...Set the contents with a dictionary.
dUnion[Dict, _DeepSetter] — The dictionary to set.
copy()
copy()def copy(self) -> _DeepSetter:
...Return a deep copy of the object.
get_dictionary()
get_dictionary()def get_dictionary(self) -> Dict:
...Get the contents of this object as a dictionary.
to_json()
to_json()def to_json(self, external_file_hash: Optional[str] = None) -> Dict:
...Serialize the object to dictionary that can be written to JSON.
external_file_hashOptional[str] — 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.
validate()
validate()def validate(self) -> None:
...Validates the current state of the configuration against its schema.
Point3D
Point3Dclass 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],
):
...Receiver in a 3-D Cartesian domain.
Initialize the spatial locations and metadata.
xfloat — X-coordinate of receiver.yfloat — Y-coordinate of receiver.zfloat — Z-coordinate of receiver.network_codestr — Network code.station_codestr — Station code.location_codestr — Location code.fieldsList[str] — Fields to record.
name str
name strFull receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.
from_json()
from_json()def from_json(d: Dict, skip_validation: bool = False) -> _BaseReceiver:
...Initialize a receiver object from a dictionary.
dDict — Dictionary containing the init parameters and a few other things.skip_validationbool — 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.
apply()
apply()def apply(self, d: Union[Dict, _DeepSetter]) -> None:
...Set the contents with a dictionary.
dUnion[Dict, _DeepSetter] — The dictionary to set.
copy()
copy()def copy(self) -> _DeepSetter:
...Return a deep copy of the object.
get_dictionary()
get_dictionary()def get_dictionary(self) -> Dict:
...Get the contents of this object as a dictionary.
to_json()
to_json()def to_json(self, external_file_hash: Optional[str] = None) -> Dict:
...Serialize the object to dictionary that can be written to JSON.
external_file_hashOptional[str] — 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.
validate()
validate()def validate(self) -> None:
...Validates the current state of the configuration against its schema.
SideSetHorizontalPointCollection2D
SideSetHorizontalPointCollection2Dclass SideSetHorizontalPointCollection2D(
salvus.flow.simple_config.receiver.cartesian._CartesianSideSet2DLine
):
def __init__(
self,
x: Union[List[float], numpy.ndarray],
offset: float = 0.0,
side_set_name: str,
network_code: str = "XX",
station_code: str,
location_code: str = "",
fields: List[str],
):
...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”.
xUnion[List[float], numpy.ndarray] — x coordinates.offsetfloat — Offset the final receivers along the y-axis. Allows placing receivers above/below side sets.side_set_namestr — Name of the side set at which to attach the receivers.network_codestr — Network code.station_codestr — Station code.location_codestr — Location code.fieldsList[str] — Fields to record.
to_list()
to_list()def to_list(self) -> List[salvus.flow.simple_config.receiver._Base]:
...Convert to a list of receivers.
SideSetPoint2D
SideSetPoint2Dclass SideSetPoint2D(
salvus.flow.simple_config.side_set_base._SideSetBase,
salvus.flow.simple_config.receiver._SideSetReceiver,
):
def __init__(
self,
point: numpy.ndarray,
direction: Union[numpy.ndarray, str],
offset: float = 0.0,
side_set_name: str,
network_code: str = "XX",
station_code: str,
location_code: str = "",
fields: List[str],
):
...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.
pointnumpy.ndarray — A point on the line.directionUnion[numpy.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.offsetfloat — Offset the final receiver along the chosen direction. Allows placing receivers above/below side sets.side_set_namestr — The name of the side set to intersect the line with.network_codestr — Network code.station_codestr — Station code.location_codestr — Location code.fieldsList[str] — Fields to record.
name str
name strFull receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.
from_json()
from_json()def from_json(d: Dict) -> Any:
...Recreate the object from a dictionary serialization of its initialization parameters.
dDict — Dictionary containing its init parameters and a few other things.
to_json()
to_json()def to_json(self, external_file_hash: Optional[str] = None) -> Dict:
...Serialize the object to dictionary that can be written to JSON.
external_file_hashOptional[str] — 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.
SideSetPoint3D
SideSetPoint3Dclass SideSetPoint3D(
salvus.flow.simple_config.side_set_base._SideSetBase,
salvus.flow.simple_config.receiver._SideSetReceiver,
):
def __init__(
self,
point: numpy.ndarray,
direction: Union[numpy.ndarray, str],
offset: float = 0.0,
side_set_name: str,
network_code: str = "XX",
station_code: str,
location_code: str = "",
fields: List[str],
):
...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.
pointnumpy.ndarray — A point on the line.directionUnion[numpy.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.offsetfloat — Offset the final receiver along the chosen direction. Allows placing receivers above/below side sets.side_set_namestr — The name of the side set to intersect the line with.network_codestr — Network code.station_codestr — Station code.location_codestr — Location code.fieldsList[str] — Fields to record.
name str
name strFull receiver name as NETWORK_CODE.STATION_CODE.LOCATION_CODE.
from_json()
from_json()def from_json(d: Dict) -> Any:
...Recreate the object from a dictionary serialization of its initialization parameters.
dDict — Dictionary containing its init parameters and a few other things.
to_json()
to_json()def to_json(self, external_file_hash: Optional[str] = None) -> Dict:
...Serialize the object to dictionary that can be written to JSON.
external_file_hashOptional[str] — 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.
SideSetVerticalPointCollection2D
SideSetVerticalPointCollection2Dclass SideSetVerticalPointCollection2D(
salvus.flow.simple_config.receiver.cartesian._CartesianSideSet2DLine
):
def __init__(
self,
y: Union[List[float], numpy.ndarray],
offset: float = 0.0,
side_set_name: str,
network_code: str = "XX",
station_code: str,
location_code: str = "",
fields: List[str],
):
...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”.
yUnion[List[float], numpy.ndarray] — y coordinates.offsetfloat — Offset the final receivers along the y-axis. Allows placing receivers above/below side sets.side_set_namestr — Name of the side set at which to attach the receivers.network_codestr — Network code.station_codestr — Station code.location_codestr — Location code.fieldsList[str] — Fields to record.
to_list()
to_list()def to_list(self) -> List[salvus.flow.simple_config.receiver._Base]:
...Convert to a list of receivers.