def initialise(self):
        ##########################
        ## domain definition
        
        ##########################
        ## domain definition
        
        multi = 1.0
        
        self.Nx = 50     #number of elements in X
        self.Ny = int(self.Nx*multi)    #number of elements in Y
        
        self.Lx = 0.5    #length of domain in X
        self.Ly = multi*self.Lx #length of domain in y
        
        ptsx = [0.0, 0.25, 0.5, 0.75, 1.0]
        ptsy = [5.0, 5.0, 2.0, 1.0, 0.0]
        self.dx = gg.bezier_spacing(self.Nx, self.Lx, ptsx, ptsy)
        self.dy = gg.bezier_spacing(self.Ny, self.Ly, ptsx, ptsy)
        
        ##########################
        ## X and Y arrays - coordinates
        self.X, self.Y = gg.get_XY(self.dx, self.dy)
        
        ##########################
        ## setup circle
        
        r = self.Lx/3.0
        
        B = zeros((self.Nx, self.Ny))
        self.bnd = zeros((self.Nx, self.Ny),dtype=uint32)
        
        x_ = -self.dx[0]/2.0
        
        for x in range(self.Nx):
            x_ += self.dx[x]
            y_ = -self.dy[0]/2.0
            for y in range(self.Ny):
                y_ += self.dy[y]
                B[x,y] = linalg.norm([x_,y_])
                self.Y[y] = y_
                if B[x,y] < r:
                    self.bnd[x,y] = 1
        
        #add solid block
        #midX = floor(self.Nx/2)
        #midY = floor(self.Ny/2)
        #size = 3
        #self.bnd[(midX-size):(midX+size),(midX-size):(midX+size)] = 2
        
        ## VALUES FOR CIRCLE
        
        rho0 = 1.165
        p0 = 101310.0
        T0 = p0/(rho0*self.R);
        u0 = sqrt(self.gamma*self.R*T0)
        
        rhoL = rho0
        TL = 303.0
        pL = rhoL*self.R*TL
        
        ## VALUES FOR BULK FLUID
        
        rhoR = 10.0*rho0
        TR = TL
        pR = rhoR*self.R*TR
        
        ##########################
        ## SIMULATION LISTS
        self.numProps = 3
        self.density =   array([rhoL,rhoR, rhoR],dtype=float64)
        self.pressure =  array([pL,pR, pR],dtype=float64)
        self.therm =      array([TL, TR, TR],dtype=float64)
        self.velX = array([0.0, 0.0, 0.0],dtype=float64)
        self.velY = array([0.0, 0.0, 0.0],dtype=float64)
        self.cell =  array([0, 0, 2],dtype=uint32)
        
        if where(self.cell == 2):
            self.isSolid = 1
        else:
            self.isSolid = 0
        
        ##########################
        ## REFERENCE QUANTITIES
        
        self.ref_rho = rho0
        self.ref_T = T0
        if self.mu_model == 'sutherland':
            self.ref_mu = self.mu_ref*(T0/self.T_ref)**(3.0/2.0)*((self.T_ref+self.S_v)/(T0 + self.S_v))
        if self.mu_model == 'VHS':
            self.ref_mu = self.mu_ref*(T0/self.T_ref)**(0.5 + self.upsilon)
        
        self.Tc = T0*(1.0 + (self.gamma - 1.0)/2.0)*(u0/sqrt(self.gamma*self.R*T0))**2   #stagnation temp
        print('Tc = {}K'.format(self.Tc))
        
