Ejemplo n.º 1
0
         - np.multiply(vy,sps.lil_matrix.dot(Gy,w))\
         - (dt/2.0)*np.multiply(vx,(np.multiply(vx,sps.lil_matrix.dot(Kxx,w)) + np.multiply(vy,sps.lil_matrix.dot(Kyx,w))))\
         - (dt/2.0)*np.multiply(vy,(np.multiply(vx,sps.lil_matrix.dot(Kxy,w)) + np.multiply(vy,sps.lil_matrix.dot(Kyy,w))))
   vorticityRHS = np.multiply(vorticityRHS,vorticityAux2BC)
   vorticityRHS = vorticityRHS + vorticityDirichletVector
   w = scipy.sparse.linalg.cg(vorticityLHS,vorticityRHS,w, maxiter=1.0e+05, tol=1.0e-05)
   w = w[0].reshape((len(w[0]),1))
 
 
 
  # Semi-Lagrangian Scheme
  elif scheme_option == 2:
 
   # Linear Element   
   if polynomial_option == 0 or polynomial_option == 1:
    w_d = semiLagrangian.Linear2D(numNodes, neighborsElements, IEN, x, y, vxSL, vySL, dt, w)
 
    A = np.copy(M)/dt
    vorticityRHS = sps.lil_matrix.dot(A,w_d)
 
    vorticityRHS = vorticityRHS + (1.0/Re)*vorticityNeumannVector
    vorticityRHS = np.multiply(vorticityRHS,vorticityAux2BC)
    vorticityRHS = vorticityRHS + vorticityDirichletVector
 
    w = scipy.sparse.linalg.cg(vorticityLHS,vorticityRHS,w, maxiter=1.0e+05, tol=1.0e-05)
    w = w[0].reshape((len(w[0]),1))
 
 
 
   # Mini Element   
   elif polynomial_option == 2:
Ejemplo n.º 2
0
   
 



  # ------------------------ semi-Lagrangian Method --------------------------------
  if scheme_option == 2:
   print ""
   print ' -----------------------'
   print ' SEMI-LAGRANGIAN METHOD:'
   print ' -----------------------'
   start_SL_time = time()

   # Linear Element   
   if polynomial_option == 0 or polynomial_option == 1:
    vx_d, vy_d = semiLagrangian.Linear2D(numNodes, neighborsElements, IEN, x, y, vxALE, vyALE, dt, vx, vy)

   # Mini Element   
   elif polynomial_option == 2:
    vx_d, vy_d, c_d = semiLagrangian.Mini2D(numNodes, neighborsElements, IEN, x, y, vxALE, vyALE, dt, vx, vy, c)
 
   # Quad Element   
   elif polynomial_option == 3:
    w_d, c_d = semiLagrangian.Quad2D(numNodes, neighborsElements, IEN, x, y, vxALE, vyALE, dt, w, c)
 
   end_SL_time = time()
   SL_time = end_SL_time - start_SL_time
   print ' time duration: %.1f seconds' %SL_time
  #----------------------------------------------------------------------------------

Ejemplo n.º 3
0
            vorticityRHS = vorticityRHS + vorticityDirichletVector
            w = scipy.sparse.linalg.cg(vorticityLHS,
                                       vorticityRHS,
                                       w,
                                       maxiter=1.0e+05,
                                       tol=1.0e-05)
            w = w[0].reshape((len(w[0]), 1))

        # Semi-Lagrangian Scheme
        elif scheme_option == 2:

            # Linear Element
            if polynomial_option == 1:
                scheme_name = 'Semi Lagrangian Linear'

                w_d = semiLagrangian.Linear2D(numNodes, neighborsElements, IEN,
                                              z, r, vz, vr, dt, w)

                A = np.copy(Mr) / dt
                vorticityRHS = sps.lil_matrix.dot(A, w_d)

                vorticityRHS = vorticityRHS + (1.0 /
                                               Re) * vorticityNeumannVector
                vorticityRHS = np.multiply(vorticityRHS, vorticityAux2BC)
                vorticityRHS = vorticityRHS + vorticityDirichletVector

                w = scipy.sparse.linalg.cg(vorticityLHS,
                                           vorticityRHS,
                                           w,
                                           maxiter=1.0e+05,
                                           tol=1.0e-05)
                w = w[0].reshape((len(w[0]), 1))