svcco.sv_interface package

Subpackages

Submodules

svcco.sv_interface.build_0d_run_script module

svcco.sv_interface.build_files module

svcco.sv_interface.build_files.build(paths, radii, normals, options, setup_file='from sv import *\nimport vtk\nimport os\nimport platform\nimport numpy as np\n\n', path_file="path_{{}} = pathplanning.Path()\npath_{{}}.set_control_points({{}})\nif {}:\n    dmg.add_path('vessel_{{}}',path_{{}})\n", contour_file=['contour_polydata = []', 'contour_list = []', 'contour_set_{} = []', 'contour_polydata_list_{} = []', 'contour_set_{}.append(segmentation.Circle({},center={},normal={}))', 'contour_polydata_list_{}.append(contour_set_{}[-1].get_polydata())', 'contour_list.append(contour_set_{})', 'contour_polydata.append(contour_polydata_list_{})', 'if {}:', "    dmg.add_segmentation('vessel_{}','vessel_{}',contour_set_{})", ''], geometry_file='num_samples = {}\nuse_distance_alignment_method = {}\nfor contour_polydata_list in contour_polydata:\n    for idx in range(len(contour_polydata_list)):\n        contour_polydata_list[idx] = geometry.interpolate_closed_curve(polydata=contour_polydata_list[idx],number_of_points=num_samples)\n        if idx != 0:\n            contour_polydata_list[idx] = geometry.align_profile(contour_polydata_list[idx-1],contour_polydata_list[idx],use_distance_alignment_method)\n', loft_file='options = geometry.LoftNurbsOptions()\n\ndef bad_edges(model):\n    # Determine the number of non-manifold and degenerate\n    # edges within a sv solid model\n    #\n    # Parameters:\n    #\n    # model     (sv.modeling.POLYDATA): sv solid modeling object\n    #\n    # Returns\n    #\n    # bad_edges_number   (int): number of non-manifold & degenerate edges\n    fe = vtk.vtkFeatureEdges()\n    fe.FeatureEdgesOff()\n    fe.BoundaryEdgesOn()\n    fe.NonManifoldEdgesOn()\n    fe.SetInputData(model.get_polydata())\n    fe.Update()\n    return fe.GetOutput().GetNumberOfCells()\n\ndef clean(model):\n    # Merge duplicate points, clean up bad edges, perform basic filtering\n    #\n    # Parameters:\n    #\n    # model    (sv.modeling.POLYDATA): sv solid model\n    #\n    # Returns:\n    #\n    # model    (sv.modeling.POLYDATA): sv solid model with cleaned polydata\n    #                                  surface mesh\n    clean_filter = vtk.vtkCleanPolyData()\n    clean_filter.PointMergingOn()\n    clean_filter.SetInputData(model.get_polydata())\n    clean_filter.Update()\n    model.set_surface(clean_filter.GetOutput())\n    return model\n\ndef tri(model):\n    # Triangle Filter for sv solid model\n    #\n    # Parameters\n    #\n    # model    (sv.modeling.POLYDATA): sv solid model object\n    #\n    # Returns\n    #\n    # model    (sv.modeling.POLYDATA): sv solid model object with\n    #                                  surface mesh containing only triangles\n    tri_filter = vtk.vtkTriangleFilter()\n    tri_filter.SetInputData(model.get_polydata())\n    tri_filter.Update()\n    model.set_surface(tri_filter.GetOutput())\n    return model\n\ndef fill(model):\n    # Fill holes within a sv solid model in order to close an open manifold\n    #\n    # Parameters\n    #\n    # model    (sv.modeling.POLYDATA): sv solid modeling object\n    #\n    # Returns\n    #\n    # model    (sv.modeling.POLYDATA): sv solid modeling object with a surface\n    #                                  mesh containing no holes\n    poly = vmtk.cap(surface=model.get_polydata(),use_center=False)\n    model.set_surface(poly)\n    return model\n\ndef surf_area(poly):\n    # Calculate the area of a polydata surface\n    #\n    # Parameters\n    #\n    # poly    (vtk.PolyData): polydata object\n    #\n    # Returns\n    #\n    # surface_area   (float): area of the polydata surface mesh\n    mass = vtk.vtkMassProperties()\n    mass.SetInputData(poly)\n    mass.Update()\n    return mass.GetSurfaceArea()\n\ndef remesh(model,radius_factor=10):\n    # Remesh the surface model using MMG.\n    #\n    # Parameters\n    #\n    # model  (sv.modeling.POLYDATA): SV solid modeling object\n    # radius_factor           (int): scale mesh global minimum edge size\n    #                                based on outlet radius\n    #\n    # Returns\n    #\n    # model  (sv.modeling.POLYDATA): remeshed model object\n    face_ids = model.get_face_ids()\n    smallest = 1e8\n    biggest = 0\n    for id in face_ids:\n        if surf_area(model.get_face_polydata(id)) < smallest:\n            smallest = surf_area(model.get_face_polydata(id))\n        if surf_area(model.get_face_polydata(id)) > biggest:\n            biggest = surf_area(model.get_face_polydata(id))\n    radius = (smallest/3.14)**(1/2)\n    hmin = radius/radius_factor\n    hmax = radius\n    print("Remeshing Model:\\nhmin: ----> {}\\nhmax ----> {}".format(hmin,hmax))\n    remeshed_polydata = mesh_utils.remesh(model.get_polydata(),hmin=hmin,hmax=hmax)\n    model.set_surface(remeshed_polydata)\n    return model\n\ndef remesh_face(model,face_id,radius_scale=10):\n    # Remesh Faces of a surface model using MMG.\n    #\n    # Parameters\n    #\n    # model  (sv.modeling.POLYDATA): SV solid modeling object\n    # face_id                 (int): face_id index within solid model\n    # radius_factor           (int): scale mesh global minimum edge size\n    #                                based on outlet radius\n    #\n    # Returns\n    #\n    # model  (sv.modeling.POLYDATA): model with remeshed face\n    face_poly = model.get_face_polydata(face_id)\n    edge_size = (surf_area(face_poly)/3.14)**(1/2)/radius_scale\n    print("Remeshing Face: {} ----> Edge Size: {}".format(face_id,edge_size))\n    remeshed_poly = mesh_utils.remesh_faces(model.get_polydata(),[face_id],edge_size)\n    model.set_surface(remeshed_poly)\n    return model\n\ndef remesh_wall(model,wall_id):\n    wall_poly = model.get_face_polydata(wall_id)\n    cell_number = wall_poly.GetNumberOfCells()\n    edge_size = ((surf_area(wall_poly)/cell_number)*0.5)**(1/2)\n    remeshed_poly = mesh_utils.remesh_faces(model.get_polydata(),[wall_id],edge_size)\n    model.set_surface(remeshed_poly)\n    new_cell_number = model.get_face_polydata(wall_id).GetNumberOfCells()\n    print("Face Elements: {} ----> Edge Size: {}".format(cell_number,new_cell_number))\n    return model\n\ndef remesh_caps(model):\n    # Remesh all caps of a surface model using MMG. By definition\n    # this function will not remesh the walls of the surface model.\n    #\n    # Parameters\n    #\n    # model  (sv.modeling.POLYDATA): SV solid modeling object\n    #\n    # Returns\n    #\n    # model  (sv.modeling.POLYDATA): model with remeshed caps\n    cap_ids = model.identify_caps()\n    face_ids = model.get_face_ids()\n    for i,c in enumerate(cap_ids):\n        if c:\n            model = remesh_face(model,face_ids[i])\n    return model\n\ndef norm(model):\n    # Determine the normal vectors along the\n    # polydata surface.\n    #\n    # PARAMETERS\n    # model    (sv.modeling.POLYDATA): SV solid modeling object\n    #\n    # Returns\n    #\n    # model    (sv.modeling.POLYDATA): SV solid model with calculated normals\n    norm_filter = vtk.vtkPolyDataNormals()\n    norm_filter.AutoOrientNormalsOn()\n    norm_filter.ComputeCellNormalsOn()\n    norm_filter.ConsistencyOn()\n    norm_filter.SplittingOn()\n    norm_filter.NonManifoldTraversalOn()\n    norm_filter.SetInputData(model.get_polydata())\n    norm_filter.Update()\n    model.set_surface(norm_filter.GetOutput())\n    return model\n\ndef loft(contours,num_pts=50,distance=False):\n    # Generate an open lofted NURBS surface along a given\n    # vessel contour group.\n    #\n    # PARAMETERS:\n    # contours (list):  list of contour polydata objects defining one vessel.\n    # num_pts  (int) :  number of sample points to take along each contour.\n    # distance (bool):  flag to use distance based method for contour alignment\n    #\n    # Return\n    #\n    # loft_solid  (sv.modeling.POLYDATA): sv solid model for the open lofted surface\n    for idx in range(len(contours)):\n        contours[idx] = geometry.interpolate_closed_curve(polydata=contours[idx],number_of_points=num_pts)\n        if idx != 0:\n            contours[idx] = geometry.align_profile(contours[idx-1],contours[idx],distance)\n    options = geometry.LoftNurbsOptions()\n    loft_polydata = geometry.loft_nurbs(polydata_list=contours,loft_options=options)\n    loft_solid = modeling.PolyData()\n    loft_solid.set_surface(surface=loft_polydata)\n    return loft_solid\n\ndef loft_all(contour_list):\n    # Loft all vessels defining the total model that you want to create.\n    #\n    # PARAMETERS\n    # contour_list: (list): list of lists that contain polydata contour groups\n    #                      Example for two vessels:\n    #\n    #                      contour_list -> [[polydataContourObject1,polydataContourObject2],[polydataContourObject1,polydataContourObject2]]\n    #\n    # RETURNS:\n    # lofts:        (list): list of open sv solid models of the lofted 3D surface. Note that\n    #                       the loft is not yet capped.\n    lofts = []\n    for group in contour_list:\n        contours,polydata =  clean_contours(group)\n        lofts.append(loft(polydata))\n    return lofts\n\n\ndef cap_all(loft_list):\n    # Cap all lofted vessels.\n    #\n    # PARAMETERS:\n    # loft_list  (list): list of sv modeling solid objects that are open lofts generated from\n    #                    the \'loft_all\' function.\n    #\n    # RETURNS:\n    # capped     (list): list of capped solids\n    capped = []\n    for loft_solid in loft_list:\n        capped_solid = modeling.PolyData()\n        capped_solid.set_surface(vmtk.cap(surface=loft_solid.get_polydata(),use_center=False))\n        capped_solid.compute_boundary_faces(angle=45)\n        capped.append(capped_solid)\n    return capped\n\ndef check_cap_solids(cap_solid_list):\n    # Check capped solids for bad edges\n    #\n    # Parameters\n    # cap_solid_list  (list): list of sv.modeling.POLYDATA solids\n    #\n    # Returns\n    #\n    # bad_edges_exist (bool): True/False value for if any bad edges\n    #                         exist within any of the solids within\n    #                         list\n    for solid in cap_solid_list:\n        if bad_edges(solid) > 0:\n            return False\n    return True\n\ndef clean_contours(contours):\n    num = len(contours)-2\n    new_contours = [contours[0]]\n    new_poly     = [contours[0].get_polydata()]\n    for i in range(1,len(contours)-1):\n        n1 = np.array(new_contours[-1].get_normal())\n        n2 = np.array(contours[i].get_normal())\n        n3 = np.array(contours[i+1].get_normal())\n        if ((np.arccos(np.dot(n1,n2.T))/np.pi)*180 > 10) or ((np.arccos(np.dot(n2,n3.T))/np.pi)*180 > 10) or check_connection(contours[i]):\n            new_contours.append(contours[i])\n            new_poly.append(contours[i].get_polydata())\n    if len(new_contours) == 1:\n        mid = len(contours)//2\n        new_contours.append(contours[mid])\n        new_poly.append(contours[mid].get_polydata())\n    new_contours.append(contours[-1])\n    new_poly.append(contours[-1].get_polydata())\n    return new_contours, new_poly\n\ndef check_connection(contour,contour_list=contour_list):\n    keep = False\n    check_center = np.array(contour.get_center())\n    for group in contour_list:\n        c = np.array(group[0].get_center())\n        if np.linalg.norm(check_center - c) < (group[0].get_radius()*2*np.pi+contour.get_radius()*2*np.pi):\n            keep = True\n            break\n    return keep\n\ndef create_vessels(contour_list,attempts=5):\n    # create seperate capped vessels for all contour groups defining a model of interest.\n    #\n    # PARAMETERS:\n    # contour_list: (list): list of lists of contour polydata objects defining individual vessels\n    #                       within the total model.\n    # attemps:      (int) : the number of times that bad edges correction will be attemped during loft\n    #                       alignment\n    i = 0\n    success = False\n    while not success and i < attempts:\n        lofts = loft_all(contour_list)\n        cap_solids = cap_all(lofts)\n        success = check_cap_solids(cap_solids)\n        i += 1\n    if success:\n        print(\'Lofting Passed\')\n    else:\n        print(\'Lofting Failed\')\n    return cap_solids\n\ndef show(model):\n    polydata = model.get_polydata()\n\n    colors = vtk.vtkNamedColors()\n    background = \'white\'\n    mapper = vtk.vtkPolyDataMapper()\n    actor  = vtk.vtkActor()\n    mapper.SetInputDataObject(polydata)\n    actor.SetMapper(mapper)\n    renderer = vtk.vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d(background))\n\n    render_window = vtk.vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetWindowName(\'Model View\')\n\n    interactor = vtk.vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n    renderer.AddActor(actor)\n    render_window.Render()\n    interactor.Start()\n\ncapped_vessels = create_vessels(contour_list)\n', solid_file='###############################\n# INITIALIZE MODELING KERNEL\n###############################\ndef robust_union(model_1,model_2):\n    modeler = modeling.Modeler(modeling.Kernel.POLYDATA)\n    model_1_be = bad_edges(model_1)\n    model_2_be = bad_edges(model_2)\n    print("Model 1 Bad Edges: {{}}\\n Model 2 Bad Edges: {{}}".format(model_1_be,model_2_be))\n    if model_1_be == 0 and model_2_be == 0:\n        unioned_model = modeler.union(model_1,model_2)\n        unioned_model = clean(unioned_model)\n        unioned_model = norm(unioned_model)\n        if bad_edges(unioned_model) > 0:\n            print(\'Unioned Model Bad Edges: {{}}\'.format(bad_edges(unioned_model)))\n            print(\'Filling\')\n            unioned_model = fill(unioned_model)\n            print(\'Unioned Model Bad Edges: {{}}\'.format(bad_edges(unioned_model)))\n            print(\'Cleaning\')\n            unioned_model = clean(unioned_model)\n            print(\'Unioned Model Bad Edges: {{}}\'.format(bad_edges(unioned_model)))\n            unioned_model = tri(unioned_model)\n            print(\'Unioned Model Bad Edges: {{}}\'.format(bad_edges(unioned_model)))\n        print(\'union successful\')\n        return unioned_model\n    else:\n        print(\'1 or both models have bad edges.\')\n        unioned_model = modeler.union(model_1,model_2)\n        unioned_model = clean(unioned_model)\n        unioned_model = norm(unioned_model)\n        return unioned_model\n\ndef union_all(solids,n_cells=100):\n    for i in range(len(solids)):\n        solids[i] = norm(solids[i])\n        solids[i] = remesh(solids[i])\n        solids[i] = remesh_caps(solids[i])\n    joined = robust_union(solids[0],solids[1])\n    for i in range(2,len(solids)):\n        print("UNION NUMBER: "+str(i)+"/"+str(len(solids)-1))\n        joined = robust_union(joined,solids[i])\n        if joined is None:\n            print("unioning failed")\n            return None,True\n    print("unioning passed")\n    return joined,False\n\nunioned_model,terminating = union_all(capped_vessels)\nmodel = modeling.PolyData()\ntmp = unioned_model.get_polydata()\nNUM_CAPS = {}\n############################\n# COMBINE FACES\n############################\nif not terminating:\n    model.set_surface(tmp)\n    model.compute_boundary_faces({})\n    caps = model.identify_caps()\n    ids = model.get_face_ids()\n    walls = [ids[i] for i,x in enumerate(caps) if not x]\n    while len(walls) > 1:\n        target = walls[0]\n        lose = walls[1]\n        model.combine_faces(target,[lose])\n        #combined = mesh_utils.combine_faces(model.get_polydata(),target,lose)\n        #model.set_surface(combined)\n        ids = model.get_face_ids()\n        caps = model.identify_caps()\n        walls = [ids[i] for i,x in enumerate(caps) if not x]\n        print(walls)\n    ids = model.get_face_ids()\n    if {}:\n        dmg.add_model(\'{}\',model)\n    if len(ids) > NUM_CAPS:\n        face_cells = []\n        for idx in ids:\n            face = model.get_face_polydata(idx)\n            cells = face.GetNumberOfCells()\n            print(cells)\n            face_cells.append(cells)\n        data_to_remove = len(ids) - NUM_CAPS\n        remove_list = []\n        for i in range(data_to_remove):\n            remove_list.append(ids[face_cells.index(min(face_cells))])\n            face_cells[face_cells.index(min(face_cells))] += 1000\n        print(remove_list)\n        while len(remove_list) > 0:\n            target = walls[0]\n            lose = remove_list.pop(-1)\n            model.combine_faces(target,[lose])\n            #combined = mesh_utils.combine_faces(model.get_polydata(),target,lose)\n            #model.set_surface(combined)\n            print(remove_list)\n        print(model.get_face_ids())\n    ###############################\n    # LOCAL SMOOTHING (not included)\n    ###############################\n    #smoothing_params = {{\'method\':\'constrained\', \'num_iterations\':5, \'constrain_factor\':0.2, \'num_cg_solves\':30}}\n    smooth_model = model.get_polydata()\n    for idx, contour_set in enumerate(contour_list):\n         if idx == 0:\n              continue\n         smoothing_params = {{\'method\':\'constrained\', \'num_iterations\':3, \'constrain_factor\':0.1+(0.9*(1-contour_set[0].get_radius()/contour_list[0][0].get_radius())), \'num_cg_solves\':30}}\n         smooth_model = geometry.local_sphere_smooth(smooth_model,contour_set[0].get_radius()*2,contour_set[0].get_center(),smoothing_params)\n         print(\'local sphere smoothing {{}}\'.format(idx))\n    model.set_surface(smooth_model)\n\nmodel = clean(model)\n#model = remesh_wall(model,walls[0])\n', mesh_file="if not terminating:\n    done = False\n    min_edge = 0.001\n    edge_size = {}\n    attempt = 0\n    while edge_size > min_edge and not done:\n        try:\n            faces = model.get_face_ids()\n            mesher = meshing.create_mesher(meshing.Kernel.TETGEN)\n            tet_options = meshing.TetGenOptions(edge_size,{},{})\n            tet_options.no_merge = {}\n            tet_options.optimization = {}\n            tet_options.minimum_dihedral_angle = {}\n            mesher.set_model(model)\n            mesher.set_walls(walls)\n            mesher.generate_mesh(tet_options)\n            msh = mesher.get_mesh()\n            done = True\n        except:\n            done = False\n            edge_size = edge_size - 0.1*edge_size\n            attempt += 1\n    if {}:\n        dmg.add_mesh('{}',msh,'{}')\n    if {}:\n        os.mkdir('{}')\n    os.mkdir('{}')\n    os.mkdir('{}')\n    os.mkdir('{}')\n    os.mkdir('{}')\n    model.write('{}'+os.sep+'model_tmp','vtp')\n    mesher.write_mesh('{}'+os.sep+'mesh-complete.mesh.vtu')\n    mesh_out = modeling.PolyData()\n    mesh_out.set_surface(mesher.get_surface())\n    mesh_out.write('{}'+os.sep+'mesh-complete','exterior.vtp')\n    mesh_out.set_surface(mesher.get_face_polydata(walls[0]))\n    mesh_out.write('{}'+os.sep+'walls_combined','vtp')\n    for face in mesher.get_model_face_ids():\n        if face == walls[0]:\n            continue\n        mesh_out.set_surface(mesher.get_face_polydata(face))\n        mesh_out.write('{}'+os.sep+'cap_{{}}'.format(face),'vtp')\n", presolver_file="if not terminating:\n    svpre_file = open('{}'+'/{}.svpre','w+')\n    svpre_construction = 'mesh_and_adjncy_vtu mesh-complete/mesh-complete.mesh.vtu\\n'\n    svpre_construction += 'set_surface_id_vtp mesh-complete/mesh-complete.exterior.vtp 1\\n'\n    resistance = dict([])\n    mass = vtk.vtkMassProperties()\n    max_surface_area = 0\n    total_res = 0\n    for i,face in enumerate(mesher.get_model_face_ids()):\n        if face == walls[0]:\n            continue\n        f_poly = mesher.get_face_polydata(face)\n        mass.SetInputData(f_poly)\n        resistance[face] = mass.GetSurfaceArea()\n        total_res += resistance[face]\n        if resistance[face] > max_surface_area:\n            skip = i + 1\n            inlet = face\n            max_surface_area = resistance[face]\n        svpre_construction += 'set_surface_id_vtp mesh-complete/mesh-surfaces/cap_{{}}.vtp {{}}\\n'.format(face,i+1)\n    #total_res -= 1/max_surface_area\n    svpre_construction += 'fluid_density {}\\n'\n    svpre_construction += 'fluid_viscosity {}\\n'\n    svpre_construction += 'initial_pressure {}\\n'\n    svpre_construction += 'initial_velocity {} {} {}\\n'\n    svpre_construction += 'prescribed_velocities_vtp mesh-complete/mesh-surfaces/cap_{{}}.vtp\\n'.format(inlet)\n    svpre_construction += 'bct_analytical_shape {}\\n'\n    svpre_construction += 'bct_period {}\\n'\n    svpre_construction += 'bct_point_number {}\\n'\n    svpre_construction += 'bct_fourier_mode_number {}\\n'\n    svpre_construction += 'bct_create mesh-complete/mesh-surfaces/cap_{{}}.vtp {}\\n'.format(inlet)\n    svpre_construction += 'bct_write_dat bct.dat\\n'\n    svpre_construction += 'bct_write_vtp bct.vtp\\n'\n    for i, outlet in enumerate(mesher.get_model_face_ids()):\n        if outlet == walls[0]:\n            continue\n        elif outlet == inlet:\n            continue\n        svpre_construction += 'pressure_vtp mesh-complete/mesh-surfaces/cap_{{}}.vtp {}\\n'.format(outlet)\n    svpre_construction += 'noslip_vtp mesh-complete/walls_combined.vtp\\n'\n    svpre_construction += 'write_geombc geombc.dat.1\\n'\n    svpre_construction += 'write_restart restart.0.1\\n'\n    svpre_file.writelines([svpre_construction])\n    svpre_file.close()\n", solver_file="if not terminating:\n    solver_file = open('{}'+'/{}.inp','w+')\n    solver_construction = 'Density: {}\\n'\n    solver_construction += 'Viscosity: {}\\n\\n'\n    solver_construction += 'Number of Timesteps: {}\\n'\n    solver_construction += 'Time Step Size: {}\\n\\n'\n    solver_construction += 'Number of Timesteps between Restarts: {}\\n'\n    solver_construction += 'Number of Force Surfaces: {}\\n'\n    solver_construction += 'Surface ID\\'s for Force Calculation: {}\\n'\n    solver_construction += 'Force Calculation Method: {}\\n'\n    solver_construction += 'Print Average Solution: {}\\n'\n    solver_construction += 'Print Error Indicators: {}\\n\\n'\n    solver_construction += 'Time Varying Boundary Conditions From File: {}\\n\\n'\n    solver_construction += 'Step Construction: {}\\n\\n'\n    num_res = len(mesher.get_model_face_ids()) - 2\n    solver_construction += 'Number of Resistance Surfaces: {{}}\\n'.format(num_res)\n    solver_construction += 'List of Resistance Surfaces:'\n    for j in range(2,len(mesher.get_model_face_ids())+1):\n        if j == skip:\n            continue\n        solver_construction += ' {{}}'.format(j)\n    solver_construction += '\\n'\n    solver_construction += 'Resistance Values:'\n    faces = mesher.get_model_face_ids()\n    outlet_res_total = {}\n    for j in range(2,len(mesher.get_model_face_ids())+1):\n        if j == skip:\n            continue\n        solver_construction += ' {{}}'.format(round(((1/resistance[faces[j-1]])*total_res)*outlet_res_total,2))\n    solver_construction += '\\n\\n'\n    solver_construction += 'Pressure Coupling: {}\\n'\n    solver_construction += 'Number of Coupled Surfaces: {{}}\\n\\n'.format(num_res)\n    solver_construction += 'Backflow Stabilization Coefficient: {}\\n'\n    solver_construction += 'Residual Control: {}\\n'\n    solver_construction += 'Residual Criteria: {}\\n'\n    solver_construction += 'Minimum Required Iterations: {}\\n'\n    solver_construction += 'svLS Type: {}\\n'\n    solver_construction += 'Number of Krylov Vectors per GMRES Sweep: {}\\n'\n    solver_construction += 'Number of Solves per Left-hand-side Formation: {}\\n'\n    solver_construction += 'Tolerance on Momemtum Equations: {}\\n'\n    solver_construction += 'Tolerance on Continuity Equations: {}\\n'\n    solver_construction += 'Tolerance on svLS NS Solver: {}\\n'\n    solver_construction += 'Maximum Number of Iterations for svLS NS Solver: {}\\n'\n    solver_construction += 'Maximum Number of Iterations for svLS Momentum Loop: {}\\n'\n    solver_construction += 'Maximum Number of Iterations for svLS Continuity Loop: {}\\n'\n    solver_construction += 'Time Integration Rule: {}\\n'\n    solver_construction += 'Time Integration Rho Infinity: {}\\n'\n    solver_construction += 'Flow Advection Form: {}\\n'\n    solver_construction += 'Quadrature Rule on Interior: {}\\n'\n    solver_construction += 'Quadrature Rule on Boundary: {}\\n'\n    solver_file.writelines([solver_construction])\n    solver_file.close()\n    numstart = open('{}'+'/numstart.dat','w+')\n    numstart.writelines(['0'])\n    numstart.close()\n\n", centerline_file="if not terminating:\n    outlets = []\n    for i,face in enumerate(mesher.get_model_face_ids()):\n        if face == walls[0]:\n            continue\n        elif face == inlet:\n            continue\n        else:\n            outlets.append(face)\n    centerline = vmtk.centerlines(mesher.get_model_polydata(),[inlet],outlets,use_face_ids=True)\n    centerline_model = modeling.PolyData()\n    centerline_model.set_surface(centerline)\n    centerline_model.write('{}'+os.sep+'centerlines','vtp')\n", rom_file='if not terminating:\n    rom_simulation = simulation.ROM()\n    params = simulation.ROMParameters()\n    model_params = params.ModelParameters()\n\n    model_params.name = \'{}\'+\'_\'+\'{}\'\n    model_params.inlet_face_names = [str(inlet)]\n    model_params.outlet_face_names = [str(o) for o in outlets]\n    model_params.centerlines_file_name = \'{}\' + os.sep +\'centerlines.vtp\'\n\n    mesh_params = params.MeshParameters()\n\n    fluid_params = params.FluidProperties()\n    material = params.WallProperties.OlufsenMaterial()\n\n    bcs = params.BoundaryConditions()\n    bcs.add_velocities(face_name=str(inlet),file_name=\'{}\'+os.sep+\'{}\')\n    for face_name in outlets:\n        bcs.add_resistance(face_name=str(face_name),resistance=((1/resistance[face_name])/total_res)*0+outlet_res_total)\n    solution_params = params.Solution()\n    solution_params.time_step = {}\n    solution_params.num_time_steps = {}\n    outdir = \'{}\'\n    rom_simulation.write_input_file(model_order={},model=model_params,\n                                    mesh=mesh_params,fluid=fluid_params,\n                                    material=material,boundary_conditions=bcs,\n                                    solution=solution_params,directory=outdir)\n    if {} == 0:\n        zeroD_folder = \'{}\'\n        run_rom = open(zeroD_folder+os.sep+\'run.py\',\'w+\')\n        run_rom_file = \'\'\n        path = sv.__path__[0].replace(os.sep+\'sv\',\'\')\n        run_rom_file += \'import os\\n\'\n        run_rom_file += \'import sys\\n\'\n        run_rom_file += "sys.path.append(\'{{}}\')\\n".format(path)\n        run_rom_file += \'from svZeroDSolver import svzerodsolver\\n\'\n        input_file = \'{}\'+os.sep+\'solver_0d.in\'\n        if \'Windows\' in platform.system():\n            input_file = input_file.replace(os.sep,os.sep+os.sep)\n        run_rom_file += "svzerodsolver.solver.set_up_and_run_0d_simulation(\'{{}}\')\\n".format(input_file)\n        run_rom.writelines([run_rom_file])\n        run_rom.close()\n\n        rom_view = open(zeroD_folder+os.sep+\'view.py\',\'w+\')\n        rom_view_file = \'\'\n        rom_view_file += \'import numpy as np\\n\'\n        rom_view_file += \'import matplotlib.pyplot as plt\\n\'\n        rom_view_file += \'data = np.load("solver_0d_branch_results.npy",allow_pickle=True).item()\\n\'\n        rom_view_file += \'vessels = []\\n\'\n        rom_view_file += \'fig_flow = plt.figure()\\n\'\n        rom_view_file += \'ax_flow = fig_flow.add_subplot()\\n\'\n        rom_view_file += \'fig_pressure = plt.figure()\\n\'\n        rom_view_file += \'ax_pressure = fig_pressure.add_subplot()\\n\'\n        rom_view_file += \'fig_flow_outlets = plt.figure()\\n\'\n        rom_view_file += \'ax_flow_outlets = fig_flow_outlets.add_subplot()\\n\'\n        rom_view_file += \'fig_pressure_outlets = plt.figure()\\n\'\n        rom_view_file += \'ax_pressure_outlets = fig_pressure_outlets.add_subplot()\\n\'\n        rom_view_file += \'for vessel in data["flow"]:\\n\'\n        rom_view_file += \'    vessels.append(vessel)\\n\'\n        rom_view_file += \'for vessel in vessels:\\n\'\n        rom_view_file += \'    ax_flow.plot(data["time"],data["flow"][vessel][0],label="vessel_"+str(vessel))\\n\'\n        rom_view_file += \'    ax_pressure.plot(data["time"],data["pressure"][vessel][0]/1333.22,label="vessel_"+str(vessel))\\n\'\n        rom_view_file += \'import json\\n\'\n        rom_view_file += \'info = json.load(open("solver_0d.in"))\\n\'\n        rom_view_file += \'all_inlets = []\\n\'\n        rom_view_file += \'all_outlets = []\\n\'\n        rom_view_file += \'for i in info["junctions"]:\\n\'\n        rom_view_file += \'    for j in i["inlet_vessels"]:\\n\'\n        rom_view_file += \'        all_inlets.append(j)\\n\'\n        rom_view_file += \'    for j in i["outlet_vessels"]:\\n\'\n        rom_view_file += \'        all_outlets.append(j)\\n\'\n        rom_view_file += \'all_inlets = set(all_inlets)\\n\'\n        rom_view_file += \'all_outlets = set(all_outlets)\\n\'\n        rom_view_file += \'true_outlets = list(all_outlets.difference(all_inlets))\\n\'\n        rom_view_file += \'true_inlets = list(all_inlets.difference(all_outlets))\\n\'\n        rom_view_file += \'for vessel in true_outlets:\\n\'\n        rom_view_file += \'    ax_flow_outlets.plot(data["time"],data["flow"][vessel][-1],label="vessel_"+str(vessel))\\n\'\n        rom_view_file += \'    ax_pressure_outlets.plot(data["time"],data["pressure"][vessel][-1]/1333.22,label="vessel_"+str(vessel))\\n\'\n        rom_view_file += \'ax_flow.set_xlabel("Time (sec)")\\n\'\n        rom_view_file += \'ax_flow.set_ylabel("Flow (mL/s)")\\n\'\n        rom_view_file += \'ax_pressure.set_xlabel("Time (sec)")\\n\'\n        rom_view_file += \'ax_pressure.set_ylabel("Pressure (mmHg)")\\n\'\n        rom_view_file += \'ax_flow_outlets.set_xlabel("Time (sec)")\\n\'\n        rom_view_file += \'ax_pressure_outlets.set_xlabel("Time (sec)")\\n\'\n        rom_view_file += \'ax_flow_outlets.set_ylabel("Flow (mL/s)")\\n\'\n        rom_view_file += \'ax_flow_outlets.set_title("Outlets Only")\\n\'\n        rom_view_file += \'ax_pressure_outlets.set_ylabel("Pressure (mmHg)")\\n\'\n        rom_view_file += \'ax_pressure_outlets.set_title("Outlets Only")\\n\'\n        rom_view_file += \'plt.show()\\n\'\n        rom_view.writelines([rom_view_file])\n        rom_view.close()\n    if {} == 1:\n        oneD_folder = \'{}\'\n        print(\'Locating OneDSovler executable...\')\n        import sv\n        from glob import glob\n        import shutil\n        if platform.system() == \'Windows\':\n            #search_path = sv.__path__[0].split(\'Python3.5\')[0]\n            search_path = \'C:\\\\Program Files\\\\SimVascular\'\n            files = glob(search_path+\'\\\\**\\\\svOneDSolver.exe\',recursive=True)\n            if len(files) > 0:\n                isfile = [os.path.isfile(f) for f in files]\n                only_files = [files[of] for of in isfile if of]\n                print(\'OneDSolver Found!\')\n                shutil.copy(only_files[0],oneD_folder)\n            else:\n                print(\'OneDSolver not found (will require user-specified executable location)\')\n        elif platform.system() == \'Linux\':\n            if \'simvascular\' not in sv.__path__[0]:\n                print(\'WARNING: Searching non-release build. OneDSolver not guarunteed to be installed.\')\n                print(\'Searching parent directory to simvascular build\')\n                search_dir = \'/usr/local/sv\'\n                files = glob(search_dir+\'/**/OneDSolver\',recursive=True)\n                if len(files) > 0:\n                    isfile = [os.path.isfile(f) for f in files]\n                    only_files = [files[of] for of in isfile if of]\n                    print(\'OneDSolver Found!\')\n                    shutil.copy(only_files[0],oneD_folder)\n                else:\n                    print(\'OneDSolver not found (will require user-specified executable location)\')\n            else:\n                #search_dir = sv.__path__[0].split(\'simvascular\')[0]\n                search_dir = \'/usr/local/sv\'\n                files = glob(search_dir+\'/**/OneDSolver\',recursive=True)\n                if len(files) > 0:\n                    isfile = [os.path.isfile(f) for f in files]\n                    only_files = [files[of] for of in isfile if of]\n                    print(\'OneDSolver Found!\')\n                    shutil.copy(only_files[0],oneD_folder)\n                else:\n                    print(\'OneDSolver not found (will require user-specified executable location)\')\n        elif platform.system() == \'Darwin\':\n            # We will just assume the search directory here\n            search_dir = \'/usr/local/sv\'\n            files = glob(search_dir+\'/**/OneDSolver\',recursive=True)\n            if len(files) > 0:\n                isfile = [os.path.isfile(f) for f in files]\n                only_files = [files[of] for of in isfile if of]\n                print(\'OneDSolver Found!\')\n                shutil.copy(only_files[0],oneD_folder)\n            else:\n                print(\'OneDSolver not found (will require user-specified executable location)\')\n', flow_file="if not terminating:\n    flow_file_3d = open('{}'+os.sep+'{}'+'_3d.flow','w+')\n    flow_file_rom = open('{}'+os.sep+'{}'+'_rom.flow','w+')\n    flow_file_lines_3d = []\n    flow_file_lines_rom = []\n    times = {}\n    flows = {}\n    for t,f in zip(times,flows):\n        flow_file_lines_3d.append(str(t)+' -'+str(f)+'\\n')\n        flow_file_lines_rom.append(str(t)+' '+str(f)+'\\n')\n    flow_file_3d.writelines(flow_file_lines_3d)\n    flow_file_rom.writelines(flow_file_lines_rom)\n    flow_file_3d.close()\n    flow_file_rom.close()\n")[source]

