Geometry module (geometry.f90)¶
Module geometry
¶
Description
Brief Description: This module handles all geometry read/write/tree generation.
LICENSE:
Full Description:
This module handles all geometry read/write/generation.
Quick access
Needed modules
arrays
: Brief Description: This module defines arrays.precision
: Brief Description: Defines the precision of real parameters.mesh_utilities
diagnostics
indices
other_consts
Variables
Subroutines and functions
-
subroutine
geometry/
allocate_node_arrays
(num_nodes)¶ allocate_node_arrays: allocate memory for arrays associated with 1D trees
Parameters: num_nodes [integer,in] Called from: define_node_geometry()
Call to: enter_exit()
-
subroutine
geometry/
add_mesh
(airway_meshfile)¶ - add_mesh: Reads in an ipmesh file and adds this mesh to the terminal
- branches of an existing tree geometry
Parameters: airway_meshfile [character(len=max_filename_len),in] Call to: enter_exit()
,reallocate_node_elem_arrays()
,element_connectivity_1d()
,evaluate_ordering()
-
subroutine
geometry/
add_matching_mesh
()¶ add_matching_mesh:
Call to: enter_exit()
,reallocate_node_elem_arrays()
-
subroutine
geometry/
append_units
()¶ append_units: Appends terminal units at the end of a tree structure
Called from: two_unit_test()
Call to: enter_exit()
-
subroutine
geometry/
define_1d_elements
(elemfile)¶ define_1d_elements: Reads in an 1D element ipelem file to define a geometry
Parameters: elemfile [character(len=max_filename_len),in] Call to: enter_exit()
,get_final_integer()
,get_local_node()
,element_connectivity_1d()
,evaluate_ordering()
-
subroutine
geometry/
define_elem_geometry_2d
(elemfile, sf_option)¶ Reads in 2D ipelem file.
Parameters: - elemfile [character(len=*)]
- sf_option [character(len=4)]
Call to: enter_exit()
,get_final_integer()
,get_four_nodes()
,element_connectivity_2d()
,line_segments_for_2d_mesh()
-
subroutine
geometry/
define_mesh_geometry_test
()¶ define_mesh_geometry_test:
Call to: enter_exit()
,element_connectivity_1d()
,evaluate_ordering()
-
subroutine
geometry/
define_node_geometry
(nodefile)¶ define_node_geometry: Reads in an ipnode file to define a tree geometry
Parameters: nodefile [character(len=max_filename_len),in] :: Input nodefile Call to: enter_exit()
,get_final_integer()
,allocate_node_arrays()
,get_final_real()
-
subroutine
geometry/
define_node_geometry_2d
(nodefile)¶ define_node_geometry_2d: Reads in an ipnode file to define surface nodes
Parameters: nodefile [character(len=*),in] Call to: enter_exit()
,get_final_integer()
,get_final_real()
-
subroutine
geometry/
define_data_geometry
(datafile)¶ define_data_geometry: reads data points from a file
Parameters: datafile [character(len=*)] Call to: enter_exit()
-
subroutine
geometry/
import_node_geometry_2d
(nodefile)¶ define_node_geometry_2d: Reads in an exnode file to define surface nodes DEC$ ATTRIBUTES DLLEXPORT,ALIAS:”SO_DEFINE_NODE_GEOMETRY_2D” :: DEFINE_NODE_GEOMETRY_2D
Parameters: nodefile [character(len=*),in] Call to: enter_exit()
,get_final_integer()
-
subroutine
geometry/
import_ply_triangles
(ply_file)¶ - import_ply_triangles: Reads in vtk ply file with list of vertex coordinates
- and triangles. Used instead of internal triangle mesh creation for tree growing Writes over any existing triangle mesh.
Parameters: ply_file [character(len=*),in] Call to: enter_exit()
-
subroutine
geometry/
triangles_from_surface
(surface_elems)¶ - triangles_from_surface: generates a linear surface mesh of triangles
- from an existing high order surface mesh.
Parameters: surface_elems (*) [integer,in] Called from: make_data_grid()
,grow_tree()
Call to: enter_exit()
,coord_at_xi()
-
subroutine
geometry/
group_elem_parent_term
(parent_list, ne_parent)¶ - group_elem_parent_term: group the terminal elements that sit distal to
- a given parent element (ne_parent)
Parameters: - parent_list (*) [integer] :: will contain terminal elements below ne_parent on exit
- ne_parent [integer,in] :: the parent element number
Use : mesh_utilities
(group_elem_by_parent()
)Called from: grow_tree()
Call to: enter_exit()
,group_elem_by_parent()
-
subroutine
geometry/
make_data_grid
(surface_elems, offset, spacing, filename, groupname)¶ - make_data_grid: makes a regularly-spaced 3D grid of data points to
- fill a bounding surface
Parameters: - surface_elems (*) [integer,in]
- offset [real,in]
- spacing [real,in]
- filename [character(len=*),in]
- groupname [character(len=*),in]
Call to: enter_exit()
,get_local_elem_2d()
,triangles_from_surface()
,volume_internal_to_surface()
,point_internal_to_surface()
-
subroutine
geometry/
make_2d_vessel_from_1d
(elem_list)¶ - make_2d_vessel_from_1d: create a surface mesh that aligns with the
- centrelines of a 1D tree, and located at distance ‘radius’ from the centre. a template for a set of 5 nodes (that together define a bifurcation) is scaled, rotated, translated to align with the 1d mesh and its radii.
Parameters: elem_list (*) [integer,in] :: the global stem element number for the 2d mesh Call to: enter_exit()
,mesh_2d_from_1d_generic()
,get_local_elem_1d()
,mesh_rotate_about_axis()
,mesh_rotate_vector_about_axis()
,bifurcation_element()
,stem_element()
,which_child()
,distance_between_points()
,mesh_2d_from_1d_crux()
,angle_btwn_points()
,unit_vector()
,angle_btwn_vectors()
,element_connectivity_2d()
,line_segments_for_2d_mesh()
,redistribute_mesh_nodes_2d_from_1d()
,merge_2d_from_1d_mesh()
,merge_trifurcations()
-
subroutine
geometry/
mesh_2d_from_1d_generic
(template_coords)¶ - mesh_2d_from_1d_generic: provide the coordinates of the templated nodes
- for a surface mesh creation about a 1d tree mesh
Parameters: template_coords (,,*,*) [real] :: side node Called from: make_2d_vessel_from_1d()
Call to: enter_exit()
-
subroutine
geometry/
mesh_rotate_about_axis
(ne, angle_z, rx, ry, txyz, template_coords)¶ - mesh_rotate_about_axis: calculates the rotation matrices and z-angle for
- rotation of a vector about an arbitrary axis defined by the direction of element ne.
Parameters: - ne [integer,in]
- angle_z [real]
- rx (,) [real] :: x-x = 1
- ry (,) [real] :: x-x = 1
- txyz (*) [real]
- template_coords (,,*,*) [real,in] :: direction to the ‘side’ node
Called from: Call to: enter_exit()
,make_plane_from_3points()
,unit_vector()
,scalar_product_3()
-
subroutine
geometry/
mesh_rotate_vector_about_axis
(n, template_vrsns, angle, length, radius, radius_weighted, rx, ry, txyz, template_coords, new_coords_derivs)¶ - mesh_rotate_vector_about_axis: rotates a vector (starting at (0,0,0))
- about an arbitrary axis. Rotation matrices are in Rx and Ry.
Parameters: - angle [real,in] :: is the amount to rotate about z-axis.
- n [integer,in] :: each node in ring, plus crux if at bifurcation
- template_vrsns (*) [integer,in]
- length [real,in]
- radius [real,in]
- radius_weighted [real,in]
- rx (3,3) [real,in]
- ry (3,3) [real,in]
- txyz (3) [real,in]
- template_coords (,,*,*) [real,in]
- new_coords_derivs (,,*,*) [real]
Called from: Call to: enter_exit()
-
subroutine
geometry/
mesh_2d_from_1d_crux
(np0, ne_1, ne_2, distance, new_coords_derivs)¶ - mesh_2d_from_1d_crux: adjusts the location of the crux node for deriving
- a 2d surface mesh over a 1d tree mesh.
Parameters: - np0 [integer,in]
- ne_1 [integer,in]
- ne_2 [integer,in]
- distance [real]
- new_coords_derivs (,,*,*) [real]
Called from: Call to: enter_exit()
,cross_product()
,unit_vector()
,scalar_product_3()
,mesh_a_x_eq_b()
-
subroutine
geometry/
merge_2d_from_1d_mesh
()¶ - merge_2d_from_1d_mesh: used for deriving a 2d surface mesh over a 1d
- tree mesh. merges the elements in the ‘rings’ that are adjacent to the bifurcations in the +Xi2 direction
Called from: make_2d_vessel_from_1d()
Call to: enter_exit()
-
subroutine
geometry/
merge_trifurcations
(short_elements)¶ - merge_trifurcations: used when deriving a 2d surface mesh from a 1d tree
- mesh. merges short 2d elements with neighbouring elements, and removes. this is required for two bifurcations that occur with a very short distance between them. i.e. when approximately a trifurcation.
Parameters: short_elements (*) [integer,in] Called from: make_2d_vessel_from_1d()
Call to: enter_exit()
-
subroutine
geometry/
define_rad_from_file
(fieldfile[, radius_type_in])¶ - define_rad_from_file: reads in a radius field associated with an
- airway tree and assigns radius information to each element, also calculates volume of each element
Parameters: fieldfile [character(len=max_filename_len),in] Options: radius_type_in [character(len=max_string_len)] Call to: enter_exit()
,get_final_integer()
,get_local_node()
,get_final_real()
,get_local_elem_1d()
-
subroutine
geometry/
define_rad_from_geom
(order_system, control_param, start_from, user_rad[, group_type_in[, group_option_in]])¶ - define_rad_from_geom: Defines vessel or airway radius based on
- their geometric structure. For ‘order_system’ == ‘strah’ or ‘horsf’, uses a user-defined maximum radius and branching ratio; for == ‘fit’, uses pre- defined radii (read in) and a calculated branching ratio for each path so that the order 1 branches have radius = USER_RAD.
Parameters: - order_system [character(len=*),in]
- control_param [real,in]
- start_from [character(len=*),in]
- user_rad [real,in] :: radius of largest branch when order_system
Options: - group_type_in [character(len=*)]
- group_option_in [character(len=*)]
Call to: enter_exit()
-
subroutine
geometry/
element_connectivity_1d
()¶ - element_connectivity_1d: Calculates element connectivity in 1D and
- stores in array elem_cnct
Called from: add_mesh()
,define_1d_elements()
,define_mesh_geometry_test()
,grow_tree()
Call to: enter_exit()
-
subroutine
geometry/
element_connectivity_2d
()¶ - element_connectivity_2d: Calculates element connectivity in 2D and
- stores in array elem_cnct_2d
Called from: define_elem_geometry_2d()
,make_2d_vessel_from_1d()
Call to: enter_exit()
,inlist()
-
subroutine
geometry/
line_segments_for_2d_mesh
(sf_option)¶ line_segments_for_2d_mesh: set up the line segment arrays for a 2d mesh
Parameters: sf_option [character(len=4),in] Called from: define_elem_geometry_2d()
,make_2d_vessel_from_1d()
Call to: enter_exit()
,inlist()
,calc_scale_factors_2d()
-
subroutine
geometry/
evaluate_ordering
()¶ - evaluate_ordering: calculates generations, Horsfield orders,
- Strahler orders for a given tree
Called from: add_mesh()
,define_1d_elements()
,define_mesh_geometry_test()
,grow_tree()
Call to: enter_exit()
-
subroutine
geometry/
set_initial_volume
(gdirn, cov, total_volume, rmax, rmin)¶ - set_initial_volume: assigns a volume to terminal units appended on a
- tree structure based on an assumption of a linear gradient in the gravitational direction with max, min, and COV values defined.
Parameters: - gdirn [integer,in]
- cov [real,in]
- total_volume [real,in]
- rmax [real,in]
- rmin [real,in]
Called from: evaluate_vent()
Call to: enter_exit()
,volume_of_mesh()
-
subroutine
geometry/
volume_of_mesh
(volume_model, volume_tree)¶ - volume_of_mesh: calculates the volume of an airway mesh including
- conducting and respiratory airways
Parameters: - volume_model [real]
- volume_tree [real]
Called from: solve_gasmix()
,airway_mesh_deform()
,set_initial_volume()
,evaluate_vent()
,evaluate_vent_step()
,evaluate_uniform_flow()
Call to: enter_exit()
-
subroutine
geometry/
write_geo_file
(type_bn, filename)¶ - write_geo_file: converts a surface mesh (created using make_2d_vessel_from_1d)
into a gmsh formatted mesh and writes to file. options on ‘type’: 1== single layered surface mesh of the vessel wall
2== double-layered thick-walled volume mesh of vessel wall 3== volume mesh of vessel lumen
Parameters: - type_bn [integer,in]
- filename [character(len=*),in]
Call to: enter_exit()
,write_surface_geo()
,geo_node_offset()
,geo_entry_exit_cap()
,write_3d_geo()
-
function
geometry/
get_final_real
(string_bn)¶ Return: get_final_real [real] :: return the real value Parameters: string_bn [character(len=*),in] Called from: define_node_geometry()
,define_node_geometry_2d()
,define_rad_from_file()
,import_exelemfield()
-
subroutine
geometry/
get_final_string
(string_bn, rtemp)¶ - get_final_string: gets the last set of characters surrounded
- by whitespace in a string
Parameters: - string_bn [character(len=*),in]
- rtemp [real,out] :: apply sign to number
Call to: enter_exit()
-
subroutine
geometry/
get_local_node
(np_global, np_local)¶ get_local_node: gets the local node number for a given global node
Parameters: - np_global [integer,in]
- np_local [integer,out]
Called from: Call to: enter_exit()
-
function
geometry/
get_parent_branch
(ne)¶ gets the elements number of the first proximal element that is a different generation number to the current elements
Parameters: ne [integer,in] Return: get_parent_branch [integer]
-
subroutine
geometry/
geo_entry_exit_cap
(element_spline, ifile, ncount_loop, ncount_spline, np_offset, nl_offset)¶ Parameters: - element_spline (,) [integer,in]
- ifile [integer,in]
- ncount_loop [integer]
- ncount_spline [integer] :: first new line
- np_offset [integer,in]
- nl_offset [integer,in]
Called from: Call to: enter_exit()
-
subroutine
geometry/
geo_node_offset
(node_xyz_offset)¶ Parameters: node_xyz_offset (,) [real] Called from: write_geo_file()
Call to: enter_exit()
,distance_between_points()
,direction_point_to_point()
-
subroutine
geometry/
reallocate_node_elem_arrays
(num_elems_new, num_nodes_new)¶ - reallocate_node_elem_arrays: Reallocates the size of geometric
- arrays when modifying geometries
Parameters: - num_elems_new [integer,in]
- num_nodes_new [integer,in]
Use : indices
Called from: add_mesh()
,add_matching_mesh()
,grow_tree()
Call to: enter_exit()
-
function
geometry/
get_local_node_f
(ndimension, np_global)¶ Parameters: - ndimension [integer,in]
- np_global [integer,in]
Return: get_local_node [integer]
Called from: get_four_nodes()
,define_geometry_fit()
,map_versions()
,distribute_surface_node_fit()
,distribute_nodes_between()
,centre_a_node()
-
function
geometry/
get_final_integer
(string_bn)¶ Return: get_final_integer [integer] :: return the integer value Parameters: string_bn [character(len=*),in] Called from: define_1d_elements()
,define_elem_geometry_2d()
,define_node_geometry()
,define_node_geometry_2d()
,import_node_geometry_2d()
,define_rad_from_file()
-
subroutine
geometry/
get_four_nodes
(ne, string_bn)¶ Parameters: - ne [integer,in]
- string_bn [character(len=132),in]
Called from: Call to: enter_exit()
,get_local_node_f()
-
subroutine
geometry/
redistribute_mesh_nodes_2d_from_1d
()¶ Called from: make_2d_vessel_from_1d()
Call to: enter_exit()
,distance_from_plane_to_point()
,distance_between_points()
,unit_vector()
-
function
geometry/
coord_at_xi
(ne, xi, basis)¶ Parameters: - ne [integer,in]
- xi (*) [real,in] :: xi^3-2xi^2+xi
- basis [character(len=*),in]
Return: coord_at_xi (3) [real]
Called from: export_cubic_lagrange_2d()
,triangles_from_surface()
,coord_at_xi()
Call to:
-
function
geometry/
get_local_elem
(ne_global)¶ Parameters: ne_global [integer,in] Return: get_local_elem [integer]
-
function
geometry/
get_local_elem_1d
(ne_global)¶ Parameters: ne_global [integer,in] Return: get_local_elem_1d [integer] Called from: make_2d_vessel_from_1d()
,define_rad_from_file()
-
function
geometry/
where_inlist
(item, ilist)¶ Parameters: - item [integer]
- ilist (*) [integer]
Return: where_inlist [integer]
-
subroutine
geometry/
write_elem_geometry_2d
(elemfile)¶ Parameters: elemfile [character(len=*),in] Call to: enter_exit()
-
subroutine
geometry/
write_node_geometry_2d
(nodefile)¶ Parameters: nodefile [character(len=*),in] Call to: enter_exit()
-
subroutine
geometry/
write_surface_geo
(element_spline, elem_surfaces, ifile, ncount_point, ncount_loop, ncount_spline, np_offset)¶ Parameters: - element_spline (,) [integer]
- elem_surfaces (,) [integer]
- ifile [integer]
- ncount_point [integer]
- ncount_loop [integer]
- ncount_spline [integer]
- np_offset [integer]
Called from: Call to: enter_exit()
-
subroutine
geometry/
write_3d_geo
(element_spline, elem_surfaces, ifile, ncount_point, ncount_loop, ncount_spline)¶ Parameters: - element_spline (,) [integer]
- elem_surfaces (,) [integer]
- ifile [integer,in]
- ncount_point [integer] :: record the centre point number for this ‘ring’
- ncount_loop [integer]
- ncount_spline [integer] :: the newest line
Called from: Call to: enter_exit()