• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Trying to add sparse matrix code to LK2/REDUCE_KFF_TO_KAA.f90 ceanwang Junior Member  Posts: 24 Threads: 7 Joined: May 2020 Reputation: 0 10-14-2020, 11:55 PM Hi, Trying to use SuperLU sparse solver which is from https://github.com/xiaoyeli/superlu First: Inputs for SuperLU are: Code:```            !NROW=n=400             !NCOL=n=400             !NNZERO=nnz=1920             !values             !rowind - row index             !colptr - column pointer```Have to map MYSTRAN's I_KOO, J_KOO, KOO to these. Second: Output for SuperLU is b(i), i=1,n after solving. Need to map this b(i) to what MYSTRAN is called. Help is appreciated. Cheers Cean The code is like this: Existing Banded: Code:```         IF (SOLLIB == 'BANDED  ') THEN                    ! Use LAPACK             KOO_SDIA   = 0             EQUIL_KOO  = 'N'             INFO = 0             CALL SYM_MAT_DECOMP_LAPACK ( SUBR_NAME, 'KOO', 'O ', NDOFO, NTERM_KOO, I_KOO, J_KOO, KOO, 'Y', KOORAT, EQUIL_KOO,      &                                          RCONDK, DEB_PRT, EQUED, KOO_SDIA, K_INORM, RCOND, KOO_SCALE_FACS, INFO )``` Newly added Sparse: Code:```        ELSE IF (SOLLIB == 'SPARSE  ') THEN             ! Add sparse matrix code here to decompose matrix KOO                         !use SuperLU subroutine hbcode1(nrow, ncol, nnzero, values, rowind, colptr)             !call hbcode1(n, n, nnz, values, rowind, colptr)             !NROW=n=400             !NCOL=n=400             !NNZERO=nnz=1920             !values             !rowind - row index             !colptr - column pointer             nrhs = 1             ldb = n             do i = 1, n                b(i) = 1             enddo             ! First, factorize the matrix. The factors are stored in *factors* handle.             iopt = 1             call c_fortran_dgssv( iopt, n, nnz, nrhs, values, rowind, colptr,      \$                      b, ldb, factors, info )                   if (info .eq. 0) then                write (*,*) 'Factorization succeeded'             else                write(*,*) 'INFO from factorization = ', info             endif             ! Second, solve the system using the existing factors.             iopt = 2             call c_fortran_dgssv( iopt, n, nnz, nrhs, values, rowind, colptr,      \$                      b, ldb, factors, info )             if (info .eq. 0) then                write (*,*) 'Solve succeeded'                write (*,*) (b(i), i=1, 10)             else                write(*,*) 'INFO from triangular solve = ', info             endif             ! Last, free the storage allocated inside SuperLU             iopt = 3             call c_fortran_dgssv( iopt, n, nnz, nrhs, values, rowind, colptr,      \$                      b, ldb, factors, info )``` Here is SuperLU's test data g20.rua https://github.com/xiaoyeli/superlu/blob...LE/g20.rua It has 400 rows, 400 columns and 1920 none zero values. The data is arrange as COLPTR, ROWIND and VALUES. « Next Oldest | Next Newest »

Forum Jump:

Users browsing this thread: 1 Guest(s) 