svcco.sv_interface.build_results module

svcco.sv_interface.centerline module

svcco.sv_interface.contour module

svcco.sv_interface.export_3d_only module

svcco.sv_interface.flow module

svcco.sv_interface.geometry module

svcco.sv_interface.get_sv_data module

svcco.sv_interface.get_sv_data.contour_check(interp_xyz, interp_r, t0, t1, radius_buffer, n_sides=4)[source]
svcco.sv_interface.get_sv_data.contour_check_all(interp_xyz, interp_r, radius_buffer)[source]
svcco.sv_interface.get_sv_data.contour_collision(x1, y1, z1, nx1, ny1, nz1, r1, x2, y2, z2, nx2, ny2, nz2, r2, radius_buffer, contours, t1, t2, n_sides=4)[source]

d1 = x1*nx1+y1*ny1+z1*nz1 d2 = x2*nx2+y2*ny2+z2*nz2 length = ((x2-x1)**2+(y2-y1)**2+(z2-z1)**2)**(1/2) if radius_buffer is not None:

r1 += radius_buffer*r1 r2 += radius_buffer*r2

if not np.isclose(nx1,0):

alpha = (nz1*nx2-nz2*nx1)/(ny2*nx1-ny1*nx2) beta = (d1*nx2-d2*nx1)/(ny2*nx1-ny1*nx2) c = ny1/nx1 a_pt = np.array([-d1/nx1-beta*c,beta,0]) pt1 = np.array([x1,y1,z1]) pt2 = np.array([x2,y2,z2]) n_line= np.array([-(alpha*c+nz1/nx1),alpha,1]) n_line=n_line/np.linalg.norm(n_line) dist1 = np.linalg.norm((pt1-a_pt)-np.dot(pt1-a_pt,n_line)*n_line) dist2 = np.linalg.norm((pt2-a_pt)-np.dot(pt2-a_pt,n_line)*n_line) print('dist1: {} r1: {}'.format(dist1,r1)) print('dist2: {} r2: {}'.format(dist2,r2)) if dist1 < r1 or dist2 < r2:

