def handle_exit_annotation(): """ Since importing firedrake_adjoint modifies a global variable, we need to pause annotations at the end of the module. **Disclaimer: copied from firedrake/tests/regression/test_adjoint_operators.py """ yield import pyadjoint annotate = pyadjoint.annotate_tape() if annotate: pyadjoint.pause_annotation()
from turbine import * from options import ArrayOptions import pyadjoint pyadjoint.pause_annotation() # Parse arguments parser = Parser("test_cases/array/ramp.py") parser.add_argument( "configuration", help="Name defining test case configuration", choices=["aligned", "staggered"], ) parser.parse_setup() parser.add_argument( "--plot_vorticity", help="Plot fluid vorticity", action="store_true", ) parser.add_argument( "--load_index", help="Optional index to load from HDF5", type=int, default=0, ) parsed_args = parser.parse_args() config = parsed_args.configuration load_index = parsed_args.load_index approach = "uniform_mesh" if parsed_args.uniform else "fixed_mesh" # Set parameters