示例#1
0
    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 %s (t=%s)."%(time.asctime(),n,t))
while t<T_END:
    if CREATE_TOPOGRAPHY: topography_old=topography
    v_old, p_old, stress_old=v, p, stress
    T_old=T
    #======= solve for velovity ====================================================================
    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))
    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)
#
#  let the show begin:
#
t1 = time.time()
print("<%s> Start time step %s (t=%s)." % (time.asctime(), n, t))
while t < T_END:
    if CREATE_TOPOGRAPHY: topography_old = topography
    v_old, p_old, stress_old = v, p, stress
    T_old = T
    #======= solve for velovity ====================================================================
    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))
    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)