return True

else:

return False

elif not np.isclose(ny1,0):

alpha = (nz1*ny2-nz2*ny1)/(nx2*ny1-nx1*ny2) beta = (d1*ny2-d2*ny1)/(nx2*ny1-nx1*ny2) c = nx1/ny1 a_pt = np.array([beta,-d1/ny1-beta*c,0]) pt1 = np.array([x1,y1,z1]) pt2 = np.array([x2,y2,z2]) n_line= np.array([alpha,-(alpha*c+nz1/ny1),1]) n_line=n_line/np.linalg.norm(n_line) dist1 = np.linalg.norm((pt1-a_pt)-np.dot(pt1-a_pt,n_line)*n_line) dist2 = np.linalg.norm((pt2-a_pt)-np.dot(pt2-a_pt,n_line)*n_line) print('dist1: {} r1: {}'.format(dist1,r1)) print('dist2: {} r2: {}'.format(dist2,r2)) if dist1 < r1 or dist2 < r2:

return True

else:

return False

else:

return None

svcco.sv_interface.get_sv_data.get_alternate_path(data, seed_edge, reference=None)[source]
svcco.sv_interface.get_sv_data.get_branches(data)[source]
svcco.sv_interface.get_sv_data.get_interpolated_sv_data(data)[source]
svcco.sv_interface.get_sv_data.get_longest_path(data, seed_edge)[source]
svcco.sv_interface.get_sv_data.get_normals(data, branches)[source]
svcco.sv_interface.get_sv_data.get_normals_v1(data, branches)[source]
svcco.sv_interface.get_sv_data.get_points(data, branches)[source]
svcco.sv_interface.get_sv_data.get_points_v1(data, branches)[source]
svcco.sv_interface.get_sv_data.get_radii(data, branches)[source]
svcco.sv_interface.get_sv_data.get_radii_v1(data, branches)[source]
svcco.sv_interface.get_sv_data.get_sv_data(network)[source]
svcco.sv_interface.get_sv_data.get_truncated_interpolated_sv_data(data, radius=None, indicies=None)[source]
svcco.sv_interface.get_sv_data.optimize_contour(t0, t1, interp_xyz, interp_r, radius_buffer, t_buffer=0.1, n_sides=50)[source]
svcco.sv_interface.get_sv_data.pathpatch_2d_to_3d(pathpatch, z=0, normal='z')[source]

