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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
*DECK NSS1TR
SUBROUTINE NSS1TR(ITRIAL,NEL,NMIX,MAT,XX,IQFR,QFR,DIFF,SIGR,FD,
1 A11)
*
*-----------------------------------------------------------------------
*
*Purpose:
* Assembly of leakage system matrices for the nodal expansion method.
*
*Copyright:
* Copyright (C) 2021 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
* ITRIAL type of base (=1: polynomial; =2: hyperbolic).
* NEL number of nodes
* NMIX number of mixtures
* MAT node mixtures
* XX node widths
* IQFR boundary conditions
* QFR albedo functions
* DIFF diffusion coefficients
* SIGR macroscopic removal cross sections
* FD discontinuity factors
*
*Parameters: output
* A11 assembly matrix.
*
*-----------------------------------------------------------------------
*
INTEGER ITRIAL(NMIX),NEL,NMIX,MAT(NEL),IQFR(6,NEL)
REAL XX(NEL),QFR(6,NEL),DIFF(NMIX),SIGR(NMIX),FD(NMIX,2),
1 A11(5*NEL,5*NEL)
*
A11(:5*NEL,:5*NEL)=0.0
! WEIGHT RESIDUAL EQUATIONS:
NUM1=0
DO KEL=1,NEL
IBM=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