Hi-PACE / hipace

Highly efficient Plasma Accelerator Emulation, quasistatic particle-in-cell code
https://hipace.readthedocs.io
Other
51 stars 14 forks source link

Add a relative tolerance to SALAME #1125

Closed AlexanderSinn closed 3 months ago

AlexanderSinn commented 3 months ago

This PR adds the option for SALAME to stop early if a relative tolerance is met (default 1e-4). New example output:

Salame weight factor on slice 6463 is 36.08182156 Total weight is 29197.82958
Salame weight factor on slice 6463 is 1.000378897 Total weight is 29208.89254
Salame weight factor on slice 6463 is 0.9998989475 Total weight is 29205.94091
Salame weight factor on slice 6463 is 0.9999670285 Total weight is 29204.97795 (converged)
Salame weight factor on slice 6462 is 35.56048808 Total weight is 28607.47294
Salame weight factor on slice 6462 is 1.000389669 Total weight is 28618.62038
Salame weight factor on slice 6462 is 0.9999003436 Total weight is 28615.76835 (converged)
Salame weight factor on slice 6461 is 33.50595155 Total weight is 27013.89738
Salame weight factor on slice 6461 is 1.000379709 Total weight is 27024.15479
Salame weight factor on slice 6461 is 0.9999002078 Total weight is 27021.45799 (converged)
Salame weight factor on slice 6460 is 35.7203742 Total weight is 28676.00284
Salame weight factor on slice 6460 is 1.000379521 Total weight is 28686.88598
Salame weight factor on slice 6460 is 0.9998988096 Total weight is 28683.98314
Salame weight factor on slice 6460 is 0.9999667186 Total weight is 28683.02849 (converged)
Salame weight factor on slice 6459 is 37.78257352 Total weight is 30305.57401
Salame weight factor on slice 6459 is 1.000390985 Total weight is 30317.42304
Salame weight factor on slice 6459 is 0.9998727361 Total weight is 30313.56473
Salame weight factor on slice 6459 is 0.9999880633 Total weight is 30313.20289 (converged)
Salame weight factor on slice 6458 is 37.24980293 Total weight is 30098.21133
Salame weight factor on slice 6458 is 1.00040052 Total weight is 30110.26625
Salame weight factor on slice 6458 is 0.9998771699 Total weight is 30106.56781
Salame weight factor on slice 6458 is 0.9999882093 Total weight is 30106.21283 (converged)
Salame weight factor on slice 6457 is 36.93648945 Total weight is 29767.69271
Salame weight factor on slice 6457 is 1.000402982 Total weight is 29779.68855
Salame weight factor on slice 6457 is 0.9999004664 Total weight is 29776.72447 (converged)
Salame weight factor on slice 6456 is 35.76575861 Total weight is 29113.98382
Salame weight factor on slice 6456 is 1.000426648 Total weight is 29126.40526
Salame weight factor on slice 6456 is 0.9999030711 Total weight is 29123.58207 (converged)
Salame weight factor on slice 6455 is 35.69385948 Total weight is 28724.57073
Salame weight factor on slice 6455 is 1.000412055 Total weight is 28736.40683
Salame weight factor on slice 6455 is 0.9998751713 Total weight is 28732.81971
Salame weight factor on slice 6455 is 0.9999878974 Total weight is 28732.47196 (converged)

The default number of iterations was increased from 3 to 5 since it can now stop early if appropriate.