Transforms a 2D Patch to a 3D patch using the given normal vector.

The patch is projected into they XY plane, rotated about the origin and finally translated by z.

svcco.sv_interface.get_sv_data.pathpatch_translate(pathpatch, delta)[source]

Translates the 3D pathpatch by the amount delta.

svcco.sv_interface.get_sv_data.plot_branches(data, branches)[source]
svcco.sv_interface.get_sv_data.plot_frames(frames)[source]
svcco.sv_interface.get_sv_data.plot_interp_vessels(interp_xyz, interp_r, normals=True)[source]
svcco.sv_interface.get_sv_data.plot_path_contours(interp_xyz, interp_r, t_list, highlight=[])[source]
svcco.sv_interface.get_sv_data.plot_sv_data(data)[source]
svcco.sv_interface.get_sv_data.rotation_matrix(d)[source]

Calculates a rotation matrix given a vector d. The direction of d corresponds to the rotation axis. The length of d corresponds to the sin of the angle of rotation.

Variant of: http://mail.scipy.org/pipermail/numpy-discussion/2009-March/040806.html

svcco.sv_interface.get_sv_data.sv_data(interp_xyz, interp_r, radius_buffer=0.25)[source]
svcco.sv_interface.get_sv_data.swap_contour(interp_xyz, t_list, c_idx, radius_buffer)[source]
svcco.sv_interface.get_sv_data.swap_worst_contour(interp_xyz, t_list, radius_buffer, thresh=20)[source]
svcco.sv_interface.get_sv_data.truncate(data, radius=None, indicies=None)[source]

