summaryrefslogtreecommitdiff
path: root/Dragon/src/SNFT1C.f
diff options
context:
space:
mode:
Diffstat (limited to 'Dragon/src/SNFT1C.f')
-rw-r--r--Dragon/src/SNFT1C.f211
1 files changed, 211 insertions, 0 deletions
diff --git a/Dragon/src/SNFT1C.f b/Dragon/src/SNFT1C.f
new file mode 100644
index 0000000..efaa775
--- /dev/null
+++ b/Dragon/src/SNFT1C.f
@@ -0,0 +1,211 @@
+*DECK SNFT1C
+ SUBROUTINE SNFT1C(NREG,NMAT,M2,NPQ,ISCAT,NSCT,JOP,U,UPQ,WPQ,ALPHA,
+ 1 PLZ,PL,MAT,VOL,SURF,TOTAL,IGAV,QEXT,LFIXUP,CURR,FLUX)
+*
+*-----------------------------------------------------------------------
+*
+*Purpose:
+* Perform one inner iteration for solving SN equations in 1D cylindrical
+* geometry.
+*
+*Copyright:
+* Copyright (C) 2005 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
+* NREG number of regions.
+* NMAT number of material mixtures.
+* M2 number of axial $\\xi$ levels.
+* NPQ number of SN directions in one octant.
+* ISCAT anisotropy of one-speed sources:
+* =1 isotropic sources;
+* =2 linearly anisotropic sources.
+* NSCT number of spherical harmonics components in the flux.
+* JOP number of base points per axial level in one octant.
+* U base points in $\\mu$ of the 1D quadrature. Used with
+* zero-weight points.
+* UPQ base points in $\\mu$ of the 2D SN quadrature.
+* WPQ weights of the 2D SN quadrature.
+* ALPHA angular redistribution terms.
+* PLZ discrete values of the spherical harmonics corresponding
+* to the 1D quadrature. Used with zero-weight points.
+* MN moment-to-discrete matrix.
+* DN discrete-to-moment matrix.
+* MAT material mixture index in each region.
+* VOL volumes of each region.
+* SURF surfaces surrounding each region.
+* TOTAL macroscopic total cross sections.
+* IGAV type of condition at axial axis (=1 specular reflection;
+* =2 zero-weight reflection; =3 averaged reflection).
+* QEXT spherical harmonics components of the fixed source.
+* LFIXUP flag to enable negative flux fixup.
+*
+*Parameters: input/output
+* CURR entering current at input and leaving current at output.
+*
+*Parameters: output
+* FLUX spherical harmonics components of the flux.
+*
+*-----------------------------------------------------------------------
+*
+*----
+* SUBROUTINE ARGUMENTS
+*----
+ INTEGER NREG,NMAT,M2,NPQ,ISCAT,NSCT,JOP(M2),MAT(NREG),IGAV
+ REAL U(M2),UPQ(NPQ),WPQ(NPQ),ALPHA(NPQ),PLZ(NSCT,M2),PL(NSCT,NPQ),
+ 1 VOL(NREG),SURF(NREG+1),TOTAL(0:NMAT),QEXT(NSCT,NREG),CURR,
+ 2 FLUX(NSCT,NREG)
+ LOGICAL LFIXUP
+*----
+* LOCAL VARIABLES
+*----
+ PARAMETER(RLOG=1.0E-8,PI=3.141592654)
+ DOUBLE PRECISION Q,E2,AFB,Q1,Q2,PSIA,WSIA,CURSUM
+ REAL, ALLOCATABLE, DIMENSION(:) :: FLXB,AFGL
+*----
+* SCRATCH STORAGE ALLOCATION
+*----
+ ALLOCATE(FLXB(M2),AFGL(NREG))
+*----
+* COMPUTE A NORMALIZATION CONSTANT.
+*----
+ DENOM=0.0
+ DO 10 I=1,NPQ
+ IF(UPQ(I).GT.0.0) DENOM=DENOM+4.0*WPQ(I)*UPQ(I)
+ 10 CONTINUE
+*----
+* OUTER LOOP OVER AXIAL LEVELS.
+*----
+ FLUX(:NSCT,:NREG)=0.0
+ CURSUM=0.0D0
+ IPQ=0
+ DO 200 IP=1,M2
+*----
+* INITIALIZATION SWEEP (USING ZERO-WEIGHT POINTS). AFB IS THE EDGE
+* FLUX VALUE AND AFGL(I) IS THE CENTERED FLUX VALUE.
+*----
+ AFB=CURR/DENOM
+ DO 30 I=NREG,1,-1 ! Spatial sweep
+ Q=0.0D0
+ IBM=MAT(I)
+ IOF=0
+ DO 25 IL=0,ISCAT-1
+ DO 20 IM=0,IL
+ IF(MOD(IL+IM,2).EQ.1) GO TO 20
+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