Beispiel #1
0
def pressure(x, y):
    if experiment == 1:
        val = x * (1. - x) - 1. / 6.
    if experiment == 2:
        val = 0.
    if experiment == 3:
        val = 0.
    if experiment == 4:
        val = 0.5 - y
    if experiment == 5:
        xxx, xxxx, val = solkz.SolKzSolution(x, y)
    if experiment == 6:
        val = 0
    if experiment == 7:
        val = 2 * x * (1 - 2 * y)
    if experiment == 8:
        val = -32000 * (y - Ly / 2)
    if experiment == 9:
        val = x * y + x + y + x**3 * y**2 - 4. / 3.
    if experiment == 10:
        val = 0
    if experiment == 11:
        val = 0
    if experiment == 12:
        val = 0
    if experiment == 13:
        xxx, xxx, val = solcx.SolCxSolution(x, y)
    if experiment == 14:
        xxx, xxx, val = solvi.solution(x, y)
    return val
Beispiel #2
0
def velocity_y(x, y):
    if experiment == 1:
        val = -y * y * (1. - y)**2 * (2. * x - 6. * x * x + 4 * x * x * x)
    if experiment == 2:
        val = 0.
    if experiment == 3:
        val = 0.
    if experiment == 4:
        val = 0
    if experiment == 5:
        xxx, val, xxxx = solkz.SolKzSolution(x, y)
    if experiment == 6:
        val = 0
    if experiment == 7:
        val = -(2 * x - 1) * y * (1 - y)
    if experiment == 8:
        val = 0
    if experiment == 9:
        val = -y - 2 * x * y + y**2 - 3 * x**2 * y + y**3 - x * y**2
    if experiment == 10:
        val = 0
    if experiment == 11:
        val = 0
    if experiment == 12:
        val = 0
    if experiment == 13:
        xxx, val, xxx = solcx.SolCxSolution(x, y)
    if experiment == 14:
        xxx, val, xxx = solvi.solution(x, y)
    return val
Beispiel #3
0
def velocity_x(x, y):
    if experiment == 1:
        val = x * x * (1. - x)**2 * (2. * y - 6. * y * y + 4 * y * y * y)
    if experiment == 2:
        val = 0.
    if experiment == 3:
        val = 0.
    if experiment == 4:
        val = 0
    if experiment == 5:
        val, xxx, xxxx = solkz.SolKzSolution(x, y)
    if experiment == 6:
        val = 0
    if experiment == 7:
        val = (2 * y - 1) * x * (1 - x)
    if experiment == 8:
        val = 0
    if experiment == 9:
        val = x + x**2 - 2 * x * y + x**3 - 3 * x * y**2 + x**2 * y
    if experiment == 10:
        val = 0
    if experiment == 11:
        val = 0
    if experiment == 12:
        val = 0
    if experiment == 13:
        val, xxx, xxx = solcx.SolCxSolution(x, y)
    if experiment == 14:
        val, xxx, xxx = solvi.solution(x, y)
    return val
Beispiel #4
0
def pressure(x, y):
    if experiment == 1:
        val = x * (1. - x) - 1. / 6.
    if experiment == 2:
        ui, vi, val = solkz.SolKzSolution(x, y)
    if experiment == 3:
        ui, vi, val = solcx.SolCxSolution(x, y)
    return val
Beispiel #5
0
def velocity_y(x, y):
    if experiment == 1:
        val = -y * y * (1. - y)**2 * (2. * x - 6. * x * x + 4 * x * x * x)
    if experiment == 2:
        ui, val, pi = solkz.SolKzSolution(x, y)
    if experiment == 3:
        ui, val, pi = solcx.SolCxSolution(x, y)
    return val
Beispiel #6
0
def velocity_x(x, y):
    if experiment == 1:
        val = x * x * (1. - x)**2 * (2. * y - 6. * y * y + 4 * y * y * y)
    if experiment == 2:
        val, vi, pi = solkz.SolKzSolution(x, y)
    if experiment == 3:
        val, vi, pi = solcx.SolCxSolution(x, y)
    return val
Beispiel #7
0
def pressure(x, y):
    if bench == 1:
        return x * (1 - x) * (1 - 2 * y)
    if bench == 4:
        ui, vi, pi = solcx.SolCxSolution(x, y)
        return pi
    if bench == 5:
        ui, vi, pi = solkz.SolKzSolution(x, y)
        return pi
    if bench == 6:
        ui, vi, pi = solvi.solution(x, y)
        return pi
    if bench == 9:
        return x * y + x + y + x**3 * y**2 - 4 / 3
Beispiel #8
0
def velocity_y(x, y):
    if bench == 1:
        return c(x) * d(y)
    if bench == 4:
        ui, vi, pi = solcx.SolCxSolution(x, y)
        return vi
    if bench == 5:
        ui, vi, pi = solkz.SolKzSolution(x, y)
        return vi
    if bench == 6:
        ui, vi, pi = solvi.solution(x, y)
        return vi
    if bench == 9:
        return -y - 2 * x * y + y**2 - 3 * x**2 * y + y**3 - x * y**2
Beispiel #9
0
def velocity_x(x, y):
    if bench == 1:
        return a(x) * b(y)
    if bench == 4:
        ui, vi, pi = solcx.SolCxSolution(x, y)
        return ui
    if bench == 5:
        ui, vi, pi = solkz.SolKzSolution(x, y)
        return ui
    if bench == 6:
        ui, vi, pi = solvi.solution(x, y)
        return ui
    if bench == 9:
        return x + x**2 - 2 * x * y + x**3 - 3 * x * y**2 + x**2 * y
Beispiel #10
0
print("dens (m,M) %.4f %.4f " %(np.min(dens),np.max(dens)))
print("visc (m,M) %.4f %.4f " %(np.min(visc),np.max(visc)))

#np.savetxt('pressure.ascii',np.array([xc,yc,p]).T,header='# xc,yc,p')
#np.savetxt('strainrate.ascii',np.array([xc,yc,exx,eyy,exy]).T,header='# xc,yc,exx,eyy,exy')

#################################################################
# compute error
#################################################################

error_u = np.empty(nnp,dtype=np.float64)
error_v = np.empty(nnp,dtype=np.float64)
error_p = np.empty(nel,dtype=np.float64)

for i in range(0,nnp):
    ui,vi,pi=solkz.SolKzSolution(x[i],y[i]) 
    error_u[i]=u[i]-ui
    error_v[i]=v[i]-vi

for i in range(0,nel): 
    ui,vi,pi=solkz.SolKzSolution(xc[i],yc[i]) 
    error_p[i]=p[i]-pi

errv=0.
errp=0.
for iel in range (0,nel):
    for iq in [-1,1]:
        for jq in [-1,1]:
            rq=iq/sqrt3
            sq=jq/sqrt3
            wq=1.*1.