svcco.sv_interface.locate module

Locate Solver Files

svcco.sv_interface.locate.locate_0d_solver(windows_drive='C', linux_drive='\\')[source]
svcco.sv_interface.locate.locate_1d_solver(windows_drive='C', linux_drive='\\')[source]

svcco.sv_interface.loft module

svcco.sv_interface.mesh module

svcco.sv_interface.options module

class svcco.sv_interface.options.file_options(num_caps, time=[0, 1], flow=[1, 1], gui=True, distal_resistance=0)[source]

Bases: object

flow_parameters(inflow_file='inflow', time=[0, 1], flow=[1, 1])[source]
rom_parameters(inflow='inflow_rom.flow', zeroD=True, oneD=True, time_step=0.001, number_time_steps=1000)[source]
set_directories(outdir=None)[source]
set_geometry_options(number_samples=50, use_distance_alignment_method=True)[source]
set_loft_options(u_knot_span_type=None, v_parametric_span_type=None, u_parametric_span_type=None, v_knot_span_type=None, v_degree=None, u_degree=None, boundary_face_angle=45)[source]
set_mesh_options(global_edge_size=0.01, surface_mesh_flag=True, volume_mesh_flag=True, no_merge=False, optimization_level=5, minimum_dihedral_angle=18.0)[source]
set_pipeline_steps(files='all', gui=False)[source]
set_solid_options(num_caps, minimum_face_cells=200, hmin=0.02, hmax=0.02, face_edge_size=0.02, boundary_face_angle=45)[source]
simulation_parameters(svpre_name='cco', fluid_density=1.06, fluid_viscosity=0.04, initial_pressure=0, initial_velocity=[0.0001, 0.0001, 0.0001], bct_analytical_shape='parabolic', inflow_file='inflow', period=1, bct_point_number=2, fourier_mode=1, pressures=0, svsolver='solver', number_timesteps=200, timestep_size=0.02, number_restarts=50, number_force_surfaces=1, surface_id_force_calc=1, force_calc_method='Velocity Based', print_avg_solution=True, print_error_indicators=False, varying_time_from_file=True, step_construction='0 1 0 1', pressure_coupling='Implicit', backflow_stabilization=0.2, residual_control=True, residual_criteria=0.01, minimum_req_iter=2, svLS_type='NS', num_krylov=100, num_solves_per_left=1, tolerance_momentum=0.05, tolerance_continuity=0.4, tolerance_svLS_NS=0.4, max_iter_NS=2, max_iter_momentum=4, max_iter_continuity=400, time_integration_rule='Second Order', time_integration_rho=0.5, flow_advection_form='Convective', quadrature_interior=2, quadrature_boundary=3, procs=24, svpost='cco', start=0, vtu=True, vtp=False, vtkcombo=False, all_arg=True, wss=False, sim_units_mm=False, sim_units_cm=True, global_edge_size=0.01, distal_resistance=0)[source]

