queens.external_geometry package#

External geometry.

Modules for preprocessing geometry from external simulation software.

Submodules#

queens.external_geometry.external_geometry module#

Module for handling external geometry objects.

class ExternalGeometry[source]#

Bases: object

Abstract base class to read in external_geometry_obj formats.

The class enables, e.g., external_geometry_obj based construction of random fields or post processing routines.

Returns:

geometry_obj (obj) – Instance of the ExternalGeometry class

abstract finish_and_clean()[source]#

Finishing, postprocessing and cleaning.

main_run()[source]#

Main routine of external_geometry_obj object.

abstract organize_sections()[source]#

Organizes (geometric) sections.

Organizes (geometric) sections in external file to read in geometric data efficiently.

abstract read_external_data()[source]#

Method that reads in external files.

Method that reads in external files containing an external_geometry_obj definition.

queens.external_geometry.fourc_dat_geometry module#

4C geometry handling.

class FourcDatExternalGeometry(input_template, input_template_preprocessed=None, list_geometric_sets=None, associated_material_numbers_geometric_set=None, random_fields=None)[source]#

Bases: ExternalGeometry

Class to read in external geometries based on 4C dat files.

path_to_dat_file#

Path to dat file from which the external_geometry_obj should be extracted.

Type:

str

path_to_preprocessed_dat_file#

Path to preprocessed dat file with added placeholders.

Type:

str

coords_dict#

Dictionary containing coordinates of the discretized random fields and corresponding placeholder names.

Type:

str

list_geometric_sets#

List of geometric sets that should be extracted.

Type:

lst

current_dat_section#

String that encodes the current section in the dat file as file is read line-wise.

Type:

str

desired_dat_sections#

Dictionary that holds only desired dat-sections and geometric sets within these sections, so that we can skip undesired parts of the dat-file.

Type:

dict

nodes_of_interest#

List that contains all (mesh) nodes that are part of a desired geometric component.

Type:

lst

new_nodes_lst#

List of new nodes that should be written in dnode topology.

Type:

lst

node_topology#

List with topology dicts of edges/nodes (here: mesh nodes not FEM nodes) for each geometric set of this category.

Type:

lst

line_topology#

List with topology dicts of line components for each geometric set of this category.

Type:

lst

surface_topology#

List of topology dicts of surfaces for each geometric set of this category.

Type:

lst

volume_topology#

List of topology of volumes for each geometric set of this category.

Type:

lst

node_coordinates#

Dictionary that holds the desired nodes as well as their corresponding geometric coordinates.

Type:

dict

element_centers#

Array with center coordinates of elements.

Type:

np.array

element_topology#

List of dictionaries containing element topology, including node mapping, materials, and element numbers.

Type:

lst

original_materials_in_dat#

List of original material numbers in dat template file.

Type:

lst

list_associated_material_numbers#

List of associated material numbers w.r.t. the geometric sets of interest.

Type:

lst

new_material_numbers#

List of new material numbers to be used.

Type:

lst

random_dirich_flag#

Flag to check if a random Dirichlet BC exists.

Type:

bool

random_transport_dirich_flag#

Flag to check if a random transport Dirichlet BC exists.

Type:

bool

random_neumann_flag#

Flag to check if a random Neumann BC exists.

Type:

bool

nodes_written#

Flag to check whether nodes have already been written.

Type:

bool

random_fields#

List of random field descriptions.

Type:

lst

Returns:

geometry_obj (obj) – Instance of FourcDatExternalGeometry class

check_if_in_desired_dat_section()[source]#

Check if the dat-section contains the desired geometric set.

Returns:

bool – True if the case is found, False otherwise.

dat_sections = ['DESIGN DESCRIPTION', 'DESIGN POINT DIRICH CONDITIONS', 'DESIGN POINT TRANSPORT DIRICH CONDITIONS', 'DNODE-NODE TOPOLOGY', 'DLINE-NODE TOPOLOGY', 'DSURF-NODE TOPOLOGY', 'DVOL-NODE TOPOLOGY', 'NODE COORDS', 'STRUCTURE ELEMENTS', 'ALE ELEMENTS', 'FLUID ELEMENTS', 'LUBRIFICATION ELEMENTS', 'TRANSPORT ELEMENTS', 'TRANSPORT2 ELEMENTS', 'THERMO ELEMENTS', 'CELL ELEMENTS', 'CELLSCATRA ELEMENTS', 'ELECTROMAGNETIC ELEMENTS', 'ARTERY ELEMENTS', 'MATERIALS']#
finish_and_clean()[source]#

Finish the analysis for the external_geometry_obj extraction.

get_coordinates_of_desired_geometric_sets(node_list)[source]#

Extract node and coordinate information of the current line.

Parameters:

node_list (list) – Current line of the dat-file

get_current_dat_section(line)[source]#

Check if the current line starts a new section in the dat-file.

Update self.current_dat_section if new section was found. If the current line is the actual section identifier, return a True boolean.

Parameters:

line (str) – Current line of the dat-file

Returns:

bool (boolean) – True or False depending if current line is the section match

get_desired_dat_sections()[source]#

Get the dat-sections that contain the desired geometric sets.

get_elements_belonging_to_desired_material(line)[source]#

Get finite element_topology that belongs to the material definition.

Note that we assume that the geometric set of interest also has its own material name. This speeds-up the element-topology mapping significantly as we do not have to find which element belongs to which geometric set by performing a large node membership search per element and for all nodes of the element. On the other hand this assumption requires that the analyst provides a dat-file in the correct format.

Parameters:

line (str) – Current line in the dat-file

get_materials(line)[source]#

Get the different material definitions from the dat file.

Parameters:

line (str) – Current line of the dat file

get_nodes_of_interest()[source]#

From the extracted topology, get a unique list of all nodes.

get_only_desired_coordinates(line)[source]#

Get coordinates of nodes that belong to a desired geometric set.

Parameters:

line (str) – Current line of the dat-file

get_only_desired_topology(line)[source]#

Check if the current line contains desired geometric sets.

Skip the topology extraction if the current section does not contain a desired geometric set, anyways.

Parameters:

line (str) – Current line of the dat-file

get_topology(line)[source]#

Get the geometric topology by extracting and grouping (mesh) nodes.

Only nodes that belong to the desired geometric sets and save them to their topology class.

Parameters:

line (str) – Current line of the dat-file

organize_sections()[source]#

Organize the sections of the external external_geometry_obj.

read_external_data()[source]#

Read the external input file with geometric data.

read_geometry_from_dat_file()[source]#

Read the dat-file line by line to be memory efficient.

section_match_dict = {'DLINE': 'DLINE-NODE TOPOLOGY', 'DNODE': 'DNODE-NODE TOPOLOGY', 'DSURFACE': 'DSURF-NODE TOPOLOGY', 'DVOL': 'DVOL-NODE TOPOLOGY'}#
write_random_fields_to_dat()[source]#

Write placeholders for random fields to the dat file.