Component

class src.openfc.components.component.Component(name, residence_time, initial_inventory=1e-12, tritium_source=0, non_radioactive_loss=0.0001)

Represents a component in a fuel cycle system.

add_input_port(port_name, incoming_fraction=1.0)

Adds an input port to the component.

Args:

port_name (str): The name of the input port. incoming_fraction (float, optional): The fraction of incoming flow to the port. Defaults to 1.0.

Returns:

Port: The created input port object.

add_output_port(port_name, outgoing_fraction=1.0)

Adds an output port to the component.

Args:

port_name (str): The name of the output port.

Returns:

Port: The created output port object.

add_tritium(amount)

Adds tritium to the component’s inventory.

Args:

amount (float): The amount of tritium to add.

calculate_inventory_derivative()

Calculates the derivative of the tritium inventory with respect to time.

Returns:

float: The derivative of the tritium inventory.

get_inflow()

Calculates the total inflow rate to the component.

Returns:

float: The total inflow rate.

get_outflow()

Calculates the outflow rate from the component.

Returns:

float: The outflow rate.

remove_tritium(amount)

Removes tritium from the component’s inventory.

Args:

amount (float): The amount of tritium to remove.

Returns:

float: The actual amount of tritium removed.

store_flows()

Stores the inflow and outflow rates of the component.

update_inventory(new_value)

Updates the tritium inventory of the component.

Args:

new_value (float): The new value of the tritium inventory.

Breeding Blanket

class src.openfc.components.breedingBlanket.BreedingBlanket(name, residence_time, N_burn, TBR, initial_inventory=0, non_radioactive_loss=0.0001, *args, **kwargs)

Fueling System

class src.openfc.components.fuelingSystem.FuelingSystem(name, N_burn, TBE, **kwargs)
get_outflow()

Calculate the outflow rate of the fueling system.

Returns:

float: The outflow rate.

Plasma

class src.openfc.components.plasma.Plasma(name, N_burn, TBE, fp_fw, fp_div, **kwargs)
calculate_inventory_derivative()

Calculate the derivative of the plasma inventory.

Returns:

float: The derivative of the plasma inventory.

get_outflow()

Calculate the outflow rate of the plasma.

Returns:

float: The outflow rate of the plasma.

ComponentMap

class src.openfc.componentMap.ComponentMap

A class that represents a component map, which stores information about components and their connections.

Attributes:

components (dict): A dictionary that maps component names to component objects. connections (dict): A dictionary that maps component names to a dictionary of port names and their connected components and ports.

add_component(component)

Adds a component to the component map.

Args:

component (Component): The component object to be added.

connect_ports(component1, port1, component2, port2)

Connects two ports of different components.

Args:

component1 (Component): The first component. port1 (Port): The port of the first component. component2 (Component): The second component. port2 (Port): The port of the second component.

disconnect_ports(component1, port1, component2, port2)

Disconnects two ports of different components.

Args:

component1 (Component): The first component. port1 (Port): The port of the first component. component2 (Component): The second component. port2 (Port): The port of the second component.

get_connected_ports(component, port)

Returns the connected component and port for a given component and port.

Args:

component (Component): The component. port (Port): The port of the component.

Returns:

tuple: A tuple containing the connected component and port.

print_connected_map()

Prints the connected map, showing the connections between components and ports.

update_flow_rates()

Updates the flow rates of the ports based on the component’s outflow and incoming fraction.

Port

class src.openfc.port.Port(name, incoming_fraction=1.0, outgoing_fraction=1.0)
set_flow_rate(flow_rate)

Set the flow rate of the port.

Parameters: - flow_rate (float): The flow rate to be set.

Simulate

class src.openfc.simulate.Simulate(dt, final_time, I_reserve, component_map, dt_max=100, max_simulations=100, TBRr_accuraty=0.001, target_doubling_time=2)
adaptive_timestep(y_new, y, t, tol=1e-06, min_dt=1e-06)

Perform adaptive time stepping.

compute_doubling_time(t, y)

Compute the doubling time of the tritium inventory in the Fueling System component.

Args: - t: Array of time values. - y: Array of component inventory values.

Returns: - doubling_time: The doubling time of the tritium inventory.

f(y)

Calculate the derivative of component inventory.

Args: - y: Array of component inventory values.

Returns: - dydt: Array of derivative values.

forward_euler()

Perform the forward Euler integration method.

Returns: - time: Array of time values. - y: Array of component inventory values.

restart()

Restart the simulation by resetting time and component inventory.

run(tolerance=0.001)

Run the simulation.

Returns: - t: Array of time values. - y: Array of component inventory values.

update_I_startup(margin)

Update the initial tritium inventory of the Fueling System component.

update_timestep(dt)

Update the time step size.

Args: - dt: New time step size.

Tools

src.openfc.tools.utils.visualize_connections(component_map)

Visualizes the connections between components in a component map.

Parameters: - component_map (ComponentMap): The component map containing the components and connections.

Returns: - None