svcco.sv_interface.paths module

svcco.sv_interface.presolver module

svcco.sv_interface.rom module

svcco.sv_interface.setup module

svcco.sv_interface.solid module

svcco.sv_interface.solver module

svcco.sv_interface.sv_install_function module

Function for installing extra external packages from within the sv python interpreter

svcco.sv_interface.view_0d_result_plots module

svcco.sv_interface.waveform module

svcco.sv_interface.waveform.LAD_16_1_func = <scipy.interpolate.interpolate.interp1d object>
LAD_9_time = [0, 0.027369555, 0.052328558, 0.079667522, 0.110573369,

0.146228432, 0.183065828, 0.225848539, 0.261502072, 0.309033998, 0.349442866, 0.394602479, 0.433821365, 0.488485528, 0.536025102, 0.579997793, 0.629908151, 0.673880842, 0.719046573,

0.760653069, 0.80582033, 0.858110649, 0.910397909, 0.962689758, 1.023297706, 1.087469478, 1.140949778, 1.193238568, 1.25028575, 1.297823795, 1.353677938, 1.40003365]

LAD_9_flow = [1.331746984, 1.328502178, 1.383319731, 1.553672039, 1.78149674,

1.834986873, 1.656670043, 1.593445492, 1.589020757, 1.351461638, 1.404361806, 1.340842273, 1.335975064, 1.155445866, 1.207461087, 1.202003913, 1.02206468, 1.016607506, 1.184747446, 1.584989331, 1.811044139, 1.746639659, 1.566405443, 1.559915832, 1.436564046, 1.254854918, 1.248217815, 1.125898467, 1.176733759, 1.170834112, 1.04807229, 1.273979607]

svcco.sv_interface.waveform.LAD_22_2_func = <scipy.interpolate.interpolate.interp1d object>
LAD_16_1_time = [0, 0.01798278, 0.035815664, 0.052466216, 0.066736807,

0.081007398, 0.09765642, 0.115487775, 0.132126091, 0.153513622, 0.177278056, 0.198660999, 0.223613883, 0.250942141, 0.275895026, 0.303224813, 0.338872228, 0.373335781, 0.408981666, 0.448194435, 0.480279556, 0.513553128, 0.551578975, 0.593173234, 0.630006042, 0.657335829, 0.681112499, 0.701325345, 0.719164348, 0.737007939, 0.758416884, 0.778637378, 0.807170912, 0.839257562, 0.86658429, 0.891532586, 0.92480157, 0.959260534, 0.998473302, 1.041249895, 1.082839566, 1.12799459, 1.162452024, 1.20998701, 1.249202838, 1.291982489, 1.325249943, 1.359715025, 1.400134599]

LAD_16_1_flow = [5.791191827, 5.904956687, 6.134403792, 6.59565786, 6.941377174,

7.287096489, 7.690435689, 7.861967926, 7.859903049, 7.683503604, 7.506809176, 7.156665126, 6.979823207, 6.744771438, 6.567929519, 6.390792618, 6.15470841, 6.092516298, 5.798517222, 5.561990541, 5.442178543, 5.322219054, 5.143754732, 5.080677673, 4.728616238, 4.551479336, 4.838103853, 5.183085712, 5.644192289, 6.279043471, 6.913452178, 7.548008377, 7.949872666, 7.887975536, 7.595008899, 7.244422375, 6.950718282, 6.714781566, 6.478254884, 6.183370862, 5.946549198, 5.709285061, 5.415433477, 5.293704093, 5.173007148, 4.993952862, 4.6423339, 4.638056656, 5.096360901]

svcco.sv_interface.waveform.LAD_4500_func = <scipy.interpolate.interpolate.interp1d object>
LAD_66_7_time = [0, 0.01132623, 0.020844545, 0.025610586, 0.030378156,

0.036338766, 0.041109396, 0.047066947, 0.054216008, 0.060181207, 0.067328738, 0.07447627, 0.080432291, 0.087581352, 0.093535844, 0.101865709, 0.114944789, 0.128017751, 0.136332321, 0.144642301, 0.15176536, 0.160073811, 0.169570713, 0.176690713, 0.186187615, 0.194491478, 0.20398838, 0.215859125, 0.22773293, 0.239608263, 0.251482068, 0.263358931, 0.274045814, 0.288301109, 0.300174914, 0.314428679, 0.331059347, 0.348873878, 0.364313035, 0.382130625, 0.397569782, 0.415382783, 0.432011922, 0.44863953, 0.464077159, 0.481891689, 0.50327922, 0.522294438, 0.540119675, 0.556753402, 0.574569462, 0.590007091, 0.60544166, 0.619687778, 0.63037466, 0.645821466, 0.657707506, 0.668409685, 0.675551098, 0.682695571, 0.688653122, 0.694607613, 0.700565164, 0.706528833, 0.712489443, 0.719641564, 0.724415252, 0.730388098, 0.737544807, 0.744703046, 0.751856695, 0.759010345, 0.767353976, 0.774503037, 0.782840549, 0.789985021, 0.799498749, 0.811387848, 0.822082379, 0.831583869, 0.837516948, 0.845828458, 0.852948458, 0.86244383, 0.869562301, 0.879059203, 0.888553046, 0.898049948, 0.908735301, 0.921799086, 0.936051323, 0.951488951, 0.964552736, 0.977621109, 0.988309522, 1.002557169, 1.015620954, 1.031061641, 1.050064623, 1.063126878, 1.080942938, 1.09994592, 1.118950431, 1.137953412, 1.1533941, 1.166456355, 1.184272415, 1.202096123, 1.21872832, 1.236550498, 1.256749579, 1.271003344, 1.287627894, 1.301875541, 1.316124719, 1.330375425, 1.34463225, 1.357706742, 1.366033547, 1.374366471, 1.381512473, 1.388660004, 1.398185968]

LAD_66_7_flow = [23.6289712, 23.85945074, 24.26367489, 24.72640387, 25.24704772,

25.94128868, 26.57776226, 27.15617349, 27.85026696, 28.71825252, 29.35443113, 29.99060973, 30.51110609, 31.20519956, 31.66778104, 32.07215268, 32.30218975, 32.30056735, 32.12579031, 31.77726866, 31.48680937, 31.08037286, 30.67378885, 30.26749983, 29.86091582, 29.2807347, 28.8741507, 28.35144197, 27.94456298, 27.59559886, 27.18871987, 26.89767062, 26.54885399, 26.31542463, 25.90854564, 25.6172014, 25.32556219, 24.86003087, 24.45270941, 24.10300784, 23.69568637, 23.17224019, 22.82268611, 22.41521716, 21.94998083, 21.48444951, 21.30805007, 21.30569021, 21.24556297, 21.06975349, 20.66213705, 20.19690072, 19.61583465, 19.03491608, 18.68609945, 18.56835233, 18.62479228, 18.85512434, 19.25964346, 19.77999233, 20.35840356, 20.82098504, 21.39939627, 22.20946697, 22.90370793, 23.71363113, 24.46593445, 25.62349436, 26.60716217, 27.64874485, 28.51658292, 29.384421, 30.31002645, 31.00411992, 31.6980659, 32.21841476, 32.44889431, 32.621164, 32.56192171, 32.32908231, 31.98085565, 31.69024887, 31.28395984, 30.81946097, 30.35525708, 29.94867307, 29.42625933, 29.01967532, 28.61294383, 28.26383221, 27.91457311, 27.44933678, 27.10022517, 26.92485816, 26.6339564, 26.11095269, 25.76184108, 25.41243449, 24.94675569, 24.53972921, 24.13211276, 23.66643396, 23.25867002, 22.79299122, 22.44358463, 22.03655815, 21.6289417, 21.5108996, 21.27717525, 21.10121828, 20.92496632, 20.63362209, 20.1103234, 19.58731969, 19.12223085, 18.71505688, 18.53954238, 18.59583485, 18.88437675, 19.40457813, 19.98284186, 20.61902046, 21.31281895]

