Skip to content

Model

Model

Model(**kwargs)

Root runtime object for Femora model construction, assembly, and export.

Initialize a Femora Model instance.

Parameters:

Name Type Description Default
**kwargs

Keyword arguments including: - model_name (str): Name of the model - model_path (str): Path to save the model

{}

Attributes

model instance-attribute

model = None

assembled_mesh instance-attribute

assembled_mesh = None

events instance-attribute

events = ModelEventBus()

_part_registry instance-attribute

_part_registry = FemoraPartRegistry()

model_name instance-attribute

model_name = get('model_name')

model_path instance-attribute

model_path = get('model_path')

_results_folder instance-attribute

_results_folder = ''

material instance-attribute

material = MaterialManager(mesh_maker=self)

element instance-attribute

element = ElementManager(mesh_maker=self)

time_series instance-attribute

time_series = TimeSeriesManager(mesh_maker=self)

ground_motion instance-attribute

ground_motion = GroundMotionManager(mesh_maker=self, time_series_manager=time_series)

damping instance-attribute

damping = DampingManager(mesh_maker=self)

mass instance-attribute

mass = MassManager(mesh_maker=self)

region instance-attribute

region = RegionManager(mesh_maker=self)

constraint instance-attribute

constraint = ConstraintManager(mesh_maker=self)

load instance-attribute

load = LoadManager(mesh_maker=self)

meshpart instance-attribute

meshpart = MeshPartManager(mesh_maker=self)

assembler instance-attribute

assembler = Assembler(mesh_maker=self)

analysis instance-attribute

analysis = AnalysisManager(mesh_maker=self)

pattern instance-attribute

pattern = PatternManager(mesh_maker=self, time_series_manager=time_series, ground_motion_manager=ground_motion)

group instance-attribute

group = GroupManager(mesh_maker=self)

recorder instance-attribute

recorder = RecorderManager(mesh_maker=self)

interface instance-attribute

interface = InterfaceManager(mesh_maker=self)

transformation instance-attribute

transformation = TransformationManager(mesh_maker=self)

section instance-attribute

section = SectionManager(mesh_maker=self)

actions instance-attribute

actions = ActionManager(mesh_maker=self)

mask instance-attribute

mask = MaskManager(mesh_maker=self)

spatial_transform instance-attribute

spatial_transform = SpatialTransformManager()

process instance-attribute

process = ProcessManager(mesh_maker=self)

_start_nodetag instance-attribute

_start_nodetag: int = 1

_start_ele_tag instance-attribute

_start_ele_tag: int = 1

_start_core_tag instance-attribute

_start_core_tag: int = 0

Methods:

_register_model_event_subscribers

_register_model_event_subscribers() -> None

set_nodetag_start

set_nodetag_start(start_tag: int) -> None

Set the starting tag number for nodes in exported TCL.

Parameters:

Name Type Description Default
start_tag int

First node tag to use (must be >= 1)

required

set_eletag_start

set_eletag_start(start_tag: int) -> None

Set the starting tag number for elements in exported TCL.

Parameters:

Name Type Description Default
start_tag int

First element tag to use (must be >= 1)

required

set_start_core_tag

set_start_core_tag(start_tag: int) -> None

Set the starting tag number for cores in exported TCL.

Parameters:

Name Type Description Default
start_tag int

First core tag to use (must be >= 0)

required

export_to_tcl

export_to_tcl(filename=None, progress_callback=None, decimals=5)

Export the model to a TCL file

Parameters:

Name Type Description Default
filename str

The filename to export to. If None, uses model_name in model_path

None
progress_callback callable

Callback function to report progress. If None, uses tqdm progress bar.

None

Returns:

Name Type Description
bool

True if export was successful, False otherwise

Raises:

Type Description
ValueError

If no filename is provided and model_name/model_path are not set

export_to_vtk

export_to_vtk(filename=None, write_info_json=False, indent=2)

Export the model to a vtk file

Parameters:

Name Type Description Default
filename str

The filename to export to. If None, uses model_name in model_path

None
write_info_json bool

When True, also write a lightweight sidecar JSON file.

False
indent int

JSON indentation level for sidecar info.

2

Returns:

Name Type Description
bool

True if export was successful, False otherwise

export_to_json

export_to_json(filename=None, indent=2)

Export a lightweight structural snapshot of the model to JSON.

Parameters:

Name Type Description Default
filename str

The filename to export to. If None, uses model_name in model_path

None
indent int

JSON indentation level. Defaults to 2.

2

Returns:

Name Type Description
bool

True if export was successful

set_model_info

set_model_info(model_name=None, model_path=None)

Update model information

Parameters:

Name Type Description Default
model_name str

New model name

None
model_path str

New model path

None

set_results_folder

set_results_folder(folder_name)

Set the results folder for the model This method updates the results folder where simulation results will be stored.

Parameters:

Name Type Description Default
folder_name str

path to the results folder

required

get_results_folder

get_results_folder()

Get the current results folder path

Returns:

Name Type Description
str

The path to the results folder

get_femora_parts

get_femora_parts() -> list[dict]

Return a read-only snapshot of source parts registered for VTK export.

_register_femora_part

_register_femora_part(*, kind: str, name: str, source_tag: int | None = None) -> FemoraPart

_assign_femora_part_data

_assign_femora_part_data(mesh, *, kind: str, name: str, source_tag: int | None = None) -> FemoraPart

print_info

print_info()

Print information about the current model on the console

Returns:

Type Description

None

get_max_ele_tag

get_max_ele_tag()

Get the maximum element tag in the assembled mesh

Returns:

Type Description

positive int: maximum element tag

-1: if no mesh is assembled

get_max_node_tag

get_max_node_tag()

Get the maximum node tag in the assembled mesh

Returns:

Type Description

positive int: maximum node tag

-1: if no mesh is assembled

get_start_ele_tag

get_start_ele_tag()

Get the start element tag

Returns:

Name Type Description
int

start element tag

get_start_node_tag

get_start_node_tag()

Get the start node tag

Returns:

Name Type Description
int

start node tag

clear_model

clear_model()

Clear the current model and reset all components to their initial state. This method wipes the current mesh, materials, elements, constraints, and all other components, allowing you to start fresh without needing to create a new Model instance.