Code Documentation

ADA

The main library.

class ada.api.spatial.Assembly(name='Ada', project='AdaProject', user: User = User(user_id='AdaUser', given_name=None, family_name=None, middle_names=None, prefix_titles=None, suffix_titles=None, org_id='ADA', org_name='Assembly For Design and Analysis', org_description=None, role='Engineer'), schema='IFC4X3_add2', metadata=None, units: Units | str = Units.M, enable_cache: bool = False, clear_cache: bool = False, cache_dir: str | Path = None, ifc_class: SpatialTypes = SpatialTypes.IfcSite)

The Assembly object. A top level container of parts, beams, plates, shapes and FEM.

push(comment, bimserver_url, username, password, project, merge=False, sync=False)

Push current assembly to BimServer with a comment tag that defines the revision name

read_fem(fem_file: str | os.PathLike, fem_format: FEATypes | str = None, name: str = None, fem_converter: FemConverters | str = 'default', cache_model_now=False)

Import a Finite Element model. Currently supported FEM formats: Abaqus, Sesam and Calculix

read_ifc(ifc_file: str | os.PathLike | ifcopenshell.file, data_only=False, elements2part=None, create_cache=False)

Import from IFC file.

to_fem(name: str, fem_format: FEATypes | str, scratch_dir=None, metadata=None, execute=False, run_ext=False, mesh_only=False, cpus=1, gpus=None, overwrite=False, fem_converter='default', exit_on_complete=True, run_in_shell=False, make_zip_file=False, return_fea_results=True, model_data_only=False) FEAResult | None

Create a FEM input file deck for executing fem analysis in a specified FEM format. Currently there is limited write support for the following FEM formats:

Open Source

  • Calculix

  • Code_Aster

not open source

  • Abaqus

  • Usfos

  • Sesam

Write support is added on a need-only-basis. Any contributions are welcomed!

Parameters:
  • name – Name of FEM analysis input deck

  • fem_format – Desired fem format

  • scratch_dir – Output directory for analysis input deck

  • metadata – Parse additional commands to FEM solver not supported by the generalized classes

  • execute – Execute analysis on complete

  • run_ext – Run analysis externally or wait for complete

  • cpus – Number of cpus for running the analysis

  • gpus – Number of gpus for running the analysis (wherever relevant)

  • overwrite – Overwrite existing input file deck

  • fem_converter – Set desired fem converter. Use either ‘default’ or ‘meshio’.

  • exit_on_complete

  • run_in_shell

  • make_zip_file

  • return_fea_results

    Automatically import the result mesh into

    Note! Meshio implementation currently only supports reading & writing elements and nodes.

Abaqus Metadata:

‘ecc_to_mpc’: Runs the method convert_ecc_to_mpc() . Default is True ‘hinges_to_coupling’: Runs the method convert_hinges_2_couplings() . Default is True

Important Note! The ecc_to_mpc and hinges_to_coupling will make permanent modifications to the model. If this proves to create issues regarding performance this should be evaluated further.

class ada.api.spatial.Part(name, color=None, placement=None, fem: FEM = None, metadata=None, parent=None, units: Units = Units.M, guid=None, ifc_store: IfcStore = None, ifc_class: SpatialTypes = SpatialTypes.IfcBuildingStorey)

A Part superclass design to host all relevant information for cad and FEM modelling.

IFC_CLASSES

alias of SpatialTypes

add_joint(joint: JointBase) JointBase

This method takes a Joint element containing two intersecting beams. It will check with the existing list of joints to see whether or not it is part of a larger more complex joint. It usese primarily two criteria.

Criteria 1: If both elements are in an existing joint already, it will u

Criteria 2: If the intersecting point coincides within a specified tolerance (currently 10mm) with an exisiting joint intersecting point. If so it will add the elements to this joint. If not it will create a new joint based on these two members.

beam_clash_check(margins=5e-05)

For all beams in a Assembly get all beams touching or within the beam. Essentially a clash check is performed and it returns a dictionary of all beam ids and the touching beams. A margin to the beam volume can be included.

Parameters:

margins – Add margins to the volume box (equal in all directions). Input is in meters. Can be negative.

Returns:

A map generator for the list of beams and resulting intersecting beams

consolidate_sections(include_self=True)

Moves all sections from all sub-parts to this part

create_objects_from_fem(skip_plates=False, skip_beams=False) None

Build Beams and Plates from the contents of the local FEM object

get_by_name(name) Part | Plate | Beam | Shape | Material | Pipe | None

Get element of any type by its name.

read_step_file(step_path, name=None, scale=None, transform=None, rotate=None, colour=None, opacity=1.0, source_units=Units.M, include_shells=False)
Parameters:
  • step_path – Can be path to stp file or path to directory of step files.

  • name – Desired name of destination Shape object

  • scale – Scale the step content upon import

  • transform – Transform the step content upon import

  • rotate – Rotate step content upon import

  • colour – Assign a specific colour upon import

  • opacity – Assign Opacity upon import

  • source_units – Unit of the imported STEP file. Default is ‘m’