# END
    def initialise(self):
        ##########################
        ## domain definition

        self.Nx = 52  # number of elements in X
        self.Ny = 125  # number of elements in Y

        self.Lx = 1.0  # length of domain in X
        self.Ly = 0.68  # length of domain in y

        ptsx = [0.0, 0.25, 0.5, 0.75, 1.0]
        ptsy = [10.0, 5.0, 2.0, 1.0, 0.0]
        self.dx = gg.bezier_spacing(self.Nx, self.Lx, ptsx, ptsy)
        self.dy = gg.bezier_spacing(self.Ny, self.Ly, ptsx, ptsy)

        ##########################
        ## X and Y arrays - coordinates
        self.X, self.Y = gg.get_XY(self.dx, self.dy)

        ##########################
        ## domain

        self.bnd = zeros((self.Nx, self.Ny), dtype=uint32)

        # inlet & top boundary
        self.bnd[0, 1 : self.Ny] = 1
        self.bnd[0 : self.Nx, self.Ny - 1] = 1

        # wall
        self.bnd[0 : self.Nx, 0] = 2

        ## VALUES FOR FLUID

        Re = 1.65e6

        rho0 = 0.0404
        T0 = 222.0
        p0 = rho0 * self.R * T0
        ux0 = 2.0 * sqrt(self.gamma * self.R * T0)
        uy0 = 0.0

        self.mu = (rho0 * ux0 * self.Lx) / Re

        ##########################
        ## SIMULATION LISTS
        self.numProps = 3
        self.density = array([rho0, rho0, rho0], dtype=float64)
        self.therm = array([T0, T0, T0], dtype=float64)
        self.velX = array([ux0, ux0, 0.0], dtype=float64)
        self.velY = array([uy0, uy0, 0.0], dtype=float64)
        self.cell = array([0, 1, 2], dtype=uint32)

        if where(self.cell == 2):
            self.isSolid = 1
        else:
            self.isSolid = 0

        ##########################
        ## REFERENCE QUANTITIES

        self.rho_ref = rho0
        maxVel = sqrt(max(abs(self.velX)) ** 2 + max(abs(self.velY)) ** 2)
        self.Tc_Tref = (
            (T0 / self.T_ref) * (1.0 + (self.gamma - 1.0) / 2.0) * (ux0 / sqrt(self.gamma * self.R * T0)) ** 2
        )
        print("Tc_Tref = {}".format(self.Tc_Tref))
Exemple #3
0
    def initialise(self):
        ##########################
        ## domain definition

        self.Nx = 52  #number of elements in X
        self.Ny = 125  #number of elements in Y

        self.Lx = 1.0  #length of domain in X
        self.Ly = 0.68  #length of domain in y

        ptsx = [0.0, 0.25, 0.5, 0.75, 1.0]
        ptsy = [10.0, 5.0, 2.0, 1.0, 0.0]
        self.dx = gg.bezier_spacing(self.Nx, self.Lx, ptsx, ptsy)
        self.dy = gg.bezier_spacing(self.Ny, self.Ly, ptsx, ptsy)

        ##########################
        ## X and Y arrays - coordinates
        self.X, self.Y = gg.get_XY(self.dx, self.dy)

        ##########################
        ## domain

        self.bnd = zeros((self.Nx, self.Ny), dtype=uint32)

        #inlet & top boundary
        self.bnd[0, 1:self.Ny] = 1
        self.bnd[0:self.Nx, self.Ny - 1] = 1

        #wall
        self.bnd[0:self.Nx, 0] = 2

        ## VALUES FOR FLUID

        Re = 1.65e6

        rho0 = 0.0404
        T0 = 222.0
        p0 = rho0 * self.R * T0
        ux0 = 2.0 * sqrt(self.gamma * self.R * T0)
        uy0 = 0.0

        self.mu = (rho0 * ux0 * self.Lx) / Re

        ##########################
        ## SIMULATION LISTS
        self.numProps = 3
        self.density = array([rho0, rho0, rho0], dtype=float64)
        self.therm = array([T0, T0, T0], dtype=float64)
        self.velX = array([ux0, ux0, 0.0], dtype=float64)
        self.velY = array([uy0, uy0, 0.0], dtype=float64)
        self.cell = array([0, 1, 2], dtype=uint32)

        if where(self.cell == 2):
            self.isSolid = 1
        else:
            self.isSolid = 0

        ##########################
        ## REFERENCE QUANTITIES

        self.rho_ref = rho0
        maxVel = sqrt(max(abs(self.velX))**2 + max(abs(self.velY))**2)
        self.Tc_Tref = (T0 / self.T_ref) * (1.0 + (self.gamma - 1.0) / 2.0) * (
            ux0 / sqrt(self.gamma * self.R * T0))**2
        print('Tc_Tref = {}'.format(self.Tc_Tref))


