Skip to content

Commit

Permalink
Update the kinetic electron test with fixed electron_ppar update
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani committed Oct 23, 2024
1 parent 8f3c675 commit 5b4e150
Showing 1 changed file with 72 additions and 72 deletions.
144 changes: 72 additions & 72 deletions moment_kinetics/test/kinetic_electron_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,21 @@ kinetic_input["timestepping"] = OptionsDict("type" => "PareschiRusso2(2,2,2)",
)

kinetic_input["electron_timestepping"] = OptionsDict("nstep" => 5000000,
"dt" => 5.0e-6,
"dt" => 2.0e-5,
"nwrite" => 10000,
"nwrite_dfns" => 100000,
"decrease_dt_iteration_threshold" => 5000,
"increase_dt_iteration_threshold" => 0,
"cap_factor_ion_dt" => 10.0,
"initialization_residual_value" => 1.0e10,
"initialization_residual_value" => 1.0e0,
"converged_residual_value" => 1.0e-1,
)

kinetic_input["nonlinear_solver"] = OptionsDict("nonlinear_max_iterations" => 1000,
"rtol" => 1.0e-8,
"atol" => 1.0e-14,
"linear_restart" => 5,
"preconditioner_update_interval" => 100,
"preconditioner_update_interval" => 1000,
)


Expand Down Expand Up @@ -172,72 +172,72 @@ function run_test()

