pyrc.core.nodes#
- class AirNode(temperature: float | int | ~numpy.number, position: ~numpy.ndarray, temperature_derivative: float | int | ~numpy.number = 0, rc_objects: ~pyrc.core.components.templates.RCObjects = <pyrc.core.components.templates.RCObjects object>, rc_solution: ~pyrc.core.components.templates.RCSolution = <pyrc.core.components.templates.RCSolution object>, **kwargs)#
Bases:
MassFlowNode- Parameters:
temperature (float | int | np.number) – The (initial) temperature of the node.
position (np.ndarray) – The position of the node in 2D/3D space. If 2D, a zero is added for the z coordinate.
flow_area (float | int | str) – Defining the area that is used for flow calculations (determining the velocity and the Courant number). Can be a string: xy: xy-plane, xz: xz-plane, yz: yz-plane If not given the smallest flow area is used that points to a
ConnectedFlowObject.flow_length (float | int | str) – Defining the length that the flow takes. Can be a string: x: delta_x, y: delta_y, z: delta_z If not given the matching one for the flow area is used.
temperature_derivative (float | int | np.number) – The temperature derivative of the node.
flow_velocity (float | int | np.number) – The flow velocity of the node. It doesn’t matter which sign it has. Only the absolute value is used.
- class ChannelNode(material: ~pyrc.core.components.templates.Material, temperature, position, flow_area: float | int | str = None, flow_length: float | int | str = None, temperature_derivative=0, flow_velocity=None, mass_flow=None, volume_flow=None, rc_objects: ~pyrc.core.components.templates.RCObjects = <pyrc.core.components.templates.RCObjects object>, rc_solution: ~pyrc.core.components.templates.RCSolution = <pyrc.core.components.templates.RCSolution object>, **kwargs)#
Bases:
MassFlowNode- Parameters:
temperature (float | int | np.number) – The (initial) temperature of the node.
position (np.ndarray) – The position of the node in 2D/3D space. If 2D, a zero is added for the z coordinate.
flow_area (float | int | str) – Defining the area that is used for flow calculations (determining the velocity and the Courant number). Can be a string: xy: xy-plane, xz: xz-plane, yz: yz-plane If not given the smallest flow area is used that points to a
ConnectedFlowObject.flow_length (float | int | str) – Defining the length that the flow takes. Can be a string: x: delta_x, y: delta_y, z: delta_z If not given the matching one for the flow area is used.
temperature_derivative (float | int | np.number) – The temperature derivative of the node.
flow_velocity (float | int | np.number) – The flow velocity of the node. It doesn’t matter which sign it has. Only the absolute value is used.
- property circumference#
- property diameter: float#
Returns the diameter by using neighbour nodes that aren’t ChannelNodes.
This assumes that each ChannelNode is connected to at least one solid node at its sides. This node is used to get the perpendicular direction and define which sides defining the diameter.
- Returns:
The diameter.
- Return type:
float
- property flow_area#
- property flow_length: float#
The effective length of the channel. Use only if no asking_node is given!
This assumes that each ChannelNode is connected to at least one solid node at its sides. This node is used to get the perpendicular direction and define which sides defining the length.
- Returns:
The length, but it can be wrong in few cases.
- Return type:
float
- get_pipe_area(asking_node: Node | BoundaryCondition) float | int | number#
Return the effective area of this ChannelNode.
- Parameters:
asking_node (Node | BoundaryCondition) – The Node that asks for the area of this Node. It is used to calculate the shift in position and to return the associated surface area accordingly.
- Returns:
The area of the surface of the cell that has the normal vector of the line you get connecting both
selfandasking_node.- Return type:
float | int | np.number
- property volume: float | int#
Returns the volume of the circular air channel.
- Returns:
The volume of the air channel.
- Return type:
float | int | np.number
- class ConnectedFlowCapacitorObject(capacity: float, temperature, rc_objects: RCObjects = <pyrc.core.components.templates.RCObjects object>, temperature_derivative=0, internal_heat_source: InternalHeatSource = None, rc_solution: RCSolution = <pyrc.core.components.templates.RCSolution object>)#
Bases:
Capacitor,ConnectedFlowObject,ABCCapacitor building part, currently designed as thermal capacitor.
- Parameters:
capacity (float) – The capacity of the capacitor.
temperature (float | int) – The temperature of the node.
temperature_derivative (float | int) – The temperature derivative of the node.
- class MassFlowNode(material: ~pyrc.core.components.templates.Material, temperature, position, flow_area: float | int | str = None, flow_length: float | int | str = None, temperature_derivative=0, flow_velocity=None, mass_flow=None, volume_flow=None, rc_objects: ~pyrc.core.components.templates.RCObjects = <pyrc.core.components.templates.RCObjects object>, rc_solution: ~pyrc.core.components.templates.RCSolution = <pyrc.core.components.templates.RCSolution object>, **kwargs)#
Bases:
Node,ConnectedFlowObject- Parameters:
temperature (float | int | np.number) – The (initial) temperature of the node.
position (np.ndarray) – The position of the node in 2D/3D space. If 2D, a zero is added for the z coordinate.
flow_area (float | int | str) – Defining the area that is used for flow calculations (determining the velocity and the Courant number). Can be a string: xy: xy-plane, xz: xz-plane, yz: yz-plane If not given the smallest flow area is used that points to a
ConnectedFlowObject.flow_length (float | int | str) – Defining the length that the flow takes. Can be a string: x: delta_x, y: delta_y, z: delta_z If not given the matching one for the flow area is used.
temperature_derivative (float | int | np.number) – The temperature derivative of the node.
flow_velocity (float | int | np.number) – The flow velocity of the node. It doesn’t matter which sign it has. Only the absolute value is used.
- __init__(material: ~pyrc.core.components.templates.Material, temperature, position, flow_area: float | int | str = None, flow_length: float | int | str = None, temperature_derivative=0, flow_velocity=None, mass_flow=None, volume_flow=None, rc_objects: ~pyrc.core.components.templates.RCObjects = <pyrc.core.components.templates.RCObjects object>, rc_solution: ~pyrc.core.components.templates.RCSolution = <pyrc.core.components.templates.RCSolution object>, **kwargs)#
- Parameters:
temperature (float | int | np.number) – The (initial) temperature of the node.
position (np.ndarray) – The position of the node in 2D/3D space. If 2D, a zero is added for the z coordinate.
flow_area (float | int | str) – Defining the area that is used for flow calculations (determining the velocity and the Courant number). Can be a string: xy: xy-plane, xz: xz-plane, yz: yz-plane If not given the smallest flow area is used that points to a
ConnectedFlowObject.flow_length (float | int | str) – Defining the length that the flow takes. Can be a string: x: delta_x, y: delta_y, z: delta_z If not given the matching one for the flow area is used.
temperature_derivative (float | int | np.number) – The temperature derivative of the node.
flow_velocity (float | int | np.number) – The flow velocity of the node. It doesn’t matter which sign it has. Only the absolute value is used.
- property balance#
- check_balance() bool#
Returns True if every parent
ConnectedFlowObjecthas a balanced volume flow.This implies that the algorithm to set the volume flow always walks from the flow start to its end and not the other way around.
- Returns:
True if every parent
ConnectedFlowObjecthas a balanced volume flow. False otherwise.- Return type:
bool
- connected_mass_transport_resistors() list[MassTransport]#
Returns all connected mass transport resistors.
- Returns:
The list.
- Return type:
list[MassTransport]
- courant_number(time_step: float)#
Calculates the courant number of the node.
- Parameters:
time_step (float | int | np.number) – The (maximum) time step used for calculation.
- Returns:
The courant number.
- Return type:
float | np.number
- property diameter: float#
Returns the hydraulic diameter.
- Returns:
The hydraulic diameter of the node.
- Return type:
float
- property flow_area#
- property flow_direction: list[ndarray]#
- property flow_length: float#
The effective length of the channel. Use only if no asking_node is given!
This assumes that each ChannelNode is connected to at least one solid node at its sides. This node is used to get the perpendicular direction and define which sides defining the length.
- Returns:
The length, but it can be wrong in few cases.
- Return type:
float
- get_minimal_perpendicular_lengths_to_flow() tuple#
- get_perpendicular_length_parallel_to_flow(asking_node: Node)#
Returns the length that is perpendicular to the connection asking_node - self and is parallel to the flow.
Used for the effective area between a Solid and a MassFlowNode as well as to get the length of ChannelNodes.
- Parameters:
asking_node (Node)
- Returns:
The length.
- Return type:
float
- get_resistor_volume_flow(resistor: MassTransport)#
Returns the volume flow for the given resistor using mass balance.
- Parameters:
resistor (MassTransport) – The
Resistorto determine the volume flow for.- Returns:
The volume flow of the given
Resistor.- Return type:
float
- property mass_flow#
Returns the cached mass flow rate (kg/s) or calculates it if needed.
- property mass_flow_neighbours#
Returns all neighbour
MassFlowNodes.- Returns:
The list with all neighbour
MassFlowNodes- Return type:
list
- property mass_flow_nodes: list#
Returns a list with all MassTransport resistors in the network.
- Returns:
The list with all MassTransport resistors in the network.
- Return type:
list
- property mass_transport_resistors: list#
Returns a list with all MassTransport resistors in the network.
- Returns:
The list with all MassTransport resistors in the network.
- Return type:
list
- propagate_flow()#
Propagates the volume flow through all connected
ConnectedFlowObjects from start to end.It considers already set volume flows on its way to the end, but until now there is now backflow allowed. So if the set volume flow of an sink exceeds the balance it will be overwritten.
Only works if the volume flow is set at the start
FlowBoundaryCondition! It walks from the start to the end and not the other way round.
- reset_properties()#
Clears cached flow velocity and mass flow to force recalculation.
- set_remaining_resistor_volume_flow()#
Sets all unset volume flows of all
MassTransportResistors.The most of them should have been set already in
self.propagate_flow().
- property sinks: list[MassFlowNode | FlowBoundaryCondition]#
Returns a list of all
MassFlowNodes into which the flow is flowing.No check is performed which node type is put into the list, but it should only be
MassFlowNodes and its descendants orFlowBoundaryConditions.- Returns:
All nodes serving as volume flow sink.
- Return type:
list
- property sources: list[Capacitor | Node]#
Returns a list with all nodes where volume flow is flowing into the node.
No check is performed which node type is put into the list, but it should only be
MassFlowNodes and its descendants orFlowBoundaryConditions.- Returns:
All nodes serving as volume flow source.
- Return type:
list
- property start_nodes: list#
Returns all nodes that are defined as a start of the mass flow.
Used for the algorithm to set the direction of the mass flow (make_velocity_direction).
- Returns:
A list with all mass flow start BoundaryConditions.
- Return type:
list
- property velocity#
Returns the cached flow velocity (m/s) or calculates it if needed.
- property volume_flow#
Returns the cached volume flow rate (m³/s).
- class Node(material: Material, temperature: float | int | np.number, position: np.ndarray | tuple, temperature_derivative: float | int | np.number = 0, internal_heat_source: bool | int | float | np.number = False, internal_heat_source_type=<class 'pyrc.core.inputs.InternalHeatSource'>, delta: np.ndarray | tuple | list = None, rc_objects=<pyrc.core.components.templates.RCObjects object>, rc_solution: RCSolution = <pyrc.core.components.templates.RCSolution object>, **kwargs: float | int | np.ndarray | Settings)#
-
- Parameters:
material (Material) – Container with all material properties stored in the node is made up from.
temperature (float | int | np.number) – The temperature of the node. It is recommended to use the SI unit Kelvin instead of degrees Celsius.
position (np.ndarray) – The position of the node in 2D/3D space. If 2D, a zero is added for the z coordinate.
temperature_derivative (float | int | np.number, optional) – The temperature derivative of the node.
internal_heat_source (bool | int | float | np.number, optional) – If True, an internal heat source term is added. It can be accessed using Node.internal_heat_source If a number, the number is used to set as volumetric heat source power in W/m**3.
internal_heat_source_type (type, optional) – The internal heat source type. Can be each
InternalHeatSourcetype.delta (np.ndarray | tuple, optional) – Delta vector [delta_x, delta_y, delta_z].
kwargs (dict) – Parameters passed to
InternalHeatSource/its type.
Notes
Be aware of the fact that the Node’s properties can change during network creation! This means, that if you add connections to a Node it’s volume/mass can change. So every object, that needs the Node’s volume/mass should be initialized after the whole network was build up. This affects, among other things,
Inputs likeInternalHeatSources, especiallyRadiation. To avoid this, you must pass the whole object (node/BC) to the Input and program it in a way that the values are created earliest when values are requested (and therefore the network must be set up (hopefully)).- __init__(material: Material, temperature: float | int | np.number, position: np.ndarray | tuple, temperature_derivative: float | int | np.number = 0, internal_heat_source: bool | int | float | np.number = False, internal_heat_source_type=<class 'pyrc.core.inputs.InternalHeatSource'>, delta: np.ndarray | tuple | list = None, rc_objects=<pyrc.core.components.templates.RCObjects object>, rc_solution: RCSolution = <pyrc.core.components.templates.RCSolution object>, **kwargs: float | int | np.ndarray | Settings)#
- Parameters:
material (Material) – Container with all material properties stored in the node is made up from.
temperature (float | int | np.number) – The temperature of the node. It is recommended to use the SI unit Kelvin instead of degrees Celsius.
position (np.ndarray) – The position of the node in 2D/3D space. If 2D, a zero is added for the z coordinate.
temperature_derivative (float | int | np.number, optional) – The temperature derivative of the node.
internal_heat_source (bool | int | float | np.number, optional) – If True, an internal heat source term is added. It can be accessed using Node.internal_heat_source If a number, the number is used to set as volumetric heat source power in W/m**3.
internal_heat_source_type (type, optional) – The internal heat source type. Can be each
InternalHeatSourcetype.delta (np.ndarray | tuple, optional) – Delta vector [delta_x, delta_y, delta_z].
kwargs (dict) – Parameters passed to
InternalHeatSource/its type.
Notes
Be aware of the fact that the Node’s properties can change during network creation! This means, that if you add connections to a Node it’s volume/mass can change. So every object, that needs the Node’s volume/mass should be initialized after the whole network was build up. This affects, among other things,
Inputs likeInternalHeatSources, especiallyRadiation. To avoid this, you must pass the whole object (node/BC) to the Input and program it in a way that the values are created earliest when values are requested (and therefore the network must be set up (hopefully)).
- area(normal: ndarray) float#
Returns the area of the desired plane in m**2.
- Parameters:
normal (np.ndarray) – The direction to the wanted plane. E.g.: if (1,0,0) the y-z-plane is wanted so the area of the yz-plane is returned.
- Returns:
The area in m^2.
- Return type:
float
- calculate_capacity()#
- calculate_volume()#
- property capacity: float | int#
Returns the capacity (not specific) of the node in J/K.
- Returns:
The capacity of the node in J/K.
- Return type:
float | int
- get_area(asking_node: Node | Cell | BoundaryCondition | Capacitor) float | int | number#
Returns the area that the asking node sees. Through this area travels the heat between both nodes.
Example: If the asking node has the same position in x and y direction but is shifted in z direction, the area of the cell face X-Y is returned.
A non-Cell class is only valid if its direction to/from self was set manually in self.manual_directions[asking_node]. Otherwise, it will throw an error.
- Parameters:
asking_node (Node | Cell | BoundaryCondition | Capacitor) – The Node that asks for the area of this Node. It is used to calculate the shift in position and to return the associated surface area accordingly. If it doesn’t inherit from Cell, it is assumed that the direction is set manually in manual_directions dict using
selfas key.- Returns:
The area of the surface of the cell that has the normal vector of the line you get connecting both
selfandasking_node.- Return type:
float | int | np.number
- get_both_perpendicular_lengths(asking_node: Geometric | Node | BoundaryCondition) tuple[float, float]#
Returns both perpendicular lengths between the self and the asking node.
- Parameters:
asking_node (Geometric | Node | BoundaryCondition) – The node asking.
- Returns:
Both length in no particular order.
- Return type:
tuple[float, float]
- get_conduction_length(asking_node: Node | ConnectedFlowObject | Geometric | Capacitor)#
Returns the length to the asking node. It’s half the delta value in direction to the asking node.
- Parameters:
asking_node (Geometric) – The Node asking for the (half) length between itself and self.
- Returns:
The half-length of self. Or: Half the delta value of self pointing towards asking_node.
- Return type:
float
- get_smaller_edge(asking_node: Geometric | Node | BoundaryCondition | Capacitor)#
Returns the smaller edge of the cell using the asking node to set the direction.
Used to determine the diameter in
MassFlowNodes.- Parameters:
asking_node (Geometric | Node | BoundaryCondition) – The node that asks for the diameter of this
Node. It determines the direction to get the right dimension.- Returns:
The diameter (smallest length of the cell side pointing towards
asking_node).- Return type:
float | int | np.number
- property mass: float | int | number#
Returns the mass flow of the node in kg.
- Returns:
The mass flow of the node in kg. If the density isn’t defined np.nan is returned.
- Return type:
float | int
- update_color(t_min: float = 263.15, t_max: float = 413.15, colormap='managua') None#
Update the color of the vbox for visualization.
- Parameters:
t_min (float | int, optional) – The minimal temperature for the color code.
t_max (float | int, optional) – The maximal temperature for the color code.
colormap (str, optional) – The colormap to use. See pyrc.core.visualization.color.color.py or the txt files in there respectively.
- property values: list#
Returns a list of all values of all object symbols, except of time dependent symbols.
Must be in the same order as self.symbols.
- Returns:
The list of sympy.symbols.
- Return type:
list
- property volume: float | int#