Example #1
0
 def source_disc(self):
     if self.is_GridBucket:
         return vem_source.DualSourceMixedDim(physics=self.physics, coupling=[None])
     else:
         return vem_source.DualSource(physics=self.physics)
tol = 1e-3

mesh_kwargs = {"mesh_size_frac": 0.045, "mesh_size_min": 0.01}
domain = {"xmin": -0.2, "xmax": 1.2, "ymin": -0.2, "ymax": 1.2}
gb = importer.dfm_2d_from_csv(folder + "network.csv", mesh_kwargs, domain)
gb.compute_geometry()
gb.assign_node_ordering()

# Assign parameters
add_data_darcy(gb, domain, tol)

# Choose and define the solvers and coupler
darcy = vem_dual.DualVEMMixedDim("flow")
A_flow, b_flow = darcy.matrix_rhs(gb)

solver_source = vem_source.DualSourceMixedDim("flow", coupling=[None])
A_source, b_source = solver_source.matrix_rhs(gb)

up = sps.linalg.spsolve(A_flow + A_source, b_flow + b_source)
darcy.split(gb, "up", up)

gb.add_node_props(["pressure", "P0u"])
for g, d in gb:
    discharge = darcy.discr.extract_u(g, d["up"])
    d["discharge"] = discharge
    d["pressure"] = darcy.discr.extract_p(g, d["up"])
    d["P0u"] = darcy.discr.project_u(g, discharge, d)

if do_save:
    exporter.export_vtk(gb, "darcy", ["pressure", "P0u"], folder=export_folder)
Example #3
0
tol = 1e-3

mesh_kwargs = {'mesh_size_frac': 0.045, 'mesh_size_min': 0.01}
domain = {'xmin': -0.2, 'xmax': 1.2, 'ymin': -0.2, 'ymax': 1.2}
gb = importer.dfm_2d_from_csv(folder + 'network.csv', mesh_kwargs, domain)
gb.compute_geometry()
gb.assign_node_ordering()

# Assign parameters
add_data_darcy(gb, domain, tol)

# Choose and define the solvers and coupler
darcy = vem_dual.DualVEMMixedDim('flow')
A_flow, b_flow = darcy.matrix_rhs(gb)

solver_source = vem_source.DualSourceMixedDim('flow')
A_source, b_source = solver_source.matrix_rhs(gb)

up = sps.linalg.spsolve(A_flow + A_source, b_flow + b_source)
darcy.split(gb, "up", up)

gb.add_node_props(['pressure', "P0u"])
for g, d in gb:
    discharge = darcy.discr.extract_u(g, d["up"])
    d['discharge'] = discharge
    d['pressure'] = darcy.discr.extract_p(g, d["up"])
    d["P0u"] = darcy.discr.project_u(g, discharge, d)

if do_save:
    exporter.export_vtk(gb, 'darcy', ['pressure', "P0u"], folder=export_folder)