Zone¶
Sublevel of the Base container.
The class Zone derives from the class antares.api.datasets.Datasets
.
- class antares.api.Zone.Zone(zone=None, inherit_bc=False, inherit_computer=None)¶
Sublevel of the Base container.
A Zone is an item of the Base data structure (ordered dictionary).
A Zone contains multiple Instants.
Methods
add_computer_function
(new_func)Set a new function.
clear
()compute
(var_name[, location, reset, store])Compute a given variable on the whole zone.
compute_bnd_unstruct_slicing
(coordinates)Regenerate the slicing in case of unstructured config.
compute_bounding_box
(coordinates)Compute the bounding box of the zone with respect to the coordinates.
compute_coordinate_system
([ttype, ...])Compute a new coordinate system in the Datasets.
copy
()delete_variables
(list_vars[, location])Delete variables in the dataset.
deserialized
(pickable_zone)Build a zone from its representation.
Dimension of the Dataset.
duplicate_variables
(list_vars, list_newvars)Duplicate variables in the dataset.
fromkeys
(iterable[, value])get
(k[,d])Return the ghost_cells table containing a dictionary for each index with two keys : 'min' and 'max'.
get_location
(location)Return a copy of the Zone containing only the variables located in the original Zone at the specified location.
Get the shape of the dataset.
Return the list of zones connected by join conditions.
Tell whether the zone is a structured mesh or not.
items
()keys
()Return keys as a list and not KeysView nor dict_keys.
pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem
()as a 2-tuple; but raise KeyError if D is empty.
rel_to_abs
([coordinates, conservative_vars, ...])Transform conservative variables from relative frame to absolute frame by looping on all instants using the
Instant.rel_to_abs()
method.rename_variables
(list_vars, list_newvars[, ...])Rename variables in the dataset.
report_coordinates_in_bnd
(coordinates)Extract coordinates from the main area.
report_node_boundaries_values
([variables])Report data from boundary to main location.
serialized
([data])Build a pickable representation of the zone.
set_computer_model
(modeling[, ...])Set a computer modeling for the zone.
set_formula
(formula)Set a formula for the dataset (Zone or Boundary).
set_formula_from_attrs
(name)Set a formula from a name in the dataset attribute.
setdefault
(k[,d])update
([E, ]**F)If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values
()Attributes
Dictionary
antares.core.AttrsManagement.AttrsManagement
containing the attributes of the Datasets.Attribute (of type
Instant
) containing variables shared for all the Instants contained in the Datasets.- add_computer_function(new_func)¶
Set a new function.
The computer will receive a new function associated to its current modeling.
- clear() None. Remove all items from D. ¶
- compute(var_name, location=None, reset=False, store=True)¶
Compute a given variable on the whole zone.
This variable is computed on all instants of the zone.
Use the
Instant.compute()
method.- Parameters:
var_name (str) – The name of the variable to compute.
location (str in LOCATIONS) – The location of the variable. If
None
, the default location is assumed.reset (bool) – Remove temporary fields stored in the equation manager.
store (bool) – Store temporary fields in the equation manager.
- compute_bnd_unstruct_slicing(coordinates)¶
Regenerate the slicing in case of unstructured config.
In case of unstructured mesh, recompute the current slicing by identifying through the nodal position the common nodes This requires to have coordinates in both bnd and main part at nodal positions
- Parameters:
coordinates (list(str)) – variables used as coordinates
- compute_bounding_box(coordinates)¶
Compute the bounding box of the zone with respect to the coordinates.
- Parameters:
coordinates (list(str)) – list of variable names
- Returns:
the bounding box
- Return type:
dictionary with key: variable names, value: list with min and max values
- compute_coordinate_system(ttype='cartesian2cylindrical', remove_current=False, current_coord_sys=['x', 'y', 'z'], new_coord_sys=['x', 'r', 'theta'], origin=[0.0, 0.0, 0.0])¶
Compute a new coordinate system in the Datasets.
- Parameters:
ttype (str in ['cartesian2cylindrical', 'cylindrical2cartesian']) – type of transformation
remove_current (bool) – remove current coordinate system after transformation
current_coord_sys (list of 3 str) – names of the current coordinates
new_coord_sys (list of 3 str) – names of the new coordinates
origin (list of 3 float) – position of the origin
Warning
‘cylindrical2cartesian’ not implemented
for ‘ttype’=’cartesian2cylindrical’, in ‘new_coord_sys’, the first coordinate is the axial direction, the second the radial one, and the third the azimuthal one (by default (x, r, \(\theta\)))
The first coordinate name in ‘new_coord_sys’ must also be into ‘current_coord_sys’.
- copy()¶
- delete_variables(list_vars, location=None)¶
Delete variables in the dataset.
- Parameters:
list_vars (list(str)) – list of variables to delete
location (str in LOCATIONS or ‘None’) – if
None
, delete the variables at the all locations
equivalent to del zone[:, :, list_vars] which uses
del
with zone slicing instead.
- classmethod deserialized(pickable_zone)¶
Build a zone from its representation.
- dimension()¶
Dimension of the Dataset.
- Returns:
dimension of the Datasets
- Return type:
int
- duplicate_variables(list_vars, list_newvars, location=None)¶
Duplicate variables in the dataset.
- Parameters:
list_vars (list(str)) – list of variables to duplicate
list_newvars (list(str)) – list of new variable names
location (str in LOCATIONS) – if different from
None
, change only the variables at the location specified
Duplication is performed element-wise.
- classmethod fromkeys(iterable, value=None)¶
- get(k[, d]) D[k] if k in D, else d. d defaults to None. ¶
- get_ghost_cells()¶
Return the ghost_cells table containing a dictionary for each index with two keys : ‘min’ and ‘max’. Each key corresponds to the boundary min or max of that index. The values are lists comtaining as many elements as the number of boundaries. For each boundary a list of two elements is given:
the first is the slicing of the present block node array corresponding to this boundary
the second is:
if the boundary is a join: (donor zone name, node array slicing of the donor boundary, trirac)
else : None
- get_location(location)¶
Return a copy of the Zone containing only the variables located in the original Zone at the specified location.
- get_shape()¶
Get the shape of the dataset.
The shape is the shape of the node values, either taken from the shared instant, or taken from the first instant.
- Returns:
the shape
- Return type:
tuple
- get_surrounding_zones()¶
Return the list of zones connected by join conditions.
- Returns:
The list of surrounding zone names.
- Return type:
list(str)
- is_structured()¶
Tell whether the zone is a structured mesh or not.
Note
all instants are supposed to be of the same kind.
- Return type:
bool
- items() a set-like object providing a view on D's items ¶
- keys()¶
Return keys as a list and not KeysView nor dict_keys.
- pop(k[, d]) v, remove specified key and return the corresponding value. ¶
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair ¶
as a 2-tuple; but raise KeyError if D is empty.
- rel_to_abs(coordinates=None, conservative_vars=None, omega='in_attr', angle='in_attr')¶
Transform conservative variables from relative frame to absolute frame by looping on all instants using the
Instant.rel_to_abs()
method.- Parameters:
coordinates (list(str)) – list of coordinates names
conservative_vars (list(str)) – list of conservative variables names in the following order: density, momentum along the x-axis; momentum along the y-axis, momentum along the z-axis and total energy per unit of volume
omega (float) – angular speed of the current base. If
in_attr
use the omega stored in the attrs, necessary if different angular speeds in the base (for example one angular speed per superblock)angle (float) – angular deviation of the current base. If
in_attr
use the angle stored in the attrs, necessary if different angular deviations in the base (for example one angular deviation per superblock and per instant)
Note
may be moved elsewhere in future releases
Warning
the angular speed must be perpendicular to the x-axis
- rename_variables(list_vars, list_newvars, location=None)¶
Rename variables in the dataset.
- Parameters:
list_vars (list(str)) – list of variables to rename
list_newvars (list(str)) – list of new variable names
location (str in LOCATIONS) – if different from
None
, change only the variables at the location specified
Replacement is performed element-wise.
- report_coordinates_in_bnd(coordinates)¶
Extract coordinates from the main area.
Scan all bnd for coordinates: if not, perform a slice on the main part to set the accurate coordinates in the boundary. Keep the shared status.
Warning
coordinates must not change between instants
- Parameters:
coordinates (list(str)) – variables used as coordinates
- report_node_boundaries_values(variables=None)¶
Report data from boundary to main location.
Warning
Apply only on Nodal data.
- Parameters:
variables (list(str) or None) – list of variables to compute at cell, if
None
, compute all variables from node to cell
- serialized(data=True)¶
Build a pickable representation of the zone.
- set_computer_model(modeling, species_database=None, addons=None)¶
Set a computer modeling for the zone.
- set_formula(formula)¶
Set a formula for the dataset (Zone or Boundary).
- set_formula_from_attrs(name)¶
Set a formula from a name in the dataset attribute.
The computer will receive a new formula associated to its current modeling. This formula is included in the zone attribute with the key name.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D ¶
- update([E, ]**F) None. Update D from mapping/iterable E and F. ¶
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values ¶
- property attrs¶
Dictionary
antares.core.AttrsManagement.AttrsManagement
containing the attributes of the Datasets.
- boundaries¶
Attribute (of type
CustomDict
) containing the boundaries of the Zone.
Attribute (of type
Instant
) containing variables shared for all the Instants contained in the Datasets.