class ada.api.primitives.PrimBox(name, p1, p2, **kwargs)

Primitive Box. Length, width & height are local x, y and z respectively

class ada.api.primitives.PrimCone(name, p1, p2, r, **kwargs)
class ada.api.primitives.PrimCyl(name, p1, p2, r, **kwargs)
class ada.api.primitives.PrimExtrude(name, curve: list[tuple], h, normal=None, origin=None, xdir=None, tol=0.001, **kwargs)
class ada.api.primitives.PrimRevolve(name, points, rev_angle, origin=None, xdir=None, normal=None, tol=0.001, **kwargs)

Revolved Primitive

class ada.api.primitives.PrimSphere(name, cog, radius, **kwargs)
class ada.api.primitives.PrimSweep(name, sweep_curve, profile_curve_outer, profile_zdir=None, profile_xdir=None, origin=None, tol=0.001, **kwargs)
class ada.api.primitives.Shape(name, geom: Geometry | list[Geometry] | None = None, color=None, opacity=1.0, mass: float = None, cog: Iterable = None, material: Material | str = None, units=Units.M, metadata=None, guid=None, placement=Placement(origin=Point([0., 0., 0.]), xdir=Point([1., 0., 0.]), ydir=Point([0., 1., 0.]), zdir=Point([0., 0., 1.]), scale=1.0), ifc_store: IfcStore = None, ifc_class: ShapeTypes = ShapeTypes.IfcBuildingElementProxy, parent=None)
IFC_CLASSES

alias of ShapeTypes

class ada.api.beams.Beam(name, n1: Node | Iterable, n2: Node | Iterable, sec: str | Section, mat: str | Material = None, up=None, angle=0.0, e1=None, e2=None, units=Units.M, **kwargs)

The base Beam object

Parameters:
  • n1 – Start position of beam. List or Node object

  • n2 – End position of beam. List or Node object

  • sec – Section definition. Str or Section Object

  • mat – Material. Str or Material object. String: [‘S355’ & ‘S420’] (default is ‘S355’ if None is parsed)

  • name – Name of beam

add_beam_to_node_refs() None

Add beam to refs on nodes

static array_from_list_of_coords(list_of_coords: list[tuple], sec: Section | str, mat: Material | str = None, name_gen: Iterable = None, make_closed=False) list[Beam]

Create an array of beams from a list of coordinates

bbox() BoundingBox

Bounding Box of beam

get_node_on_beam_by_fraction(fraction: float) Node

Returns node as a fraction of the beam length from n1-node.

get_node_on_beam_by_point(point: ndarray) Node

Returns node on beam from point

property length: float

Returns the length of the beam

property ori

Get the x-vector, y-vector and z-vector of a given beam

remove_beam_from_node_refs() None

Remove beam from refs on nodes

property xvec: Direction

Local X-vector

property xvec_e: Direction

Local X-vector (including eccentricities)

property yvec: Direction

Local Y-vector

class ada.api.beams.BeamRevolve(name: str, curve: CurveRevolve, sec: str | Section, **kwargs)
class ada.api.beams.BeamSweep(name: str, curve: CurveOpen2d, sec: str | Section, **kwargs)
class ada.api.beams.BeamTapered(name, n1: Iterable, n2: Iterable, sec: str | Section, tap: str | Section = None, taper_type: TaperTypes | str = TaperTypes.CENTERED, **kwargs)
class ada.api.plates.Plate(name: str, points: CurvePoly2d | list[tuple[_NTYPE, _NTYPE]], t: float, mat: str | Material = 'S420', origin: Iterable | Point = None, xdir: Iterable | Direction = None, n: Iterable | Direction = None, orientation: Placement = None, pl_id=None, tol=None, **kwargs)

A plate object. The plate element covers all plate elements.

Contains a dictionary with each point of the plate described by an id (index) and a Node object.

Parameters:
  • name – Name of plate

  • points – List of 2D point coordinates (or a PolyCurve) that make up the plate. Each point is (x, y, optional [radius])

  • t – Thickness of plate

  • mat – Material. Can be either Material object or built-in materials (‘S420’ or ‘S355’)

  • origin – Explicitly define origin of plate. If not set

  • xdir – Explicitly define x direction of plate. If not set

  • n – Explicitly define normal direction of plate. If not set

bbox() BoundingBox

Bounding Box of plate

property n: ndarray

Normal vector

property t: float

Plate thickness

class ada.api.plates.PlateCurved(name, face_geom: Geometry, t: float, mat: str | Material = 'S420', **kwargs)
class ada.api.containers.Beams(beams: Iterable[Beam] = None, parent=None)

A collections of Beam objects

from_guid(guid: str) Beam

