Search Site | Contact Details | FAQ

ADAS Subroutine d5mfsp

        SUBROUTINE D5MFSP( NDSTAT , NDMET  , NDONE  ,
     &                     NSTATE , NMET   , ID     , NMSUM  ,
     &                     CFREC  , CFION  , CFMET  , CPOPN  ,
     &                     POPN   , POPNMO , POPNPO ,
     &                     CPOPND , CPOPNZ ,
     &                     POPF   ,
     &                     XTEMP  , YTEMP  ,
     &                     RHS    , RDUM   , SOLVE  , LSOLVE , LAGAIN
     &                   )
C-------------------------------------------------------------------------------
C******************* FORTRAN77 SUBROUTINE: D5MFSP ********************* ********
C
C PURPOSE: TO PERFORM THE MAIN MATRIX ALGEBRA WHICH CALCULATES THE
C          LEVEL POPULATIONS-INCLUDING METASTABLE STATES
C
C CALLING PROGRAM: D5MPOP
C
C INPUT: (R*8) CFREC( , , )  = RECOMBINATION RATE COEFFICIENTS TO ALL
C         METASTABLE NDMET;STARTING FROM FIRST TO
C         GROUND LEVEL,WITH CFREC(NDMET,NDMET,1)
C         SET TO ZERO
C         DIMENSIONS = (NDMET,NDMET,NDSTAT)
C
C        (R*8) CFION( , , )  = IONISATION RATE COEFFICIENTS TO ALL
C         METASTABLE NDMET;STARTING FROM GROUND TO
C         FIRST LEVEL,WITH
C                CFION(NDMET,NDMET,NSTATE) SET TO ZERO
C         DIMENSIONS = (NDMET,NDMET,NDSTAT)
C
C        (I*4) NSTATE        = PARAMETER = NO OF NDMET
C
C        (I*4) NDMET         = PARAMETER = MAXIMUM SIZE OF MATRICES
C         HOLDING METASTABLE TRANSITIONS
C
C        (R*8) NMET( )       = NO  OF METASTABLES IN EACH ENERGY LEVEL
C         DETERMINES ACTUAL SIZE OF MINI MATRICES
C         DIMENSION = NDSTAT
C
C        (I*4) NDONE         = 1 0;MODIFYING MATRICES IN ORDER TO USE
C         SUBROUTINES
C
C        (I*4) ID            = POSITION OF DOMINANT TERM
C
C        (R*8) CFMET( , , )  = CROSS COUPLING COEFFICIENTS BETWEEN
C         METASTABLE NDMET WITH LEADING DIAGONAL
C         CALCULATED
C         DIMENSIONS = (NDMET,NDMET,NDSTAT)
C
C        (L*4) LSOLVE        =  TRUE  => XXMINV SOLVES SET OF 'N' LINEAR
C          EQUATIONS A X = B WHERE A,X,B ARE
C          MATRICES/VECTORS AND:
C          A = 'A(,)' ON INPUT
C          X = 'B()' ON OUTPUT
C          B = 'B()' ON INPUT
C          FALSE  => ONLY MATRIX INVERSION,
C          A INVERSE REPLACES A
C
C        (R*8) DINT          = + OR - 1 DEPENDING ON THE NUMBER OF ROW
C         INTERCHANGES IN THE MATRIX INVERSION
C
C
C        (R*8) NMETZ    = ACTUAL DIMENSION OF NORMALIZATION MATRIX
C         ONCE FIRST ROW & COLUMN IS ELIMINATED
C       = NMET(ID)+NMET(ID+1)-1
C
C        (I*4) NDSTAT    = PARAMETER = MAXIMUM NUMBER OF NDMET
C
C        (I*4) NPOSX    = NMET(ID)
C
C        (I*4) NPOSY    = NMET(ID+1)
C
C
C OUTPUT:(R*8) CPOPN( , , )  = ARRAY HOLDING COEFFICIENTS OF POPULATION
C         STATE EQUATIONS
C         DIMENSIONS = (NDMET,NDMET,NDSTAT+1)
C
C        (R*8) POPN( , , )   = ARRAY HOLDING POPULATION STATE VALUES WITH
C         THIRD DIMENSION SET TO 1
C         DIMENSIONS = (NDMET,NDONE,NDSTAT+1)
C
C        (R*8) CPOPND( , , ) = TEMPORARY NAME OF MATRIX TO BE SUBSTITUTED
C         INTO NEXT EQUATION IN UPWARD LOOP
C         DIMENSIONS = (NDMET,NDMET,NDSTAT+1)
C
C        (R*8) CPOPNZ( , , ) = TEMPORARY NAME OF MATRIX TO BE SUBSTITUTED
C         INTO NEXT EQUATION  IN DOWNWARD LOOP
C         DIMENSIONS = (NDMET,NDMET,NDSTAT+1)
C
C        (R*8) POPNPO( , , ) = TEMPORARY NAME OF MATRIX HOLDING POPULATION
C         STATE VALUES AFTER NORMALIZATION,TO BE
C         SUBSTITUTED INTO NEXT EQUATION IN UPWARD
C         LOOP
C         DIMENSIONS = (NDMET,NDONE,NDSTAT+1)
C
C        (R*8) POPNMO( , , ) = TEMPORARY NAME OF MATRIX HOLDING POPULATION
C         STATE VALUES AFTER NORMALIZATION,TO BE
C         SUBSTITUTED INTO NEXT EQUATION IN DOWNWARD
C         LOOP
C         DIMENSIONS = (NDMET,NDONE,NDSTAT+1)
C
C        (R*8) SUM           = SUM OF ALL LEVEL POPULATION VALUES
C         INCLUDING METASTABLES
C
C        (R*8) XTEMP( , )    = TEMPORARY MATRIX FOR DURING SUBROUTINE
C         CALCULATIONS
C         DIMENSIONS = (NDMET,NDMET)
C
C        (R*8) YTEMP( , )    = TEMPORARY MATRIX FOR DURING SUBROUTINE
C         CALCULATIONS
C         DIMENSIONS = (NDMET,NDMET)
C
C        (R*8) PTEMP( , , )  = TEMPORARY MATRIX FOR DURING ERROR CHECK
C         CALCULATIONS
C         DIMENSIONS = (NDMET,NDONE,NDSTAT)
C
C        (R*8) QTEMP( , , )  = TEMPORARY MATRIX FOR DURING ERROR CHECK
C         CALCULATIONS
C         DIMENSIONS = (NDMET,NDONE,NDSTAT)
C
C        (R*8) RTEMP( , , )  = TEMPORARY MATRIX FOR DURING ERROR CHECK
C         CALCULATIONS
C         DIMENSIONS = (NDMET,NDONE,NDSTAT)
C
C        (R*8) STEMP( , , )  = TEMPORARY MATRIX FOR DURING ERROR CHECK
C         CALCULATIONS
C         DIMENSIONS = (NDMET,NDONE,NDSTAT)
C
C        (R*8) TEMP( , , )   = MATRIX HOLDING RESULTS OF ERROR CHECK
C         ALL OF WHICH SHOULD BE ZERO
C         DIMENSIONS = (NDMET,NDONE,NDSTAT)
C
C        (R*8) SOLVE( , )    = NORMALIZATION MATRIX AT CRITICAL STAGE
C         DIMENSIONS = (2*NDMET-1,2*NDMET-1)
C
C        (R*8) CTEMP( , , )  = HOLDS VALUES OF CFMET FOR ERROR CHECK,IS
C         NECCESSARY SINCE CFMET IS ALTERED DURING
C         CALCULATIONS
C         DIMENSIONS = (NDMET,NDMET,NDSTAT)
C
C        (R*8) RHS( )    = SIPHONED OFF COLUMN OF NORMALIZATION
C         MATRIX,USED TO CALCULATE METASTABLE
C         NDMET OF DOMINANT STAGE THROUGH XXMINV
C         DIMENSIONS = (2*NDMET-1)
C
C        (R*8) RDUM( )    = DUMMY ARRAY USED IN XXMINV AS RHS WHEN
C         LSOLVE =  FALSE
C
C
C ROUTINES :
C           ROUTINE   SOURCE    BRIEF DESCRIPTION
C           ___________________________________________________________
C           DXMADD    ADAS      MATRIX ADDITION/SUBTRACTION
C           DXMMUL    ADAS      MATRIX MULTIPLICATION
C           XXMINV    ADAS      MATRIX INVERSION
C
C
C AUTHOR:  D. BROOKS, H. P. SUMMERS, JET
C          K1/1/57
C          JET EXT. 4941
C
C DATE:    02/06/94
C
C UPDATE:  14/02/95  HPS - INTRODUCED IAGAIN TO IMPROVE DOMINANT STAGE
C                          IDENTIFICATION.
C UPDATE:  06/07/95  HPS - MODIFIED LOOP TO PREVENT IAGAIN AND HENCE ID
C                          BEING SET GREATER THAN NSTATE-1.
C
C UNIX-IDL PORT:
C
C VERSION: 1.1                          DATE: 08-11-95
C MODIFIED: TIM HAMMOND (TESSELLA SUPPORT SERVICES PLC)
C               - FIRST RELEASE
C
C VERSION: 1.2                          DATE: 01-12-95
C MODIFIED: TIM HAMMOND (TESSELLA SUPPORT SERVICES PLC)
C               - COPIED FOLLOWING UPDATES MADE BY DAVID BROOKS:
C
C UPDATE:  29/11/95  DHB - INTRODUCED A CHECK TO MAKE SURE THAT THE
C                          POPULATION EQUATIONS ARE SOLVED FOR THE BEST
C                          POSSIBLE CHOICE OF DOMINANT STAGE. NB: THIS
C                          IS NOT THE DOMINANT STAGE ITSELF BUT THE
C                          NEAREST STAGE TO IT THAT CAN SUPPORT THE
C                          CALCULATION I.E. THERE IS A CHECK TO MAKE
C                          SURE THE DOMINANT STAGE IDENTIFICATION DOES
C                          NOT PUSH THE SOLUTION LOOP TOO CLOSE TO ANY
C                          REGION OF RAPID POPULATION DROP OFF. THE
C                          PARAMETER ACC HAS BEEN INTRODUCED TO MEASURE
C                          THIS DROP OFF AND CAN BE ADJUSTED IF IT IS TOO
C                          STRINGENT.
C UPDATE:  29/11/95  DHB - ADDED CHECK TO AVOID UNNECCESARY LOOPING IN
C                          UNRESOLVED CASE.
C
C VERSION: 1.3                          DATE: 01-12-95
C MODIFIED: TIM HAMMOND (TESSELLA SUPPORT SERVICES PLC)
C               - SWAPPED ORDER OF DECLARATION OF PARAMETER ACC.
C
C-------------------------------------------------------------------------------
      INTEGER             ID,          NDMET,       NDONE,       NDSTAT
      INTEGER             NMET(NDSTAT),             NMSUM,       NSTATE
      LOGICAL             LAGAIN,      LSOLVE
      REAL*8              CFION(NDMET,NDMET,NDSTAT)
      REAL*8              CFMET(NDMET,NDMET,NDSTAT)
      REAL*8              CFREC(NDMET,NDMET,NDSTAT)
      REAL*8              CPOPN(NDMET,NDMET,NDSTAT+1)
      REAL*8              CPOPND(NDMET,NDMET,NDSTAT+1)
      REAL*8              CPOPNZ(NDMET,NDMET,NDSTAT+1)
      REAL*8              POPF(NMSUM), POPN(NDMET,NDONE,NDSTAT+1)
      REAL*8              POPNMO(NDMET,NDONE,NDSTAT+1)
      REAL*8              POPNPO(NDMET,NDONE,NDSTAT+1)
      REAL*8              RDUM(NDMET), RHS(2*NDMET-1)
      REAL*8              SOLVE(2*NDMET-1,2*NDMET-1)
      REAL*8              XTEMP(NDMET,NDMET),       YTEMP(NDMET,NDMET)
© Copyright 1995-2024 The ADAS Project
Comments and questions to: adas-at-adas.ac.uk