Boundary

Class for Boundary Condition.

class antares.api.Boundary.Boundary(bnd=None, inherit_computer=None)

Boundary class inherits from Window class.

Note

The attribute name is the name of the Boundary object. The dictionary Zone.boundaries maps a (key) name to a Boundary object. Both names could be different for a given Boundary object even if it would be weird to do so.

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_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_boundary)

Build a pickable representation of the boundary.

dimension()

Dimension of the Dataset.

duplicate_variables(list_vars, list_newvars)

Duplicate variables in the dataset.

fromkeys(iterable[, value])

get(k[,d])

get_ghost_cells()

Return the ghost_cells table.

get_location(location, new_dataset)

Return a copy of the Datasets containing only the variables located in the original Datasets at the specified location.

get_shape()

Get the shape of the dataset.

is_structured()

Tell whether the zone is a structured mesh or not.

items()

keys()

Return keys as a list and not KeysView nor dict_keys.

orient_flat_range_slicing(base)

Create the slicing to reorient data from boundary to orientation 1.

orientation_slicing(base)

Create the slicing to reorient the boundary of 3D structured mesh to orientation 1.

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.

serialized([data])

Build a pickable representation of the boundary.

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])

slicing_orientation()

Give the orientation of a 3D slicing.

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

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_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_boundary)

Build a pickable representation of the boundary.

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.

Returns:

a list containing a dictionary for each index with two keys: ‘min’ and ‘max’.

Each key corresponds to the boundary min or max of that index. As we are in Windows (or in a Boundary), return a default result as if this was a zone without any boundaries defined

The values are lists containing 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, new_dataset)

Return a copy of the Datasets containing only the variables located in the original Datasets at the specified location.

Parameters:
  • location (string in LOCATIONS) – location to extract

  • new_dataset (Datasets) – The dataset that will contain the variables located at the given location.

Returns:

the Datasets with only specified location variables

Return type:

Datasets or None

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

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.

orient_flat_range_slicing(base)

Create the slicing to reorient data from boundary to orientation 1.

If the orientation of the boundary is -1, the boundary is reoriented. The rule is to invert the first axis of the boundary that has a range greater then 1. If the orientation of the boundary is 1 or undefined, it does nothing.

Main difference with Boundary.orientation_slicing(): the range of the slicing is given by the boundary data range. Then, the start and stop are None. So, only the step is changed.

Parameters:

base (Base) – the parent Base of the Boundary.

Returns:

the slicing to apply to reorient boundary data.

Return type:

tuple(slice)

orientation_slicing(base)

Create the slicing to reorient the boundary of 3D structured mesh to orientation 1.

If the orientation of the boundary is -1, the boundary is reoriented. The rule is to invert the first axis of the boundary that has a range greater then 1. If the orientation of the boundary is 1 or undefined, it does nothing.

Each slice of the slicing is assumed to have a None “step”.

Parameters:

base (Base) – the parent Base of the Boundary.

Returns:

the slicing to apply to reorient the boundary.

Return type:

tuple(slice)

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.

serialized(data=True)

Build a pickable representation of the boundary.

set_computer_model(modeling, species_database=None, addons=None)

Set a computer modeling for the zone.

See antares.api.Instant.Instant.set_computer_model().

set_formula(formula)

Set a formula for the dataset (Zone or Boundary).

See antares.api.Instant.Instant.set_formula()

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
slicing_orientation()

Give the orientation of a 3D slicing.

Considering (i, j, k) as a right-handed basis, a 3D slicing has orientation 1 when the slicing gives a orientation 1 face, i.e. the resulting (i’, j’) basis can be completed with a k’ vector such that (i’, j’, k’) is a right-handed basis AND k’ direction is outward the interval of k values.

Returns:

1 if right-handed oriented, -1 if left-handed oriented, 0 if undefined

Return type:

int

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.

bndphys
Type:

, optional

container

Attribute (of type CustomDict) containing all kind of data associated to the Window, and not constrained to the shape. These data are ignored during a family slicing. optional.

donor_bnd_name

Name of the donor boundary.

Type:

str, optional. Valid for ‘type’=’grid_connectivity’ with ‘gc_type’=’abutting_1to1’

donor_zone_name

Name of the donor zone.

Type:

str, optional. Valid for ‘type’=’grid_connectivity’ with ‘gc_type’=’abutting_1to1’

elsA

Dictionary of elsA options.

keys: + bnd_dir: directory of boundary files + omega_file: filename for rotation velocity on walls + axis_ang_1, axis_ang_2: + xrot_angle, yrot_angle, zrot_angle: rotation angle for periodicity + xtran, ytran, ztran: translation for periodicity

Type:

dict, optional

family_name

Name of the family associated to the boundary condition.

Type:

str, optional

family_number

Number of the family associated to the boundary condition.

Type:

int, optional

gc_type

Type of the grid connectivity boundary.

Type:

str in [‘abutting_1to1’, ‘abutting’], compulsory if ‘type’=’grid_connectivity’, else optional

glob_border_cur_name

The boundary belongs to this set of boundaries.

Type:

str, optional. Valid for ‘type’=’grid_connectivity’ with ‘gc_type’=’abutting’

glob_border_opp_name

The set of boundaries opposite to the set of boundaries which the boundary belongs to.

Type:

str, optional. Valid for ‘type’=’grid_connectivity’ with ‘gc_type’=’abutting’

name

Name of the boundary.

Type:

str, compulsory

num_type

For gmsh.

Type:

str, compulsory if ‘type’=’boundary’

pangle
Type:

, optional

periodicity

namedtuple PERIODIC_T. None if no periodicity Otherwise, provide the rotation center and angle and the translation (all np.array(float of nbdim size) keys: rotationcenter rotationangle translation

property shared

Attribute (of type Instant) containing variables shared for all the Instants contained in the Datasets.

property slicing

Get slicing attribute.

slicing_donor

Contains the interface patch subrange of indices for the adjacent zone.

Type:

tuple or list, compulsory, for structured grids: tuple of 3 slice objects (six integers), topological information

transform

List of X integers, X being the dimension of the space, valid for ‘type’=’grid_connectivity’ with ‘gc_type’=’abutting_1to1’

Type:

list(int), optional

type

Type of the boundary.

Type:

str in [‘boundary’, ‘grid_connectivity’], compulsory

zone_name

Name of the Zone in which the slicing should be applied.

Type:

str, compulsory