Get beam from its guid

from_name(name: str) Beam

Get beam from its name

get_beams_within_volume(vol_, margins) Iterable[Beam]
Parameters:
  • vol – List or tuple of tuples [(xmin, xmax), (ymin, ymax), (zmin, zmax)]

  • margins – Add margins to the volume box (equal in all directions). Input is in meters. Can be negative.

Returns:

List of beam ids

merge_beams(beam_segments: Iterable[Beam]) Beam

Merge all beam segments into the first entry in beam_segments by changing the beam nodes.

class ada.api.containers.Connections(connections: Iterable[JointBase] = None, parent=None)
find(out_of_plane_tol=0.1, joint_func=None, point_tol=0.0001)

Find all connections between beams in all parts using a simple clash check.

Parameters:
  • out_of_plane_tol

  • joint_func – Pass a function for mapping the generic Connection classes to a specific reinforced Joints

  • point_tol

class ada.api.containers.Materials(materials: Iterable[Material] = None, parent: Part | Assembly = None, units=Units.M)

Collection of materials

class ada.api.containers.Plates(plates: Iterable[Plate] = None, parent: Part = None)

Plate object collection

class ada.api.containers.Sections(sections: Iterable[Section] = None, parent: Part | Assembly = None, units=Units.M)
class ada.base.physical_objects.BackendGeom(name, guid=None, metadata=None, units=Units.M, parent=None, color: Color | Iterable[float, float, float] | str | None = None, placement=None, ifc_store: IfcStore = None, opacity=1.0)

The backend of all physical components (Beam, Plate, etc.) or aggregate of components (Part, Assembly)

IFC utilities

IFC4X1

Blender wrapper and utilities

Blender

class ada.core.blender.Blender(work_dir, project_name, exe_path=None)

A class wrapping around Blender

Assuming you have added blender exe dir to system path, this will automatically pick it up. Otherwise, pass it as a variable

Parameters:
  • work_dir

  • project_name

  • exe_path

run(script_path=None, run_silent=True)

Start Blender in the currently defined project_path

Bimserver utilities

BimServer

class ada.core.bimserver.BimServerApi(hostname, username=None, password=None)

A minimal BIMserver.org API client. Interfaces are obtained from the server and can be retrieved as attributes from an API instance. The interfaces expose their methods as functions with keyword arguments.

Example: import bimserver client = bimserver.api(server_address, username, password) client.Bimsie1ServiceInterface.addProject(projectName=”My new project”)

class ada.core.bimserver.BimServerConnect(bimserver_url, username, password, assembly, allow_create_project=True)

BimServerConnect extends the bimserver json api and allows for simple pull/push operations on the server.

ServiceInterface

https://github.com/opensourceBIM/BIMserver/blob/8bc7413132ed934d13d4759ad5aadc1e9692f78b/PluginBase/src/org/bimserver/shared/interfaces/ServiceInterface.java

Parameters:
  • bimserver_url

  • username – Valid username

  • password – Password

  • assembly (ada.Assembly)

  • allow_create_project – Allow creation of projects

pull(project_name, checkout)
Parameters:
  • project_name

  • checkout

Returns:

push(project_name, comment, merge=False, sync=False)

Push to BimServer

Parameters:
  • project_name

  • comment – Commit message

  • merge

  • sync

ada.core.bimserver.bs_get_project(project_name, bimserver_url, username, password, allow_create_project=True, schema='ifc4')

For manual interaction with bimserver

Parameters:
  • project_name

  • bimserver_url

  • username

  • password

  • allow_create_project

  • schema

Returns:

ada.core.bimserver.bs_push(ifc_file, bimserver_url, username, password, project_name, comment, merge=False, sync=False, allow_create_project=True, schema='ifc4')

For manual interaction with bimserver

Parameters:
  • ifc_file

  • bimserver_url

  • username

  • password

  • project_name

  • comment

  • merge

  • sync

  • allow_create_project

  • schema

Returns:

ada.core.bimserver.download_extract_zip(url)

Download a ZIP file and extract its contents in memory yields (filename, file-like object) pairs

code from: https://techoverflow.net/2018/01/16/downloading-reading-a-zip-file-in-memory-using-python/

Other

ada.core.utils.closest_val_in_dict(val: int | float, dct: Dict[int | float, Any]) Any

When mapping using a dictionary and value do not match with the keys in the dictionary. :param val: Value a number, usually float :param dct: Dictionary with number keys (int o float) :return: Dictionary-value corresponding to the keys nearest the input value

ada.core.utils.download_to(destination, url, file_override_ok=False)
Parameters:
  • destination – Destination file path

  • url – Url of file subject for download

  • file_override_ok – Download and write over existing file

ada.core.utils.get_current_user()

Return the username of currently logged in user

ada.core.utils.make_name_fem_ready(value, no_dot=False)

