summaryrefslogtreecommitdiff
path: root/Donjon/src/RESROD.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 /Donjon/src/RESROD.f
Initial commit from Polytechnique Montreal
Diffstat (limited to 'Donjon/src/RESROD.f')
-rw-r--r--Donjon/src/RESROD.f80
1 files changed, 80 insertions, 0 deletions
diff --git a/Donjon/src/RESROD.f b/Donjon/src/RESROD.f
new file mode 100644
index 0000000..aac2edb
--- /dev/null
+++ b/Donjon/src/RESROD.f
@@ -0,0 +1,80 @@
+*DECK RESROD
+ SUBROUTINE RESROD(NB,NZ,ZZ,IND,ZLEVEL,ITOP,VB)
+*
+*-----------------------------------------------------------------------
+*
+*Purpose:
+* Move a control rod over a fuel channel.
+*
+*Copyright:
+* Copyright (C) 2017 Ecole Polytechnique de Montreal.
+*
+*Author(s):
+* A. Hebert
+*
+*Parameters: input
+* NB number of fuel bundles per channel.
+* NZ number of axial meshes.
+* ZZ axial meshes.
+* IND bundle index of each axial mesh.
+* ZLEVEL insertion parameter of the control rod in the channel (set
+* between 0.0 and 1.0).
+* ITOP direction flag for the rod (=1: from top; =-1: from bottom).
+*
+*Parameters: output
+* VB insertion parameter corresponding to each bundle.
+*
+*-----------------------------------------------------------------------
+*
+*----
+* SUBROUTINE ARGUMENTS
+*----
+ INTEGER NB,NZ,IND(NZ),ITOP
+ REAL ZZ(NZ+1),ZLEVEL,VB(NB)
+*
+ ZMIN=ZZ(NZ+1)
+ ZMAX=ZZ(1)
+ DO IZ=1,NZ
+ IF(IND(IZ).EQ.0) CYCLE
+ ZMIN=MIN(ZZ(IZ),ZMIN)
+ ZMAX=MAX(ZZ(IZ+1),ZMAX)
+ ENDDO
+ IF(ITOP.EQ.1) THEN
+ VB(:NB)=0.0
+ ZPO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