gel.scripts.get_veh
Creates mesh with indications of which elements are in event horizon
1"""Creates mesh with indications of which elements are in event horizon""" 2import argparse 3import os 4os.environ["SUPPRESS_ADJOINT"] = "1" 5from gel import * 6 7 8def get_veh(cell_data_dir, u_exp_file, directory, cutoff=0.38, 9 bci=None, bco=None): 10 """Creates .pvd (and support files) with event horizon indication. 11 12 * `cell_data_dir`: str path to directory with files needed by 13 `gel.geometry.Geometry` 14 * `u_exp_file`: str path to full-shape .xdmf file with displacements 15 "u" to use in determining event horizon 16 * `directory`: str path to directory within which to create new 17 files 18 * `cutoff`: float displacement magnitude in microns to use as event 19 horizon cutoff value 20 * `bci`: str or None. Override path to the inner cell-surface BC .vtk; 21 when None, `gel.geometry.Geometry` defaults to `cell_data_dir/bci.vtk` 22 * `bco`: str or None. Override path to the outer boundary BC .vtk 23 24 Side-effects: creates "u_regions_{cutoff}.pvd" and support files 25 with element-wise data having event horizon tags from 26 `gel.geometry.Geometry` 27 """ 28 geo = Geometry( 29 cell_data_dir, 30 u_magnitude_subdomains_file=u_exp_file, 31 detectable_u_cutoff=cutoff, 32 bci_data=bci, 33 bco_data=bco 34 ) 35 filename = os.path.join(directory, f"u_regions_{cutoff}.pvd") 36 File(filename) << geo.dx.subdomain_data() 37 38 39def get_veh_main(): 40 """The function invoked by the command. Parses arguments and passes 41 to `get_veh`. 42 """ 43 parser = argparse.ArgumentParser( 44 description="Obtain a mesh indicating which cells are counted" 45 " as being within the event horizon for visualization." 46 ) 47 parser.add_argument( 48 "-c", 49 type=str, 50 metavar="CELL_DATA", 51 help="directory containing gel geometry" 52 ) 53 parser.add_argument( 54 "-i", 55 type=str, 56 metavar="INPUT_FULL_SHAPE", 57 help="full-shape 1st order Lagrange .xdmf file with " 58 "displacements 'u'" 59 ) 60 parser.add_argument( 61 "-o", 62 type=str, 63 metavar="OUTPUT_DIR", 64 help="result will be saved as " 65 "OUTPUT_DIR/u_regions_{THRESHOLD}.pvd and supporting files" 66 ) 67 parser.add_argument( 68 "-t", 69 type=float, 70 metavar="THRESHOLD", 71 default=0.38, 72 help="threshold by which VEH is determined in microns" 73 ) 74 parser.add_argument( 75 "--bci", 76 type=str, 77 metavar="CELL_SURF_MESH", 78 default=None, 79 help="override path to inner cell-surface BC .vtk (default: -c dir's " 80 "bci.vtk)" 81 ) 82 parser.add_argument( 83 "--bco", 84 type=str, 85 metavar="OUTER_SURF_MESH", 86 default=None, 87 help="override path to outer boundary BC .vtk (default: -c dir's " 88 "bco.vtk)" 89 ) 90 args = parser.parse_args() 91 92 get_veh(args.c, args.i, args.o, args.t, args.bci, args.bco) 93 94 95if __name__=="__main__": 96 get_veh_main()
def
get_veh( cell_data_dir, u_exp_file, directory, cutoff=0.38, bci=None, bco=None):
9def get_veh(cell_data_dir, u_exp_file, directory, cutoff=0.38, 10 bci=None, bco=None): 11 """Creates .pvd (and support files) with event horizon indication. 12 13 * `cell_data_dir`: str path to directory with files needed by 14 `gel.geometry.Geometry` 15 * `u_exp_file`: str path to full-shape .xdmf file with displacements 16 "u" to use in determining event horizon 17 * `directory`: str path to directory within which to create new 18 files 19 * `cutoff`: float displacement magnitude in microns to use as event 20 horizon cutoff value 21 * `bci`: str or None. Override path to the inner cell-surface BC .vtk; 22 when None, `gel.geometry.Geometry` defaults to `cell_data_dir/bci.vtk` 23 * `bco`: str or None. Override path to the outer boundary BC .vtk 24 25 Side-effects: creates "u_regions_{cutoff}.pvd" and support files 26 with element-wise data having event horizon tags from 27 `gel.geometry.Geometry` 28 """ 29 geo = Geometry( 30 cell_data_dir, 31 u_magnitude_subdomains_file=u_exp_file, 32 detectable_u_cutoff=cutoff, 33 bci_data=bci, 34 bco_data=bco 35 ) 36 filename = os.path.join(directory, f"u_regions_{cutoff}.pvd") 37 File(filename) << geo.dx.subdomain_data()
Creates .pvd (and support files) with event horizon indication.
cell_data_dir: str path to directory with files needed bygel.geometry.Geometryu_exp_file: str path to full-shape .xdmf file with displacements "u" to use in determining event horizondirectory: str path to directory within which to create new filescutoff: float displacement magnitude in microns to use as event horizon cutoff valuebci: str or None. Override path to the inner cell-surface BC .vtk; when None,gel.geometry.Geometrydefaults tocell_data_dir/bci.vtkbco: str or None. Override path to the outer boundary BC .vtk
Side-effects: creates "u_regions_{cutoff}.pvd" and support files
with element-wise data having event horizon tags from
gel.geometry.Geometry
def
get_veh_main():
40def get_veh_main(): 41 """The function invoked by the command. Parses arguments and passes 42 to `get_veh`. 43 """ 44 parser = argparse.ArgumentParser( 45 description="Obtain a mesh indicating which cells are counted" 46 " as being within the event horizon for visualization." 47 ) 48 parser.add_argument( 49 "-c", 50 type=str, 51 metavar="CELL_DATA", 52 help="directory containing gel geometry" 53 ) 54 parser.add_argument( 55 "-i", 56 type=str, 57 metavar="INPUT_FULL_SHAPE", 58 help="full-shape 1st order Lagrange .xdmf file with " 59 "displacements 'u'" 60 ) 61 parser.add_argument( 62 "-o", 63 type=str, 64 metavar="OUTPUT_DIR", 65 help="result will be saved as " 66 "OUTPUT_DIR/u_regions_{THRESHOLD}.pvd and supporting files" 67 ) 68 parser.add_argument( 69 "-t", 70 type=float, 71 metavar="THRESHOLD", 72 default=0.38, 73 help="threshold by which VEH is determined in microns" 74 ) 75 parser.add_argument( 76 "--bci", 77 type=str, 78 metavar="CELL_SURF_MESH", 79 default=None, 80 help="override path to inner cell-surface BC .vtk (default: -c dir's " 81 "bci.vtk)" 82 ) 83 parser.add_argument( 84 "--bco", 85 type=str, 86 metavar="OUTER_SURF_MESH", 87 default=None, 88 help="override path to outer boundary BC .vtk (default: -c dir's " 89 "bco.vtk)" 90 ) 91 args = parser.parse_args() 92 93 get_veh(args.c, args.i, args.o, args.t, args.bci, args.bco)
The function invoked by the command. Parses arguments and passes
to get_veh.