Based on typically allowed names in FEM, this function will try to rename objects to comply without significant changes to the original name

Parameters:
  • value

  • no_dot

Returns:

Fixed name

ada.core.utils.replace_nodes_by_tol(nodes, decimals=0, tol=0.0001)
Parameters:
  • nodes (ada.core.containers.Nodes)

  • decimals

  • tol

ada.core.utils.roundoff(x: float, precision=6) float

Round using a specific number precision using the Decimal package

ada.core.utils.set_list_first_position_elem(array: list, element) list

Moves the element to the first position in the list and maintains order. Returns a new list.

ada.core.utils.thread_this(list_in, function, cpus=4)

Make a function (which only takes in a list) to run on multiple processors

Parameters:
  • list_in

  • function

  • cpus

Returns:

ada.core.utils.traverse_hdf_datasets(hdf_file)

Traverse all datasets across all groups in HDF5 file.

ada.core.utils.zip_dir(directory, zip_path, incl_only=None)
Parameters:
  • directory – Directory path subject for zipping

  • zip_path – Destination path of zip file

  • incl_only – (optional) List of suffixes that all files should have in order to be included in the zip file

Returns:

FEM (Finite Element Method)

A shared class structure for describing finite element models and analysis

Main

class ada.fem.Amplitude(name: str, x: list[float], y: list[float], smooth=None, metadata=None, parent: FEM = None)
class ada.fem.Bc(name, fem_set: FemSet, dofs, magnitudes=None, bc_type='displacement', amplitude: Amplitude = None, init_condition=None, metadata=None, parent=None)
class ada.fem.Connector(name, el_id, n1: Node, n2: Node, con_type, con_sec: ConnectorSection, preload=None, csys: Csys = None, metadata=None, parent: FEM = None)
class ada.fem.ConnectorSection(name, elastic_comp: _T_E = None, damping_comp: _T_D = None, plastic_comp: _T_P = None, rigid_dofs: _T_R = None, metadata=None, parent=None)

A connector section.

