def testConstF_FreeBottom_smallK(self): k = 1.e-8 mp = self.getScalarMask(include_bottom=False) mv = self.getVectorMask(include_bottom=True) u_ref, p_ref, f = self.setSolutionFixedBottom(p0=2500, pb=4000., f0=10., fb=10., k=k) p = p_ref # *mp u = u_ref * mv df = DarcyFlow(self.dom, verbose=VERBOSE, solver=self.SOLVER) df.setValue(g=f, location_of_fixed_pressure=mp, location_of_fixed_flux=mv, permeability=Scalar(k, Function(self.dom))) v, p = df.solve(u, p) self.assertTrue( Lsup(v - u_ref) < self.TEST_TOL * Lsup(u_ref), "flux error too big.") self.assertTrue( Lsup(p - p_ref) < self.TEST_TOL * Lsup(p_ref), "pressure error too big.")
except ImportError: HAVE_FINLEY = False from esys.weipa import saveVTK if not HAVE_FINLEY: print("Finley module not available") else: # generate domain: mydomain = Rectangle(l0=2.,l1=1.,n0=40, n1=20) # normal flux is given x = mydomain.getX() # set location of fixed pressure and flux: p_BC=whereZero(x[1]-1.)*wherePositive(x[0]-1.) u_BC=(whereZero(x[0])+whereZero(x[0]-2.)) * [1.,0.] + \ (whereZero(x[1]) + whereZero(x[1]-1.)*whereNonPositive(x[0]-1.0)) * [0., 1.] # define darcy flow solver: mypde = DarcyFlow(domain=mydomain) mypde.setValue(g=[0., 2], location_of_fixed_pressure=p_BC, location_of_fixed_flux=u_BC, permeability=100.) u,p=mypde.solve(u0=x[1]*[0., -1.], p0=0) # write u to an external file saveVTK("u.vtu",flux=u, pressure=p)