Esempio n. 1
0
         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())
 n+=1
 t+=dt
 # print "influx= ",integrate(inner(v,dom.getNormal())), sqrt(integrate(length(v)**2,FunctionOnBoundary(dom))), integrate(1., FunctionOnBoundary(dom))
 print("<%s> Time step %s (t=%s) completed."%(time.asctime(),n,t))
 #======= setup Temperature problem ====================================================================
 #
 heat.setValue(v=v,Q=CHI_REF*flow.getTau()**2/flow.getCurrentEtaEff())
 dt=heat.getSafeTimeStepSize()
 print("<%s> New time step size is %e"%(time.asctime(),dt))
 if n == 10: 1/0
 #======= set-up topography ==================================================================================
 if CREATE_TOPOGRAPHY:
     dt=min(mts.getSafeTimeStepSize()*0.5,dt)
     print("<%s> New time step size is %e"%(time.asctime(),dt))
 print("<%s> Start time step %s (t=%s)."%(time.asctime(),n+1,t+dt))
 #
 #  solve temperature:
 #
 T=heat.getSolution(dt)
 print("Temperature range ",inf(T),sup(T))
 print("<%s> temperature update completed."%time.asctime())
 #======= anaysis ==================================================================================
             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())
 n += 1
 t += dt
 # print "influx= ",integrate(inner(v,dom.getNormal())), sqrt(integrate(length(v)**2,FunctionOnBoundary(dom))), integrate(1., FunctionOnBoundary(dom))
 print("<%s> Time step %s (t=%s) completed." % (time.asctime(), n, t))
 #======= setup Temperature problem ====================================================================
 #
 heat.setValue(v=v, Q=CHI_REF * flow.getTau()**2 / flow.getCurrentEtaEff())
 dt = heat.getSafeTimeStepSize()
 print("<%s> New time step size is %e" % (time.asctime(), dt))
 if n == 10: 1 / 0
 #======= set-up topography ==================================================================================
 if CREATE_TOPOGRAPHY:
     dt = min(mts.getSafeTimeStepSize() * 0.5, dt)
     print("<%s> New time step size is %e" % (time.asctime(), dt))
 print("<%s> Start time step %s (t=%s)." % (time.asctime(), n + 1, t + dt))
 #
 #  solve temperature:
 #
 T = heat.getSolution(dt)
 print("Temperature range ", inf(T), sup(T))
 print("<%s> temperature update completed." % time.asctime())
 #======= anaysis ==================================================================================