All *_comp properties can be one of the following

  • scalar stiffness value <float | int> (assumed linear stiffness in all degrees of freedom)

  • Tabular stiffness values <list[list[list[scalar numeric, scalar numeric]]]> where the structure is as follows

    list[ # Tabular data for stiffness in all Degrees of Freedom
    list[ # Tabular data for stiffness in Degree of Freedom i]

    list[numeric scalar, numeric scalar] # Tabular scalars [Force, Displacement] ]

    ]

class ada.fem.Constraint(name, con_type, m_set: FemSet | Surface, s_set: FemSet | Surface, dofs=None, pos_tol=None, mpc_type=None, csys: Csys = None, parent=None, metadata=None, influence_distance: float = None)
class ada.fem.Csys(name, definition='COORDINATES', system='RECTANGULAR', nodes: list[Node] = None, coords=None, metadata=None, parent: FEM = None)
property coords

Coordinates: (x, y, origin[optional]). y can be anywhere in the x-y plane

class ada.fem.Elem(el_id, nodes: list[Node], el_type: str | ShellShapes | LineShapes | SolidShapes, elset=None, fem_sec: FemSection = None, mass_props=None, parent: FEM = None, el_formulation_override=None, metadata=None)
updating_nodes(old_node: Node, new_node: Node) None

Exchanging old node with new node, and updating the element shape

class ada.fem.FEM(name: 'str', metadata: 'Dict' = <factory>, parent: 'Part' = None, nodes: 'Nodes' = <factory>, ref_points: 'Nodes' = <factory>, ref_sets: 'FemSets' = <factory>, elements: 'FemElements' = <factory>, sets: 'FemSets' = <factory>, sections: 'FemSections' = <factory>, initial_state: 'PredefinedField' = None, subroutine: 'str' = None)
add_interface_nodes(interface_nodes: List[Node | InterfaceNode])

Nodes used for interfacing between other parts. Pass a custom Constraint if specific coupling is needed

add_rp(name: str, node: Node)

Adds a reference point in assembly with a specific name

add_set(fem_set: FemSet, p=None, vol_box=None, vol_cyl=None, single_member=False, tol=0.0001) FemSet
Parameters:
  • fem_set – A fem set object

  • p – Single point (x,y,z)

  • vol_box – Search by a box volume. Where p is (xmin, ymin, zmin) and vol_box is (xmax, ymax, zmax)

  • vol_cyl – Search by cylindrical volume. Used together with p to find nodes within cylinder inputted by [radius, height, thickness]

  • single_member – Set True if you wish to keep only a single member

  • tol – Point Tolerances. Default is 1e-4

add_step(step: _step_types) _step_types

Add an analysis step to the assembly

create_fem_elem_from_obj(obj, el_type=None) Elem

Converts structural object to FEM elements. Currently only BEAM is supported

get_all_bcs() Iterable[Bc]

Get all the boundary conditions in the entire assembly

get_all_masses() Iterable[Mass]

Get all the Masses in the entire assembly

class ada.fem.FemSection(name, sec_type: GeomRepr | str, elset: FemSet, material: Material, section=None, local_z=None, local_y=None, thickness=None, int_points=5, metadata=None, parent=None, refs=None, sec_id=None, is_rigid=False)
property local_y: ndarray

Local y describes the cross vector of the beams X and Z axis

property local_z: ndarray

Local Z describes the up vector of the cross section

class ada.fem.FemSet(name, members: None | list[Elem | Node], set_type: Literal['nset', 'elset'] = None, metadata=None, parent=None)
Parameters:
  • name – Name of Set

  • members – Set Members

  • set_type – Type of set (either ‘nset’ or ‘elset’)

  • metadata – Metadata for object

  • parent – Parent object

class ada.fem.FieldOutput(name, nodal=None, element=None, contact=None, int_value=1, int_type='frequency', metadata=None, parent: Step = None)
Parameters:
  • name

  • nodal

  • element

  • contact

  • int_value – Field output step interval. Default is 1

  • int_type

  • metadata

  • parent

class ada.fem.HistOutput(name: str, fem_set: FemSet | None | list[Surface], set_type: str, variables: list[str], int_value=1, int_type='frequency', metadata=None, parent=None)
Parameters:
  • name – Unique History Output Name

  • fem_set – Set name associated for history output

  • set_type

  • variables

  • int_type – Interval type

class ada.fem.Interaction(name, contact_type, surf1: Surface | None, surf2: Surface | None, int_prop: InteractionProperty, constraint: Constraint = None, surface_type='SURFACE TO SURFACE', parent=None, metadata=None)

A class representing the physical properties of interaction between solid bodies.

property parent
Return type:

ada.FEM

class ada.fem.InteractionProperty(name, friction=None, pressure_overclosure='HARD', tabular=None, metadata=None, parent=None)
class ada.fem.Load(name: str, load_type: str, magnitude: float, fem_set: FemSet = None, dof: int | List[int] = None, amplitude: Amplitude = None, follower_force=False, acc_vector=None, accr_origin=None, accr_rot_axis=None, csys: Csys = None, metadata=None, parent: Step = None)
Parameters:
  • load_type – Type of loads. See Load.TYPES for allowable load types.

  • magnitude – Magnitude of load

  • name – (Required in the event of a point load being applied)

  • fem_set – Set reference (Required in the event of a point load being applied)

  • dof – Degrees of freedom (Required in the event of a point load being applied)

  • follower_force – Should follower force be accounted for

  • amplitude – Attach an amplitude object to the load

  • accr_origin – Origin of a rotational Acceleration field (necessary for load_type=’acc_rot’).

class ada.fem.LoadCase(name, comment, loads=None, mass=None, lcsys=None, metadata=None, parent=None)
class ada.fem.LoadGravity(name, acceleration=-9.81)
class ada.fem.LoadPoint(name, magnitude, fem_set, dof, amplitude=None, follower_force=True, csys=None)
class ada.fem.LoadPressure(name: str, magnitude: float, surface: Surface, distribution='uniform')
class ada.fem.Mass(name, ref: FemSet | list[Node] | None, mass, mass_type=None, ptype=None, mass_id: int = None, units=None, metadata=None, parent=None)
class ada.fem.PredefinedField(name, field_type, fem_set: FemSet = None, dofs=None, magnitude=None, initial_state_file=None, initial_state_part=None, metadata=None, parent=None)
class ada.fem.Spring(name, el_id, el_type, stiff, fem_set: FemSet, metadata=None, parent=None)
class ada.fem.StepEigen(name, num_eigen_modes: int, field_el_outputs=None, **kwargs)
property num_eigen_modes

Number of requested Eigen modes

class ada.fem.StepExplicit(name, **kwargs)
class ada.fem.StepImplicitDynamic(name, dyn_type='QUASI-STATIC', nl_geom=False, total_time=100.0, total_incr=1000, init_incr=100.0, min_incr=1e-08, max_incr=100.0, **kwargs)
class ada.fem.StepImplicitStatic(name, implicit_type='static', nl_geom=False, total_time=100.0, total_incr=1000, init_incr=100.0, min_incr=1e-08, max_incr=100.0, **kwargs)
class ada.fem.StepSteadyState(name, unit_load: Load, fmin, fmax, alpha=0.1, beta=10, **kwargs)
Parameters:
  • alpha – Rayleigh Damping

  • beta – Rayleigh Damping

  • unit_load – Unit Load

  • fmin – Minimum frequency

  • fmax – Maximum frequency

class ada.fem.Surface(name, surf_type, fem_set: FemSet | List[FemSet], weight_factor=None, el_face_index: int | List[int] = None, id_refs=None, parent: FEM = None, metadata=None)

Documentation

Parameters.

Parameters:
  • name – Unique name of surface

  • surf_type – Type of surface

  • fem_set

  • weight_factor

  • id_refs – Explicitly defined by list of tuple [(elid/nid,spos), ..]

  • parent

  • metadata

FEM Containers

class ada.fem.containers.COG(p: 'np.array', tot_mass: 'float' = None, tot_vol: 'float' = None, sh_mass: 'float' = None, bm_mass: 'float' = None, no_mass: 'float' = None)
property x: float

Returns x-coordinate to the point p

property y: float

Returns y-coordinate to the point p

property z: float

Returns z-coordinate to the point p

class ada.fem.containers.FemElements(elements: Iterable[Elem | Mass | Connector] = None, fem_obj: FEM = None, from_np_array=None)

Container class for FEM elements

build_sets()

Create sets from attached elset attribute on elements

calc_cog() COG

Calculate COG of your FEM model based on element mass distributed to element and nodes

connector_by_name(name: str)

Get Connector by name

filter_elements(keep_elem=None, delete_elem=None)

Filter which element types you wish to keep using the “keep_elem” list of elem_types or which elements you wish to delete using the ‘delete_elem’ option.

Parameters:
  • keep_elem

  • delete_elem

Link element nodes with the parent fem node collection

remove(elems: Elem | List[Elem])

Remove elem or list of elements from container

remove_elements_by_id(ids: int | List[int])

Remove elements from element ids. Will remove elements on completion

remove_elements_by_set(elset: FemSet)

Remove elements from element set. Will remove element set on completion

renumber(start_id=1, renumber_map: dict = None)

Ensures that the node numberings starts at 1 and has no holes in its numbering.

Utils

ada.fem.utils.elset_to_part(name: str, elset: FemSet) Part

Create a new part based on a specific element set.

ada.fem.utils.get_beam_end_nodes(bm: Beam, end=1, tol=0.001) list[Node]

Get list of nodes from end of beam

ada.fem.utils.get_eldata(fem_source: Assembly | Part | FEM)

Return a dictionary of basic mesh statistics

ada.fem.utils.get_nodes_along_plate_edges(pl: Plate, fem: FEM, edge_indices=None, tol=0.001) list[Node]

Return FEM nodes from edges of a plate

IO

All code related to interoperability for Finite Element Method (FEM)

Code Aster

Code Aster is an Open Source FEM solver

ada.fem.formats.code_aster.run_code_aster(inp_path, cpus=2, gpus=None, run_ext=False, metadata=None, execute=True, return_bat_str=False, exit_on_complete=True, run_in_shell=False)
Parameters:
  • inp_path – Path to input file folder(s)

  • cpus – Number of CPUs to run the analysis on. Default is 2.

  • gpus – Number of GPUs to run the analysis on. Default is none.

  • run_ext – If False the process will wait for the abaqus analysis to finish. Default is False

  • metadata – Dictionary containing various metadata relevant for the analysis

  • execute – Automatically starts Abaqus analysis. Default is True

  • return_bat_str

  • exit_on_complete

  • run_in_shell

ada.fem.formats.code_aster.to_fem(assembly: Assembly, name, analysis_dir, metadata=None, model_data_only=False)

Write Code_Aster .med and .comm file from Assembly data

GMSH

GMSH is a three-dimensional finite element mesh generator with built-in pre- and post-processing facilities

class ada.fem.meshing.GmshData(entities: 'list[tuple]', geom_repr: 'str | GeomRepr', order: 'int', obj: 'Shape | Beam | Plate | Pipe', mesh_size: 'float' = None)
class ada.fem.meshing.GmshOptions(Mesh_Algorithm: 'int' = 6, Mesh_ElementOrder: 'int' = 1, Mesh_Algorithm3D: 'int' = 1, Mesh_MeshSizeMin: 'float' = None, Mesh_MeshSizeMax: 'float' = 0.1, Mesh_SecondOrderIncomplete: 'int' = 1, Mesh_Smoothing: 'int' = 3, Mesh_RecombinationAlgorithm: 'int' = None, Mesh_SubdivisionAlgorithm: 'int' = None, Mesh_MeshSizeFromCurvature: 'bool' = False, Mesh_MinimumElementsPerTwoPi: 'int' = 12, Geometry_Tolerance: 'float' = 1e-05, Geometry_OCCImportLabels: 'int' = 1, Geometry_OCCMakeSolids: 'int' = None, General_ColorScheme: 'int' = 3, General_Orthographic: 'int' = 0, General_Terminal: 'int' = 1)
class ada.fem.meshing.GmshTask(ada_obj: 'List[Union[Shape, Beam, Plate]]', geom_repr: 'str', mesh_size: 'float', options: 'GmshOptions' = <factory>)

Abaqus

Abaqus is a Proprietary Finite Element suite (pre/post processor and solver)

ada.fem.formats.abaqus.read_fem(fem_file, fem_name=None) Assembly

This will create and add an AbaqusPart object based on a path reference to a Abaqus input file.

ada.fem.formats.abaqus.to_fem(assembly: Assembly, name, analysis_dir=None, metadata=None, writable_obj: StringIO = None, model_data_only=False)

Build the Abaqus Analysis input deck

Calculix

Calculix is an Open Source (GNU General Public License V2 or later) FEM solver

ada.fem.formats.calculix.to_fem(assembly: Assembly, name, analysis_dir, metadata=None, model_data_only=False)

Write a Calculix input file stack

Sesam

Sesam By DnvGL is a proprietary finite element suite (pre/post processor and solver)

ada.fem.formats.sesam.read_fem(fem_file: PathLike, fem_name: str = None)

Import contents from a Sesam fem file into an assembly object

Usfos

USFOS is a proprietary finite element solver

Utilities

A collection of python utilities and different Python Wrappers for Various FEM software (Abaqus, Femap, GMSH).

class ada.fem.formats.utils.LocalExecute(inp_path, cpus=2, gpus=None, run_ext=False, metadata=None, auto_execute=True, excute_locally=True, run_in_shell=False)

Backend Component for executing local analysis

ada.fem.formats.utils.get_fem_model_from_assembly(assembly: Assembly) Part

Scans the assembly tree for parts containing FEM elements. If multiple FEM objects are not empty, they will be merged

ada.fem.formats.utils.get_ff_regex(flag, *args)

Compile a regex search string for Fortran formatted string input.

Parameters:
  • flag – Name of keyword flag (ie. the first word on a line of input parameters)

  • args – Group name for each parameter. Include the character | to signify the parameters is optional.

Returns:

Returns a compiled regex search string.. re.compile(..)

ada.fem.formats.utils.line_elem_to_beam(elem: Elem, parent: Part, prefix='bm') Beam

Convert FEM line element to Beam

Materials

A collection of different utilities for material properties. Future use-case would be that this library contains a library of structural material properties that have been properly defined and accepted by all locations.

Metals

class ada.materials.metals.CarbonSteel(grade='S355', plasticity_model: PlasticityModel = None, E=210000000000.0, rho=7850, v=0.3, zeta=1.15, alpha=1.2e-05, sig_y=None, sig_u=None, temp_range=None, units='m', parent=None)
property cp

Specific Heat. Joule per kelvin and kilogram J/(K kg)

property grade

Material Grade

property kappa

Thermal conductivity. Watts per meter-kelvin W/(mK)

class ada.materials.metals.DnvGl16Mat(t, grade, mat_def='Low', eps_max=0.3, data_points=200)

This function returns a carbon steel Material object based on the formulas in DNVGL RP C208 (september 2016)

Parameters:
  • t – Thickness of the material

  • grade – Material Grade ‘S355’ or ‘S420’

  • mat_def – Material Definition

  • eps_max – Maximum epsilon

  • data_points – Number of datapoints

Returns:

tuple of (eps_p, sig_p)

class ada.materials.metals.Metal(E, rho, sig_y, sig_u, v, zeta, alpha, plasticitymodel=PlasticityModel(sig_p=None, eps_p=None), units='m', parent=None)

Base object for all metals

property E

Young’s Modulus

property G

Shear Modulus

property alpha: float

Thermal Expansion coefficient

property plasticity_model: PlasticityModel

Constitutive Equation for plasticity

property rho: float

Density

property sig_u

Ultimate yield stress

property sig_y

Yield stress

property v: float

Poisson Ratio

property zeta: float

Material damping coefficient

class ada.materials.metals.PlasticityModel(sig_p: 'List[float]' = None, eps_p: 'List[float]' = None)

Polymers

class ada.materials.polymers.models.Calibrate(mat_data, num_int=300, load_types=None, interpolate=True, incompressible=True)
Parameters:
  • mat_data (matdb.classes.MatDataSheet) – Material data sheet object

  • interpolate – All test dataset arrays are interpolated to have equal length.

  • num_int – Total number of points employed in the linear interpolation of test strain and stress data.

  • load_types – Manually override which test result you wish to calibrate for. Default is None which means it will be checked for all available test data [‘uniaxial’, ‘biaxial’, ‘planar’]

  • incompressible – Does nothing (for now)

property aba_str
Returns:

Abaqus input str

property bia_eps

Interpolated array of biaxial strain test data

property biaxial
Returns:

Return type:

matdb.classes.TestData

property mat_data
Returns:

Return type:

matdb.classes.MatDataSheet

property pla_eps

Interpolated array of planar strain test data

property planar
Returns:

Return type:

matdb.classes.TestData

plot(model, params, eng_plot=True)
Parameters:
  • model

  • params

  • eng_plot – Plot using engineering stress and strain.

Returns:

run(model, initial_guess, method='leastsq')

Run calibration for a specific model.

requires the “lmfit” package.

conda install -c conda-forge lmfit

Parameters:
  • model – Define which polymer model to calibrate for

  • initial_guess

  • method

Returns:

property uni_eps

Interpolated or original array of uniaxial strain test data

property uniaxial
Returns:

Return type:

matdb.classes.TestData

ada.materials.polymers.models.NH_3D(stretch, param)

Neo-Hookean. 3D loading specified by stretches.

param[0]=mu, param[1]=kappa

Parameters:
  • stretch

  • param

Returns:

ada.materials.polymers.models.Yeoh_3D(stretch, param)

Yeoh. 3D loading specified by stretches. param: [C10, C20, C30, kappa]. Returns true stress.

ada.materials.polymers.models.biaxial_stress(model, trueStrainVec, params)

Compressible biaxial loading. Returns true stress.

ada.materials.polymers.models.neo_hookean(strain, mu, load_type='uniaxial')

Neo-Hookean incompressible uniaxial

Parameters:
  • strain

  • mu – Shear modulus

  • load_type – Type of loading

Returns:

ada.materials.polymers.models.planar_stress(model, trueStrainVec, params)

Compressible planar loading. Returns true stress.

ada.materials.polymers.models.uniaxial_stress(model, true_strain, params)

Compressible uniaxial loading. Returns true stress.

ada.materials.polymers.models.yeoh(strain, c10, c20, c30, load_type='uniaxial')

Yeoh incompressible

ada.materials.polymers.utils.E_from_mu_kappa(mu, kappa)

Young’s Modulus from known shear and bulk modulus’

Parameters:
  • mu – Shear Modulus

  • kappa – Bulk Modulus

Returns:

ada.materials.polymers.utils.S_from_sig(e, sig)

Convert true stress to engineering stress

Parameters:
  • e – engineering strain

  • sig – true stress

Returns:

engineering stress

ada.materials.polymers.utils.coeff_det(e, p)

Coefficient of Determination The Coefficient of Determination (R2) is defined by:

R2=1−∑i(ei–pi)2(ei–em)2

where

ei is an experimental stress value (or strain value if stress control) pi is a predicted stress value (or strain value if stress control) em is the mean of the experimental values

Returns:

ada.materials.polymers.utils.e_from_eps(eps)

Convert true strain to engineering strain

Parameters:

eps – true strain

Returns:

engineering strain

ada.materials.polymers.utils.msd(e, p)

Mean Square Difference (MSD) The Mean Square Difference (MSD) is defined by:

MSD=1n∑i=1n(ei–pi)2

where:

ei is an experimental stress value (or strain value if stress control) pi is a predicted stress value (of strain value if stress control) n is the total number of points

Returns:

ada.materials.polymers.utils.nmad(e, p)

Normalized Mean Absolute Difference (NMAD)

The Normalized Mean Absolute Difference (NMAD) fitness value represents the average error in percent between the experimental data and the model predictions. The NMAD value is defined by:

NMAD = 100*(|e-p|)max(|e|,|p|)

Parameters:
  • e – Is the vector of experimental stress values (or if strain control, the vector of experimental strain values)

  • p – Is the vector of predicted stress values

Returns:

Sections

class ada.sections.GeneralProperties(parent: 'Section' = None, Ax: 'float' = None, Ix: 'float' = None, Iy: 'float' = None, Iz: 'float' = None, Iyz: 'float' = None, Wxmin: 'float' = None, Wymin: 'float' = None, Wzmin: 'float' = None, Shary: 'float' = None, Sharz: 'float' = None, Shceny: 'float' = None, Shcenz: 'float' = None, Sy: 'float' = None, Sz: 'float' = None, Sfy: 'float' = 1, Sfz: 'float' = 1, Cy: 'float' = None, Cz: 'float' = None)
calc_parent_properties() GeneralProperties

Returns calculated properties based on parent section

property modified: bool

Returns true if attributes are not equal to the calculated properties of the parent section

exception ada.sections.utils.UnableToConvertSectionError
ada.sections.utils.interpret_section_str(in_str: str, s=0.001, units=Units.M) tuple[Section, Section]
Parameters:
  • in_str

  • s – Scale factor

  • units – The desired units after applied scale factor

Returns:

Two section (to account for potential beam tapering)

ada.sections.utils.profile_db_collect(sec_type: str, dim: str, units: Units = Units.M)

Return a section object based on values in a profile db json document. Source JSON is in units ‘m’ meters.

Base Classes

Visualization Classes

class ada.visit.concept.ObjectMesh(guid: 'str', faces: 'np.ndarray', position: 'np.ndarray', normal: 'np.ndarray | None' = None, color: 'list | None' = None, edges: 'np.ndarray' = None, vertex_color: 'np.ndarray' = None, instances: 'np.ndarray | None' = None, id_sequence: 'dict' = <factory>, translation: 'np.ndarray' = None)