summaryrefslogtreecommitdiff
path: root/Trivac/src/NSS2TR.f
diff options
context:
space:
mode:
authorstainer_t <thomas.stainer@oecd-nea.org>2025-09-08 13:48:49 +0200
committerstainer_t <thomas.stainer@oecd-nea.org>2025-09-08 13:48:49 +0200
commit7dfcc480ba1e19bd3232349fc733caef94034292 (patch)
tree03ee104eb8846d5cc1a981d267687a729185d3f3 /Trivac/src/NSS2TR.f
Initial commit from Polytechnique Montreal
Diffstat (limited to 'Trivac/src/NSS2TR.f')
-rwxr-xr-xTrivac/src/NSS2TR.f125
1 files changed, 125 insertions, 0 deletions
diff --git a/Trivac/src/NSS2TR.f b/Trivac/src/NSS2TR.f
new file mode 100755
index 0000000..76f664d
--- /dev/null
+++ b/Trivac/src/NSS2TR.f
@@ -0,0 +1,125 @@
+*DECK NSS2TR
+ SUBROUTINE NSS2TR(ITRIAL,NEL,NMIX,MAT,XX,IQFR,QFR,DIFF,SIGR,SIGT,
+ 1 FD,A11)
+*
+*-----------------------------------------------------------------------
+*
+*Purpose:
+* Assembly of non-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 section.
+* SIGT macroscopic cross section.
+* 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),SIGT(NMIX),
+ 1 FD(NMIX,2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1+4)=-FDP*SINH(ETA/2.0)
+ A11(NUM1+4,NUM1+5)=-FDP*ALP1/ETA
+ ENDIF
+ IF(ITRIAL(IBMP) == 2) THEN
+ ALP1P=ETAP*COSH(ETAP/2.0)-2.0*SINH(ETAP/2.0)
+ A11(NUM1+4,NUM2+4)=-FDM*SINH(ETAP/2.0)
+ A11(NUM1+4,NUM2+5)=FDM*ALP1P/ETAP
+ ENDIF
+ NUM1=NUM1+5
+ ENDDO
+ ! left boundary condition:
+ IBM=MAT(1)
+ ETA=XX(1)*SQRT(SIGR(IBM)/DIFF(IBM))
+ IF((IQFR(1,1) == -1).OR.(IQFR(1,1) > 0)) THEN
+ ! VOID
+ AFACTOR=QFR(1,1)
+ A11(NUM1+4,1)=-AFACTOR
+ A11(NUM1+4,2)=AFACTOR/2.0
+ A11(NUM1+4,3)=-AFACTOR/2.0
+ IF(ITRIAL(IBM) == 2) THEN
+ ALP1=ETA*COSH(ETA/2.0)-2.0*SINH(ETA/2.0)
+ A11(NUM1+4,4)=AFACTOR*SINH(ETA/2.0)
+ A11(NUM1+4,5)=-AFACTOR*ALP1/ETA
+ ENDIF
+ ENDIF
+ ! right boundary condition:
+ IBM=MAT(NEL)
+ ETA=XX(NEL)*SQRT(SIGR(IBM)/DIFF(IBM))
+ IF((IQFR(2,NEL) == -1).OR.(IQFR(2,NEL) > 0)) THEN
+ NUM2=5*(NEL-1)
+ ! VOID
+ AFACTOR=QFR(2,NEL)
+ A11(NUM1+5,NUM2+1)=-AFACTOR
+ A11(NUM1+5,NUM2+2)=-AFACTOR/2.0
+ A11(NUM1+5,NUM2+3)=-AFACTOR/2.0
+ IF(ITRIAL(IBM) == 2) THEN
+ ALP1=ETA*COSH(ETA/2.0)-2.0*SINH(ETA/2.0)
+ A11(NUM1+5,NUM2+4)=-AFACTOR*SINH(ETA/2.0)
+ A11(NUM1+5,NUM2+5)=-AFACTOR*ALP1/ETA
+ ENDIF
+ ENDIF
+ RETURN
+ END SUBROUTINE NSS2TR