# END
Exemple #4
0
    def initialise(self):
        ##########################
        ## domain definition
        
        # GAS PROPERTIES 1
        rho1 = 1.0
        T1 = 150.0
        p1 = rho1*self.R*T1
        mu1 = self.mu_ref*(T1/self.T_ref)**(0.5 + self.upsilon)
        M1 = 4.0
        a1 = sqrt(self.gamma*self.R*T1)
        ux1 = M1*a1
        uy1 = 0.0
        
        # GAS PROPERTIES 2
        rho2 = rho1*((self.gamma + 1.0)*M1**2)/((self.gamma - 1.0)*M1**2+2.0)
        T2 = T1*((2.0+(self.gamma-1.0)*M1**2)*((2*self.gamma*M1**2-(self.gamma-1.0))/((self.gamma+1.0)**2*M1**2)))
        p2 = rho2*self.R*T2
        mu2 = self.mu_ref*(T2/self.T_ref)**(0.5 + self.upsilon)
        M2 = sqrt(((self.gamma-1.0)*M1**2+2.0)/(2*self.gamma*M1**2-(self.gamma-1.0)))
        a2 = sqrt(self.gamma*self.R*T2)
        ux2 = M2*a2
        uy2 = 0.0
        
        # mean free path
        lambda1 = (2.0*mu1)/(rho1*sqrt((8.0*self.R*T1)/pi))
        
        self.Nx = 100     #number of elements in X
        self.Ny = 10    #number of elements in Y
        
        m = 30.0    #multiplier of mean free path
        
        self.Lx = m*lambda1    #length of domain in X
        self.Ly = self.Lx #length of domain in y
        
        ptsxX = [0.0, 1.0]
        ptsyX = [0.0, 0.0]
        self.dx = gg.bezier_spacing(self.Nx, self.Lx, ptsxX, ptsyX)
        ptsxY = [0.0, 1.0]
        ptsyY = [0.0, 0.0]
        self.dy = gg.bezier_spacing(self.Ny, self.Ly, ptsxY, ptsyY)
        
        ##########################
        ## X and Y arrays - coordinates
        self.X, self.Y = gg.get_XY(self.dx, self.dy)
        
        ##########################
        ## domain
        
        self.bnd = zeros((self.Nx, self.Ny),dtype=uint32)
        
        midX = int(self.Nx/2.0)
        
        #inlet
        self.bnd[0,:] = 0
        
        #zone 1
        self.bnd[1:midX,:] = 1
        
        #zone 2
        self.bnd[midX:-1,:] = 2
        
        #outlet
        self.bnd[-1,:] = 3
        
        
        ##########################
        ## SIMULATION LISTS
        self.numProps = 4
        self.density =   array([rho1, rho1, rho2, rho2],dtype=float64)
        self.therm =      array([T1, T1, T2, T2],dtype=float64)
        self.velX = array([ux1, ux1, ux2, ux2],dtype=float64)
        self.velY = array([uy1, uy1, uy2, uy2],dtype=float64)
        self.cell =  array([1,0,0,1],dtype=uint32)
        
        if where(self.cell == 2):
            self.isSolid = 1
        else:
            self.isSolid = 0
        
        ##########################
        ## REFERENCE QUANTITIES
        
        self.ref_rho = rho1
        self.ref_T = T1
        self.ref_mu = mu1
        
        maxVel = sqrt(max(abs(self.velX))**2 + max(abs(self.velY))**2)
        self.Tc = 1.5*T1*(1.0 + (self.gamma - 1.0)/2.0)*(ux1/sqrt(self.gamma*self.R*T1))**2   #stagnation temp
        print('Tc = {}K'.format(self.Tc))
        
# END