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)) # Quad Element elif polynomial_option == 3: w_d = semiLagrangian.Quad2D(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)) #---------------------------------------------------------------------------------- #---------- Step 4 - Solve the streamline equation --------------------------------
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 #---------------------------------------------------------------------------------- # ------------------------ SOLVE LINEAR EQUATIONS ---------------------------------- print "" print ' ----------------------------' print ' SOLVE THE LINEARS EQUATIONS:'
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)) # Quad Element elif polynomial_option == 3: scheme_name = 'Semi Lagrangian Quad' w_d = semiLagrangian.Quad2D(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)) #----------------------------------------------------------------------------------