CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Galerkin projection (http://www.cfd-online.com/Forums/main/89120-galerkin-projection.html)

sara2115 June 5, 2011 10:57

Galerkin projection
 
Hi every one.
thank you for reading my thread.
I am working on galerkin projection to make a reduced order model by proper orthogonal modes, but i don't understand why my galerkin projection dosen't work properly. I've used general coordinates to calculate spatial derivatives.
I have checked all the steps but I don't understand why it doesn't work.
here is my code ... every term is a part of projection...
ns= number of modes
nn=number of grids in direction
mm=number of grids in direction
vm=mean velocity in y direction
um=mean velocity in x direction
Q = temporal coefficients for ROM
thank you.



!------------------------------------------
!================================ CONVECTION TERM ===========================
!================================ THE FIRST TERM ===========================
DO K=1,NS
DO I=1,MM
DO J=1,NN
T1 =PHI_U(I,J,K)*(UM(I,J)*UM_DX(I,J)+VM(I,J)*UM_DY(I, J))&
+PHI_V(I,J,K)*(UM(I,J)*VM_DX(I,J)+VM(I,J)*VM_DY(I, J))
TERM_1(k)=T1+TERM_1(k)
END DO
END DO
END DO
!================================== THE SECOND TERM ==========================
DO K=1,NS
DO M=1,NS
DO I=1,MM
DO J=1,NN
T2 =PHI_U(I,J,K)*(UM(I,J)*PHI_UDX(I,J,M)+VM(I,J)*PHI_ UDY(I,J,M))&
+PHI_V(I,J,K)*(UM(I,J)*PHI_VDX(I,J,M)+VM(I,J)*PHI_ VDY(I,J,M))
TERM_2(k,M)=TERM_2(K,M)+T2
END DO
END DO
END DO
END DO
!=================================== THE THIRD TERM ==========================
DO K=1,NS
DO M=1,NS
DO I=1,MM
DO J=1,NN
T3 =PHI_U(I,J,K)*(PHI_U(I,J,M)*UM_DX(I,J)+PHI_V(I,J,M )*UM_DY(I,J))&
+PHI_V(I,J,K)*(PHI_U(I,J,M)*VM_DX(I,J)+PHI_V(I,J,M )*VM_DY(I,J))
TERM_3(K,M)=TERM_3(K,M)+T3
END DO
END DO
END DO
END DO
!=================================== THE FORTH TERM ==========================
!=================================== FORTHE-FIRST ===========================
DO K=1,NS
DO M=1,NS
DO N=1,NS
DO I=1,MM
DO J=1,NN
T4_1 =PHI_U(I,J,K)*(PHI_U(I,J,N)*PHI_UDX(I,J,M)+PHI_V(I ,J,N)*PHI_UDY(I,J,M))
TERM4_1(K,M,N)=TERM4_1(K,M,N)+T4_1
END DO
END DO
END DO
END DO
END DO
!=================================== FORTHE-SECOND ============================
DO K=1,NS
DO M=1,NS
DO N=1,NS
DO I=1,MM
DO J=1,NN
T4_2 =PHI_V(I,J,K)*(PHI_U(I,J,N)*PHI_VDX(I,J,M)+PHI_V(I ,J,N)*PHI_VDY(I,J,M))
TERM4_2(K,M,N)=TERM4_2(K,M,N)+T4_2
END DO
END DO
END DO
END DO
END DO
!==================== SUM OF FIRST TERM AND THE SECOND ONE ====================
DO K=1,NS
DO M=1,NS
DO N=1,NS TERM_4(K,M,N)=TERM4_1(K,M,N)+TERM4_2(K,M,N) !*Q1(M)*Q1(N)
END DO
END DO
END DO
!================================================= =============================
! THE PRESSURE TERM IS ZERO AND IT HAS NO CORPORATION TO THE SET OF ODES
!================================================= =============================
!================================== THE DIFFUSION TERM ============================
DO K=1,NS
DO I=1,MM
DO J=1,NN
TERM5_1(K)=TERM5_1(K)+PHI_U(I,J,K)*(UM_DX2(I,J)+UM _DY2(I,J))+PHI_V(I,J,K)*(VM_DX2(I,J)+VM_DY2(I,J))
END DO
END DO
END DO
!==================================== FIFTH-SECOND =============================
DO K=1,NS
DO M=1,NS
DO I=1,MM
DO J=1,NN
T5_2=PHI_U(I,J,K)*(PHI_UDX2(I,J,M)+PHI_UDY2(I,J,M) )+PHI_V(I,J,K)*(PHI_VDX2(I,J,M)+PHI_VDY2(I,J,M))
TERM5_2(K,M)=TERM5_2(K,M)+T5_2
END DO
END DO
END DO
END DO
!================================================= =============================
!===========
!===========
!===========
DO K=1,NS
A(K) =-TERM_1(K)+TERM5_1(K)/RE
END DO
!
DO K=1,NS
DO M=1,NS
B(K,M) =-TERM_2(K,M)-TERM_3(K,M)+TERM5_2(K,M)/RE
END DO
END DO
!
DO K=1,NS
DO M=1,NS
DO N=1,NS
C(K,M,N)=-TERM_4(K,M,N)
END DO
END DO
END DO
!================================================= =============================
!======================
!======================
!======================
DO K=1,NS
DO M=1,NS
BB(K)=BB(K)+B(K,M)*Q1(M)
END DO
END DO
!===============
DO K=1,NS
DO M=1,NS
DO N=1,NS
CC(K)=CC(K)+C(K,M,N)*Q1(M)*Q1(N)
END DO
END DO
END DO
!===============
DO K=1,NS
F(K)=(A(K)+BB(K)+CC(K))
END DO
!===============
!===============
!===============
Q=Q*DT+F


All times are GMT -4. The time now is 16:18.