svcco.sv_interface.waveform.LAD_66_7_func = <scipy.interpolate.interpolate.interp1d object>
LAD_22_2_time = [0, 0.015764949, 0.027660167, 0.037181542, 0.046699858,

0.057409684, 0.065744137, 0.076453963, 0.087162259, 0.100247457, 0.112136557, 0.125211049, 0.137092501, 0.150160875, 0.162040797, 0.171540758, 0.183419151, 0.195294485, 0.205982898, 0.21667131, 0.230928135, 0.243994979, 0.257063352, 0.270133256, 0.28439008, 0.298645375, 0.314090651, 0.328347476, 0.346169654, 0.362801852, 0.38062403, 0.397257757, 0.416265327, 0.432897524, 0.453095075, 0.475667998, 0.494678628, 0.516067689, 0.537459809, 0.560037321, 0.577859499, 0.600429363, 0.624187679, 0.642011386, 0.662215055, 0.674104155, 0.68243096, 0.690759295, 0.699087631, 0.707420554, 0.716941929, 0.726466363, 0.734803875, 0.744328309, 0.755042723, 0.764565628, 0.774083943, 0.78717373, 0.80025434, 0.81214344, 0.825214873, 0.837093266, 0.851350091, 0.862038503, 0.872726915, 0.884603779, 0.897666034, 0.910732878, 0.926176625, 0.940433449, 0.955877196, 0.973699374, 0.992710003, 1.012907554, 1.029538222, 1.046170419, 1.062802616, 1.085378599, 1.107949993, 1.129334465, 1.151908918, 1.169728037, 1.194680922, 1.22320069, 1.249342025, 1.273106459, 1.29330248, 1.314683894, 1.334881444, 1.347952877, 1.36221582, 1.375297959, 1.386003197, 1.399091454]

LAD_22_2_flow = [11.6405935, 11.92839795, 12.33232712, 12.852381, 13.25660515,

13.77651154, 14.35462778, 14.87453417, 15.3365257, 15.79822224, 15.97049193, 16.0267844, 15.90947975, 15.73411274, 15.55889323, 15.26813896, 15.03500457, 14.68604045, 14.39513869, 14.10423693, 13.92872243, 13.69544056, 13.52007355, 13.40262141, 13.22710691, 12.99367754, 12.81801556, 12.64250106, 12.46654409, 12.23281974, 12.05686276, 11.88105328, 11.58911908, 11.35539474, 11.12122791, 10.82885124, 10.65274678, 10.5342622, 10.53160736, 10.41297529, 10.23701832, 9.828811909, 9.420458009, 9.302415905, 9.299908555, 9.472178248, 9.76072015, 10.10717692, 10.45363369, 10.97383507, 11.49388895, 12.12977257, 12.82371855, 13.45960217, 14.15325316, 14.73122192, 15.13544606, 15.77088721, 16.05883915, 16.23110884, 16.17157157, 15.93843718, 15.76292269, 15.47202092, 15.18111916, 14.89006991, 14.48304343, 14.24976156, 14.0161847, 13.8406702, 13.60709334, 13.43113637, 13.25503191, 13.02086508, 12.72922587, 12.49550152, 12.26177717, 12.08523023, 11.73493869, 11.44270951, 11.20824771, 10.916461, 10.73961908, 10.62024956, 10.44326014, 10.26656572, 9.974484027, 9.566425109, 9.332258287, 9.272721016, 9.32886599, 9.674732795, 10.02089458, 10.59842086]

