Пример #1
0
parser.add_argument("--end", type=float)
parser.add_argument("--tp", type=float, help="Time at loading")
args = parser.parse_known_args()[0]

#
# Convert and read mesh and tags
#
meshname = args.mesh
filedir = os.path.dirname(__file__)

t0 = time()
infile = XDMFFile(MPI.COMM_WORLD,
                  os.path.join(filedir, "mesh/{}.xdmf".format(meshname)), "r")
mesh = infile.read_mesh(name="Grid")
mesh.topology.create_connectivity_all()
mt_cell = infile.read_meshtags(mesh, "Grid")
infile.close()

infile = XDMFFile(
    MPI.COMM_WORLD,
    os.path.join(filedir, "mesh/{}_triangle.xdmf".format(meshname)), "r")
mt_facet = infile.read_meshtags(mesh, "Grid")
infile.close()

# External boundary facets
ds = ufl.Measure("ds",
                 domain=mesh,
                 subdomain_data=mt_facet,
                 metadata={"quadrature_degree": 2})
dx = ufl.Measure("dx",
                 domain=mesh,
Пример #2
0
#
# Read mesh and tags
#
filedir = os.path.dirname(__file__)

t0 = time()
infile = XDMFFile(MPI.COMM_WORLD,
                  os.path.join(filedir, "mesh/{}.xdmf".format(args.mesh)), "r")
mesh = infile.read_mesh(name="Grid")
mesh.topology.create_connectivity_all()
infile.close()

infile = XDMFFile(MPI.COMM_WORLD,
                  os.path.join(filedir, "mesh/{}_line.xdmf".format(args.mesh)),
                  "r")
mt_line = infile.read_meshtags(mesh, name="Grid")
infile.close()

top_load_facets = mt_line.indices[np.where(mt_line.values == 4)[0]]

# External boundary facets
dx = ufl.Measure("dx", domain=mesh)

if rank == 0:
    logger.info(f"[Timer] Mesh reading: {time() - t0}")
    logger.info(f"Mesh hmin: {mesh.hmin()} hmax: {mesh.hmax()}")
    logger.info(
        f"Num cells global: {mesh.topology.index_map(3).size_global}, local: {mesh.topology.index_map(3).size_local}"
    )

w0, w1, intern_var0, intern_var1 = fecoda.main.initialize_functions(mesh)