From 39dfc77cef947191d7cefc6daa2a4d9a0b32fcd6 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 14:06:54 +0800 Subject: [PATCH 01/14] fix(trx): libnf's pm_local is a REAL mass, not an INTEGER (#234) pm_local (MODULE libnf_local) was declared INTEGER and assigned PA(nsp_idnf(id_nf))*AMP, a mass of order 1e-27 kg, so it truncated to 0 and sigmav_nf_local's velocity=SQRT(2.D0*energy*RKEV/pm_local) divided by zero. Reached through sigmav_nf_int only; the model_pnf rate path (sigmav_nf) does not use it. Item 2 of #234. Co-Authored-By: Claude Opus 5.5 --- trx/libnf.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trx/libnf.f90 b/trx/libnf.f90 index b0dad6247..2d90cc4bd 100644 --- a/trx/libnf.f90 +++ b/trx/libnf.f90 @@ -2,8 +2,8 @@ MODULE libnf_local USE bpsd_kinds - INTEGER:: id_nf_local,pm_local - REAL(rkind):: temperature_local + INTEGER:: id_nf_local + REAL(rkind):: pm_local,temperature_local END MODULE libnf_local MODULE libnf From 26cd2f3eb81f5e7b2ce0508ffdcd14160b0b5212 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 14:39:17 +0800 Subject: [PATCH 02/14] fix(trx): IMPLICIT NONE in the libnf modules (#234) As asked in the triage of #234 item 3 (the phantom PUBLIC sigmav_nfb_int is not on develop): MODULE libnf_local and MODULE libnf get a module-level IMPLICIT NONE, so that a name declared nowhere is a compile error rather than an implicitly typed module variable. Every procedure of libnf already had its own. It compiles cleanly (gfortran 15, the trx build with the run-time checks of make.header's DFLAGS; no warning under -Wall -Wextra -Wconversion), and a model_pnf=0 run of the 10 keV D-T deck prints the same output as develop apart from the timing lines. Co-Authored-By: Claude Opus 5.5 --- trx/libnf.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trx/libnf.f90 b/trx/libnf.f90 index 2d90cc4bd..308024fda 100644 --- a/trx/libnf.f90 +++ b/trx/libnf.f90 @@ -2,6 +2,7 @@ MODULE libnf_local USE bpsd_kinds + IMPLICIT NONE INTEGER:: id_nf_local REAL(rkind):: pm_local,temperature_local END MODULE libnf_local @@ -9,6 +10,7 @@ END MODULE libnf_local MODULE libnf USE bpsd_kinds USE bpsd_constants + IMPLICIT NONE ! Fusion model ! model_pnf=0 : no fusion reaction From c0dd27211d089185d562bcdd645eb771f5ea93ea Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 17:55:25 +0800 Subject: [PATCH 03/14] fix(trx): sigmav_nf returns m^3/s, not cm^3/s (#236) The svnf_* tables in trx/libnf.f90 are in cm^3/s: read that way the D-T table follows Bosch-Hale (Nucl. Fusion 32 (1992) 611) to 0.80-1.01 over 1-100 keV and peaks at 8.7e-16 cm^3/s. sigmav_nf returned them unconverted, while tr_pnf needs m^3/s (SNF = wgt*PN1*PN2*1.D20*RATE_NF with RN in 1e20 m^-3) and the menu's B command prints the value, so every model_pnf fusion rate was 1e6 too large. The same table in trm/libsigma.f90 is converted by both of its callers (*(1E-6)). One factor 1.D-6 at the function's single computed exit, which covers all five tables and every caller once; the branch below 1 keV returns 0 before it. Co-Authored-By: Claude Opus 5.5 --- trx/libnf.f90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/trx/libnf.f90 b/trx/libnf.f90 index 308024fda..a56732e6f 100644 --- a/trx/libnf.f90 +++ b/trx/libnf.f90 @@ -427,6 +427,12 @@ FUNCTION sigmav_nf(id_nf,temperature) WRITE(6,'(A,ES12.4)') ' temperature=',temperature STOP END IF + ! The svnf_* tables are in cm^3/s (D-T peaks at 8.7e-16 cm^3/s, as in + ! Bosch-Hale); tr_pnf needs m^3/s (its SNF has RN in 1e20 m^-3), and + ! the menu's B command prints the value. One conversion at the + ! computed exit covers all five tables; the low-temperature branch + ! returns 0 before it. + sigmav_nf=sigmav_nf*1.D-6 END FUNCTION sigmav_nf ! --- sigmav_nf by integeral over energy --- From 31e65493a6a6d0efa032ba0e7de7b901ad186226 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 14:39:17 +0800 Subject: [PATCH 04/14] fix(trx): the fusion-product slowing-down uses the product species nsp (#235) In tr_pnf's slowing-down loop, VF, TAUS and COULOG took PA(ns), PZ(ns) and COULOG(1,ns,...), where ns is the counter of the preceding DO NS=1,NSMAX loop and holds NSMAX+1 there: a slot outside the run's species (trinit sets PA = PZ = 1 there), not the fusion product. nsp = nsp_nnf(nnf), the product, is assigned one line above and was otherwise unused. Item 1 of #235; item 3 of #229. Co-Authored-By: Claude Opus 5.5 --- trx/trpnf.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trx/trpnf.f90 b/trx/trpnf.f90 index 6c49468d8..ce4a30257 100644 --- a/trx/trpnf.f90 +++ b/trx/trpnf.f90 @@ -105,10 +105,10 @@ SUBROUTINE tr_pnf DO nnf=1,nnfmax nsp=nsp_nnf(nnf) WF = RW(NR,NNBMAX+NNF) - VF =SQRT(2.D0*eng_nnf(nnf)*RKEV/(PA(ns)*AMP)) + VF =SQRT(2.D0*eng_nnf(nnf)*RKEV/(PA(nsp)*AMP)) HYF=HY(VF/VCR) - TAUS = 0.2D0*PA(ns)*ABS(TE)**1.5D0 & - /(PZ(ns)**2*ANE*COULOG(1,ns,ANE,TE)) + TAUS = 0.2D0*PA(nsp)*ABS(TE)**1.5D0 & + /(PZ(nsp)**2*ANE*COULOG(1,nsp,ANE,TE)) TAUF(NNF,NR)= 0.5D0*TAUS*(1.D0-HYF) END DO END DO From ef97528178de14db0b5f05b4d3ae32e162b5911a Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 14:08:59 +0800 Subject: [PATCH 05/14] fix(trx): tr_pnf resets PNF_NSNNFNR with its siblings (#235) tr_pnf zeroed four of its output arrays at entry but not PNF_NSNNFNR, which it then accumulates with `+` (PNF_NSNNFNR(nsp,nnf,nr) = PNF_NSNNFNR(nsp,nnf,nr) + eng*SNF*1.D20). tr_pnf runs once per TRCALC, several times per step, so the fusion power held the sum of every call of the run instead of the current one. Item 2 of #235; item 2 of #229. Co-Authored-By: Claude Opus 5.5 --- trx/trpnf.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/trx/trpnf.f90 b/trx/trpnf.f90 index ce4a30257..e6c1e2558 100644 --- a/trx/trpnf.f90 +++ b/trx/trpnf.f90 @@ -66,6 +66,7 @@ SUBROUTINE tr_pnf PNFCL_NSNNFNR(1:NSMAX,1:NNFMAX,1:NRMAX)=0.D0 ! collisional transfer in SNFNN_NNFNR(1:NNFMAX,1:NRMAX)=0.D0 ! neutron number PNFNN_NNFNR(1:NNFMAX,1:NRMAX)=0.D0 ! neutron power + PNF_NSNNFNR(1:NSMAX,1:NNFMAX,1:NRMAX)=0.D0 ! fusion power DO nnf=1,nnfmax id_nf=id_nf_nnf(nnf) From 293899fed2f681329fa44c02c160c30aa85e1cc7 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 14:09:45 +0800 Subject: [PATCH 06/14] fix(trx): tr_pnf resets PNFIN_NSNNFNR too (#229) PNFIN_NSNNFNR is allocated (trcomm.f90) but written nowhere; TRGLOB sums it into PNFIN_NSNR, PNFIN_NNFNR and PNFIN_NSNNF, so those read whatever the allocation held. It is now zeroed with the other outputs at the top of tr_pnf, so they read 0. Whether it should carry a value (as PNBIN_NNBNR does for NBI in trpnb.f90) is left open, as #229 asks. Item 1 of #229. Co-Authored-By: Claude Opus 5.5 --- trx/trpnf.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/trx/trpnf.f90 b/trx/trpnf.f90 index e6c1e2558..cc9bbf5f5 100644 --- a/trx/trpnf.f90 +++ b/trx/trpnf.f90 @@ -67,6 +67,7 @@ SUBROUTINE tr_pnf SNFNN_NNFNR(1:NNFMAX,1:NRMAX)=0.D0 ! neutron number PNFNN_NNFNR(1:NNFMAX,1:NRMAX)=0.D0 ! neutron power PNF_NSNNFNR(1:NSMAX,1:NNFMAX,1:NRMAX)=0.D0 ! fusion power + PNFIN_NSNNFNR(1:NSMAX,1:NNFMAX,1:NRMAX)=0.D0 ! fusion power in DO nnf=1,nnfmax id_nf=id_nf_nnf(nnf) From 3953ef5294c84f4cfb839e3f86b74b3c28655d41 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 17:58:49 +0800 Subject: [PATCH 07/14] fix(trx): set_usigmav_nf's species check takes model_pnf 14, not 13 (#235) The species-presence check had CASE(1,12,13) / CASE(2,3) / CASE(4). 13 is rejected earlier by the first SELECT CASE (CASE DEFAULT), so that label was dead, while 14, which the first two blocks accept (CASE(4,14), nnfmax=13) and the header documents, matched nothing here and reached CASE DEFAULT's STOP. model_pnf=14 indexes the same six species as 4: at this commit the only 14-specific remap in the file is the32's product (He4; the next commit makes dd3's another), and dd2, dhe32, the35 and the36 resolve to H and He5 for any model_pnf other than 12. So CASE(1,12) / CASE(2,3) / CASE(4,14). The message of that branch said libnb; it is libnf. Item 3 of #235. Co-Authored-By: Claude Opus 5.5 --- trx/libnf.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trx/libnf.f90 b/trx/libnf.f90 index a56732e6f..101c086de 100644 --- a/trx/libnf.f90 +++ b/trx/libnf.f90 @@ -182,7 +182,7 @@ SUBROUTINE set_usigmav_nf END SELECT SELECT CASE(model_pnf) - CASE(1,12,13) + CASE(1,12) IF(NS_D*NS_T*NS_He4.EQ.0) THEN IF(NS_D.EQ.0) WRITE(6,*) 'XX Error: libnf: NS_D=0' IF(NS_T.EQ.0) WRITE(6,*) 'XX Error: libnf: NS_T=0' @@ -198,7 +198,7 @@ SUBROUTINE set_usigmav_nf IF(NS_He3.EQ.0) WRITE(6,*) 'XX Error: libnf: NS_He3=0' STOP END IF - CASE(4) + CASE(4,14) IF(NS_D*NS_T*NS_He4*NS_H*NS_He3*NS_He5.EQ.0) THEN IF(NS_D.EQ.0) WRITE(6,*) 'XX Error: libnf: NS_D=0' IF(NS_T.EQ.0) WRITE(6,*) 'XX Error: libnf: NS_T=0' @@ -209,7 +209,7 @@ SUBROUTINE set_usigmav_nf STOP END IF CASE DEFAULT - WRITE(6,*) 'XX Error libnb: undefined model_pnf: model_pnf=',model_pnf + WRITE(6,*) 'XX Error libnf: undefined model_pnf: model_pnf=',model_pnf STOP END SELECT From 1cae55663ccaed63d265f7fb16ca4db998a095e3 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 14:39:18 +0800 Subject: [PATCH 08/14] fix(trx): the product of dd3 is He3, He4 only in the reduced variants 12 and 14 (#235) nsp_idnf(id_nf_dd3) was NS_He3 for model_pnf=12 and NS_He4 for every other model_pnf. dd3 is D + D -> He3 + n, and the header gives the two reduced variants the same DD3 line, "D + D -> He3 + n ! He4 + n" (12 and 14, nsmax=4): they collapse the He3 product onto He4. So 12 and 14 get He4, and the full variants 2, 3 and 4 He3. For 12 that is also the direction of its sibling remap (dd2 gives He4 to 12 and H otherwise). As written, a model_pnf=12 run, whose composition carries no He3 (the presence check asks for D, T and He4 only), took NS_He3 = 0 as the product index and stopped at an array bound (Index '0' of dimension 1 of snf_nsnnfnr, with run-time checks). model_pnf=14 keeps He4, as on develop. Its other remaps do not agree with each other (the32 treats it as reduced, giving He4; dd2, dhe32, the35 and the36 resolve as for the full variants, which is why the presence check is CASE(4,14)); that is left to the module lead. Kept as a commit of its own, as asked in the triage, so that it can be dropped without touching the rest. Related to item 3 of #235. Co-Authored-By: Claude Opus 5.5 --- trx/libnf.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trx/libnf.f90 b/trx/libnf.f90 index 101c086de..544e4cb88 100644 --- a/trx/libnf.f90 +++ b/trx/libnf.f90 @@ -243,10 +243,10 @@ SUBROUTINE set_usigmav_nf ns1_idnf(id_nf_dd3)=NS_D ns2_idnf(id_nf_dd3)=NS_D wgt_idnf(id_nf_dd3)=0.5D0 - IF(model_pnf.EQ.12) THEN - nsp_idnf(id_nf_dd3)=NS_He3 - ELSE + IF(model_pnf.EQ.12.OR.model_pnf.EQ.14) THEN nsp_idnf(id_nf_dd3)=NS_He4 + ELSE + nsp_idnf(id_nf_dd3)=NS_He3 END IF eng_idnf(id_nf_dd3)=0.82D3*RKEV enn_idnf(id_nf_dd3)=2.45D3*RKEV From 5ab6100086c7b025362f75540c4d8b47527fc4d0 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 14:10:26 +0800 Subject: [PATCH 09/14] fix(trx): the dd2 block sets enn_idnf(id_nf_dd2), not dd3's (#229) Inside the id_nf_dd2 block, enn_idnf(id_nf_dd3)=0.D0 cleared the neutron energy of the next channel (which the dd3 block then sets again) and left enn_idnf(id_nf_dd2) unassigned; tr_pnf compares it with 0 to decide whether the channel makes neutrons. dd2 (D + D -> T + p) has none: enn_idnf(id_nf_dd2)=0.D0. Item 4 of #229. Co-Authored-By: Claude Opus 5.5 --- trx/libnf.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trx/libnf.f90 b/trx/libnf.f90 index 544e4cb88..5271c3f62 100644 --- a/trx/libnf.f90 +++ b/trx/libnf.f90 @@ -238,7 +238,7 @@ SUBROUTINE set_usigmav_nf nsp_idnf(id_nf_dd2)=NS_H END IF eng_idnf(id_nf_dd2)=3.02D3*RKEV - enn_idnf(id_nf_dd3)=0.D0 + enn_idnf(id_nf_dd2)=0.D0 ns1_idnf(id_nf_dd3)=NS_D ns2_idnf(id_nf_dd3)=NS_D From 5c7b87d477370dd8af8f09e8199b7a9ffabea2e6 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 14:10:51 +0800 Subject: [PATCH 10/14] fix(trx): the fusion-product speed applies RKEV once (#268) eng_nnf is in joules already, and VF applied RKEV to it a second time. Found with the others while building the 1e-10 reference from trx, on the same line as item 1 of #235, and filed afterwards as #268. Kept as the last commit so that it can be dropped. VF = SQRT(2*eng_nnf*RKEV/(PA*AMP)) multiplied a joule value by RKEV again: eng_nnf(nnf) = eng_idnf(id_nf), which libnf sets in joules (eng_idnf(id_nf_dt) = 3.5D3*RKEV), and tr_pnf's own power line uses it as joules (PNF = eng*SNF*1.D20, W/m^3). VF came out at about 1.3e-8 of the alpha's speed (sqrt(RKEV)), so HY(VF/VCR) and TAUF were wrong; trx's NBI path converts once, from keV (VB = SQRT(2*PNBENG*RKEV/AMB)). VF = SQRT(2*eng_nnf/(PA(nsp)*AMP)). Co-Authored-By: Claude Opus 5.5 --- trx/trpnf.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trx/trpnf.f90 b/trx/trpnf.f90 index cc9bbf5f5..185eb7a91 100644 --- a/trx/trpnf.f90 +++ b/trx/trpnf.f90 @@ -107,7 +107,7 @@ SUBROUTINE tr_pnf DO nnf=1,nnfmax nsp=nsp_nnf(nnf) WF = RW(NR,NNBMAX+NNF) - VF =SQRT(2.D0*eng_nnf(nnf)*RKEV/(PA(nsp)*AMP)) + VF =SQRT(2.D0*eng_nnf(nnf)/(PA(nsp)*AMP)) ! eng_nnf is in J already HYF=HY(VF/VCR) TAUS = 0.2D0*PA(nsp)*ABS(TE)**1.5D0 & /(PZ(nsp)**2*ANE*COULOG(1,nsp,ANE,TE)) From 428c030718c08c13a20f67fc4c8c0e70130c2757 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Wed, 21 Oct 2026 00:04:30 +0800 Subject: [PATCH 11/14] fix(trx): model_pnf=14 is refused, with its own message (#235) The presence check's CASE(4,14) let model_pnf=14 run whenever D, T, He4, H and He3 are present. NS_He5 is no species found in the run: pl/plinit.f90 sets it to the literal 7, and tr_prep_ns neither resets nor matches it, and a He5 species cannot be defined at all: pl_prep_ns, which tr_prep calls through pl_prep, stops on an NPA=2, PA=5 species. So for 14 the presence check passed on NS_He5 = 7, nsp_idnf(id_nf_the35) was 7, and tr_pnf wrote SNF_NSNNFNR(7,...) and PNF_NSNNFNR(7,...), past the (NSMAX,NNFMAX,NRMAX) arrays for NSMAX < 7. He3 can be defined through the plparm file that trmain reads (&PL takes NPA and PA): with H and He3 there and NSMAX=6, the branch stopped at trpnf.f90:88, "Index '7' of dimension 1 of array 'snf_nsnnfnr' above upper bound of 6". 14 now has its own CASE: it stops with "XX Error: libnf: model_pnf=14 is not available: no He5 species can be defined", where develop stopped with "undefined model_pnf". CASE(4) is as on develop; model_pnf=4 has the same NS_He5 hole there, left to the module lead with the species set 14 is meant to have. Asked in the review of #269. Item 3 of #235. Co-Authored-By: Claude Opus 5.5 --- trx/libnf.f90 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/trx/libnf.f90 b/trx/libnf.f90 index 5271c3f62..eefb8127b 100644 --- a/trx/libnf.f90 +++ b/trx/libnf.f90 @@ -198,7 +198,7 @@ SUBROUTINE set_usigmav_nf IF(NS_He3.EQ.0) WRITE(6,*) 'XX Error: libnf: NS_He3=0' STOP END IF - CASE(4,14) + CASE(4) IF(NS_D*NS_T*NS_He4*NS_H*NS_He3*NS_He5.EQ.0) THEN IF(NS_D.EQ.0) WRITE(6,*) 'XX Error: libnf: NS_D=0' IF(NS_T.EQ.0) WRITE(6,*) 'XX Error: libnf: NS_T=0' @@ -208,6 +208,14 @@ SUBROUTINE set_usigmav_nf IF(NS_He5.EQ.0) WRITE(6,*) 'XX Error: libnf: NS_He5=0' STOP END IF + CASE(14) + ! NS_He5 is not a species found in the run: pl_init sets it to 7 and + ! tr_prep_ns never matches a He5 species, so the35's product would go + ! to species slot 7 (past the arrays when NSMAX < 7). Refused until a + ! He5 species can be defined. + WRITE(6,*) 'XX Error: libnf: model_pnf=14 is not available: ', & + 'no He5 species can be defined' + STOP CASE DEFAULT WRITE(6,*) 'XX Error libnf: undefined model_pnf: model_pnf=',model_pnf STOP From c4bca92b208078c5462e451fa6a5aef3e5e40a9d Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 23:48:24 +0800 Subject: [PATCH 12/14] docs(trx): sigmav_nf states its unit, m^3/s, and the B command prints it (#236) Since #236's fix sigmav_nf returns m^3/s. Its PUBLIC line and its header comment now say so, and the menu's B command, which printed "sigma=" with no unit, prints "sigmav [m^3/s]=". No value changes. Asked as a LOW in the review of #269. Co-Authored-By: Claude Opus 5.5 --- trx/libnf.f90 | 4 ++-- trx/trmenu.f90 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/trx/libnf.f90 b/trx/libnf.f90 index eefb8127b..2d52d277b 100644 --- a/trx/libnf.f90 +++ b/trx/libnf.f90 @@ -114,7 +114,7 @@ MODULE libnf PUBLIC set_usigmav_nf ! set_usigmav_nf PUBLIC sigma_nf ! sigma_nf(id_nf,energy) - PUBLIC sigmav_nf ! sigmav_nf(id_nf,temperature) + PUBLIC sigmav_nf ! sigmav_nf(id_nf,temperature) [m^3/s] CONTAINS @@ -387,7 +387,7 @@ FUNCTION sigma_nf(id_nf,energy) RETURN END FUNCTION sigma_nf - ! --- reaction rate of nuclear fusion: sigmav --- + ! --- reaction rate of nuclear fusion: sigmav [m^3/s] --- ! --- as a function of temperature in keV FUNCTION sigmav_nf(id_nf,temperature) diff --git a/trx/trmenu.f90 b/trx/trmenu.f90 index 84e5df54d..9d3e6194c 100644 --- a/trx/trmenu.f90 +++ b/trx/trmenu.f90 @@ -154,7 +154,7 @@ SUBROUTINE tr_menu 7777 CONTINUE WRITE(6,*) '## INPUT id,T(kev)T' READ(5,*,END=7779) id,temp - WRITE(6,*) ' sigma=',sigmav_nf(id,temp) + WRITE(6,*) ' sigmav [m^3/s]=',sigmav_nf(id,temp) GOTO 7777 7779 CONTINUE From 8daf0d6c9db895e5a21b565da7bad8d0afe2f1fb Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Wed, 21 Oct 2026 00:04:47 +0800 Subject: [PATCH 13/14] docs(changelog): the trx fusion path and power totals (#269, #270) One Fixed entry for this pull request and #270, as suggested in the review of #269. Results of model_pnf>0 runs change; in NBI runs the printed beam collisional powers PBCLE to PBCLA change by 1e6 (now MW). PNB_TOT and PRF_TOT are not fixed by this, since the arrays they integrate are never filled in trx (#238); they read 0 with model_nnb=1, PNBIN=10 and with PECIN=5 on #238's deck with fusion off, develop against #270. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b27ede66a..8807623ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,24 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/). ### Fixed +- **trx: the fusion reaction path and the power totals** (#269, #270; + issues #229, #234, #235, #236, #238, #268). `sigmav_nf` returned its + tables in cm^3/s where `tr_pnf` takes m^3/s, so every `model_pnf` rate + was 1e6 too large (#238's 10 keV D-T deck stopped with negative + temperatures). `tr_pnf` took the slowing-down species from a stale loop + index, applied `RKEV` twice to the product's speed (so `TAUF` was + round-off), added `PNF_NSNNFNR` up over its calls and never set + `PNFIN_NSNNFNR`. Ten power integrals of `TRGLOB` stayed in W where + `PINT`, `QF` and the confinement times take MW. Also in `libnf`: + `pm_local` is a `REAL`, both modules are `IMPLICIT NONE`, the D-D branch + to He3 gives He3 for `model_pnf` 2, 3 and 4 and He4 for the reduced 12 + (which ran past an array bound before), the dd2 block sets its own + `enn_idnf`, and the species check refuses `model_pnf=14` with its own + message, since no He5 species can be defined. Results of every + `model_pnf>0` run change. In NBI runs the printed beam collisional + powers (`PBCLE` to `PBCLA`) are now in MW; `PNB_TOT` and `PRF_TOT` are + not fixed by this, since the arrays they integrate are never filled in + trx (#238). - **MCP servers: the `mcp` dependency is pinned to `>=1.2,<2`** in the seven server `pyproject.toml` files, the CI workflow, the servers' own "not installed" message, the READMEs, the Sphinx MCP pages, the From b9ae2485318476680f51eb2a3db402673aca2cc9 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Thu, 22 Oct 2026 10:16:43 +0800 Subject: [PATCH 14/14] docs(trx): changelog entry for #269 only; model_pnf=14 not available (#269) As asked in the second review of #269. The CHANGELOG entry covered #270 too: its sentences on the ten TRGLOB integrals of trx/trrslt.f90 and on the NBI powers describe code this branch does not change, so they move to an entry on #270, and this one is tagged (#269; ...). "never set PNFIN_NSNNFNR" is replaced by what the code does: tr_pnf zeroes it on each call and nothing else writes it, so its totals stay 0. Also from that review: the model tables of trx/libnf.f90 and trx/trinit.f90 mark model_pnf=14 as not available (no He5 species can be defined), and the CASE(14) comment names the THe35 product and the arrays it would overrun (tr_pnf's (NSMAX,NNFMAX,NRMAX) arrays). No code changes. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 32 ++++++++++++++------------------ trx/libnf.f90 | 7 ++++--- trx/trinit.f90 | 1 + 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8807623ea..40736285c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,24 +96,20 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/). ### Fixed -- **trx: the fusion reaction path and the power totals** (#269, #270; - issues #229, #234, #235, #236, #238, #268). `sigmav_nf` returned its - tables in cm^3/s where `tr_pnf` takes m^3/s, so every `model_pnf` rate - was 1e6 too large (#238's 10 keV D-T deck stopped with negative - temperatures). `tr_pnf` took the slowing-down species from a stale loop - index, applied `RKEV` twice to the product's speed (so `TAUF` was - round-off), added `PNF_NSNNFNR` up over its calls and never set - `PNFIN_NSNNFNR`. Ten power integrals of `TRGLOB` stayed in W where - `PINT`, `QF` and the confinement times take MW. Also in `libnf`: - `pm_local` is a `REAL`, both modules are `IMPLICIT NONE`, the D-D branch - to He3 gives He3 for `model_pnf` 2, 3 and 4 and He4 for the reduced 12 - (which ran past an array bound before), the dd2 block sets its own - `enn_idnf`, and the species check refuses `model_pnf=14` with its own - message, since no He5 species can be defined. Results of every - `model_pnf>0` run change. In NBI runs the printed beam collisional - powers (`PBCLE` to `PBCLA`) are now in MW; `PNB_TOT` and `PRF_TOT` are - not fixed by this, since the arrays they integrate are never filled in - trx (#238). +- **trx: the fusion reaction path** (#269; issues #229, #234, #235, #236, + #268). `sigmav_nf` returned its tables in cm^3/s where `tr_pnf` takes + m^3/s, so every `model_pnf` rate was 1e6 too large (#238's 10 keV D-T + deck stopped with negative temperatures). `tr_pnf` took the slowing-down + species from a stale loop index, applied `RKEV` twice to the product's + speed (so `TAUF` was round-off) and added `PNF_NSNNFNR` up over its + calls; `PNF_NSNNFNR` and `PNFIN_NSNNFNR` are now zeroed on each call + (nothing else writes `PNFIN_NSNNFNR`, so its totals stay 0). Also in + `libnf`: `pm_local` is a `REAL`, both modules are `IMPLICIT NONE`, the + D-D branch to He3 gives He3 for `model_pnf` 2, 3 and 4 and He4 for the + reduced 12 (which ran past an array bound before), the dd2 block sets + its own `enn_idnf`, and the species check refuses `model_pnf=14` with + its own message, since no He5 species can be defined. Results of every + `model_pnf>0` run change. - **MCP servers: the `mcp` dependency is pinned to `>=1.2,<2`** in the seven server `pyproject.toml` files, the CI workflow, the servers' own "not installed" message, the READMEs, the Sphinx MCP pages, the diff --git a/trx/libnf.f90 b/trx/libnf.f90 index 2d52d277b..314ee7af7 100644 --- a/trx/libnf.f90 +++ b/trx/libnf.f90 @@ -42,6 +42,7 @@ MODULE libnf ! T + He3 -> He4 + p + n THe31 THe32 ! T + He3 -> He4 + D THe33 THe34 ! T + He3 -> He5 + p ! He4 + p THe35 THe36 + ! not available: no He5 species can be defined ! Fusion reaction id INTEGER,PARAMETER,PUBLIC:: id_nf_DT= 1 ! D + T -> + n @@ -210,9 +211,9 @@ SUBROUTINE set_usigmav_nf END IF CASE(14) ! NS_He5 is not a species found in the run: pl_init sets it to 7 and - ! tr_prep_ns never matches a He5 species, so the35's product would go - ! to species slot 7 (past the arrays when NSMAX < 7). Refused until a - ! He5 species can be defined. + ! tr_prep_ns never matches a He5 species, so the THe35 product would + ! go to species slot 7 (past tr_pnf's (NSMAX,NNFMAX,NRMAX) arrays when + ! NSMAX < 7). Refused until a He5 species can be defined. WRITE(6,*) 'XX Error: libnf: model_pnf=14 is not available: ', & 'no He5 species can be defined' STOP diff --git a/trx/trinit.f90 b/trx/trinit.f90 index b2ecde2de..64e4e2e2c 100644 --- a/trx/trinit.f90 +++ b/trx/trinit.f90 @@ -495,6 +495,7 @@ SUBROUTINE tr_init ! T + He3 -> He4 + p + n THe31 THe32 ! T + He3 -> He4 + D THe33 THe34 ! T + He3 -> He5 + p ! He4 + p THe35 THe36 + ! not available: no He5 species can be defined model_pnf=0