# Regression test
# Benchmark data generated in serial on Linux
expected_Ez = [-0.5990683230706185 -0.604849806235434;
-0.4944296396481284 -0.49739671491727844;
-0.30889032954504736 -0.30924318765687464;
-0.2064830747303776 -0.20682475071884582;
-0.21232457328748663 -0.21299072376949116;
-0.18233875912042674 -0.18256905463006085;
-0.16711429522309232 -0.1673112962636778;
-0.16920776495088916 -0.1693227707158167;
-0.1629417555658927 -0.16304933113558318;
-0.16619150334079993 -0.16629539618289285;
-0.15918194883360942 -0.1592799009526323;
-0.14034706409006803 -0.140437217833422;
-0.12602184032280567 -0.12610387949683538;
-0.10928716440800472 -0.10935785133612701;
-0.07053969674257217 -0.07058573063123225;
-0.0249577746169536 -0.024974174596810936;
-2.8327303308330514e-15 -1.441401377024236e-10;
0.024957774616960776 0.02497417427570905;
0.07053969674257636 0.07058572965952663;
0.10928716440799909 0.10935785264749627;
0.1260218403227975 0.12610388283669527;
0.1403470640900294 0.1404372197714126;
0.1591819488336015 0.15927992284761766;
0.16619150334082114 0.1662953275454769;
0.16294175556587748 0.1630489871826757;
0.16920776495090983 0.1693233489685909;
0.1671142952230893 0.16731075590341918;
0.1823387591204167 0.1825740389953209;
0.21232457328753865 0.21297925141919793;
0.20648307473037922 0.20682690396901446;
0.3088903295450278 0.30925854110074175;
0.4944296396481271 0.49731601862961966;
0.5990683230705801 0.6046564647413697]
expected_vthe = [27.08102229345079 27.08346736523219;
27.087730258479823 27.089003820908527;
27.091898844901323 27.09181784480061;
27.092455021687254 27.092742387764524;
27.09350739287911 27.094148133125078;
27.093817059011126 27.093889601910092;
27.09443981315218 27.094610141036807;
27.09484177005478 27.094996783801374;
27.094985914811055 27.0950626278904;
27.095122128675094 27.09525702879687;
27.09536357532887 27.09548558966323;
27.095582117080163 27.095716810823177;
27.09568783962135 27.09578276803757;
27.0957775472326 27.095878610625554;
27.095909169276535 27.09600041573683;
27.095978269355648 27.096074922150624;
27.095988166679223 27.096080134292468;
27.095978269713978 27.096074922508883;
27.095909171602027 27.096000418062378;
27.09577755035281 27.095878613746088;
27.095687838236376 27.095782766652857;
27.09558211622511 27.095716809968053;
27.09536353456768 27.09548554890375;
27.095122105596843 27.095257005693973;
27.094986093051983 27.09506280663278;
27.094841563692096 27.094996577040796;
27.094439553087433 27.094609881510113;
27.093813728418613 27.09388627063591;
27.093489818175936 27.094130555874184;
27.09246140309467 27.092748772044477;
27.09185903467811 27.09177803239964;
27.08774827015981 27.089021820036553;
27.081240668889404 27.0836857414255]
expected_Ez = [-0.5990683230706185 -1.136483186157602;
-0.4944296396481284 -0.9873296990705788;
-0.30889032954504736 -0.6694380824928302;
-0.2064830747303776 -0.4471331690708596;
-0.21232457328748663 -0.423069171542538;
-0.18233875912042674 -0.3586467595624931;
-0.16711429522309232 -0.3018272987758344;
-0.16920776495088916 -0.27814384649305496;
-0.1629417555658927 -0.26124630661090814;
-0.16619150334079993 -0.2572789330163811;
-0.15918194883360942 -0.23720078037362732;
-0.14034706409006803 -0.20520396656341475;
-0.12602184032280567 -0.1827016549071128;
-0.10928716440800472 -0.15808919669899502;
-0.07053969674257217 -0.10137753767917096;
-0.0249577746169536 -0.0358411459260082;
-2.8327303308330514e-15 -2.0803303361189427e-5;
0.024957774616960776 0.03584490974053962;
0.07053969674257636 0.1013692898656727;
0.10928716440799909 0.15807862358546687;
0.1260218403227975 0.18263049748179466;
0.1403470640900294 0.20516566362571026;
0.1591819488336015 0.23711236692241613;
0.16619150334082114 0.257126146434857;
0.16294175556587748 0.2609881259705107;
0.16920776495090983 0.2778978154805798;
0.1671142952230893 0.3015349192528757;
0.1823387591204167 0.3585291689672981;
0.21232457328753865 0.4231179549656996;
0.20648307473037922 0.44816400221269476;
0.3088903295450278 0.6716787105435247;
0.4944296396481271 0.9861165590258743;
0.5990683230705801 1.1300034111861956]
expected_vthe = [22.64555285302391 22.485481713141688;
23.763411647653097 23.63281883616836;
25.26907160117684 25.181703459470448;
26.17920352818247 26.12461016686916;
26.514772631426933 26.476018852279974;
26.798783188585713 26.774387562937218;
27.202255545479264 27.203662204308202;
27.50424749120107 27.527732850637264;
27.630498656270504 27.6642323848215;
27.748483758260697 27.79134809261204;
27.933760382468346 27.990808336620802;
28.08611508251559 28.153978618442775;
28.14959662643782 28.221734439130564;
28.207730844115044 28.283677711828023;
28.28567669896009 28.36634261525836;
28.32728392065335 28.410489883644782;
28.331064506972027 28.41437629072209;
28.32729968986601 28.41050992096321;
28.285678151542136 28.366352683865195;
28.207765527709956 28.28373408727703;
28.149604559462947 28.221771261090687;
28.086248527111163 28.154158507899695;
27.933979289064936 27.991103719847732;
27.74906125092813 27.792046191405188;
27.631210333523736 27.66508092926101;
27.505479130159543 27.529115937508752;
27.20422756527604 27.20578114592589;
26.801712351383053 26.77740066591359;
26.517644511297203 26.478915386575462;
26.18176436913143 26.127099000267552;
25.26635932097994 25.178676836919877;
23.756593489029708 23.625697695979085;
22.64390166090378 22.48400980852866]

if expected_Ez == nothing
# Error: no expected input provided
Expand All @@ -257,9 +257,9 @@ function run_test()
# Iteration counts are fairly inconsistent, but it's good to check that they at
# least don't unexpectedly increase by an order of magnitude.
# Expected iteration count is from a serial run on Linux.
expected_electron_advance_linear_iterations = 11394
@test electron_advance_linear_iterations < 2.0 * expected_electron_advance_linear_iterations
if !(electron_advance_linear_iterations < 2.0 * expected_electron_advance_linear_iterations)
expected_electron_advance_linear_iterations = 49307
@test electron_advance_linear_iterations < 2 * expected_electron_advance_linear_iterations
if !(electron_advance_linear_iterations < 2 * expected_electron_advance_linear_iterations)
println("electron_advance_linear_iterations=$electron_advance_linear_iterations was greater than twice the expected $expected_electron_advance_linear_iterations.")
end
end
Expand Down

0 comments on commit 5b4e150

Please sign in to comment.