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    """Creates .pvd (and support files) with event horizon indication.
10
11    * `cell_data_dir`: str path to directory with files needed by
12    `gel.geometry.Geometry`
13    * `u_exp_file`: str path to full-shape .xdmf file with displacements
14    "u" to use in determining event horizon
15    * `directory`: str path to directory within which to create new
16    files
17    * `cutoff`: float displacement magnitude in microns to use as event
18    horizon cutoff value
19
20    Side-effects: creates "u_regions_{cutoff}.pvd" and support files
21    with element-wise data having event horizon tags from
22    `gel.geometry.Geometry`
23    """
24    geo = Geometry(
25        cell_data_dir,
26        u_magnitude_subdomains_file=u_exp_file,
27        detectable_u_cutoff=cutoff
28    )
29    filename = os.path.join(directory, f"u_regions_{cutoff}.pvd")
30    File(filename) << geo.dx.subdomain_data()
31
32
33def get_veh_main():
34    """The function invoked by the command. Parses arguments and passes
35    to `get_veh`.
36    """
37    parser = argparse.ArgumentParser(
38        description="Obtain a mesh indicating which cells are counted"
39        " as being within the event horizon for visualization."
40    )
41    parser.add_argument(
42        "-c",
43        type=str,
44        metavar="CELL_DATA",
45        help="directory containing gel geometry"
46    )
47    parser.add_argument(
48        "-i",
49        type=str,
50        metavar="INPUT_FULL_SHAPE",
51        help="full-shape 1st order Lagrange .xdmf file with "
52        "displacements 'u'"
53    )
54    parser.add_argument(
55        "-o",
56        type=str,
57        metavar="OUTPUT_DIR",
58        help="result will be saved as "
59        "OUTPUT_DIR/u_regions_{THRESHOLD}.pvd and supporting files"
60    )
61    parser.add_argument(
62        "-t",
63        type=float,
64        metavar="THRESHOLD",
65        default=0.38,
66        help="threshold by which VEH is determined in microns"
67    )
68    args = parser.parse_args()
69
70    get_veh(args.c, args.i, args.o, args.t)
71
72
73if __name__=="__main__":
74    get_veh_main()
def get_veh(cell_data_dir, u_exp_file, directory, cutoff=0.38):
 9def get_veh(cell_data_dir, u_exp_file, directory, cutoff=0.38):
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
21    Side-effects: creates "u_regions_{cutoff}.pvd" and support files
22    with element-wise data having event horizon tags from
23    `gel.geometry.Geometry`
24    """
25    geo = Geometry(
26        cell_data_dir,
27        u_magnitude_subdomains_file=u_exp_file,
28        detectable_u_cutoff=cutoff
29    )
30    filename = os.path.join(directory, f"u_regions_{cutoff}.pvd")
31    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 by gel.geometry.Geometry
  • u_exp_file: str path to full-shape .xdmf file with displacements "u" to use in determining event horizon
  • directory: str path to directory within which to create new files
  • cutoff: float displacement magnitude in microns to use as event horizon cutoff value

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():
34def get_veh_main():
35    """The function invoked by the command. Parses arguments and passes
36    to `get_veh`.
37    """
38    parser = argparse.ArgumentParser(
39        description="Obtain a mesh indicating which cells are counted"
40        " as being within the event horizon for visualization."
41    )
42    parser.add_argument(
43        "-c",
44        type=str,
45        metavar="CELL_DATA",
46        help="directory containing gel geometry"
47    )
48    parser.add_argument(
49        "-i",
50        type=str,
51        metavar="INPUT_FULL_SHAPE",
52        help="full-shape 1st order Lagrange .xdmf file with "
53        "displacements 'u'"
54    )
55    parser.add_argument(
56        "-o",
57        type=str,
58        metavar="OUTPUT_DIR",
59        help="result will be saved as "
60        "OUTPUT_DIR/u_regions_{THRESHOLD}.pvd and supporting files"
61    )
62    parser.add_argument(
63        "-t",
64        type=float,
65        metavar="THRESHOLD",
66        default=0.38,
67        help="threshold by which VEH is determined in microns"
68    )
69    args = parser.parse_args()
70
71    get_veh(args.c, args.i, args.o, args.t)

The function invoked by the command. Parses arguments and passes to get_veh.