Skip to content

Commit

Permalink
Fix to #1061
Browse files Browse the repository at this point in the history
The convergence statistics with cycle were incorrect
because all plasma cells including cells were
included.  The fix counts only cells that
are fully in the wind, unless the special mode
to calculate ionizationin partial cells is invoked
  • Loading branch information
kslong committed May 7, 2024
1 parent 83d4617 commit 540ded4
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions source/ionization.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,28 +306,31 @@ check_convergence (void)
{
int n;
int nconverge, nconverging, ntot;
int nte, ntr, nhc; //NSH 70g - three new counters for the different convergence criteria
int nmax; //NSH 130725 - counter for cells which are marked as converged, but over temp
int nte, ntr, nhc;
int nmax;
double xconverge, xconverging;

nconverge = nconverging = ntot = 0;
ntr = nte = nhc = nmax = 0;

for (n = 0; n < NPLASMA; n++)
{
ntot++;
if (plasmamain[n].converge_whole == CONVERGENCE_CHECK_PASS)
nconverge++;
if (plasmamain[n].trcheck == CONVERGENCE_CHECK_PASS)
ntr++;
if (plasmamain[n].techeck == CONVERGENCE_CHECK_PASS)
nte++;
if (plasmamain[n].hccheck == CONVERGENCE_CHECK_PASS)
nhc++;
if (plasmamain[n].techeck == CONVERGENCE_CHECK_OVER_TEMP)
nmax++;
if (plasmamain[n].converging == CELL_CONVERGING)
nconverging++;
if (wmain[plasmamain[n].nwind].inwind == W_ALL_INWIND || modes.partial_cells == PC_INCLUDE)
{
ntot++;
if (plasmamain[n].converge_whole == CONVERGENCE_CHECK_PASS)
nconverge++;
if (plasmamain[n].trcheck == CONVERGENCE_CHECK_PASS)
ntr++;
if (plasmamain[n].techeck == CONVERGENCE_CHECK_PASS)
nte++;
if (plasmamain[n].hccheck == CONVERGENCE_CHECK_PASS)
nhc++;
if (plasmamain[n].techeck == CONVERGENCE_CHECK_OVER_TEMP)
nmax++;
if (plasmamain[n].converging == CELL_CONVERGING)
nconverging++;
}
}

xconverge = ((double) nconverge) / ntot;
Expand Down

0 comments on commit 540ded4

Please sign in to comment.