__license__="""Licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0""" __url__="https://launchpad.net/escript-finley" import sys # get the tools we want to use from esys.escript import * from esys.weipa import saveVTK try: from esys.dudley import Rectangle # some parameters L0=1. L1=1. T_bot=100 # generate n0 x n1 elements over [0,l0] x [0,l1] mydomain=Rectangle(l0=L0,l1=L1,n0=20,n1=20) # print spatial dimension: print("dimension = ",mydomain.getDim()) # get coordinates of points in domain: x=mydomain.getX() print(x) # set a function T_D=T_bot/L1*(L1-x[1]) # save T_D for visualisation saveVTK("u.vtu",T=T_D) except ImportError: print("Dudley module not available")
t_step = 0 t_step_end = 2000 TOL = 1.0e-5 max_iter = 400 verbose = True useUzawa = True #define mesh l0 = 0.9142 l1 = 1.0 n0 = 200 n1 = 200 mesh = Rectangle(l0=l0, l1=l1, order=2, n0=n0, n1=n1) #get mesh dimensions numDim = mesh.getDim() #get element size h = Lsup(mesh.getSize()) #level set parameters tolerance = 1.0e-6 reinit_max = 30 reinit_each = 3 alpha = 1 smooth = alpha * h #boundary conditions x = mesh.getX() #left + bottom + right + top b_c = whereZero(x[0]) * [1.0, 0.0] + whereZero(x[1]) * [1.0, 1.0] + whereZero( x[0] - l0) * [1.0, 0.0] + whereZero(x[1] - l1) * [1.0, 1.0]
t_step = 0 t_step_end = 2000 TOL = 1.0e-5 max_iter=400 verbose=True useUzawa=True #define mesh l0=0.9142 l1=1.0 n0=200 n1=200 mesh=Rectangle(l0=l0, l1=l1, order=2, n0=n0, n1=n1) #get mesh dimensions numDim = mesh.getDim() #get element size h = Lsup(mesh.getSize()) #level set parameters tolerance = 1.0e-6 reinit_max = 30 reinit_each = 3 alpha = 1 smooth = alpha*h #boundary conditions x = mesh.getX() #left + bottom + right + top b_c = whereZero(x[0])*[1.0,0.0] + whereZero(x[1])*[1.0,1.0] + whereZero(x[0]-l0)*[1.0,0.0] + whereZero(x[1]-l1)*[1.0,1.0]
# dom=Rectangle(12,8,l0=1.5) # dom=Rectangle(24,16,l0=1.5) dom=Rectangle(48,32,l0=1.5) # dom=Rectangle(8*48,8*32,l0=1.5) # dom=Rectangle(120,80,l0=1.5) V=Scalar(1.,Function(dom))*[-1.,0] THETA=0. fc=TransportPDE(dom,num_equations=1,theta=THETA) fc.setTolerance(1.e-12) fc.setValue(M=Scalar(1.,Function(dom)),C=V) x=dom.getX() x_0=[0.5,0.5] sigma=0.075 u0=1. for i in range(dom.getDim()): u0=u0*exp(-(x[i]-x_0[i])**2/sigma**2) u0=whereNonPositive(abs(x[0]-0.4)-0.2)*whereNonPositive(abs(x[1]-0.5)-0.2) # f1=0.5 # f2=2. # u0=f2*clip(x[0]-0.5,0.)-clip(0.5-x[0],0.)*f1+f1*0.5 # u0=exp(-3*(x[0]-2.)**2) # u0=x[0] u0/=Lsup(u0) c=0 saveVTK("u.%s.vtu"%c,u=u0) fc.setInitialSolution(u0) t_end=0.6 dt=2.49999e-2*0+6.2499999e-02/4