Exemplo n.º 1
0
        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()
Exemplo n.º 2
0
    #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 %d (t=%e) 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))
    #=========================== setup topography ============================
    if CREATE_TOPO:
        dt=min(mts.getSafeTimeStepSize()*0.5,dt)
        #print("<%s> New time step size is %e"%(time.asctime(),dt))
    #print("<%s> Start time step %d (t=%e)."%(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())
    #============================== analysis =================================
    #
    #  .... Nusselt number
    #
    dTdz=grad(T)[DIM-1]
    Nu=1.-integrate(v[DIM-1]*T)/integrate(dTdz)
    eta_bar=integrate(flow.getTau())/integrate(flow.getTau()/flow.getCurrentEtaEff())
Exemplo n.º 3
0
    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()

Exemplo n.º 4
0
    #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 %d (t=%e) 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))
    #=========================== setup topography ============================
    if CREATE_TOPO:
        dt = min(mts.getSafeTimeStepSize() * 0.5, dt)
        #print("<%s> New time step size is %e"%(time.asctime(),dt))
    #print("<%s> Start time step %d (t=%e)."%(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())
    #============================== analysis =================================
    #
    #  .... Nusselt number
    #
    dTdz = grad(T)[DIM - 1]
    Nu = 1. - integrate(v[DIM - 1] * T) / integrate(dTdz)
    eta_bar = integrate(flow.getTau()) / integrate(