Reactors, Components and Managers
Components are the fundamental building blocks of a bluemira design.
A Component is a physical object or a group of physical objects, organised in a tree structure.
A user may want access to some properties associated with a Component that are related
but not directly connected to the physical object.
For this reason we have ComponentManagers which can provide helper functions for common operations or
have extra information stored such as the equilibira in a plasma ComponentManager.
To manage a set of ComponentManagers a Reactor class is used which represents the full reactor object.
The Component class
Two types of Component classes are defined that can be used to represent different parts of a design:
bluemira.base.components.Componentis the base class and defines the framework on which other components can be defined within bluemira. When used directly it allows other types of component to be grouped together into super-structures. For example, a blanket first wall, breeding zone, manifold, and back supporting structure may be grouped into a blanket system. As these objects are not physical, they do not have a corresponding shape or material composition.bluemira.base.components.PhysicalComponentdefines the physical parts of a reactor, such as blanket layers, vessel shells, or ports. As implementations ofbluemira.base.components.PhysicalComponentcorrespond to a physical object, instances of that class can be defined with a shape and a material.
A Component can be used as shown below:
>>> from bluemira.base.components import Component, PhysicalComponent
>>> reactor = Component("My Reactor")
>>> plasma = PhysicalComponent("Plasma", plasma_shape)
>>> blanket = Component("Blanket")
>>> blanket.add_child(PhysicalComponent("First Wall", wall_shape))
>>> blanket.add_child(PhysicalComponent("Breeding Zone", breeding_zone_shape))
>>> reactor.add_child(plasma)
>>> reactor.add_child(blanket)
>>> print(reactor.tree())
My Reactor (Component)
├── Plasma (PhysicalComponent)
└── Blanket (Component)
├── First Wall (PhysicalComponent)
└── Breeding Zone (PhysicalComponent)
A component object as above doesn’t expose much functionality or flexibility and is designed to exist as a container for CAD structures. The ComponentManagers and Reactor objects discussed below are designed to give the Reactor Designer this flexibility.
ComponentManagers
ComponentManagers are designed to be created by the Reactor Designer.
The aim is to make it easier to access logically associated properties of a Component that may not be directly connected to the physical object.
It also can contain helper methods to ease access of specific sections of geometry,
for instance the separatrix of a plasma.
from bluemira.base.components import Component
from bluemira.base.reactor import ComponentManager
class Plasma(ComponentManager):
def lcfs(self):
return (
self.component
.get_component("xz")
.get_component('LCFS')
.shape.boundary[0]
)
A ComponentManager should be how a Component is used after creation within the top level of the reactor design.
Reactor
Reactors are again designed to be created by the Reactor Designer.
This object is the complete reactor and is a container that allows easy access to any part of it.
Methods on the Reactor object have access to all parts of the reactor
enabling functionality that needs to interact with multiple ComponentManagers.
from bluemira.base.reactor import Reactor
class MyReactor(Reactor):
'''An example of how to declare a reactor structure.'''
plasma: MyPlasma
tf_coils: MyTfCoils
def get_ripple(self):
'''Calculate the ripple in the TF coils.'''
reactor = MyReactor("My Reactor", n_sectors=1)
reactor.plasma = build_plasma()
reactor.tf_coils = build_tf_coils()
reactor.show_cad()
A Reactor interacts dynamically with ComponentManagers.
All the default methods on Reactor such as show_cad() will act
on the currently available ComponentManagers ignoring unavailable parts
of the reactor. If a Component is directly added to a Reactor
and not wrapped in a ComponentManagers it will be ignored by the Reactor methods.