svcco.sv_interface.ROM package¶
Submodules¶
svcco.sv_interface.ROM.centerlines module¶
The module is used to extact centerlines from a surface mesh.
- class svcco.sv_interface.ROM.centerlines.Centerlines[source]¶
Bases:
object
The Centerlines class is used to encapsulate centerline calculations.
- extract_center_lines(params)[source]¶
Extract the centerlines of a surface. The centerline geometry is returned as a vtkPolyData object.
- class svcco.sv_interface.ROM.centerlines.ClosestPoints(inp)[source]¶
Bases:
object
Find closest points within a geometry
svcco.sv_interface.ROM.generate_1d_mesh module¶
This module provides the interface to the modules creating a 1D mesh used for 1D simulations.
Centerlines can be computed or read in. If centerline are read from a file then they must have been split and grouped along branches. If you are reading the centerlines computed by the SimVascular Models plugin then the Full_Centerlines.vtp file must be used.
- class svcco.sv_interface.ROM.generate_1d_mesh.Args[source]¶
Bases:
object
This class defines the command line arguments to the generate-1d-mesh script.
- BOUNDARY_SURFACE_DIR = 'boundary_surfaces_directory'¶
- CENTERLINE_INPUT_FILE = 'centerlines_input_file'¶
- CENTERLINE_OUTPUT_FILE = 'centerlines_output_file'¶
- COMPUTE_CENTERLINES = 'compute_centerlines'¶
- COMPUTE_MESH = 'compute_mesh'¶
- DENSITY = 'density'¶
- ELEMENT_SIZE = 'element_size'¶
- INFLOW_INPUT_FILE = 'inflow_input_file'¶
- INLET_FACE_INPUT_FILE = 'inlet_face_input_file'¶
- LINEAR_MATERIAL_EHR = 'linear_material_ehr'¶
- LINEAR_MATERIAL_PRESSURE = 'linear_material_pressure'¶
- MATERIAL_MODEL = 'material_model'¶
- MESH_OUTPUT_FILE = 'mesh_output_file'¶
- MINIMUM_NUMBER_ELEMENTS = 'min_num_elements'¶
- MODEL_NAME = 'model_name'¶
- MODEL_ORDER = 'model_order'¶
- NUM_TIME_STEPS = 'num_time_steps'¶
- OLUFSEN_MATERIAL_EXP = 'olufsen_material_exp'¶
- OLUFSEN_MATERIAL_K1 = 'olufsen_material_k1'¶
- OLUFSEN_MATERIAL_K2 = 'olufsen_material_k2'¶
- OLUFSEN_MATERIAL_K3 = 'olufsen_material_k3'¶
- OLUFSEN_MATERIAL_PRESSURE = 'olufsen_material_pressure'¶
- OUTFLOW_BC_INPUT_FILE = 'outflow_bc_input_file'¶
- OUTFLOW_BC_TYPE = 'outflow_bc_type'¶
- OUTLET_FACE_NAMES_INPUT_FILE = 'outlet_face_names_input_file'¶
- OUTPUT_DIRECTORY = 'output_directory'¶
- PREFIX = '--'¶
- SAVE_DATA_FREQUENCY = 'save_data_frequency'¶
- SEGMENT_MINIMUM_NUMBER = 'seg_min_num'¶
- SEGMENT_SIZE = 'seg_size'¶
- SEGMENT_SIZE_ADAPTIVE = 'seg_size_adaptive'¶
- SOLVER_OUTPUT_FILE = 'solver_output_file'¶
- SURFACE_MODEL = 'surface_model'¶
- TIME_STEP = 'time_step'¶
- UNIFORM_BC = 'uniform_bc'¶
- UNITS = 'units'¶
- VISCOSITY = 'viscosity'¶
- WALL_PROPERTIES_INPUT_FILE = 'wall_properties_input_file'¶
- WALL_PROPERTIES_OUTPUT_FILE = 'wall_properties_output_file'¶
- svcco.sv_interface.ROM.generate_1d_mesh.compute_centerlines(params)[source]¶
Compute the centerlines for a surface model.
- svcco.sv_interface.ROM.generate_1d_mesh.read_centerlines(params)[source]¶
Read centerlines for a surface model from a file.
The centerlines must have had
- svcco.sv_interface.ROM.generate_1d_mesh.run(**kwargs)[source]¶
Execute the 1D mesh generation using passed parameters.
- svcco.sv_interface.ROM.generate_1d_mesh.run_from_c(*args, **kwargs)[source]¶
Execute the 1D mesh generation using passed parameters from c++
The '*args' argument contains the directory to write the log file.
- svcco.sv_interface.ROM.generate_1d_mesh.set_parameters(**kwargs)[source]¶
Set the values of parameters input from the command line.
The **kwargs argument can originate from the command line or from a direct call to the 'run()' function, in which case parser.parse_args() is not called and so we need to check here if required arguments have been passed.
svcco.sv_interface.ROM.io_0d module¶
svcco.sv_interface.ROM.io_1d module¶
This module handles file i/o for the SimVascular 1D solver (https://github.com/SimVascular/oneDSolver).
- class svcco.sv_interface.ROM.io_1d.FlowData(time, flow)¶
Bases:
tuple
- property flow¶
Alias for field number 1
- property time¶
Alias for field number 0
- svcco.sv_interface.ROM.io_1d.add_array(data, identifier, array, name)[source]¶
Add array to vtkPolyData Args:
data: vtkPolyData object identifier: array association (point or cell) array: scalar list or numpy array name: display name of array
- svcco.sv_interface.ROM.io_1d.coronary_sv_to_oned(bc)[source]¶
Convert format of coronary boundary condition parameters from svSimVascular to svOneDSolver
- svcco.sv_interface.ROM.io_1d.read_inflow_file(mesh, params)[source]¶
Read the inflow file.
The file can be formatted as space- or comma-separated value pairs.
- Example:
<time1> <flow1> <time2> <flow2> ... <timeN> <flowN>
- svcco.sv_interface.ROM.io_1d.read_outlet_face_names(mesh, params)[source]¶
Read in outlet face names file.
- svcco.sv_interface.ROM.io_1d.read_variable_outflow_bcs(params)[source]¶
Read in data for variable flow boundary conditions from file (RCR, resistance, coronary)
- svcco.sv_interface.ROM.io_1d.write_mesh(mesh, params)[source]¶
Write the 1D mesh to a VTK VTP format file. Args:
mesh: Mesh object params: 1d model parameters
- svcco.sv_interface.ROM.io_1d.write_solver_joints(mesh, ofile, params)[source]¶
Write a solver input file joints section.
- svcco.sv_interface.ROM.io_1d.write_solver_material(mesh, ofile, params)[source]¶
Write a solver input file material section.
- svcco.sv_interface.ROM.io_1d.write_solver_nodes(mesh, ofile, params)[source]¶
Write a solver input file nodes section.
- svcco.sv_interface.ROM.io_1d.write_solver_options(mesh, ofile, params)[source]¶
Write a solver input file options section.
- svcco.sv_interface.ROM.io_1d.write_solver_output(mesh, ofile, params)[source]¶
Write a solver input file output section.
svcco.sv_interface.ROM.io_headers module¶
This file contains i/o headers for the SimVascular 1D solver (https://github.com/SimVascular/oneDSolver).
- class svcco.sv_interface.ROM.io_headers.Headers[source]¶
Bases:
object
Collection of headers of all oneDSolver input-file sections
- element = ['# =============', '# ELEMENT CARD', '# =============', '# - 1d_segment_name', '# - 1d_segment_number / 0d_element_number', '# - average_radius', '# - length', '# - blood_density', '# - blood_dynamic_viscosity', '# - Eh/r', '# - inlet_node_number', '# - outlet_node_number', '# - vessel_vector_x_coor', '# - vessel_vector_y_coor', '# - vessel_vector_z_coor', '# - boundary_condition_type', '# - boundary_condition_datatable_name', '# - 0d_element_type, i.e. R, RC, RL, RCL, L, C, etc.', '# - 0d_element_values in format of: R or R C or R L or R C L or L or C or blank for custom 0d elements', '']¶
- inlet_bc = ['# ==============================', '# INLET BOUNDARY CONDITION CARD', '# ==============================', '# - inlet_segment_number', '# - inlet_boundary_condition_type', '# - inlet_boundary_condition_datatable_name', '']¶
- joint1 = ['#', '# ==========', '# JOINT CARD', '# ==========', '# - Joint Name (string)', '# - Joint Node (double)', '# - Joint Inlet Name (string)', '# - Joint Outlet Name (string)', '']¶
- joint2 = ['#', '# ================================', '# JOINTINLET AND JOINTOUTLET CARDS', '# ================================', '# - Inlet/Outlet Name (string)', '# - Total Number of segments (int)', '# - List of segments (list of int)', '']¶
- junction = ['#', '# ==========', '# JUNCTION MODEL CARD', '# ==========', '# - joint_name', '# - junction_type, i.e. NORMAL_JUNCTION, etc.', '']¶
- material = ['# =============', '# MATERIAL CARD', '# =============', '# - Material Name (string)', "# - Material Type (string - 'LINEAR','OLUFSEN')", '# - Material Density (double)', '# - Material Viscosity (double)', '# - Material PRef (double)', '# - Material Exponent (double)', '# - Material Parameter 1 (double)', '# - Material Parameter 2 (double)', '# - Material Parameter 3 (double)', '']¶
- node = ['#', '# ==========', '# NODE CARD', '# ==========', '# - Node Name (double)', '# - Node X Coordinate (double)', '# - Node Y Coordinate (double)', '# - Node Z Coordinate (double)', '']¶
- output = ['# ============', '# OUTPUT CARD', '# ============', '#', '# 1. Output file format. The following output types are supported:', '#\t\tTEXT. The output of every segment is written in separate text files for the flow rate, pressure, area and Reynolds number. The rows contain output values at varying locations along the segment while columns contains results at various time instants.', '#\t\tVTK. The results for all time steps are plotted to a 3D-like model using the XML VTK file format.', '# 2. VTK export option. Two options are available for VTK file outputs:', '#\t\t0 - Multiple files (default). A separate file is written for each saved increment. A pvd file is also provided which contains the time information of the sequence. This is the best option to create animations.', '#\t\t1 - The results for all time steps are plotted to a single XML VTK file.', '']¶
- segment = ['# ============', '# SEGMENT CARD', '# ============', '# - Segment Name (string)', '# - Segment ID (int)', '# - Segment Length (double)', '# - Total Finite Elements in Segment (int)', '# - Segment Inlet Node (int)', '# - Segment Outlet Node (int)', '# - Segment Inlet Area (double)', '# - Segment Outlet Area (double)', '# - Segment Inflow Value (double)', '# - Segment Material (string)', "# - Type of Loss (string - 'NONE','STENOSIS','BRANCH_THROUGH_DIVIDING','BRANCH_SIDE_DIVIDING','BRANCH_THROUGH_CONVERGING',", "# 'BRANCH_SIDE_CONVERGING','BIFURCATION_BRANCH')", '# - Branch Angle (double)', '# - Upstream Segment ID (int)', '# - Branch Segment ID (int)', "# - Boundary Condition Type (string - 'NOBOUND','PRESSURE','AREA','FLOW','RESISTANCE','RESISTANCE_TIME','PRESSURE_WAVE',", "# 'WAVE','RCR','CORONARY','IMPEDANCE','PULMONARY')", '# - Data Table Name (string)', '']¶
- solveroptions = ['# ==================', '# SOLVEROPTIONS CARD', '# ==================', '# - Solver Time Step (double), ', '# - Steps Between Saves (int), ', '# - Max Number of Steps (int)', '# - Number of quadrature points for finite elements (int), ', '# - Name of Datatable for inlet conditions (string)', "# - Type of boundary condition (string - 'NOBOUND','PRESSURE','AREA','FLOW','RESISTANCE','RESISTANCE_TIME','PRESSURE_WAVE',", "# 'WAVE','RCR','CORONARY','IMPEDANCE','PULMONARY')", '# - Convergence tolerance (double), ', '# - Formulation Type (int - 0 Advective, 1 Conservative), ', '# - Stabilization (int - 0 No stabilization, 1 With stabilization)', '']¶
- solveroptions_0d = ['# ==================', '# SOLVEROPTIONS_0D CARD', '# ==================', '# - number_of_time_pts_per_cardiac_cycle (int)', '# - number_of_cardiac_cycles (int)', '']¶
svcco.sv_interface.ROM.manage module¶
svcco.sv_interface.ROM.mesh module¶
This module is used to create an input file for the SimVascular 1D solver (https://github.com/SimVascular/oneDSolver).
A 1D mesh is generated from the centerline geometry caculated from a closed polygonal surface.
A centerline consists of m cells, m=number of tract ids, the length of a cell/line is an approximation of a group. In Cell Data, lines are listed from 0 to m. For each line, the first number is the number of points for this line followed by 1st point to the last point.
- class svcco.sv_interface.ROM.mesh.Bifurcation[source]¶
Bases:
object
Simple class to track inlet and outlets of a bifurcation
- class svcco.sv_interface.ROM.mesh.Mesh[source]¶
Bases:
object
The Mesh class is used to encapsulate 1D mesh calculations.
- class CellDataFields[source]¶
Bases:
object
This class defines the required field cell data field names.
- class Open(*args, **kwds)[source]¶
Bases:
object
This class wraps the 'open' class and adds a method to automatically write newlines.
- class PointDataFields[source]¶
Bases:
object
This class defines the required field point data field names.
- AREA = 'CenterlineSectionArea'¶
- BIFURCATION = 'BifurcationId'¶
- BRANCH = 'BranchId'¶
- CENT = 'CenterlineId'¶
- NODEID = 'GlobalNodeId'¶
- NORMAL = 'CenterlineSectionNormal'¶
- PATH = 'Path'¶
- check_centerlines_data()[source]¶
Check that the centerline data contains all of the required fields.
- discretize_branches(params)[source]¶
Create refined physical quantities: nodes / areas / segment lengths
- get_junction_length(br)[source]¶
Get the length of the part of a branch that is within the upstream junction Args:
br: BranchId
Returns: path length within junction
- svcco.sv_interface.ROM.mesh.curvature_radius(points)[source]¶
Calculate curvature radius from list of points with three adjacent points each
- svcco.sv_interface.ROM.mesh.find_stenoses(area, path, params)[source]¶
Returns stenosis locations and coefficients along a branch
- svcco.sv_interface.ROM.mesh.get_1d_seg_num(area, params)[source]¶
Get number of segments for 1d solver
svcco.sv_interface.ROM.models module¶
Contains all ROM building blocks (currently onky 1D)
svcco.sv_interface.ROM.parameters module¶
- class svcco.sv_interface.ROM.parameters.MaterialModel[source]¶
Bases:
object
- LINEAR = 'LINEAR'¶
- OLUFSEN = 'OLUFSEN'¶
- class svcco.sv_interface.ROM.parameters.OutflowBoundaryConditionType[source]¶
Bases:
object
- CORONARY = 'coronary'¶
- ONED_TO_SV = {'coronary': 'cort.dat', 'rcr': 'rcrt.dat', 'resistance': 'resistance.dat'}¶
- RCR = 'rcr'¶
- RESISTANCE = 'resistance'¶
- SV_TO_ONED = {'cort.dat': 'coronary', 'rcrt.dat': 'rcr', 'resistance.dat': 'resistance'}¶
svcco.sv_interface.ROM.utils module¶
The module contains utilities used to read files, calculate centers, etc.
- svcco.sv_interface.ROM.utils.read_polydata(file_name, datatype=None)[source]¶
Read a vtp file.
- Args:
file_name (str): The input polydata file. datatype (str): Additional parameter for vtkIdList objects.
- Returns:
polydata (vtkDataObject): Geometry read in from the input file.
- svcco.sv_interface.ROM.utils.read_surface(file_name, file_format='vtp', datatype=None)[source]¶
Read surface geometry from a file.
- Args:
file_name (str): Path to input file. file_format (str): File format (.vtp, .stl, etc.). datatype (str): Additional parameter for vtkIdList objects.
- Returns:
- polyData (vtkSTL/vtkPolyData/vtkXMLStructured/
vtkXMLRectilinear/vtkXMLPolydata/vtkXMLUnstructured/ vtkXMLImage/Tecplot): Output data.