Пример #1
0
def mesh(Lx, Ly, res, **namespace):
    mesh = load_mesh("meshes/hourglass_res" + str(res) + ".h5")
    # Check:
    # coords = mesh.coordinates()[:]
    # assert(np.max(coords[:, 0]) == Lx)
    # assert(np.max(coords[:, 1]) == Ly)
    return mesh
Пример #2
0
def mesh(Lx=8.,
         Ly=8.,
         rad=0.25,
         num_obstacles=100,
         grid_spacing=0.05,
         **namespace):
    mesh = load_mesh(
        "meshes/periodic_porous_Lx{}_Ly{}_rad{}_N{}_dx{}.h5".format(
            Lx, Ly, rad, num_obstacles, grid_spacing))
    return mesh
Пример #3
0
def mesh(Lx, Ly, res, **namespace):
    mesh = load_mesh("meshes/snoevsen_res{}.h5".format(res))
    # Check:
    coords = mesh.coordinates()[:]
    import mpi4py.MPI as mpi
    comm = mpi.COMM_WORLD
    rank = comm.Get_rank()
    max_x_loc = coords[:, 0].max()
    max_y_loc = coords[:, 1].max()
    max_x = comm.reduce(max_x_loc, op=mpi.MAX, root=0)
    max_y = comm.reduce(max_y_loc, op=mpi.MAX, root=0)
    if rank == 0:
        assert (max_x == Lx)
        assert (max_y == Ly)
    return mesh
Пример #4
0
def mesh(Lx=8.,
         Ly=8.,
         rad=0.25,
         num_obstacles=100,
         grid_spacing=0.05,
         **namespace):
    try:
        mesh = load_mesh(
            "meshes/periodic_porous_Lx{}_Ly{}_rad{}_N{}_dx{}.h5".format(
                Lx, Ly, rad, num_obstacles, grid_spacing))
    except:
        info_error("Can't find mesh. Go to utilities/ "
                   "and run \n\n\t"
                   "python3 generate_mesh.py mesh=periodic_porous_2d \n\n"
                   "with default parameters.")
    return mesh
Пример #5
0
# Problem specific parameters
parameters.update(problem())

# Internalize cmd arguments and mesh
vars().update(import_problem_hook(**vars()))

# If loading from checkpoint, update parameters from file, and then
# again from command line arguments.
if restart_folder:
    info_red("Loading parameters from checkpoint.")
    load_parameters(parameters, os.path.join(restart_folder, "parameters.dat"))
    internalize_cmd_kwargs(parameters, cmd_kwargs)
    vars().update(parameters)

    info_red("Loading mesh from checkpoint.")
    mesh = load_mesh(os.path.join(restart_folder, "fields.h5"),
                     use_partition_from_file=True)

# Import solver functionality
exec("from solvers.{} import *".format(solver))

# Get subproblems
subproblems = get_subproblems(**vars())

# Declare finite elements
elements = dict()
for name, (family, degree, is_vector) in base_elements.items():
    if is_vector:
        elements[name] = df.VectorElement(family, mesh.ufl_cell(), degree)
    else:
        elements[name] = df.FiniteElement(family, mesh.ufl_cell(), degree)
Пример #6
0
def mesh(Lx=4., Ly=3., grid_spacing=0.04, **namespace):
    return load_mesh("meshes/periodic_porous_dx" + str(grid_spacing) + ".h5")
Пример #7
0
def mesh(Lx, Ly, grid_spacing, **namespace):
    mesh = load_mesh("meshes/flipper2_dx" + str(grid_spacing) + ".h5")
    #mesh = load_mesh("meshes/flipper_dx" + str(grid_spacing) + ".h5")
    #mesh = df.Mesh("meshes/dolfin_fine.xml.gz")
    return mesh
Пример #8
0
def mesh(Lx, Ly, grid_spacing, **namespace):
    # You have to run generate_mesh.py mesh=extended_polygon ... first
    mesh = load_mesh("meshes/flipper_dx{}_Lx{}_Ly{}.h5".format(
        grid_spacing, Lx, Ly))
    return mesh
Пример #9
0
def mesh(H=0.41, L=2.2, x0=0.2, y0=0.2, R=0.05, res=96, **namespace):
    mesh = load_mesh(
        "meshes/cylinderinchannel_H{}_L{}_x{}_y{}_r{}_res{}.h5".format(
            H, L, x0, y0, R, res))
    return mesh
Пример #10
0
def mesh(Lx, Ly, res, **namespace):
    mesh = load_mesh("meshes/snoevsen_res{}_extruded.h5".format(res))
    return mesh
Пример #11
0
def mesh(res, **namespace):
    m = load_mesh("meshes/snoevsen_3d_periodic_res{}.h5".format(res))
    return m