From be3208014e36d6ed7fb81570bb27318866279b8f Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Tue, 20 Oct 2026 14:13:22 +0800 Subject: [PATCH 1/2] fix(trx): the ten per-channel power integrals of TRGLOB convert W to MW (#238) TRGLOB's legacy power integrals divide by 1.D6 (POHT, PEXT, PRBT, PRCT, PRLT, PRSUMT, PCXT, PIET), and the totals they enter are in MW (PINT = POHT + PNB_TOT + PRF_TOT + PNF_TOT + PEXST; trprf.f90 sets PIC_TOT/PLH_TOT/PEC_TOT from the input powers in MW; trhelp.f90 documents PNB_TOT in MW). The ten per-channel integrals did not: PIC_NSNIC, PLH_NSNLH, PEC_NSNEC, PNB_NSNNB, PNBIN_NSNNB, PNBCL_NSNNB, PNF_NSNNF, PNFIN_NSNNF, PNFCL_NSNNF and PNFNN_NNF were in W, so the channel totals PNF_TOT, PNB_TOT and PRF_TOT were 1e6 too large, which corrupted PINT, QF and the confinement diagnostics that take PINT (TAUE1 and TAUE2 directly, TAUE89 and TAUE98 and so H98Y2 through fractional powers). Each of the ten now ends in /1.D6; nothing else changes (the particle-source integrals in between are in 1/s and stay as they are). The solver uses the W/m^3 profiles and is unaffected. Issue #238; its seven secondary items are left for the module lead, as decided there. Co-Authored-By: Claude Opus 5.5 --- trx/trrslt.f90 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/trx/trrslt.f90 b/trx/trrslt.f90 index 853fd77b5..835a5b61d 100644 --- a/trx/trrslt.f90 +++ b/trx/trrslt.f90 @@ -164,15 +164,15 @@ SUBROUTINE TRGLOB DO NS=1,NSMAX DO NIC=1,NICMAX PIC_NSNIC(NS,NIC) & - =SUM(PIC_NSNICNR(NS,NIC,1:NRMAX)*DVRHO(1:NRMAX))*DR + =SUM(PIC_NSNICNR(NS,NIC,1:NRMAX)*DVRHO(1:NRMAX))*DR/1.D6 END DO DO NLH=1,NLHMAX PLH_NSNLH(NS,NLH) & - =SUM(PLH_NSNLHNR(NS,N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1:NRMAX)*DVRHO(1:NRMAX))*DR + =SUM(PNFIN_NSNNFNR(NS,NNF,1:NRMAX)*DVRHO(1:NRMAX))*DR/1.D6 PNFCL_NSNNF(NS,NNF) & - =SUM(PNFCL_NSNNFNR(NS,NNF,1:NRMAX)*DVRHO(1:NRMAX))*DR + =SUM(PNFCL_NSNNFNR(NS,NNF,1:NRMAX)*DVRHO(1:NRMAX))*DR/1.D6 END DO END DO @@ -325,7 +325,7 @@ SUBROUTINE TRGLOB SNFNN_NNF(NNF) & =SUM(SNFNN_NNFNR(NNF,1:NRMAX)*DVRHO(1:NRMAX))*DR PNFNN_NNF(NNF) & - =SUM(PNFNN_NNFNR(NNF,1:NRMAX)*DVRHO(1:NRMAX))*DR + =SUM(PNFNN_NNFNR(NNF,1:NRMAX)*DVRHO(1:NRMAX))*DR/1.D6 END DO SNFNN_TOT=SUM(SNFNN_NNF(1:NNFMAX)) From d2bbfccaee7cc61322597a5056ee18f78f38ea95 Mon Sep 17 00:00:00 2001 From: HengyuLi-Ozaki-lab Date: Thu, 22 Oct 2026 10:17:03 +0800 Subject: [PATCH 2/2] docs(changelog): the TRGLOB power integrals in MW (#270) The sentences on the ten TRGLOB integrals and on the NBI powers were in #269's CHANGELOG entry, although this pull request makes that change; the review of #269 asked to move them here, so that develop's changelog is true whichever of the two merges first. The entry sits after the second [Unreleased] Fixed entry, a boundary no other open pull request inserts at. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b27ede66a..d6ad1ff2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -121,6 +121,16 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/). overflows and a step never ends); `NSAMAX` above `NSBMAX`; an evolved species number outside 1 to `MIN(NSMAX, NSBMAX)`; a background species number outside 1 to `NSMAX`. +- **trx: the per-channel power integrals of `TRGLOB` are in MW** (#270; + issue #238). Ten of them (`PIC_NSNIC`, `PLH_NSNLH`, `PEC_NSNEC`, + `PNB_NSNNB`, `PNBIN_NSNNB`, `PNBCL_NSNNB`, `PNF_NSNNF`, `PNFIN_NSNNF`, + `PNFCL_NSNNF`, `PNFNN_NNF`) stayed in W where `PINT`, `QF` and the + confinement times take MW, so `PNF_TOT` entered `PINT` 1e6 too large and + corrupted `PINT`, `QF`, `TAUE1`, `TAUE2` and, through fractional powers, + `TAUE89`, `TAUE98` and `H98Y2` of runs with fusion. 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 `eq_mcp`, `tr_mcp`, `tot_mcp`: Fortran output no longer reaches the JSON-RPC pipe.** A stdio server's fd 1 is the pipe to its client, and the library's `WRITE(6,...)` went into it: in one stdio