svcco.sv_interface.waveform.generate_physiologic_wave(flow_value, diameter, time=[[0, 0.012707403, 0.022236425, 0.028206212, 0.03536751, 0.044919475, 0.054459204, 0.064003522, 0.074737821, 0.083081451, 0.090232042, 0.097373455, 0.105698731, 0.11639785, 0.123523968, 0.1330224, 0.138957008, 0.143698576, 0.150818576, 0.156751654, 0.163868595, 0.174546301, 0.182847104, 0.188775594, 0.199454829, 0.210135594, 0.222004809, 0.233877084, 0.24693781, 0.258811614, 0.273063851, 0.288499949, 0.303934518, 0.322932911, 0.33956205, 0.357371991, 0.372811149, 0.389437228, 0.407245641, 0.425058641, 0.441680132, 0.461865447, 0.479683036, 0.499880587, 0.518891216, 0.537906434, 0.552163259, 0.5628532, 0.57116471, 0.580663142, 0.592532358, 0.60202926, 0.610336182, 0.618644633, 0.624576181, 0.634077672, 0.643585281, 0.65309289, 0.660231244, 0.668562638, 0.674523248, 0.68167231, 0.688827489, 0.695982668, 0.701952455, 0.707920713, 0.713885912], [0, 0.01132623, 0.020844545, 0.025610586, 0.030378156, 0.036338766, 0.041109396, 0.047066947, 0.054216008, 0.060181207, 0.067328738, 0.07447627, 0.080432291, 0.087581352, 0.093535844, 0.101865709, 0.114944789, 0.128017751, 0.136332321, 0.144642301, 0.15176536, 0.160073811, 0.169570713, 0.176690713, 0.186187615, 0.194491478, 0.20398838, 0.215859125, 0.22773293, 0.239608263, 0.251482068, 0.263358931, 0.274045814, 0.288301109, 0.300174914, 0.314428679, 0.331059347, 0.348873878, 0.364313035, 0.382130625, 0.397569782, 0.415382783, 0.432011922, 0.44863953, 0.464077159, 0.481891689, 0.50327922, 0.522294438, 0.540119675, 0.556753402, 0.574569462, 0.590007091, 0.60544166, 0.619687778, 0.63037466, 0.645821466, 0.657707506, 0.668409685, 0.675551098, 0.682695571, 0.688653122, 0.694607613, 0.700565164, 0.706528833, 0.712489443, 0.719641564], [0, 0.015764949, 0.027660167, 0.037181542, 0.046699858, 0.057409684, 0.065744137, 0.076453963, 0.087162259, 0.100247457, 0.112136557, 0.125211049, 0.137092501, 0.150160875, 0.162040797, 0.171540758, 0.183419151, 0.195294485, 0.205982898, 0.21667131, 0.230928135, 0.243994979, 0.257063352, 0.270133256, 0.28439008, 0.298645375, 0.314090651, 0.328347476, 0.346169654, 0.362801852, 0.38062403, 0.397257757, 0.416265327, 0.432897524, 0.453095075, 0.475667998, 0.494678628, 0.516067689, 0.537459809, 0.560037321, 0.577859499, 0.600429363, 0.624187679, 0.642011386, 0.662215055, 0.674104155, 0.68243096, 0.690759295, 0.699087631, 0.707420554, 0.716941929], [0, 0.01798278, 0.035815664, 0.052466216, 0.066736807, 0.081007398, 0.09765642, 0.115487775, 0.132126091, 0.153513622, 0.198660999, 0.223613883, 0.250942141, 0.275895026, 0.303224813, 0.338872228, 0.408981666, 0.448194435, 0.480279556, 0.513553128, 0.551578975, 0.657335829, 0.681112499, 0.701325345, 0.719164348], [0, 0.079667522, 0.110573369, 0.146228432, 0.261502072, 0.394602479, 0.536025102, 0.629908151, 0.673880842, 0.719046573]], flow=[[30.40501077, 31.15657663, 31.96620486, 33.00793503, 34.16534744, 35.84369869, 37.05873099, 38.44750789, 39.89405217, 40.81965762, 41.57166596, 41.97618509, 42.20681213, 42.32131444, 42.14668489, 41.79801575, 41.50770396, 41.04379505, 40.63750602, 40.28927936, 39.7671606, 39.07085476, 38.37484391, 37.85287264, 37.21448167, 36.63400557, 36.05338197, 35.58858812, 35.12364677, 34.71676778, 34.36750868, 33.84435748, 33.26329141, 32.62386801, 32.27431392, 31.635038, 31.22771654, 30.76233272, 30.06514194, 29.54169576, 28.90256733, 28.20508156, 27.85537999, 27.62121316, 27.4451087, 27.44274884, 27.26723434, 27.03424745, 26.74364067, 26.39497153, 25.81434794, 25.40776394, 24.94341255, 24.53697604, 24.13083451, 23.8979951, 23.89681517, 23.89563524, 24.18432464, 24.64661114, 25.34085211, 26.03494558, 26.96069852, 27.88645146, 28.92818163, 29.91199693, 30.40501077], [23.6289712, 23.85945074, 24.26367489, 24.72640387, 25.24704772, 25.94128868, 26.57776226, 27.15617349, 27.85026696, 28.71825252, 29.35443113, 29.99060973, 30.51110609, 31.20519956, 31.66778104, 32.07215268, 32.30218975, 32.30056735, 32.12579031, 31.77726866, 31.48680937, 31.08037286, 30.67378885, 30.26749983, 29.86091582, 29.2807347, 28.8741507, 28.35144197, 27.94456298, 27.59559886, 27.18871987, 26.89767062, 26.54885399, 26.31542463, 25.90854564, 25.6172014, 25.32556219, 24.86003087, 24.45270941, 24.10300784, 23.69568637, 23.17224019, 22.82268611, 22.41521716, 21.94998083, 21.48444951, 21.30805007, 21.30569021, 21.24556297, 21.06975349, 20.66213705, 20.19690072, 19.61583465, 19.03491608, 18.68609945, 18.56835233, 18.62479228, 18.85512434, 19.25964346, 19.77999233, 20.35840356, 20.82098504, 21.39939627, 22.20946697, 22.90370793, 23.6289712], [11.6405935, 11.92839795, 12.33232712, 12.852381, 13.25660515, 13.77651154, 14.35462778, 14.87453417, 15.3365257, 15.79822224, 15.97049193, 16.0267844, 15.90947975, 15.73411274, 15.55889323, 15.26813896, 15.03500457, 14.68604045, 14.39513869, 14.10423693, 13.92872243, 13.69544056, 13.52007355, 13.40262141, 13.22710691, 12.99367754, 12.81801556, 12.64250106, 12.46654409, 12.23281974, 12.05686276, 11.88105328, 11.58911908, 11.35539474, 11.12122791, 10.82885124, 10.65274678, 10.5342622, 10.53160736, 10.41297529, 10.23701832, 9.828811909, 9.420458009, 9.302415905, 9.299908555, 9.472178248, 9.76072015, 10.10717692, 10.45363369, 10.97383507, 11.6405935], [5.791191827, 5.904956687, 6.134403792, 6.59565786, 6.941377174, 7.287096489, 7.690435689, 7.861967926, 7.859903049, 7.683503604, 7.156665126, 6.979823207, 6.744771438, 6.567929519, 6.390792618, 6.15470841, 5.798517222, 5.561990541, 5.442178543, 5.322219054, 5.143754732, 4.551479336, 4.838103853, 5.183085712, 5.791191827], [1.331746984, 1.553672039, 1.78149674, 1.834986873, 1.589020757, 1.340842273, 1.207461087, 1.02206468, 1.016607506, 1.331746984]], normalize_time=False, one_cycle=True, n_time_points=50, min_buffer=0.05, pulse_by_diameter=False)[source]
svcco.sv_interface.waveform.wave(mean_flow, diameter, time=[[0, 0.012707403, 0.022236425, 0.028206212, 0.03536751, 0.044919475, 0.054459204, 0.064003522, 0.074737821, 0.083081451, 0.090232042, 0.097373455, 0.105698731, 0.11639785, 0.123523968, 0.1330224, 0.138957008, 0.143698576, 0.150818576, 0.156751654, 0.163868595, 0.174546301, 0.182847104, 0.188775594, 0.199454829, 0.210135594, 0.222004809, 0.233877084, 0.24693781, 0.258811614, 0.273063851, 0.288499949, 0.303934518, 0.322932911, 0.33956205, 0.357371991, 0.372811149, 0.389437228, 0.407245641, 0.425058641, 0.441680132, 0.461865447, 0.479683036, 0.499880587, 0.518891216, 0.537906434, 0.552163259, 0.5628532, 0.57116471, 0.580663142, 0.592532358, 0.60202926, 0.610336182, 0.618644633, 0.624576181, 0.634077672, 0.643585281, 0.65309289, 0.660231244, 0.668562638, 0.674523248, 0.68167231, 0.688827489, 0.695982668, 0.701952455, 0.707920713, 0.713885912], [0, 0.01132623, 0.020844545, 0.025610586, 0.030378156, 0.036338766, 0.041109396, 0.047066947, 0.054216008, 0.060181207, 0.067328738, 0.07447627, 0.080432291, 0.087581352, 0.093535844, 0.101865709, 0.114944789, 0.128017751, 0.136332321, 0.144642301, 0.15176536, 0.160073811, 0.169570713, 0.176690713, 0.186187615, 0.194491478, 0.20398838, 0.215859125, 0.22773293, 0.239608263, 0.251482068, 0.263358931, 0.274045814, 0.288301109, 0.300174914, 0.314428679, 0.331059347, 0.348873878, 0.364313035, 0.382130625, 0.397569782, 0.415382783, 0.432011922, 0.44863953, 0.464077159, 0.481891689, 0.50327922, 0.522294438, 0.540119675, 0.556753402, 0.574569462, 0.590007091, 0.60544166, 0.619687778, 0.63037466, 0.645821466, 0.657707506, 0.668409685, 0.675551098, 0.682695571, 0.688653122, 0.694607613, 0.700565164, 0.706528833, 0.712489443, 0.719641564], [0, 0.015764949, 0.027660167, 0.037181542, 0.046699858, 0.057409684, 0.065744137, 0.076453963, 0.087162259, 0.100247457, 0.112136557, 0.125211049, 0.137092501, 0.150160875, 0.162040797, 0.171540758, 0.183419151, 0.195294485, 0.205982898, 0.21667131, 0.230928135, 0.243994979, 0.257063352, 0.270133256, 0.28439008, 0.298645375, 0.314090651, 0.328347476, 0.346169654, 0.362801852, 0.38062403, 0.397257757, 0.416265327, 0.432897524, 0.453095075, 0.475667998, 0.494678628, 0.516067689, 0.537459809, 0.560037321, 0.577859499, 0.600429363, 0.624187679, 0.642011386, 0.662215055, 0.674104155, 0.68243096, 0.690759295, 0.699087631, 0.707420554, 0.716941929], [0, 0.01798278, 0.035815664, 0.052466216, 0.066736807, 0.081007398, 0.09765642, 0.115487775, 0.132126091, 0.153513622, 0.198660999, 0.223613883, 0.250942141, 0.275895026, 0.303224813, 0.338872228, 0.408981666, 0.448194435, 0.480279556, 0.513553128, 0.551578975, 0.657335829, 0.681112499, 0.701325345, 0.719164348], [0, 0.079667522, 0.110573369, 0.146228432, 0.261502072, 0.394602479, 0.536025102, 0.629908151, 0.673880842, 0.719046573]], flow=[[30.40501077, 31.15657663, 31.96620486, 33.00793503, 34.16534744, 35.84369869, 37.05873099, 38.44750789, 39.89405217, 40.81965762, 41.57166596, 41.97618509, 42.20681213, 42.32131444, 42.14668489, 41.79801575, 41.50770396, 41.04379505, 40.63750602, 40.28927936, 39.7671606, 39.07085476, 38.37484391, 37.85287264, 37.21448167, 36.63400557, 36.05338197, 35.58858812, 35.12364677, 34.71676778, 34.36750868, 33.84435748, 33.26329141, 32.62386801, 32.27431392, 31.635038, 31.22771654, 30.76233272, 30.06514194, 29.54169576, 28.90256733, 28.20508156, 27.85537999, 27.62121316, 27.4451087, 27.44274884, 27.26723434, 27.03424745, 26.74364067, 26.39497153, 25.81434794, 25.40776394, 24.94341255, 24.53697604, 24.13083451, 23.8979951, 23.89681517, 23.89563524, 24.18432464, 24.64661114, 25.34085211, 26.03494558, 26.96069852, 27.88645146, 28.92818163, 29.91199693, 30.40501077], [23.6289712, 23.85945074, 24.26367489, 24.72640387, 25.24704772, 25.94128868, 26.57776226, 27.15617349, 27.85026696, 28.71825252, 29.35443113, 29.99060973, 30.51110609, 31.20519956, 31.66778104, 32.07215268, 32.30218975, 32.30056735, 32.12579031, 31.77726866, 31.48680937, 31.08037286, 30.67378885, 30.26749983, 29.86091582, 29.2807347, 28.8741507, 28.35144197, 27.94456298, 27.59559886, 27.18871987, 26.89767062, 26.54885399, 26.31542463, 25.90854564, 25.6172014, 25.32556219, 24.86003087, 24.45270941, 24.10300784, 23.69568637, 23.17224019, 22.82268611, 22.41521716, 21.94998083, 21.48444951, 21.30805007, 21.30569021, 21.24556297, 21.06975349, 20.66213705, 20.19690072, 19.61583465, 19.03491608, 18.68609945, 18.56835233, 18.62479228, 18.85512434, 19.25964346, 19.77999233, 20.35840356, 20.82098504, 21.39939627, 22.20946697, 22.90370793, 23.6289712], [11.6405935, 11.92839795, 12.33232712, 12.852381, 13.25660515, 13.77651154, 14.35462778, 14.87453417, 15.3365257, 15.79822224, 15.97049193, 16.0267844, 15.90947975, 15.73411274, 15.55889323, 15.26813896, 15.03500457, 14.68604045, 14.39513869, 14.10423693, 13.92872243, 13.69544056, 13.52007355, 13.40262141, 13.22710691, 12.99367754, 12.81801556, 12.64250106, 12.46654409, 12.23281974, 12.05686276, 11.88105328, 11.58911908, 11.35539474, 11.12122791, 10.82885124, 10.65274678, 10.5342622, 10.53160736, 10.41297529, 10.23701832, 9.828811909, 9.420458009, 9.302415905, 9.299908555, 9.472178248, 9.76072015, 10.10717692, 10.45363369, 10.97383507, 11.6405935], [5.791191827, 5.904956687, 6.134403792, 6.59565786, 6.941377174, 7.287096489, 7.690435689, 7.861967926, 7.859903049, 7.683503604, 7.156665126, 6.979823207, 6.744771438, 6.567929519, 6.390792618, 6.15470841, 5.798517222, 5.561990541, 5.442178543, 5.322219054, 5.143754732, 4.551479336, 4.838103853, 5.183085712, 5.791191827], [1.331746984, 1.553672039, 1.78149674, 1.834986873, 1.589020757, 1.340842273, 1.207461087, 1.02206468, 1.016607506, 1.331746984]], diam=[0.45, 0.00667, 0.00222, 0.00161, 0.0009], n_time_points=50)[source]

Module contents