a0 = 1 n0 = 1 n1 = 0.5 a1 = -(a0 * n0) / n1 v[0] = a0 * sin(pi * n0 * x[0]) * cos(pi * n1 * x[1]) v[1] = a1 * cos(pi * n0 * x[0]) * sin(pi * n1 * x[1]) else: a0 = 1 a1 = 1 n0 = 2 n1 = 2 n2 = 0.5 a2 = -(a0 * n0 + a1 * n1) / n2 v[0] = a0 * sin(pi * n0 * x[0]) * cos(pi * n1 * x[1]) * cos( pi * n2 * x[2]) v[1] = a1 * cos(pi * n0 * x[0]) * sin(pi * n1 * x[1]) * cos( pi * n2 * x[2]) v[2] = a2 * cos(pi * n0 * x[0]) * cos(pi * n1 * x[1]) * sin( pi * n2 * x[2]) mts = Mountains(mydomain, eps=EPS) while t < T_END: print("STEP ", t) mts.setVelocity(v * cos(OMEGA * t)) Z = mts.update() saveVTK("state.%d.vtu" % n, sol=Z, v=mts.getVelocity()) print("Integral(Z)=", integrate(Z), Lsup(mts.getVelocity()[DIM - 1])) n += 1 t += mts.getSafeTimeStepSize()
flow=IncompressibleIsotropicFlowCartesian(dom, stress=stress, v=v, p=p, t=t, numMaterials=2, verbose=VERBOSE) flow.setDruckerPragerLaw(tau_Y=TAU_Y/P_REF+BETA*(1.-Function(dom).getX()[DIM-1])) flow.setElasticShearModulus(MUE) flow.setTolerance(FLOW_TOL) flow.setEtaTolerance(FLOW_TOL) flow.setExternals(fixed_v_mask=fixed_v_mask) print(("<%s> Flow solver has been set up."%time.asctime())) # # topography setup # boundary=FunctionOnBoundary(dom).getX()[DIM-1] top_boundary_mask=whereZero(boundary-sup(boundary)) surface_area=integrate(top_boundary_mask) if CREATE_TOPO: mts=Mountains(dom,eps=TOPO_SMOOTH) mts.setTopography(topography) print(("<%s> topography has been set up."%time.asctime())) # # let the show begin: # t1 = time.time() print(("<%s> Start time step %d (t=%s)."%(time.asctime(),n,t))) while t<T_END: if CREATE_TOPO: topography_old=topography v_old, p_old, stress_old=v, p, stress T_old=T #========================= solve for velocity ============================ eta_N=exp(Ar*((1.+V_REF*(1-Function(dom).getX()[DIM-1]))/(T_OFFSET_REF+interpolate(T,Function(dom)))-1./T_OFFSET_REF)) #print("viscosity range :", inf(eta_N), sup(eta_N))
if DIM==2: a0=1 n0=1 n1=0.5 a1=-(a0*n0)/n1 v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1]) v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1]) else: a0=1 a1=1 n0=2 n1=2 n2=0.5 a2=-(a0*n0+a1*n1)/n2 v[0]=a0*sin(pi*n0*x[0])* cos(pi*n1*x[1])* cos(pi*n2*x[2]) v[1]=a1*cos(pi*n0*x[0])* sin(pi*n1*x[1])* cos(pi*n2*x[2]) v[2]=a2*cos(pi*n0*x[0])* cos(pi*n1*x[1])* sin(pi*n2*x[2]) mts=Mountains(mydomain,eps=EPS) while t<T_END: print("STEP ", t) mts.setVelocity(v*cos(OMEGA*t)) Z=mts.update() saveVTK("state.%d.vtu"%n,sol=Z, v=mts.getVelocity()) print("Integral(Z)=",integrate(Z),Lsup(mts.getVelocity()[DIM-1])) n+=1 t+=mts.getSafeTimeStepSize()
flow.setDruckerPragerLaw(tau_Y=TAU_Y / P_REF + BETA * (1. - Function(dom).getX()[DIM - 1])) flow.setElasticShearModulus(MUE) flow.setTolerance(FLOW_TOL) flow.setEtaTolerance(FLOW_TOL) flow.setExternals(fixed_v_mask=fixed_v_mask) print(("<%s> Flow solver has been set up." % time.asctime())) # # topography setup # boundary = FunctionOnBoundary(dom).getX()[DIM - 1] top_boundary_mask = whereZero(boundary - sup(boundary)) surface_area = integrate(top_boundary_mask) if CREATE_TOPO: mts = Mountains(dom, eps=TOPO_SMOOTH) mts.setTopography(topography) print(("<%s> topography has been set up." % time.asctime())) # # let the show begin: # t1 = time.time() print(("<%s> Start time step %d (t=%s)." % (time.asctime(), n, t))) while t < T_END: if CREATE_TOPO: topography_old = topography v_old, p_old, stress_old = v, p, stress T_old = T #========================= solve for velocity ============================ eta_N = exp( Ar *