# Load the domain coordinates domain_coordinates = loadtxt('domain_coordinates1.out') mesh_name = 'ant_mesh' # Create a contour for the domain #======================================================= # Create a mesh file in the current directory m = MeshGenerator(bedmap2, mesh_name, '') # Manually set the countour instead of calculating it automatically m.set_contour(domain_coordinates) # Write the contour points to the mesh file m.write_gmsh_contour(100000, boundary_extend = False) # Extrude the flat mesh 10,000 meters in the z dimension. The height of the # mesh can be automatically scaled to the proper height by the model object m.extrude(10000, 14) # We're finished with the flat mesh! m.close_file() # Refine the mesh based on ice thickness #======================================================= ref_bm = MeshRefiner(bedmap2, 'H', gmsh_file_name = mesh_name) # Refine the mesh based on the refinement radius a, aid = ref_bm.add_static_attractor(1.5) ref_bm.set_background_field(aid) # Write out the file ref_bm.finish(gui=False, out_file_name = mesh_name) # Convert the generated .msh file to an xml file m.convert_msh_to_xml(mesh_name, mesh_name)
# Get the Antarctica data sets bedmap2 = DataFactory.get_bedmap2(thklim=200) # Load in a DataInput object. We won't use it, but we need to pass a DataInput # to the MeshGenerator, and we have to fake it out. db2 = DataInput(None, bedmap2) # Create a mesh file in the current directory m = MeshGenerator(db2, mesh_name, '') # Manually set the countour instead of calculating it automatically m.set_contour(cont) # Write the contour points to the mesh file m.write_gmsh_contour(100000, boundary_extend = False) # Extrude the flat mesh 10,000 meters in the z dimension. The height of the # mesh can be automatically scaled to the proper height by the model object m.extrude(20000, 10) # We're finished with the flat mesh! m.close_file() # Refine the mesh based on thickness # Wrap the bed spline in a function that takes two arguments def bed(x,y) : return bed_spline(x) # Define a function for getting the surface elevation # The minimum height of the surface above the bed min_surface = 200 # Angle of the surface slope in the y direction