summaryrefslogtreecommitdiff
path: root/Trivac/src/BIVA04.f
blob: d80182aa9f7f7676f25c014cb127494ea343d98c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
*DECK BIVA04
      SUBROUTINE BIVA04(ITY,MAXKN,MAXQF,SGD,NREG,LL4,ISPLH,NBMIX,IIMAX,
     1 SIDE,MAT,KN,QFR,VOL,MU,SYS)
*
*-----------------------------------------------------------------------
*
*Purpose:
* Assembly of a within-group (leakage and removal) or out-of-group
* system matrix in mesh-centered finite-difference diffusion
* approximation (hexagonal geometry).
*
*Copyright:
* Copyright (C) 2002 Ecole Polytechnique de Montreal
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version
*
*Author(s): A. Hebert
*
*Parameters: input
* ITY     type of assembly: =0: leakage-removal matrix assembly;
*         =1: cross section matrix assembly.
* MAXKN   dimension of array KN.
* MAXQF   dimension of array QFR.
* SGD     nuclear properties. SGD(:,1) and SGD(:,2) are diffusion
*         coefficients. SGD(:,3) are removal macroscopic cross sections.
* NREG    number of hexagons in BIVAC.
* LL4     number of unknowns per group in BIVAC. Equal to the number
*         of finite elements (hexagons or triangles) excluding the
*         virtual elements.
* ISPLH   type of hexagonal mesh-splitting:
*         =1: hexagonal elements; >1: triangular elements.
* NBMIX   number of macro-mixtures.
* IIMAX   allocated dimension of array SYS.
* SIDE    side of the hexagons.
* MAT     mixture index per hexagon.
* KN      element-ordered unknown list.
* QFR     element-ordered information.
* VOL     volume of hexagons.
* MU      indices used with the compressed diagonal storage mode matrix
*         SYS.
*
*Parameters: output
* SYS     system matrix.
*
*-----------------------------------------------------------------------
*
*----
*  SUBROUTINE ARGUMENTS
*----
      INTEGER ITY,MAXKN,MAXQF,NREG,LL4,ISPLH,NBMIX,IIMAX,MAT(NREG),
     1 KN(MAXKN),MU(LL4)
      REAL SGD(NBMIX,3),SIDE,QFR(MAXQF),VOL(NREG),SYS(IIMAX)
*----
*  LOCAL VARIABLES
*----
      DOUBLE PRECISION A1,DHARM,VAR1
      DHARM(X1,X2,DIF1,DIF2)=2.0D0*DIF1*DIF2/(X1*DIF2+X2*DIF1)
*
      IF(ISPLH.EQ.1) THEN
         DS=SQRT(3.0)*SIDE
         FACT=2.0/(3.0*DS)
         NSURF=6
      ELSE
         DS=SIDE/(SQRT(3.0)*REAL(ISPLH-1))
         FACT=4.0/(3.0*DS)
         NSURF=3
      ENDIF
*----
*  ASSEMBLY OF A SYSTEM MATRIX.
*----
      IF(ITY.EQ.0) THEN
*        LEAKAGE-REMOVAL SYSTEM MATRIX ASSEMBLY.
         NUM1=0
         DO 35 IND1=1,LL4
         KHEX=KN(NUM1+NSURF+1)
         IF(VOL(KHEX).EQ.0.0) GO TO 30
         L=MAT(KHEX)
         VOL0=QFR(NUM1+NSURF+1)
         SIDEB=FACT*VOL0
         VAR1=0.0D0
         KEY0=MU(IND1)-IND1
         DO 20 IX=1,NSURF
         IND2=KN(NUM1+IX)
         A1=0.0
         IF(IND2.GT.0) THEN
            LL=MAT(KN(IND2*(NSURF+1)))
            A1=DHARM(DS,DS,SGD(L,1),SGD(LL,1))*SIDEB
         ELSE IF(IND2.EQ.-1) THEN
            A1=DHARM(DS,DS,SGD(L,1),DS*QFR(NUM1+IX)/2.0)*SIDEB
         ELSE IF(IND2.EQ.-2) THEN
            A1=0.0D0
         ELSE IF(IND2.EQ.-3) THEN
            A1=2.0D0*DHARM(DS,DS,SGD(L,1),SGD(L,1))*SIDEB
         ENDIF
         VAR1=VAR1+A1
         IF(IND2.GT.0) THEN
            IF(IND2.LT.IND1) THEN
               KEY=KEY0+IND2
               SYS(KEY)=SYS(KEY)-REAL(A1)
            ENDIF
         ENDIF
   20    CONTINUE
         KEY=KEY0+IND1
         SYS(KEY)=SYS(KEY)+REAL(VAR1)+SGD(L,3)*VOL0
   30    NUM1=NUM1+NSURF+1
   35    CONTINUE
      ELSE
*        CROSS SECTION SYSTEM MATRIX ASSEMBLY.
         NUM1=0
         DO 45 IND1=1,LL4
         KHEX=KN(NUM1+NSURF+1)
         IF(VOL(KHEX).EQ.0.0) GO TO 40
         L=MAT(KHEX)
         KEY=MU(IND1)
         SYS(KEY)=SYS(KEY)+SGD(L,1)*QFR(NUM1+NSURF+1)
   40    NUM1=NUM1+NSURF+1
   45    CONTINUE
      ENDIF
      RETURN
      END