print("viscosity range :", inf(eta_N), sup(eta_N)) flow.setPowerLaws([eta_N, eta_N ], [ 1., TAU_0], [1,N]) flow.setExternals(F=Ra*T*unitVector(DIM-1,DIM)) # if dt<=0 or not CREATE_TOPOGRAPHY: if not CREATE_TOPOGRAPHY: flow.update(dt, iter_max=100, verbose=False) else: topography_last=topography Topo_norm, error_Topo=1,1 i=0 print("DDDDD : ====",dt) while error_Topo > TOPO_TOL * Topo_norm: flow.setStatus(t, v_old, p_old, stress_old) flow.setExternals(f=-SURFACE_LOAD*(topography-dt*v)*unitVector(DIM-1,DIM)*top_boundary_mask, restoration_factor=SURFACE_LOAD*dt*top_boundary_mask) flow.update(dt, iter_max=100, verbose=False) v=flow.getVelocity() mts.setTopography(topography_old) mts.setVelocity(v) topography_last, topography=topography, mts.update(dt, allow_substeps=True) error_Topo=sqrt(integrate(((topography-topography_last)*top_boundary_mask)**2)) Topo_norm=sqrt(integrate((topography*top_boundary_mask)**2)) print("DDDDD :", "input=",integrate(v*top_boundary_mask)[DIM-1],"output=", integrate(topography*top_boundary_mask)/Lsup(topography), error_Topo, Topo_norm) print("topography update step %s error = %e, norm = %e."%(i, error_Topo, Topo_norm), Lsup(v)) i+=1 if i > TOPO_ITER_MAX: raise RuntimeError("topography did not converge after %s steps."%TOPO_ITER_MAX) v=flow.getVelocity() for d in range(DIM): print("range %d-velocity"%d,inf(v[d]),sup(v[d])) print("Courant = ",inf(dom.getSize()/(length(v)+1e-19)), inf(dom.getSize()**2)) print("<%s> flow solver completed."%time.asctime())
# if dt<=0 or not CREATE_TOPOGRAPHY: if not CREATE_TOPOGRAPHY: flow.update(dt, iter_max=100, verbose=False) else: topography_last = topography Topo_norm, error_Topo = 1, 1 i = 0 print("DDDDD : ====", dt) while error_Topo > TOPO_TOL * Topo_norm: flow.setStatus(t, v_old, p_old, stress_old) flow.setExternals(f=-SURFACE_LOAD * (topography - dt * v) * unitVector(DIM - 1, DIM) * top_boundary_mask, restoration_factor=SURFACE_LOAD * dt * top_boundary_mask) flow.update(dt, iter_max=100, verbose=False) v = flow.getVelocity() mts.setTopography(topography_old) mts.setVelocity(v) topography_last, topography = topography, mts.update( dt, allow_substeps=True) error_Topo = sqrt( integrate( ((topography - topography_last) * top_boundary_mask)**2)) Topo_norm = sqrt(integrate((topography * top_boundary_mask)**2)) print("DDDDD :", "input=", integrate(v * top_boundary_mask)[DIM - 1], "output=", integrate(topography * top_boundary_mask) / Lsup(topography), error_Topo, Topo_norm) print( "topography update step %s error = %e, norm = %e." % (i, error_Topo, Topo_norm), Lsup(v))