From 6684f2eb64bc0aae8e0234e683fccaa3c243daa3 Mon Sep 17 00:00:00 2001 From: totork Date: Wed, 18 Mar 2026 15:07:36 +0100 Subject: [PATCH 01/21] Added first step of 3D MMS test --- CMakeLists.txt | 2 + .../integrated/2D-axial-circular-fci/axial.m | 73 ++++ .../2D-axial-circular-fci/axial_notebook.nb | 343 ++++++++++++++++++ .../2D-axial-circular-fci/data/BOUT.inp | 67 ++++ .../integrated/2D-axial-circular-fci/runtest | 135 +++++++ 5 files changed, 620 insertions(+) create mode 100644 tests/integrated/2D-axial-circular-fci/axial.m create mode 100644 tests/integrated/2D-axial-circular-fci/axial_notebook.nb create mode 100644 tests/integrated/2D-axial-circular-fci/data/BOUT.inp create mode 100755 tests/integrated/2D-axial-circular-fci/runtest diff --git a/CMakeLists.txt b/CMakeLists.txt index 9eae66871..91cf77861 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,6 +298,8 @@ if(HERMES_TESTS) DEPENDS setup-test) endif() endfunction() + hermes_add_integrated_test(2D-axial-circular-fci + REQUIRES BOUT_ENABLE_METRIC_3D) hermes_add_integrated_test(2D-vorticity-inversion-fci REQUIRES BOUT_ENABLE_METRIC_3D) hermes_add_integrated_test(1D-sheathtest-recycling-fci diff --git a/tests/integrated/2D-axial-circular-fci/axial.m b/tests/integrated/2D-axial-circular-fci/axial.m new file mode 100644 index 000000000..d391b57f7 --- /dev/null +++ b/tests/integrated/2D-axial-circular-fci/axial.m @@ -0,0 +1,73 @@ +(* ::Package:: *) + +BeginPackage["axial`"] + +(* To run the package, execute the following line in a notebook +<Normal*) + +(* Beginning of Notebook Content *) +Notebook[{ + +Cell[CellGroupData[{ +Cell[BoxData[ + RowBox[{"\[IndentingNewLine]", + RowBox[{"SetDirectory", "[", + RowBox[{"NotebookDirectory", "[", "]"}], "]"}]}]], "Input", + CellChangeTimes->{{3.941091023755059*^9, 3.941091026844414*^9}}, + CellLabel->"In[1]:=",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], + +Cell[BoxData["\<\"/viper/u1/toto/soft/hermes-3/build_new/tests/integrated/2D-\ +axial-circular-fci\"\>"], "Output", + CellChangeTimes->CompressedData[" +1:eJwVy0sowwEcwPFxmG2NtlGzl7zCHEhZrZXWHHZYCI0o84o8Vl4LzQGRR1qY +oqakaGaMpqEoIzHGPJocMI9adsB/yUqTR36/w7fP6RtX3VxYG0IikaTQOWP1 +lqIiZAFmZSwVbPVVGGigwuE+Rs+cnjYGWGbPtaBMx6WQCXZxQ8dZ4G5P0jJa +36Q/iAK3RFIlG5wS9avQAgp5ggN6uyeFPDCF9itG3fLZFD74oEnIRS11b3pU +UeHKFIBVfskgGkbTjMWA+VpGiwqscWk70cG1I3M5+Los5lWC55vVGvTt6duJ +Xswdc6rAyxVuOjrbIclC1YHiPfTdmviHRn8NL9yAFMHkJso3i5yoYLvd6AGL +BryHqH+edofqxCYfmkecsu/BpSSr7QHsEHs2HsH1mVr5Ezj0NXb9DH4YG8g+ +sGSxJYh+vHim6eWEjH5E3Ud1sjwJfRF+G59AGare5HCwkJOmRCfUNgM6qu3L +iAD9t6YeFtjJSrWjwSHySCSoE5wY0NLGHTMa/OGdoD9T1hyjhZBlX+kf0aj4 +zxf0H1Zi/l0= + "], + CellLabel->"Out[1]=",ExpressionUUID->"b5f61823-234d-47a3-8ecb-2ab82fad46f4"] +}, Open ]], + +Cell[CellGroupData[{ + +Cell[BoxData[ + RowBox[{"<<", "axial.m"}]], "Input", + CellChangeTimes->{{3.9410005336133223`*^9, 3.941000541398674*^9}, { + 3.941000701368867*^9, 3.941000721827975*^9}, {3.941000869088725*^9, + 3.941000881063511*^9}, 3.941091017550275*^9}, + CellLabel->"In[2]:=",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], + +Cell[CellGroupData[{ + +Cell[BoxData["\<\"Computing MMS Terms\"\>"], "Print", + CellChangeTimes->CompressedData[" +1:eJwVzE0ogwEcx/GR18Uw8s7yUl4OSIhleC5IrSQJ2bwl5T0TqR3mJWYUdlCo +HTSszXAwL4kkkUc5CBFG3rWei8OSIf/f4dvn9o2qay9pcOLxeBJq2tlzli/j +GJenQRaKKy4UvqT2OdYMeYLGRD/ywXV8QkhyJrUJKjtsBwHwebE0iMxPcpbD +yrcWbQjZOepICCNZVVUWVJx4J4ST8YI5KfweZrTQ1SpKjyBzL6aGoIfoYzyS +3Bzo7ZCRp832Hhio7zbKybjTqbAasl23qoAB9mYWdulTQmtJh/AoGeaVL0jg +58jyHuwvMvzBc1324jV5prZsQF36zjHcZ1/mb8mtjJVD6Ou+fQObinPeoO08 +OfiOjFRr1qwkP8awfk9W/0oKHvDti718ITXvr26v5OWT4wsWWiyzXnKOiVY8 +7sPCzE2xl4FjqrKnOSiTu8V7k6pWcymUDqbNwB8Pn1QBKfYLVwnJfuXuLmzj +KzX+pEBUPwPHvsuMcLR4koVmq490folj9oKu7mHOb4EN/gNRyPK7 + "], + CellLabel-> + "During evaluation of \ +In[2]:=",ExpressionUUID->"5bfbe9fd-ab13-4b3c-b1c4-b5eb0f8469fe"], + +Cell[BoxData["\<\"Finished MMS Terms\"\>"], "Print", + CellChangeTimes->CompressedData[" +1:eJwVzGkogwEcx/GRYxbDyM1ylOMFEmIZnjeuWkkSsrmScmciNTVHzCjshULt +hRwLwwtzJJI0eZQXQoSRW+t544VkyP/34tvn3Te0qrmgxo7H40mpCXuXKYGc +Yxwe+1goKTlXepC6pwgj5AlrYzzJe8eRURHJLWoWoarFeuANn+YLfcmsWHsF +LH1t0PmTrUO26ECSVZelQuWxW3QQGSWclsHvAUYHHS3ipGAy43y8H/LF7yMh +5GZvZ4ucPKn/7IA+M+0LCjLyZDywgmzWryqh92c9C9tm4gMqSZvoMA5mFs9J +4cfg8h7syTP8wTN92vwVeaoxbUB90s4R3GefZ2/IreQVM/Rw3r6Gdfnpr9B6 +Fud3S4ZotGsWUhBuWL8jy3+l2ff4dkdcPJPatxenF/Li0fYFc0ymKVcFx4Qp +H/ZhTsqmxNXAMWVpExyUK5yi3Eh1o7EQyvoSJ+EP3z1BSEo8g9Qiske1uwub +BCqtFykUV0/C4e+iBTiUP8ZCo8VdNrvEMXu+l3fQ3JVrhf9SlPLF + "], + CellLabel-> + "During evaluation of \ +In[2]:=",ExpressionUUID->"34065837-eadc-4dc3-be4c-78795b8adda1"], + +Cell[BoxData["9.579629665962438`*^7"], "Print", + CellChangeTimes->CompressedData[" +1:eJwVzE0ogwEcx/GR18Uw8s7yUl4OSIhleC6IVpKEbN4Sec9Eaod5iRmFHRRq +B3lZGA7GJFoSeZSDEGHkXeu5OEiG/H+Hb5/bN6y6tbDWjsfjSahJe9dpvoxj +HB77WSguPVd4ktqnSAPkCepivch7x9ExIcktqZegss267wOfFor8yOw4ezks +e23SBpDtw7aYIJJVladBxbF7TDAZLZiRwu9BRgsdLaLkEDLzfGIAuojeR0NJ +U193m4w8afzsgr6znYtyMupkIqiSbNWtKaDPZyMLO2YTAqtIm/AwHmaVzEvg +x9CKGfbm6f/gmS594Yo8VRs3oS555wjusc9zN+RWyuoB9HTevoYNBRmv0HoW +739Lhqo16xaSH6HfuCMrfiU59/j2RF48k5q3F6cX8uLR9gVzjcZpNznHhCse +9mBuqknspueY8vRJDsrkTtHupKrZUASl/UlT8MfFI1FAir2CVUKyV7m7C1v4 +So03KRDVTMGR7+JFOFwwzkKDxUM6t8wxZr/LO1hvzrfCf1GF8qw= + "], + CellLabel-> + "During evaluation of \ +In[2]:=",ExpressionUUID->"1f1b93f4-0e7d-48c8-beef-cb5620d8b280"] +}, Open ]] +}, Open ]], + +Cell[CellGroupData[{ + +Cell[BoxData[{ + RowBox[{ + RowBox[{"kx", " ", "=", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"kz", "=", "4"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"ky", "=", "1"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"omega", "=", "0.1"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"amp", "=", "0.5"}], ";"}], "\[IndentingNewLine]", + RowBox[{"phz", " ", "=", " ", "0.1"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"phy", " ", "=", "0.5"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"pht", "=", " ", "0.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"xmin", "=", "0.4"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"xmax", "=", "0.6"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"offset", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"Dperp", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"Dpar", " ", "=", " ", "100000"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{ + RowBox[{"q", "[", "x_", "]"}], " ", "=", " ", + RowBox[{"3.0", "+", + RowBox[{"3.5", " ", "*", " ", "x"}]}]}], ";"}], + "\[IndentingNewLine]"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"CForm", "[", + RowBox[{"MmsDens", "[", + RowBox[{"xl", ",", "zl", ",", "yl", ",", "t"}], "]"}], "]"}], + "\[IndentingNewLine]"}], "\[IndentingNewLine]"}], "Input", + CellChangeTimes->{{3.941001710751292*^9, 3.941001799493569*^9}, { + 3.94100196287262*^9, 3.94100197699585*^9}, {3.941002082278537*^9, + 3.941002091026224*^9}, {3.941005604446062*^9, 3.9410056280492363`*^9}, { + 3.941005702954153*^9, 3.941005712874386*^9}, {3.941005747843405*^9, + 3.94100575324975*^9}, {3.941009187354603*^9, 3.941009247364457*^9}, { + 3.94100966318116*^9, 3.941009680024501*^9}, {3.941091600565372*^9, + 3.9410916014166613`*^9}, {3.941091731467869*^9, 3.941091794275579*^9}, { + 3.941091841698888*^9, 3.94109184990349*^9}, {3.94110656901536*^9, + 3.941106579582962*^9}, {3.941106650936283*^9, 3.94110669207623*^9}, + 3.941106732865182*^9, {3.941120562846257*^9, 3.941120568623769*^9}, { + 3.941120627216084*^9, 3.941120628259906*^9}, {3.941120719254148*^9, + 3.941120719910901*^9}, {3.941120781889386*^9, 3.941120787474683*^9}, { + 3.9411251832829638`*^9, 3.941125233701482*^9}, {3.941128545834157*^9, + 3.9411285503249607`*^9}, {3.9411285973137712`*^9, 3.941128604556089*^9}, { + 3.941130823020509*^9, 3.941130836706815*^9}, {3.941132669299409*^9, + 3.9411326822525787`*^9}, {3.9411333416570683`*^9, 3.941133341715454*^9}, { + 3.9411354363450203`*^9, 3.941135441093075*^9}, {3.941137102236459*^9, + 3.941137103929172*^9}, {3.941212667495749*^9, 3.9412126703613577`*^9}, { + 3.941264227933763*^9, 3.941264274028784*^9}, {3.941266728760947*^9, + 3.941266734322445*^9}, {3.941269687955462*^9, 3.9412696987061653`*^9}, { + 3.941271079546174*^9, 3.941271081196938*^9}, {3.9412719962761*^9, + 3.941271997015006*^9}, {3.9412730616699057`*^9, 3.941273066087247*^9}, { + 3.941273533132288*^9, 3.94127355265935*^9}, {3.941273899665763*^9, + 3.941273921460822*^9}, {3.9415184110422688`*^9, 3.9415184170689363`*^9}, { + 3.9415185124635487`*^9, 3.9415185185770617`*^9}, {3.9415188636598063`*^9, + 3.94151886756817*^9}, 3.9415321328707323`*^9, {3.9415427858429737`*^9, + 3.941542828000198*^9}, {3.941542872244955*^9, 3.941542873488117*^9}, { + 3.941543280452444*^9, 3.941543353814756*^9}, {3.941543921314495*^9, + 3.941543944142756*^9}, {3.94154588614583*^9, 3.941545886200872*^9}, { + 3.941551072132766*^9, 3.94155107423029*^9}, {3.941622928218151*^9, + 3.941622975931859*^9}, {3.9416232368015337`*^9, 3.941623242079863*^9}, { + 3.980418501299036*^9, 3.980418510848222*^9}, {3.980419223612973*^9, + 3.9804192259502373`*^9}, {3.980419424952941*^9, 3.9804194250073843`*^9}, { + 3.9804234906671753`*^9, 3.980423505726005*^9}, {3.980441355886915*^9, + 3.980441368363199*^9}, {3.982829754504801*^9, 3.982829782740342*^9}, { + 3.9828299614012003`*^9, 3.982829964662109*^9}, {3.982831344310981*^9, + 3.9828313473575497`*^9}}, + CellLabel->"In[3]:=",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], + +Cell[BoxData["0.1`"], "Output", + CellChangeTimes->{ + 3.941009688547415*^9, 3.941091609619776*^9, {3.941091721815781*^9, + 3.94109175661007*^9}, 3.941091800122217*^9, 3.941091861807825*^9, + 3.941094505048383*^9, 3.941094632399669*^9, 3.94109500239986*^9, + 3.941106598058303*^9, 3.94110669394636*^9, 3.941106733977233*^9, + 3.9411070572842493`*^9, 3.941108055401798*^9, 3.941110920195258*^9, + 3.941111135388945*^9, 3.9411154343472643`*^9, 3.941120680145395*^9, + 3.941120754512067*^9, 3.941120792306068*^9, 3.941125270776736*^9, + 3.9411285314437933`*^9, 3.94112865354068*^9, 3.9411305706981773`*^9, + 3.941130863732583*^9, 3.941131412892272*^9, 3.941132715845481*^9, + 3.941133367217663*^9, 3.94113549000552*^9, 3.9412642619733667`*^9, + 3.941264321927586*^9, 3.941266776146008*^9, 3.941269726592196*^9, + 3.9412704321241703`*^9, 3.941271127788968*^9, 3.941271764441196*^9, + 3.941271938828134*^9, 3.941272048248835*^9, 3.9412730959363823`*^9, + 3.941273591507408*^9, {3.941518418753319*^9, 3.941518436017467*^9}, + 3.941518506514503*^9, 3.9415186678213663`*^9, 3.94151878816772*^9, + 3.941518930271064*^9, 3.941524789151843*^9, 3.941525052529055*^9, + 3.941525223263277*^9, 3.941525310950933*^9, 3.9415257007103243`*^9, + 3.94152899981022*^9, 3.941531065665744*^9, 3.9415322221566772`*^9, + 3.941543605943892*^9, 3.9415439146525593`*^9, 3.941543993887024*^9, + 3.941545930879993*^9, 3.94162301201434*^9, 3.941623323243279*^9, + 3.980419544580164*^9, 3.980420976435289*^9, 3.980421442630149*^9, + 3.9804217996122704`*^9, 3.9804223560539*^9, 3.980423483943228*^9, + 3.980423570934939*^9, 3.9804323880265083`*^9, 3.980432889684306*^9, + 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, + 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, + 3.9828314519018393`*^9}, + CellLabel->"Out[8]=",ExpressionUUID->"40a194c8-1bdc-4e9a-80a5-5b364025cba0"], + +Cell["\<\ +1. - 0.5*Cos(0.5 - yl)* + Sin(31.41592653589794*(-0.4 + xl))* + Sin(0.1 - 4*zl)\ +\>", "Output", + CellChangeTimes->{ + 3.941009688547415*^9, 3.941091609619776*^9, {3.941091721815781*^9, + 3.94109175661007*^9}, 3.941091800122217*^9, 3.941091861807825*^9, + 3.941094505048383*^9, 3.941094632399669*^9, 3.94109500239986*^9, + 3.941106598058303*^9, 3.94110669394636*^9, 3.941106733977233*^9, + 3.9411070572842493`*^9, 3.941108055401798*^9, 3.941110920195258*^9, + 3.941111135388945*^9, 3.9411154343472643`*^9, 3.941120680145395*^9, + 3.941120754512067*^9, 3.941120792306068*^9, 3.941125270776736*^9, + 3.9411285314437933`*^9, 3.94112865354068*^9, 3.9411305706981773`*^9, + 3.941130863732583*^9, 3.941131412892272*^9, 3.941132715845481*^9, + 3.941133367217663*^9, 3.94113549000552*^9, 3.9412642619733667`*^9, + 3.941264321927586*^9, 3.941266776146008*^9, 3.941269726592196*^9, + 3.9412704321241703`*^9, 3.941271127788968*^9, 3.941271764441196*^9, + 3.941271938828134*^9, 3.941272048248835*^9, 3.9412730959363823`*^9, + 3.941273591507408*^9, {3.941518418753319*^9, 3.941518436017467*^9}, + 3.941518506514503*^9, 3.9415186678213663`*^9, 3.94151878816772*^9, + 3.941518930271064*^9, 3.941524789151843*^9, 3.941525052529055*^9, + 3.941525223263277*^9, 3.941525310950933*^9, 3.9415257007103243`*^9, + 3.94152899981022*^9, 3.941531065665744*^9, 3.9415322221566772`*^9, + 3.941543605943892*^9, 3.9415439146525593`*^9, 3.941543993887024*^9, + 3.941545930879993*^9, 3.94162301201434*^9, 3.941623323243279*^9, + 3.980419544580164*^9, 3.980420976435289*^9, 3.980421442630149*^9, + 3.9804217996122704`*^9, 3.9804223560539*^9, 3.980423483943228*^9, + 3.980423570934939*^9, 3.9804323880265083`*^9, 3.980432889684306*^9, + 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, + 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, + 3.9828314519487143`*^9}, + CellLabel-> + "Out[17]//CForm=",ExpressionUUID->"0ab2513c-b632-4afa-a991-864039ec9da9"] +}, Open ]], + +Cell[BoxData[""], "Input", + CellChangeTimes->{{3.9804234827382107`*^9, 3.980423485860519*^9}}, + CellLabel->"In[18]:=",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], + +Cell[BoxData[ + RowBox[{ + RowBox[{"Export", "[", + RowBox[{ + RowBox[{"FileNameJoin", "[", + RowBox[{"{", + RowBox[{ + RowBox[{"NotebookDirectory", "[", "]"}], ",", "\"\\""}], + "}"}], "]"}], ",", + RowBox[{"ToLowerCase", "[", + RowBox[{"ToString", "[", + RowBox[{ + RowBox[{"CForm", "[", + RowBox[{"MmsDens", "[", + RowBox[{"xl", ",", "zl", ",", "yl", ",", "t"}], "]"}], "]"}], ",", + "InputForm"}], "]"}], "]"}]}], "]"}], ";"}]], "Input", + CellChangeTimes->{{3.941091108047451*^9, 3.941091108047735*^9}, + 3.941091893938613*^9, {3.941091943764895*^9, 3.941091953659176*^9}, { + 3.94109205520127*^9, 3.9410920828692217`*^9}, {3.941543505174944*^9, + 3.941543506958555*^9}, {3.941551089773295*^9, 3.941551093286003*^9}, { + 3.9804213870984488`*^9, 3.980421390947422*^9}, {3.9804222978401527`*^9, + 3.980422306130024*^9}}, + CellLabel->"In[19]:=",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], + +Cell[BoxData[ + RowBox[{ + RowBox[{"Export", "[", + RowBox[{ + RowBox[{"FileNameJoin", "[", + RowBox[{"{", + RowBox[{ + RowBox[{"NotebookDirectory", "[", "]"}], ",", "\"\\""}], + "}"}], "]"}], ",", + RowBox[{"ToLowerCase", "[", + RowBox[{"ToString", "[", + RowBox[{ + RowBox[{"CForm", "[", + RowBox[{"Smms", "[", + RowBox[{"xl", ",", "zl", ",", "yl", ",", "t"}], "]"}], "]"}], ",", + "InputForm"}], "]"}], "]"}]}], "]"}], ";"}]], "Input", + CellChangeTimes->{{3.941092152330538*^9, 3.941092164437331*^9}, { + 3.941543525003409*^9, 3.9415435486676207`*^9}, {3.94155108160419*^9, + 3.941551083792343*^9}, {3.9804213936372538`*^9, 3.980421397635703*^9}, { + 3.980422311434009*^9, 3.980422315912444*^9}}, + CellLabel->"In[20]:=",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] +}, +WindowSize->{513, 627}, +WindowMargins->{{Automatic, 0}, {Automatic, 0}}, +FrontEndVersion->"14.3 for Linux x86 (64-bit) (July 8, 2025)", +StyleDefinitions->"Default.nb", +ExpressionUUID->"ee53c5d0-dbab-4b20-a961-e0f5716cf87c" +] +(* End of Notebook Content *) + +(* Internal cache information *) +(*CellTagsOutline +CellTagsIndex->{} +*) +(*CellTagsIndex +CellTagsIndex->{} +*) +(*NotebookFileOutline +Notebook[{ +Cell[CellGroupData[{ +Cell[580, 22, 285, 5, 51, "Input",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], +Cell[868, 29, 797, 14, 53, "Output",ExpressionUUID->"b5f61823-234d-47a3-8ecb-2ab82fad46f4"] +}, Open ]], +Cell[CellGroupData[{ +Cell[1702, 48, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], +Cell[CellGroupData[{ +Cell[2046, 57, 741, 14, 23, "Print",ExpressionUUID->"5bfbe9fd-ab13-4b3c-b1c4-b5eb0f8469fe"], +Cell[2790, 73, 740, 14, 23, "Print",ExpressionUUID->"34065837-eadc-4dc3-be4c-78795b8adda1"], +Cell[3533, 89, 735, 14, 30, "Print",ExpressionUUID->"1f1b93f4-0e7d-48c8-beef-cb5620d8b280"] +}, Open ]] +}, Open ]], +Cell[CellGroupData[{ +Cell[4317, 109, 4158, 75, 374, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], +Cell[8478, 186, 1928, 28, 33, "Output",ExpressionUUID->"40a194c8-1bdc-4e9a-80a5-5b364025cba0"], +Cell[10409, 216, 2017, 33, 80, "Output",ExpressionUUID->"0ab2513c-b632-4afa-a991-864039ec9da9"] +}, Open ]], +Cell[12441, 252, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], +Cell[12617, 256, 984, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], +Cell[13604, 280, 852, 20, 149, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] +} +] +*) + diff --git a/tests/integrated/2D-axial-circular-fci/data/BOUT.inp b/tests/integrated/2D-axial-circular-fci/data/BOUT.inp new file mode 100644 index 000000000..9cd4f8413 --- /dev/null +++ b/tests/integrated/2D-axial-circular-fci/data/BOUT.inp @@ -0,0 +1,67 @@ +nout = 50 +timestep = 0.1 + + + + + +minvalue= (-2.0+0.5) / (nx - 2*2) +maxvalue= (nx-3+0.5) / (nx - 2*2) +xmax = 0.6 +xmin = 0.4 +xl = (xmax - xmin)*(x-minvalue)/(maxvalue-minvalue) + xmin +yl = y +zl = z + + +[input] + +error_on_unused_options = false + +[mesh] + +extrapolate_y = false + +[mesh:paralleltransform] +type = fci + +[mesh] + +symmetricGlobalX = true + +[solver] +mxstep = 10000 +rtol = 1e-8 +atol = 1e-12 +mms = true # Run with MMS sources and output diagnostics +mms_initialise = true +type = cvode + + +[hermes] +components = h+ + + +Nnorm = 1e18 +Bnorm = 1 +Tnorm = 5 + +[h+] # Ions +type = evolve_density, anomalous_diffusion_3d +charge = 1.0 +AA = 1.0 + +mms = true + +anomalous_D = 1.0 +anomalous_D_par = 1e5 + +use_finite_difference = true + +[Nh+] + +solution = 1. - 0.5*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + +source = -1.0438816894489344e-8*((-15.70796326794897*cos(31.41592653589794*(-0.4 + xl))*cos(0.5 - yl)*sin(0.1 - 4*zl))/xl + 493.4802200544682*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (8.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(xl,2)) - (0.0010438816894489343*((4.*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl))/(3. + 3.5*xl) + 0.5*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (8.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(3. + 3.5*xl,2)))/(1 + power(xl,2)/power(3. + 3.5*xl,2)) + +bndry_all = dirichlet_o2(`Nh+:solution`) diff --git a/tests/integrated/2D-axial-circular-fci/runtest b/tests/integrated/2D-axial-circular-fci/runtest new file mode 100755 index 000000000..5352af7f9 --- /dev/null +++ b/tests/integrated/2D-axial-circular-fci/runtest @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 + +# Python script to run and analyse MMS test + +from __future__ import division +from __future__ import print_function +import numpy as np +try: + from builtins import str +except: + pass + +from boututils.run_wrapper import shell, launch_safe, getmpirun +from boutdata.collect import collect + +from numpy import sqrt, max, abs, mean, array, log, concatenate + +import tarfile + + +gridpath = "../../../../grids/mms_axial_circular_fci/" +#archive_path = "MMS_Circle_fci_XZ.tar.xz" + +#try: +# with tarfile.open(gridpath + archive_path, "r:xz") as tar: +# tar.extractall(path=gridpath) +# print("Successfully extracted the grids!") +#except: +# raise FileNotFoundError("Could not fine mms slab y file to extract") + + +#def gridname(nx): +# return gridpath + f"circular_{int(nx+4)}_{4}_{int(nx*8)}.nc" + +def gridname(nx): + return gridpath + f"Axial_circular_q_{int(nx)}_{int(4*nx)}_0.4_0.6_3.0_3.5.fci.grid.nc" + + +# List of NY values to use +#nxlist = [36, 68, 132, 260] #, 640, 1280, 2560, 5120] +nxlist = [16,32] +nout = 10 +timestep = 1e5 / nout + +nproc = 1 + +varnames = ["Nh+"] + +results = {} +for var in varnames: + results[var] = {"l2":[], "inf":[]} + +for ny in nxlist: + args = "mesh:file="+gridname(ny)+" nout="+str(nout)+" timestep="+str(timestep) + " nx="+str(ny+4) + + print("Running with " + args) + + # Delete old data + shell("rm data/BOUT.dmp.*.nc") + + # Command to run + cmd = "../../../hermes-3 " + args + # Launch using MPI + s, out = launch_safe(cmd, nproc=nproc, pipe=True) + + # Save output to log file + f = open("run.log."+str(ny), "w") + f.write(out) + f.close() + + # Collect data + for var in varnames: + E = collect("E_"+var, tind=[nout,nout], path="data", info=False) + print(str(np.array(E).shape)) + E = E[0,2:-2,1:-1,:] + + l2 = sqrt(mean(E**2)) + linf = max(abs(E)) + results[var]["l2"].append( l2 ) + results[var]["inf"].append( linf ) + + print("Error norm %s: l-2 %f l-inf %f" % (var, l2, linf)) + +# Calculate grid spacing +dy = 1. / array(nxlist) + +success = True + +for var in varnames: + l2 = results[var]["l2"] + order = log(l2[-1] / l2[-2]) / log(dy[-1] / dy[-2]) + print("Convergence order %s = %f" % (var, order)) + + if order < 1.8: + success = False + +# plot errors +try: + import matplotlib.pyplot as plt + + for var in varnames: + l2 = results[var]["l2"] + inf = results[var]["inf"] + order = log(l2[-1] / l2[-2]) / log(dy[-1] / dy[-2]) + + plt.plot(dy, l2, '-o', label=r'$l_2$ ('+var+')') + plt.plot(dy, inf, '-x', label=r'$l_\infty$ ('+var+')') + plt.plot(dy, l2[-1]*(dy/dy[-1])**order, '--', label="Order %.1f" % (order)) + + plt.legend(loc="upper left") + plt.grid() + + plt.yscale('log') + plt.xscale('log') + + plt.xlabel(r'Mesh spacing $\delta y$') + plt.ylabel("Error norm") + + plt.savefig("fluid_norm.pdf") + plt.savefig("fluid_norm.png") + + #plt.show() + plt.close() +except: + # Plotting could fail for any number of reasons, and the actual + # error raised may depend on, among other things, the current + # matplotlib backend, so catch everything + pass + +if success: + print(" => Test passed") + exit(0) +else: + print(" => Test failed") + exit(1) From aefa7083b6dd24028f0828a6f8e3e8b31080ae7c Mon Sep 17 00:00:00 2001 From: totork Date: Wed, 18 Mar 2026 21:36:02 +0100 Subject: [PATCH 02/21] More work on 2D axial MMS test --- .../integrated/2D-axial-circular-fci/axial.m | 3 +- .../2D-axial-circular-fci/axial_notebook.nb | 133 +++++++++--------- .../2D-axial-circular-fci/data/BOUT.inp | 6 +- .../integrated/2D-axial-circular-fci/runtest | 2 +- 4 files changed, 74 insertions(+), 70 deletions(-) diff --git a/tests/integrated/2D-axial-circular-fci/axial.m b/tests/integrated/2D-axial-circular-fci/axial.m index d391b57f7..852e558e7 100644 --- a/tests/integrated/2D-axial-circular-fci/axial.m +++ b/tests/integrated/2D-axial-circular-fci/axial.m @@ -35,8 +35,7 @@ LaplacePerp[f_,r_,p_,z_,t_] = D[f[r,p,z,t],{r,2}] + D[f[r,p,z,t],r]/r + 1.0/(r*r)*D[f[r,p,z,t],{p,2}]; -d2dpar2[f_, x_, z_, y_, t_] = Dpar * ((D[D[f[x, z, y, t], y], y] + 2/q[x]*D[D[f[x, z, y, t], y], z] + - 1/q[x]^2*D[D[f[x, z, y, t], z], z])/absb[x]^2); + xn[x_] = (x-xmin)/(xmax-xmin); diff --git a/tests/integrated/2D-axial-circular-fci/axial_notebook.nb b/tests/integrated/2D-axial-circular-fci/axial_notebook.nb index d7a73b6fe..501d5c919 100644 --- a/tests/integrated/2D-axial-circular-fci/axial_notebook.nb +++ b/tests/integrated/2D-axial-circular-fci/axial_notebook.nb @@ -10,10 +10,10 @@ NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] -NotebookDataLength[ 15967, 335] -NotebookOptionsPosition[ 14460, 302] -NotebookOutlinePosition[ 14847, 318] -CellTagsIndexPosition[ 14804, 315] +NotebookDataLength[ 16196, 340] +NotebookOptionsPosition[ 14690, 307] +NotebookOutlinePosition[ 15077, 323] +CellTagsIndexPosition[ 15034, 320] WindowFrame->Normal*) (* Beginning of Notebook Content *) @@ -30,18 +30,18 @@ Cell[BoxData[ Cell[BoxData["\<\"/viper/u1/toto/soft/hermes-3/build_new/tests/integrated/2D-\ axial-circular-fci\"\>"], "Output", CellChangeTimes->CompressedData[" -1:eJwVy0sowwEcwPFxmG2NtlGzl7zCHEhZrZXWHHZYCI0o84o8Vl4LzQGRR1qY -oqakaGaMpqEoIzHGPJocMI9adsB/yUqTR36/w7fP6RtX3VxYG0IikaTQOWP1 -lqIiZAFmZSwVbPVVGGigwuE+Rs+cnjYGWGbPtaBMx6WQCXZxQ8dZ4G5P0jJa -36Q/iAK3RFIlG5wS9avQAgp5ggN6uyeFPDCF9itG3fLZFD74oEnIRS11b3pU -UeHKFIBVfskgGkbTjMWA+VpGiwqscWk70cG1I3M5+Los5lWC55vVGvTt6duJ -Xswdc6rAyxVuOjrbIclC1YHiPfTdmviHRn8NL9yAFMHkJso3i5yoYLvd6AGL -BryHqH+edofqxCYfmkecsu/BpSSr7QHsEHs2HsH1mVr5Ezj0NXb9DH4YG8g+ -sGSxJYh+vHim6eWEjH5E3Ud1sjwJfRF+G59AGare5HCwkJOmRCfUNgM6qu3L -iAD9t6YeFtjJSrWjwSHySCSoE5wY0NLGHTMa/OGdoD9T1hyjhZBlX+kf0aj4 -zxf0H1Zi/l0= +1:eJwVy0sowwEcwPFxmFmjbVbMNnnFOJCyWivp7+AghBBlXlmMYiw0BxMZsTBF +TUnRMIZpKMojMebdcMBsSnbAf4nS5JHf7/Dtc/pGVDbkyXwoFAoBnTEXb2lS +kvhglYf7g43uMj0dzLDaD9FTm6OJCZZsZZlQlvUijgW2hfoOscFtdcw8WlOv +2+OA66LU/GBwVNQlRXNp1GEu+Ng+EscDhfRfMWpPnxDyQacyKgs1Vb/q0Iyy +k2QBWOGRaFA/unIwDMxRMRVSsOpE1Ypqlg+MpeDLvJhXDp6tVSrR14dvG3o+ +ecitAC8WQhPRiRZJClr3UbiDvpmj/9CQr97pG5AmGFlD+UaRDRVsNBscYEH3 +4z7qmaLfoVrxjBvNJo+D78G5GLPFCbaIHasucGVclv4A9nwNXj+B7wY51Q0W +zSq86PuzY4xRShKMA/9dVEtkSxiz8Fv4JMqUdsQGgHnchHx0uM6iRwdUnUmB +oOd2Rs0GW9nxW6i3h9oXBGoFR3q0uHbTiHp/eEfoz6g502AiibRLnQvlRH4+ +o/1C+ecSeKXtDzKD/46VB5E= "], - CellLabel->"Out[1]=",ExpressionUUID->"b5f61823-234d-47a3-8ecb-2ab82fad46f4"] + CellLabel->"Out[1]=",ExpressionUUID->"5bedbaff-1a28-4446-a114-d67b5d1de442"] }, Open ]], Cell[CellGroupData[{ @@ -57,51 +57,54 @@ Cell[CellGroupData[{ Cell[BoxData["\<\"Computing MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzE0ogwEcx/GR18Uw8s7yUl4OSIhleC5IrSQJ2bwl5T0TqR3mJWYUdlCo -HTSszXAwL4kkkUc5CBFG3rWei8OSIf/f4dvn9o2qay9pcOLxeBJq2tlzli/j -GJenQRaKKy4UvqT2OdYMeYLGRD/ywXV8QkhyJrUJKjtsBwHwebE0iMxPcpbD -yrcWbQjZOepICCNZVVUWVJx4J4ST8YI5KfweZrTQ1SpKjyBzL6aGoIfoYzyS -3Bzo7ZCRp832Hhio7zbKybjTqbAasl23qoAB9mYWdulTQmtJh/AoGeaVL0jg -58jyHuwvMvzBc1324jV5prZsQF36zjHcZ1/mb8mtjJVD6Ou+fQObinPeoO08 -OfiOjFRr1qwkP8awfk9W/0oKHvDti718ITXvr26v5OWT4wsWWiyzXnKOiVY8 -7sPCzE2xl4FjqrKnOSiTu8V7k6pWcymUDqbNwB8Pn1QBKfYLVwnJfuXuLmzj -KzX+pEBUPwPHvsuMcLR4koVmq490folj9oKu7mHOb4EN/gNRyPK7 +1:eJwVzGkogwEcx/GRc7Ex97kc5XiBhFiu5w1SK0lCNldS7kyk9mKOmFHYC4Xa +CzkWhhfmSCSJPMoLIcLIrfUoXiwZ8v+9+PZ59w2pbMqvtuHxeBnUmK3zBF/G +MXYPPSyUFJ8p3EjtY7gB8gQ10e7knf3QsIjk5tXzUNls3vOEj7MFPmRWjK0c +lrzUa/3IlgFrVADJqkpToOLINSqQjBRMSuF3H6OF9iZxYhCZcTbaC53Eb0PB +5Hp3R7OMPK6ztEPvqbY5ORlxPBpQTjbplhXQ01LHwtapOP8K0io6iIWZRTNp +8LN/cQd25er/4KkudfaSPFEb16AucesQ7rJP09fkRtLSPnRz3LyCtXnpL9B8 +Gut7QwarNSsmkh+mX70ly37Tsu/w7Qw/fyI1r88Oz+T5g/UL5hiNEy5yjglV +3O/CnOR1iYueY0pTxzgokztEupKqBkMBlPYkjMMfJ2G8gJS4B6pEZJdyexs2 +8pUaD1IgrhqHg9+Fc3Agb4SFBpNQOr3AMTs+F7cw/TfbDL2ErGWJfPf+8Fgm +/wHMHfu8 "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"5bfbe9fd-ab13-4b3c-b1c4-b5eb0f8469fe"], +In[2]:=",ExpressionUUID->"67140594-6287-48aa-b636-8ae4c0e1d587"], Cell[BoxData["\<\"Finished MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzGkogwEcx/GRYxbDyM1ylOMFEmIZnjeuWkkSsrmScmciNTVHzCjshULt -hRwLwwtzJJI0eZQXQoSRW+t544VkyP/34tvn3Te0qrmgxo7H40mpCXuXKYGc -Yxwe+1goKTlXepC6pwgj5AlrYzzJe8eRURHJLWoWoarFeuANn+YLfcmsWHsF -LH1t0PmTrUO26ECSVZelQuWxW3QQGSWclsHvAUYHHS3ipGAy43y8H/LF7yMh -5GZvZ4ucPKn/7IA+M+0LCjLyZDywgmzWryqh92c9C9tm4gMqSZvoMA5mFs9J -4cfg8h7syTP8wTN92vwVeaoxbUB90s4R3GefZ2/IreQVM/Rw3r6Gdfnpr9B6 -Fud3S4ZotGsWUhBuWL8jy3+l2ff4dkdcPJPatxenF/Li0fYFc0ymKVcFx4Qp -H/ZhTsqmxNXAMWVpExyUK5yi3Eh1o7EQyvoSJ+EP3z1BSEo8g9Qiske1uwub -BCqtFykUV0/C4e+iBTiUP8ZCo8VdNrvEMXu+l3fQ3JVrhf9SlPLF +1:eJwVzGkogwEcx/GRc7Ex97kc5XiBhFiu5w1SK0lCNldS7kyk9mKOmFHYC4Xa +CzkWhhfGJJJEHuWFEGHk1nreUEuG/H8vvn3efcOqWwpr7Xg8XhY1Ye86xZdx +jMNjHwslpecKD1L7FGmAPEFdrCd57zgyKiK5RfUiVLZa9r3h03yRH5kTZy+H +Za+N2gCybcgWE0SyqvI0qDh2jwkmowXTUvg9wGiho1mcHEJmnY/3Qxfx+0go +aertapWRJw3WTug707EgJ6NOxoMqyRbdqgJ6WxtY2D6TEFhF2kSH8TC7ZC4D +fgwu78KefP0fPNOlz1+Rp2rjBtQlbx/BPfZ59obcTFk5gB7OW9ewviDzFVrO +4v1vyVC1Zs1M8iP063dkxW9G7j2+3ZEXz6Tm7cXphbx4tH3BPKNxyk3OMeGK +hz2Yl2qSuOk5pjx9goMyuVO0O6lqMhRBaV/SJPxxESYKSIlnsEpE9ih3dmAz +X6nxIgXimkk4/F28AIcKxlhoMAuls0scs+t3eQczf3Mt0EfIWlfItrJPr1Xy +H8ol+4Y= "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"34065837-eadc-4dc3-be4c-78795b8adda1"], +In[2]:=",ExpressionUUID->"d9675f49-a212-4de7-ad56-ac4ada991bda"], Cell[BoxData["9.579629665962438`*^7"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzE0ogwEcx/GR18Uw8s7yUl4OSIhleC6IVpKEbN4Sec9Eaod5iRmFHRRq -B3lZGA7GJFoSeZSDEGHkXeu5OEiG/H+Hb5/bN6y6tbDWjsfjSahJe9dpvoxj -HB77WSguPVd4ktqnSAPkCepivch7x9ExIcktqZegss267wOfFor8yOw4ezks -e23SBpDtw7aYIJJVladBxbF7TDAZLZiRwu9BRgsdLaLkEDLzfGIAuojeR0NJ -U193m4w8afzsgr6znYtyMupkIqiSbNWtKaDPZyMLO2YTAqtIm/AwHmaVzEvg -x9CKGfbm6f/gmS594Yo8VRs3oS555wjusc9zN+RWyuoB9HTevoYNBRmv0HoW -739Lhqo16xaSH6HfuCMrfiU59/j2RF48k5q3F6cX8uLR9gVzjcZpNznHhCse -9mBuqknspueY8vRJDsrkTtHupKrZUASl/UlT8MfFI1FAir2CVUKyV7m7C1v4 -So03KRDVTMGR7+JFOFwwzkKDxUM6t8wxZr/LO1hvzrfCf1GF8qw= +1:eJwVzGkogwEcx/GRc7Ex97kc5XiBhFiu5w1SK0lCNldS7kyk9mKOmFHYC4Xa +CzkWhhfmSCSJPMoLIcLIrfW8oCwZ8v+9+PZ59w2pbMqvtuHxeBnUmK3zBF/G +MXYPPSyUFJ8p3EjtY7gB8gQ10e7knf3QsIjk5tXzUNls3vOEj7MFPmRWjK0c +lrzUa/3IlgFrVADJqkpToOLINSqQjBRMSuF3H6OF9iZxYhCZcTbaC53Eb0PB +5Hp3R7OMPK6ztEPvqbY5ORlxPBpQTjbplhXQ01LHwtapOP8K0io6iIWZRTNp +8KN/cQd25er/4KkudfaSPFEb16AucesQ7rJP09fkRtLSPnRz3LyCtXnpL9B8 +Gut7QwarNSsmkh+mX70ly37Tsu/w7Qw/fyI1r88Oz+T5g/UL5hiNEy5yjglV +3O/CnOR1iYueY0pTxzgokztEupKqBkMBlPYkjMMfJ2G8gJS4B6pEZJdyexs2 +8pUaD1IgrhqHg9+Fc3Agb4SFBpNQOr3AMTs+F7cw/TfbDL2ErGWJLHz/9Fgm +/wHNcvwD "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"1f1b93f4-0e7d-48c8-beef-cb5620d8b280"] +In[2]:=",ExpressionUUID->"582989d5-f346-46c3-a4fc-513b67e9711a"] }, Open ]] }, Open ]], @@ -132,13 +135,13 @@ Cell[BoxData[{ RowBox[{ RowBox[{"Dperp", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"Dpar", " ", "=", " ", "100000"}], ";"}], "\[IndentingNewLine]", + RowBox[{"Dpar", " ", "=", " ", "2000"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"q", "[", "x_", "]"}], " ", "=", " ", RowBox[{"3.0", "+", - RowBox[{"3.5", " ", "*", " ", "x"}]}]}], ";"}], + RowBox[{"0.0", " ", "*", " ", "x"}]}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"CForm", "[", @@ -181,8 +184,10 @@ Cell[BoxData[{ 3.9804234906671753`*^9, 3.980423505726005*^9}, {3.980441355886915*^9, 3.980441368363199*^9}, {3.982829754504801*^9, 3.982829782740342*^9}, { 3.9828299614012003`*^9, 3.982829964662109*^9}, {3.982831344310981*^9, - 3.9828313473575497`*^9}}, - CellLabel->"In[3]:=",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], + 3.9828313473575497`*^9}, {3.98285198331588*^9, 3.982851984615147*^9}, { + 3.9828527440353117`*^9, + 3.9828527456692553`*^9}},ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-\ +14a98dc670e3"], Cell[BoxData["0.1`"], "Output", CellChangeTimes->{ @@ -211,8 +216,8 @@ Cell[BoxData["0.1`"], "Output", 3.980423570934939*^9, 3.9804323880265083`*^9, 3.980432889684306*^9, 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, - 3.9828314519018393`*^9}, - CellLabel->"Out[8]=",ExpressionUUID->"40a194c8-1bdc-4e9a-80a5-5b364025cba0"], + 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9}, + CellLabel->"Out[8]=",ExpressionUUID->"89b53873-92e9-4783-b1e4-8ca7d52ef7c3"], Cell["\<\ 1. - 0.5*Cos(0.5 - yl)* @@ -245,9 +250,9 @@ Cell["\<\ 3.980423570934939*^9, 3.9804323880265083`*^9, 3.980432889684306*^9, 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, - 3.9828314519487143`*^9}, + 3.9828314519018393`*^9, 3.982852024070077*^9, 3.98285225754487*^9}, CellLabel-> - "Out[17]//CForm=",ExpressionUUID->"0ab2513c-b632-4afa-a991-864039ec9da9"] + "Out[17]//CForm=",ExpressionUUID->"255071a0-89ec-4adc-9073-74949eff201a"] }, Open ]], Cell[BoxData[""], "Input", @@ -319,24 +324,24 @@ CellTagsIndex->{} Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 285, 5, 51, "Input",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], -Cell[868, 29, 797, 14, 53, "Output",ExpressionUUID->"b5f61823-234d-47a3-8ecb-2ab82fad46f4"] +Cell[868, 29, 809, 14, 53, "Output",ExpressionUUID->"5bedbaff-1a28-4446-a114-d67b5d1de442"] }, Open ]], Cell[CellGroupData[{ -Cell[1702, 48, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], +Cell[1714, 48, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], Cell[CellGroupData[{ -Cell[2046, 57, 741, 14, 23, "Print",ExpressionUUID->"5bfbe9fd-ab13-4b3c-b1c4-b5eb0f8469fe"], -Cell[2790, 73, 740, 14, 23, "Print",ExpressionUUID->"34065837-eadc-4dc3-be4c-78795b8adda1"], -Cell[3533, 89, 735, 14, 30, "Print",ExpressionUUID->"1f1b93f4-0e7d-48c8-beef-cb5620d8b280"] +Cell[2058, 57, 758, 15, 23, "Print",ExpressionUUID->"67140594-6287-48aa-b636-8ae4c0e1d587"], +Cell[2819, 74, 757, 15, 23, "Print",ExpressionUUID->"d9675f49-a212-4de7-ad56-ac4ada991bda"], +Cell[3579, 91, 752, 15, 30, "Print",ExpressionUUID->"582989d5-f346-46c3-a4fc-513b67e9711a"] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[4317, 109, 4158, 75, 374, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], -Cell[8478, 186, 1928, 28, 33, "Output",ExpressionUUID->"40a194c8-1bdc-4e9a-80a5-5b364025cba0"], -Cell[10409, 216, 2017, 33, 80, "Output",ExpressionUUID->"0ab2513c-b632-4afa-a991-864039ec9da9"] +Cell[4380, 112, 4238, 77, 374, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], +Cell[8621, 191, 1972, 28, 33, "Output",ExpressionUUID->"89b53873-92e9-4783-b1e4-8ca7d52ef7c3"], +Cell[10596, 221, 2060, 33, 80, "Output",ExpressionUUID->"255071a0-89ec-4adc-9073-74949eff201a"] }, Open ]], -Cell[12441, 252, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], -Cell[12617, 256, 984, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], -Cell[13604, 280, 852, 20, 149, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] +Cell[12671, 257, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], +Cell[12847, 261, 984, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], +Cell[13834, 285, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] } ] *) diff --git a/tests/integrated/2D-axial-circular-fci/data/BOUT.inp b/tests/integrated/2D-axial-circular-fci/data/BOUT.inp index 9cd4f8413..cab67fc7a 100644 --- a/tests/integrated/2D-axial-circular-fci/data/BOUT.inp +++ b/tests/integrated/2D-axial-circular-fci/data/BOUT.inp @@ -31,7 +31,7 @@ symmetricGlobalX = true [solver] mxstep = 10000 -rtol = 1e-8 +rtol = 1e-6 atol = 1e-12 mms = true # Run with MMS sources and output diagnostics mms_initialise = true @@ -54,7 +54,7 @@ AA = 1.0 mms = true anomalous_D = 1.0 -anomalous_D_par = 1e5 +anomalous_D_par = 2000 use_finite_difference = true @@ -62,6 +62,6 @@ use_finite_difference = true solution = 1. - 0.5*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) -source = -1.0438816894489344e-8*((-15.70796326794897*cos(31.41592653589794*(-0.4 + xl))*cos(0.5 - yl)*sin(0.1 - 4*zl))/xl + 493.4802200544682*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (8.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(xl,2)) - (0.0010438816894489343*((4.*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl))/(3. + 3.5*xl) + 0.5*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (8.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(3. + 3.5*xl,2)))/(1 + power(xl,2)/power(3. + 3.5*xl,2)) +source = (-0.000020877633788978686*(1.3333333333333333*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl) + 1.3888888888888888*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))/(1 + 0.1111111111111111*power(xl,2)) - 1.0438816894489344e-8*((-15.70796326794897*cos(31.41592653589794*(-0.4 + xl))*cos(0.5 - yl)*sin(0.1 - 4*zl))/xl + 493.4802200544682*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (8.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(xl,2)) bndry_all = dirichlet_o2(`Nh+:solution`) diff --git a/tests/integrated/2D-axial-circular-fci/runtest b/tests/integrated/2D-axial-circular-fci/runtest index 5352af7f9..cae56249c 100755 --- a/tests/integrated/2D-axial-circular-fci/runtest +++ b/tests/integrated/2D-axial-circular-fci/runtest @@ -33,7 +33,7 @@ gridpath = "../../../../grids/mms_axial_circular_fci/" # return gridpath + f"circular_{int(nx+4)}_{4}_{int(nx*8)}.nc" def gridname(nx): - return gridpath + f"Axial_circular_q_{int(nx)}_{int(4*nx)}_0.4_0.6_3.0_3.5.fci.grid.nc" + return gridpath + f"Axial_circular_q_{int(nx)}_{int(4*nx)}_0.4_0.6_3.0_0.0.fci.grid.nc" # List of NY values to use From c6ee9f77f50f3402d76beab6db9b2a8629303f79 Mon Sep 17 00:00:00 2001 From: totork Date: Wed, 18 Mar 2026 21:37:09 +0100 Subject: [PATCH 03/21] Update MMS notebook --- .../2D-axial-circular-fci/axial_notebook.nb | 133 +++++++++--------- 1 file changed, 67 insertions(+), 66 deletions(-) diff --git a/tests/integrated/2D-axial-circular-fci/axial_notebook.nb b/tests/integrated/2D-axial-circular-fci/axial_notebook.nb index 501d5c919..1f1d24b2b 100644 --- a/tests/integrated/2D-axial-circular-fci/axial_notebook.nb +++ b/tests/integrated/2D-axial-circular-fci/axial_notebook.nb @@ -10,10 +10,10 @@ NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] -NotebookDataLength[ 16196, 340] -NotebookOptionsPosition[ 14690, 307] -NotebookOutlinePosition[ 15077, 323] -CellTagsIndexPosition[ 15034, 320] +NotebookDataLength[ 16342, 341] +NotebookOptionsPosition[ 14836, 308] +NotebookOutlinePosition[ 15223, 324] +CellTagsIndexPosition[ 15180, 321] WindowFrame->Normal*) (* Beginning of Notebook Content *) @@ -30,18 +30,18 @@ Cell[BoxData[ Cell[BoxData["\<\"/viper/u1/toto/soft/hermes-3/build_new/tests/integrated/2D-\ axial-circular-fci\"\>"], "Output", CellChangeTimes->CompressedData[" -1:eJwVy0sowwEcwPFxmFmjbVbMNnnFOJCyWivp7+AghBBlXlmMYiw0BxMZsTBF -TUnRMIZpKMojMebdcMBsSnbAf4nS5JHf7/Dtc/pGVDbkyXwoFAoBnTEXb2lS -kvhglYf7g43uMj0dzLDaD9FTm6OJCZZsZZlQlvUijgW2hfoOscFtdcw8WlOv -2+OA66LU/GBwVNQlRXNp1GEu+Ng+EscDhfRfMWpPnxDyQacyKgs1Vb/q0Iyy -k2QBWOGRaFA/unIwDMxRMRVSsOpE1Ypqlg+MpeDLvJhXDp6tVSrR14dvG3o+ -ecitAC8WQhPRiRZJClr3UbiDvpmj/9CQr97pG5AmGFlD+UaRDRVsNBscYEH3 -4z7qmaLfoVrxjBvNJo+D78G5GLPFCbaIHasucGVclv4A9nwNXj+B7wY51Q0W -zSq86PuzY4xRShKMA/9dVEtkSxiz8Fv4JMqUdsQGgHnchHx0uM6iRwdUnUmB -oOd2Rs0GW9nxW6i3h9oXBGoFR3q0uHbTiHp/eEfoz6g502AiibRLnQvlRH4+ -o/1C+ecSeKXtDzKD/46VB5E= +1:eJwVy1kowwEcwPHxMLNG26zYJVeMB1JWayXNgwchhCgzZLnKtVjzgMgRC1PU +lBQNY9gaC+XIPXeOB8ymZA/4L1HacuT3e/j2efqGltZmy71IJFIydEZfuKNI +CcknozjEF6x3yrRUMHX/8hA9tdoa6GDhRroBZexfRDPAZo73IBPcbI2cQytq +NLsscFWYlBMIjgg7pGgWhTzEBp9ahqO5oID6K0IvU8YFPNCuCE9HDeVvGjRV +dpLAB0tc4i7Uh6oYCAYzVfQ6KVh2olKiXaYDfRH4OifiFoNnllIF+vb4bUXP +Jw7ZJeDFPCcOHW8SJ6LVn3lb6Lsx4g8N8vRM3YIU/rAF5emFVpS/1qizgbmd +T3uoa5J6j6pF0040gzgOfABnI41mO9gksi07wKUxecoj2O0ZuHkGP3SVZCeY +P1PnRj9ebKO0IkJCO/DdRtWSDDFtBn4zj0Dp0rYoPzCbHZuDDlWbtWi/qj3e +H3TdTbcyQSUzZgN1d5N7A0A1/0iLFlSt61H3D/cI/RkxpukMhCT5SuNAWWFf +L2ifoPJrEbxW9wUYwRXTTi76D+TiDJ0= "], - CellLabel->"Out[1]=",ExpressionUUID->"5bedbaff-1a28-4446-a114-d67b5d1de442"] + CellLabel->"Out[1]=",ExpressionUUID->"0e0ce5db-9968-4678-bade-a56ea533da98"] }, Open ]], Cell[CellGroupData[{ @@ -57,54 +57,54 @@ Cell[CellGroupData[{ Cell[BoxData["\<\"Computing MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzGkogwEcx/GRc7Ex97kc5XiBhFiu5w1SK0lCNldS7kyk9mKOmFHYC4Xa -CzkWhhfmSCSJPMoLIcLIrfUoXiwZ8v+9+PZ59w2pbMqvtuHxeBnUmK3zBF/G -MXYPPSyUFJ8p3EjtY7gB8gQ10e7knf3QsIjk5tXzUNls3vOEj7MFPmRWjK0c -lrzUa/3IlgFrVADJqkpToOLINSqQjBRMSuF3H6OF9iZxYhCZcTbaC53Eb0PB -5Hp3R7OMPK6ztEPvqbY5ORlxPBpQTjbplhXQ01LHwtapOP8K0io6iIWZRTNp -8LN/cQd25er/4KkudfaSPFEb16AucesQ7rJP09fkRtLSPnRz3LyCtXnpL9B8 -Gut7QwarNSsmkh+mX70ly37Tsu/w7Qw/fyI1r88Oz+T5g/UL5hiNEy5yjglV -3O/CnOR1iYueY0pTxzgokztEupKqBkMBlPYkjMMfJ2G8gJS4B6pEZJdyexs2 -8pUaD1IgrhqHg9+Fc3Agb4SFBpNQOr3AMTs+F7cw/TfbDL2ErGWJfPf+8Fgm -/wHMHfu8 +1:eJwVzFsoswEcx/GR42JjzsflUA4XSIjl9NwgtZIkZHt5JeWcidQu5hCzKexC +oXYhh4XhwphEksjzlguhVxg5az2KiyVD/r+Lb5+7b8TfluJaBx6Pl0uNO7pP +8mUc43TXx0JJ+anCi9TdRxshT1AX703eOA+PiEhuQb0Ala3WPV94P1cSQOYl +OMphxVOjLohs09rjQkhWVZkBFf8840LJWMGUFH4OMDrobBGnhpE5p2P90E38 +MhxOmnu7WmXkUYOtE/pPd8zLyZijsZAqskW/ooC+tgYWtk8nBVeTdtFBIswt +m82C74NLO7Cn0PADT/SZc+fksdq0DvWpW4dwl32YuSQ30pb3oZfr5gWsL8p+ +gtaTxMArMlytWbWQ/CjD2jX55zsr/wbf7uizB1Lz/OjySJ7d2T9ggck06SHn +mEjF7S4sSDdLPAwcU5k5zkGZ3CXWk1Q1GUugtC9lAn65CZMFpMQ7VCUie5Tb +27CZr9T4kAJxzQQc+iydh9qiURYaLULpzCLH7AT8v4bZ3/lW6Cdkbcvkq/+b +zwqpLY4vhb+8mP+k "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"67140594-6287-48aa-b636-8ae4c0e1d587"], +In[2]:=",ExpressionUUID->"473cff57-8647-4b4c-bf0c-4d5eaa3b6b82"], Cell[BoxData["\<\"Finished MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzGkogwEcx/GRc7Ex97kc5XiBhFiu5w1SK0lCNldS7kyk9mKOmFHYC4Xa -CzkWhhfGJJJEHuWFEGHk1nreUEuG/H8vvn3efcOqWwpr7Xg8XhY1Ye86xZdx -jMNjHwslpecKD1L7FGmAPEFdrCd57zgyKiK5RfUiVLZa9r3h03yRH5kTZy+H -Za+N2gCybcgWE0SyqvI0qDh2jwkmowXTUvg9wGiho1mcHEJmnY/3Qxfx+0go -aertapWRJw3WTug707EgJ6NOxoMqyRbdqgJ6WxtY2D6TEFhF2kSH8TC7ZC4D -fgwu78KefP0fPNOlz1+Rp2rjBtQlbx/BPfZ59obcTFk5gB7OW9ewviDzFVrO -4v1vyVC1Zs1M8iP063dkxW9G7j2+3ZEXz6Tm7cXphbx4tH3BPKNxyk3OMeGK -hz2Yl2qSuOk5pjx9goMyuVO0O6lqMhRBaV/SJPxxESYKSIlnsEpE9ih3dmAz -X6nxIgXimkk4/F28AIcKxlhoMAuls0scs+t3eQczf3Mt0EfIWlfItrJPr1Xy -H8ol+4Y= +1:eJwVzE1ImgEcx3EXWU1My97LKa2gGqPGqGhS1nNZEQgRIdtIWxsRrJWRsRh4 +cCabWWB5CErwMGqJZXXI5hiTiNjoCTqMikbNYmkvyBPUQUJX9P8dvnxu3/xX +uuaOOzwer46aiLvrEGg4Jv7IzELF8219CmkPFnogT9T5IJU85NtGJSQ3a5mF +ht7wWjoMzrRkkU9L47Twxclbew7ZNxwrySNZY+sTqN9ILpGSxaLPKhj9xNgh +PyCvuEfWbo9/hEnyM5uM9A2+79WQm12RAZg59c6tJYs2x/Nekjrnoh6mR7pY +2D/1KLedjEl+lcG6Z19q4OXQ/Ao0Nbpu4JazeuYP+dvi/QqdFT/W4Sobmt4n +v1Uu/IQpid/34Jsm5QkMb5Vl/yVlFutSgBQUuJYPyLbrmvpDfD8U7oRI6+lx +wjG5cxS7gg1er0Oo5Zj7+n+rsKHKpxC6OKa1eoKDGm1CcTJp7Pa0QJW5fBL+ +TxI/FpGKVKlRQpoMfj/sERisaaRI/noSjkTVbjjcNMZCT0Csmp7jmJWs3QOo +vK4PwwwxG1kgzzMv0hbJeOdDNbwFuoD/aw== "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"d9675f49-a212-4de7-ad56-ac4ada991bda"], +In[2]:=",ExpressionUUID->"f5b098b0-d445-4178-844e-9ad69a9178f4"], Cell[BoxData["9.579629665962438`*^7"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzGkogwEcx/GRc7Ex97kc5XiBhFiu5w1SK0lCNldS7kyk9mKOmFHYC4Xa -CzkWhhfmSCSJPMoLIcLIrfW8oCwZ8v+9+PZ59w2pbMqvtuHxeBnUmK3zBF/G -MXYPPSyUFJ8p3EjtY7gB8gQ10e7knf3QsIjk5tXzUNls3vOEj7MFPmRWjK0c -lrzUa/3IlgFrVADJqkpToOLINSqQjBRMSuF3H6OF9iZxYhCZcTbaC53Eb0PB -5Hp3R7OMPK6ztEPvqbY5ORlxPBpQTjbplhXQ01LHwtapOP8K0io6iIWZRTNp -8KN/cQd25er/4KkudfaSPFEb16AucesQ7rJP09fkRtLSPnRz3LyCtXnpL9B8 -Gut7QwarNSsmkh+mX70ly37Tsu/w7Qw/fyI1r88Oz+T5g/UL5hiNEy5yjglV -3O/CnOR1iYueY0pTxzgokztEupKqBkMBlPYkjMMfJ2G8gJS4B6pEZJdyexs2 -8pUaD1IgrhqHg9+Fc3Agb4SFBpNQOr3AMTs+F7cw/TfbDL2ErGWJLHz/9Fgm -/wHNcvwD +1:eJwVzE1ImgEcx3EnqzkpTWu1VVNWwWqHOaJiSW9Ph4qBIENihdobMagtI6MI +PDiTzSyoPAQVeAhdknN1mNWIImJs7Ak8jIqiMul9yDOog0Rm7P87fPncvk+a +Da9b7/B4vApqnH9/UqjjmLtHVhYq6zaNSaTjOMcHeaK3zyRkKG54REpyXpsX +mjrDP1Lg8bQmjax6ztfD+rN3jkdk12A0L4NkzdpiaFxPzMskc0VTKnj9iXHA +uKC88DFZvjn2EQrkf4dl5GJ/X6eODLRHemGqq2dGTz4NjGU0kgbnnBGmRNpZ +2O16kd5ERqW/FLDizedSeDnwdRVaXnlu4YazZHqH/GPzL0Bn4fJvuMaeuPfI +70WzP2HSvaVd2KYuO4PhDcXDfVJms38LksJsz/wB2RArrQ7h+yFn64S0n5/G +n5JbR9ErWOP3TyboOSbLeLgGa14uKhM8HKMtGeegTh+fm0ia3/s0UGUtmIA3 +AnG+iFRKMs1S0mJaWYEdQpM9mRTJWybg0HXtDBxUj7LQFxSr3F84ZjVt+wCW +xarD8IGYjcyS/1IvkufISKWiFv4Hv54AEw== "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"582989d5-f346-46c3-a4fc-513b67e9711a"] +In[2]:=",ExpressionUUID->"3f9194e7-81e0-4b9d-9d98-51875d993cd6"] }, Open ]] }, Open ]], @@ -185,9 +185,8 @@ Cell[BoxData[{ 3.980441368363199*^9}, {3.982829754504801*^9, 3.982829782740342*^9}, { 3.9828299614012003`*^9, 3.982829964662109*^9}, {3.982831344310981*^9, 3.9828313473575497`*^9}, {3.98285198331588*^9, 3.982851984615147*^9}, { - 3.9828527440353117`*^9, - 3.9828527456692553`*^9}},ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-\ -14a98dc670e3"], + 3.9828527440353117`*^9, 3.9828527456692553`*^9}}, + CellLabel->"In[3]:=",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], Cell[BoxData["0.1`"], "Output", CellChangeTimes->{ @@ -216,8 +215,9 @@ Cell[BoxData["0.1`"], "Output", 3.980423570934939*^9, 3.9804323880265083`*^9, 3.980432889684306*^9, 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, - 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9}, - CellLabel->"Out[8]=",ExpressionUUID->"89b53873-92e9-4783-b1e4-8ca7d52ef7c3"], + 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, + 3.9828527873122396`*^9}, + CellLabel->"Out[8]=",ExpressionUUID->"09638d36-e084-4afc-bc77-821a997aa418"], Cell["\<\ 1. - 0.5*Cos(0.5 - yl)* @@ -250,9 +250,10 @@ Cell["\<\ 3.980423570934939*^9, 3.9804323880265083`*^9, 3.980432889684306*^9, 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, - 3.9828314519018393`*^9, 3.982852024070077*^9, 3.98285225754487*^9}, + 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, + 3.9828527873668756`*^9}, CellLabel-> - "Out[17]//CForm=",ExpressionUUID->"255071a0-89ec-4adc-9073-74949eff201a"] + "Out[17]//CForm=",ExpressionUUID->"fe74f41e-c333-4ebc-97bc-a1af72f7317e"] }, Open ]], Cell[BoxData[""], "Input", @@ -324,24 +325,24 @@ CellTagsIndex->{} Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 285, 5, 51, "Input",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], -Cell[868, 29, 809, 14, 53, "Output",ExpressionUUID->"5bedbaff-1a28-4446-a114-d67b5d1de442"] +Cell[868, 29, 817, 14, 53, "Output",ExpressionUUID->"0e0ce5db-9968-4678-bade-a56ea533da98"] }, Open ]], Cell[CellGroupData[{ -Cell[1714, 48, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], +Cell[1722, 48, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], Cell[CellGroupData[{ -Cell[2058, 57, 758, 15, 23, "Print",ExpressionUUID->"67140594-6287-48aa-b636-8ae4c0e1d587"], -Cell[2819, 74, 757, 15, 23, "Print",ExpressionUUID->"d9675f49-a212-4de7-ad56-ac4ada991bda"], -Cell[3579, 91, 752, 15, 30, "Print",ExpressionUUID->"582989d5-f346-46c3-a4fc-513b67e9711a"] +Cell[2066, 57, 766, 15, 23, "Print",ExpressionUUID->"473cff57-8647-4b4c-bf0c-4d5eaa3b6b82"], +Cell[2835, 74, 785, 15, 23, "Print",ExpressionUUID->"f5b098b0-d445-4178-844e-9ad69a9178f4"], +Cell[3623, 91, 780, 15, 30, "Print",ExpressionUUID->"3f9194e7-81e0-4b9d-9d98-51875d993cd6"] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[4380, 112, 4238, 77, 374, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], -Cell[8621, 191, 1972, 28, 33, "Output",ExpressionUUID->"89b53873-92e9-4783-b1e4-8ca7d52ef7c3"], -Cell[10596, 221, 2060, 33, 80, "Output",ExpressionUUID->"255071a0-89ec-4adc-9073-74949eff201a"] +Cell[4452, 112, 4255, 76, 374, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], +Cell[8710, 190, 2000, 29, 33, "Output",ExpressionUUID->"09638d36-e084-4afc-bc77-821a997aa418"], +Cell[10713, 221, 2089, 34, 80, "Output",ExpressionUUID->"fe74f41e-c333-4ebc-97bc-a1af72f7317e"] }, Open ]], -Cell[12671, 257, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], -Cell[12847, 261, 984, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], -Cell[13834, 285, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] +Cell[12817, 258, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], +Cell[12993, 262, 984, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], +Cell[13980, 286, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] } ] *) From 0fd8fcdc92d6ecbe29c90bdacc50b59f3180d152 Mon Sep 17 00:00:00 2001 From: totork Date: Wed, 18 Mar 2026 23:39:43 +0100 Subject: [PATCH 04/21] Add zoidberg to CI --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e9fb62e2a..b0f6241ad 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,6 +57,8 @@ jobs: - name: Install pip packages run: | ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils + python -m pip install git+https://github.com/boutproject/zoidberg@better-metric + # Add the pip install location to the runner's PATH echo ~/.local/bin >> $GITHUB_PATH - name: Build and run tests From 2e6be54e9b605ddf47545127fb4967cac8a9bdb1 Mon Sep 17 00:00:00 2001 From: totork Date: Wed, 18 Mar 2026 23:43:19 +0100 Subject: [PATCH 05/21] Try fix indent in CI --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b0f6241ad..6b24b3112 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,10 +56,10 @@ jobs: - name: Install pip packages run: | - ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils - python -m pip install git+https://github.com/boutproject/zoidberg@better-metric + ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils + python -m pip install git+https://github.com/boutproject/zoidberg@better-metric - # Add the pip install location to the runner's PATH + # Add the pip install location to the runner's PATH echo ~/.local/bin >> $GITHUB_PATH - name: Build and run tests run: cmake . -B build $BOUT_CONFIGURE_OPTIONS -DPACKAGE_TESTS=OFF -DBOUT_USE_PETSC=ON && From 61771f03925f26844bdc8ed01243632437b8f723 Mon Sep 17 00:00:00 2001 From: totork Date: Wed, 18 Mar 2026 23:57:03 +0100 Subject: [PATCH 06/21] CI formatting --- .github/workflows/tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6b24b3112..079b18dc6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,10 +56,8 @@ jobs: - name: Install pip packages run: | - ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils - python -m pip install git+https://github.com/boutproject/zoidberg@better-metric - - # Add the pip install location to the runner's PATH + ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils + # Add the pip install location to the runner's PATH echo ~/.local/bin >> $GITHUB_PATH - name: Build and run tests run: cmake . -B build $BOUT_CONFIGURE_OPTIONS -DPACKAGE_TESTS=OFF -DBOUT_USE_PETSC=ON && From 34a2e92f3a0be0e1a08094597649b1bc0824da06 Mon Sep 17 00:00:00 2001 From: totork Date: Wed, 18 Mar 2026 23:59:32 +0100 Subject: [PATCH 07/21] Add zoidberg to CI --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 079b18dc6..d321c00b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,6 +57,7 @@ jobs: - name: Install pip packages run: | ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils + python -m pip install git+https://github.com/boutproject/zoidberg@better-metric # Add the pip install location to the runner's PATH echo ~/.local/bin >> $GITHUB_PATH - name: Build and run tests From 721642a85d7d9d6caf567f739504b4e4a4a19efe Mon Sep 17 00:00:00 2001 From: totork Date: Thu, 19 Mar 2026 00:01:35 +0100 Subject: [PATCH 08/21] CI formatting --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d321c00b5..abe7a8074 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,7 +57,7 @@ jobs: - name: Install pip packages run: | ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils - python -m pip install git+https://github.com/boutproject/zoidberg@better-metric + python -m pip install git+https://github.com/boutproject/zoidberg@better-metric # Add the pip install location to the runner's PATH echo ~/.local/bin >> $GITHUB_PATH - name: Build and run tests From d04e9b713f702dcab448f626060b31fc31e76dd1 Mon Sep 17 00:00:00 2001 From: totork Date: Thu, 19 Mar 2026 02:07:50 +0100 Subject: [PATCH 09/21] Add script to generate grids --- grids/generate_axial_circular.py | 92 ++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 grids/generate_axial_circular.py diff --git a/grids/generate_axial_circular.py b/grids/generate_axial_circular.py new file mode 100644 index 000000000..5acb99604 --- /dev/null +++ b/grids/generate_axial_circular.py @@ -0,0 +1,92 @@ +import zoidberg +from zoidberg.field import Slab +import numpy as np + +import os +import sys + +class Axial_circular(Slab): + def __init__(self,rho_1,rho_2,Lz,By,R0, q0 = 3.0, q1 = 0.2): + self.rho_1 = float(rho_1) + self.rho_2 = float(rho_2) + self.Lz = float(Lz) + self.By = float(By) + self.R0 = R0 + + def qprofile(self,x,z,phi): + theta=np.arctan2(z,x-self.R0) + r = np.sqrt(np.power(x-self.R0,2)+np.power(z,2)) + return q0 + q1 * r + + def Bxfunc(self,x,z,phi): + theta=np.arctan2(z,x-self.R0) + r = np.sqrt(np.power(x-self.R0,2)+np.power(z,2)) + q = self.qprofile(x,z,phi) + return -r * np.sin(theta) / q + + def Bzfunc(self,x,z,phi): + theta=np.arctan2(z,x-self.R0) + r = np.sqrt(np.power(x-self.R0,2)+np.power(z,2)) + q = self.qprofile(x,z,phi) + return r * np.cos(theta) / q + + def Byfunc(self,x,z,phi): + return np.full(x.shape,self.By) + + + + +R0 = 1.5 +rho_1 = 0.4 +rho_2 = 0.6 +B0 = 1.0 +Ly = 2.0 * np.pi +q0 = 3.0 +q1 = 0.0 +field = Axial_circular(rho_1, rho_2, Ly, B0,R0, q0=q0, q1=q1) + +folder = "mms_axial_circular_fci/" + +if not os.path.exists(folder): + os.mkdir(folder) + +force = "-f" in sys.argv or "--force" in sys.argv + + + +for scale in [1,2]: + nx = scale * 16 + nz = scale * 64 + ny = scale * 8 + + filename = f"Axial_circular_q_{nx}_{nz}_{rho_1}_{rho_2}_{q0}_{q1}.fci.grid.nc" + fn = folder + filename + + if os.path.exists(fn) and not force: + print(fn, " exists") + continue + + + inner = zoidberg.rzline.shaped_line(R0=R0,a=rho_1,n=nz) + outer = zoidberg.rzline.shaped_line(R0=R0,a=rho_2,n=nz) + + pol_grid = zoidberg.poloidal_grid.grid_annulus(inner,outer,nx+4,nz) + pol_grids = [] + for i in range(ny): + pol_grids.append(pol_grid) + + grid = zoidberg.grid.Grid(pol_grids, np.linspace(0.0, 2.0 * np.pi, ny, endpoint=False),Ly,yperiodic=True) + maps = zoidberg.zoidberg.make_maps(grid, field) + + maps["forward_xt_prime"][2,:,:] = 2.0 + maps["backward_xt_prime"][2,:,:] = 2.0 + + maps["forward_xt_prime"][-3,:,:] = float(nx+4-3) + maps["backward_xt_prime"][-3,:,:] = float(nx+4-3) + + with zoidberg.zoidberg.MapWriter(fn) as mw: + mw.add_grid_field(rectangle, magnetic_field) + mw.add_maps(maps) + mw.add_dagp() + + print(fn, " done") From 3429adab82e6c1c44854ab3ae6328bfd35f9358a Mon Sep 17 00:00:00 2001 From: totork Date: Thu, 19 Mar 2026 02:09:39 +0100 Subject: [PATCH 10/21] Create grids in CMake --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91cf77861..caf1be409 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,6 +245,14 @@ add_custom_command(TARGET setup-test PRE_BUILD if(HERMES_TESTS) enable_testing() + if (BOUT_ENABLE_METRIC_3D) + add_custom_command(TARGET setup-test PRE_BUILD + COMMAND python3 ./generate_axial_circular.py + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/grids + ) + file(CREATE_LINK ${CMAKE_CURRENT_SOURCE_DIR}/grids ${CMAKE_CURRENT_BINARY_DIR}/grids SYMBOLIC) + endif() + # Integrated tests function(hermes_add_integrated_test TESTNAME) set(oneValueArgs DOWNLOAD DOWNLOAD_NAME) From 70d47a37e83d639a0ada04a77ddf32bf6965bcde Mon Sep 17 00:00:00 2001 From: totork Date: Thu, 19 Mar 2026 02:21:28 +0100 Subject: [PATCH 11/21] Fix grid generation --- grids/generate_axial_circular.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grids/generate_axial_circular.py b/grids/generate_axial_circular.py index 5acb99604..de4492b81 100644 --- a/grids/generate_axial_circular.py +++ b/grids/generate_axial_circular.py @@ -85,7 +85,7 @@ def Byfunc(self,x,z,phi): maps["backward_xt_prime"][-3,:,:] = float(nx+4-3) with zoidberg.zoidberg.MapWriter(fn) as mw: - mw.add_grid_field(rectangle, magnetic_field) + mw.add_grid_field(pol_grids, field) mw.add_maps(maps) mw.add_dagp() From bf9fbf6e809cd0aa008d1d22ff3768e3074f51de Mon Sep 17 00:00:00 2001 From: totork Date: Thu, 19 Mar 2026 16:20:35 +0100 Subject: [PATCH 12/21] Use actual grid in grid generation --- grids/generate_axial_circular.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grids/generate_axial_circular.py b/grids/generate_axial_circular.py index de4492b81..564912162 100644 --- a/grids/generate_axial_circular.py +++ b/grids/generate_axial_circular.py @@ -85,7 +85,7 @@ def Byfunc(self,x,z,phi): maps["backward_xt_prime"][-3,:,:] = float(nx+4-3) with zoidberg.zoidberg.MapWriter(fn) as mw: - mw.add_grid_field(pol_grids, field) + mw.add_grid_field(grid, field) mw.add_maps(maps) mw.add_dagp() From cfaed9d54ef7b7b12517af0cab1688f2b132ed07 Mon Sep 17 00:00:00 2001 From: totork Date: Thu, 19 Mar 2026 23:26:58 +0100 Subject: [PATCH 13/21] First commit of 3D conduction test --- .../3D-Axial-circular-conduction-fci/axial.m | 72 ++++ .../axial_notebook.nb | 349 ++++++++++++++++++ .../data/BOUT.inp | 67 ++++ .../3D-Axial-circular-conduction-fci/runtest | 135 +++++++ 4 files changed, 623 insertions(+) create mode 100644 tests/integrated/3D-Axial-circular-conduction-fci/axial.m create mode 100644 tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb create mode 100644 tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp create mode 100755 tests/integrated/3D-Axial-circular-conduction-fci/runtest diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/axial.m b/tests/integrated/3D-Axial-circular-conduction-fci/axial.m new file mode 100644 index 000000000..852e558e7 --- /dev/null +++ b/tests/integrated/3D-Axial-circular-conduction-fci/axial.m @@ -0,0 +1,72 @@ +(* ::Package:: *) + +BeginPackage["axial`"] + +(* To run the package, execute the following line in a notebook +<Normal*) + +(* Beginning of Notebook Content *) +Notebook[{ + +Cell[CellGroupData[{ +Cell[BoxData[ + RowBox[{"\[IndentingNewLine]", + RowBox[{"SetDirectory", "[", + RowBox[{"NotebookDirectory", "[", "]"}], "]"}]}]], "Input", + CellChangeTimes->{{3.941091023755059*^9, 3.941091026844414*^9}}, + CellLabel->"In[1]:=",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], + +Cell[BoxData["\<\"/viper/u1/toto/soft/hermes-3/build_new/tests/integrated/2D-\ +axial-circular-fci\"\>"], "Output", + CellChangeTimes->CompressedData[" +1:eJwVy1kowwEcwPHxMLNG26zYJVeMB1JWayXNgwchhCgzZLnKtVjzgMgRC1PU +lBQNY9gaC+XIPXeOB8ymZA/4L1HacuT3e/j2efqGltZmy71IJFIydEZfuKNI +CcknozjEF6x3yrRUMHX/8hA9tdoa6GDhRroBZexfRDPAZo73IBPcbI2cQytq +NLsscFWYlBMIjgg7pGgWhTzEBp9ahqO5oID6K0IvU8YFPNCuCE9HDeVvGjRV +dpLAB0tc4i7Uh6oYCAYzVfQ6KVh2olKiXaYDfRH4OifiFoNnllIF+vb4bUXP +Jw7ZJeDFPCcOHW8SJ6LVn3lb6Lsx4g8N8vRM3YIU/rAF5emFVpS/1qizgbmd +T3uoa5J6j6pF0040gzgOfABnI41mO9gksi07wKUxecoj2O0ZuHkGP3SVZCeY +P1PnRj9ebKO0IkJCO/DdRtWSDDFtBn4zj0Dp0rYoPzCbHZuDDlWbtWi/qj3e +H3TdTbcyQSUzZgN1d5N7A0A1/0iLFlSt61H3D/cI/RkxpukMhCT5SuNAWWFf +L2ifoPJrEbxW9wUYwRXTTi76D+TiDJ0= + "], + CellLabel->"Out[1]=",ExpressionUUID->"0e0ce5db-9968-4678-bade-a56ea533da98"] +}, Open ]], + +Cell[CellGroupData[{ + +Cell[BoxData[ + RowBox[{"<<", "axial.m"}]], "Input", + CellChangeTimes->{{3.9410005336133223`*^9, 3.941000541398674*^9}, { + 3.941000701368867*^9, 3.941000721827975*^9}, {3.941000869088725*^9, + 3.941000881063511*^9}, 3.941091017550275*^9}, + CellLabel->"In[2]:=",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], + +Cell[CellGroupData[{ + +Cell[BoxData["\<\"Computing MMS Terms\"\>"], "Print", + CellChangeTimes->CompressedData[" +1:eJwVzFsoswEcx/GR42JjzsflUA4XSIjl9NwgtZIkZHt5JeWcidQu5hCzKexC +oXYhh4XhwphEksjzlguhVxg5az2KiyVD/r+Lb5+7b8TfluJaBx6Pl0uNO7pP +8mUc43TXx0JJ+anCi9TdRxshT1AX703eOA+PiEhuQb0Ala3WPV94P1cSQOYl +OMphxVOjLohs09rjQkhWVZkBFf8840LJWMGUFH4OMDrobBGnhpE5p2P90E38 +MhxOmnu7WmXkUYOtE/pPd8zLyZijsZAqskW/ooC+tgYWtk8nBVeTdtFBIswt +m82C74NLO7Cn0PADT/SZc+fksdq0DvWpW4dwl32YuSQ30pb3oZfr5gWsL8p+ +gtaTxMArMlytWbWQ/CjD2jX55zsr/wbf7uizB1Lz/OjySJ7d2T9ggck06SHn +mEjF7S4sSDdLPAwcU5k5zkGZ3CXWk1Q1GUugtC9lAn65CZMFpMQ7VCUie5Tb +27CZr9T4kAJxzQQc+iydh9qiURYaLULpzCLH7AT8v4bZ3/lW6Cdkbcvkq/+b +zwqpLY4vhb+8mP+k + "], + CellLabel-> + "During evaluation of \ +In[2]:=",ExpressionUUID->"473cff57-8647-4b4c-bf0c-4d5eaa3b6b82"], + +Cell[BoxData["\<\"Finished MMS Terms\"\>"], "Print", + CellChangeTimes->CompressedData[" +1:eJwVzE1ImgEcx3EXWU1My97LKa2gGqPGqGhS1nNZEQgRIdtIWxsRrJWRsRh4 +cCabWWB5CErwMGqJZXXI5hiTiNjoCTqMikbNYmkvyBPUQUJX9P8dvnxu3/xX +uuaOOzwer46aiLvrEGg4Jv7IzELF8219CmkPFnogT9T5IJU85NtGJSQ3a5mF +ht7wWjoMzrRkkU9L47Twxclbew7ZNxwrySNZY+sTqN9ILpGSxaLPKhj9xNgh +PyCvuEfWbo9/hEnyM5uM9A2+79WQm12RAZg59c6tJYs2x/Nekjrnoh6mR7pY +2D/1KLedjEl+lcG6Z19q4OXQ/Ao0Nbpu4JazeuYP+dvi/QqdFT/W4Sobmt4n +v1Uu/IQpid/34Jsm5QkMb5Vl/yVlFutSgBQUuJYPyLbrmvpDfD8U7oRI6+lx +wjG5cxS7gg1er0Oo5Zj7+n+rsKHKpxC6OKa1eoKDGm1CcTJp7Pa0QJW5fBL+ +TxI/FpGKVKlRQpoMfj/sERisaaRI/noSjkTVbjjcNMZCT0Csmp7jmJWs3QOo +vK4PwwwxG1kgzzMv0hbJeOdDNbwFuoD/aw== + "], + CellLabel-> + "During evaluation of \ +In[2]:=",ExpressionUUID->"f5b098b0-d445-4178-844e-9ad69a9178f4"], + +Cell[BoxData["9.579629665962438`*^7"], "Print", + CellChangeTimes->CompressedData[" +1:eJwVzE1ImgEcx3EnqzkpTWu1VVNWwWqHOaJiSW9Ph4qBIENihdobMagtI6MI +PDiTzSyoPAQVeAhdknN1mNWIImJs7Ak8jIqiMul9yDOog0Rm7P87fPncvk+a +Da9b7/B4vApqnH9/UqjjmLtHVhYq6zaNSaTjOMcHeaK3zyRkKG54REpyXpsX +mjrDP1Lg8bQmjax6ztfD+rN3jkdk12A0L4NkzdpiaFxPzMskc0VTKnj9iXHA +uKC88DFZvjn2EQrkf4dl5GJ/X6eODLRHemGqq2dGTz4NjGU0kgbnnBGmRNpZ +2O16kd5ERqW/FLDizedSeDnwdRVaXnlu4YazZHqH/GPzL0Bn4fJvuMaeuPfI +70WzP2HSvaVd2KYuO4PhDcXDfVJms38LksJsz/wB2RArrQ7h+yFn64S0n5/G +n5JbR9ErWOP3TyboOSbLeLgGa14uKhM8HKMtGeegTh+fm0ia3/s0UGUtmIA3 +AnG+iFRKMs1S0mJaWYEdQpM9mRTJWybg0HXtDBxUj7LQFxSr3F84ZjVt+wCW +xarD8IGYjcyS/1IvkufISKWiFv4Hv54AEw== + "], + CellLabel-> + "During evaluation of \ +In[2]:=",ExpressionUUID->"3f9194e7-81e0-4b9d-9d98-51875d993cd6"] +}, Open ]] +}, Open ]], + +Cell[CellGroupData[{ + +Cell[BoxData[{ + RowBox[{ + RowBox[{"kx", " ", "=", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"kz", "=", "4"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"ky", "=", "1"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"omega", "=", "0.1"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"amp", "=", "0.5"}], ";"}], "\[IndentingNewLine]", + RowBox[{"phz", " ", "=", " ", "0.1"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"phy", " ", "=", "0.5"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"pht", "=", " ", "0.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"xmin", "=", "0.4"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"xmax", "=", "0.6"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"offset", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"Dperp", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"Dpar", " ", "=", " ", "2000"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{ + RowBox[{ + RowBox[{"q", "[", "x_", "]"}], " ", "=", " ", + RowBox[{"3.0", "+", + RowBox[{"0.0", " ", "*", " ", "x"}]}]}], ";"}], + "\[IndentingNewLine]"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"CForm", "[", + RowBox[{"MmsDens", "[", + RowBox[{"xl", ",", "zl", ",", "yl", ",", "t"}], "]"}], "]"}], + "\[IndentingNewLine]"}], "\[IndentingNewLine]"}], "Input", + CellChangeTimes->{{3.941001710751292*^9, 3.941001799493569*^9}, { + 3.94100196287262*^9, 3.94100197699585*^9}, {3.941002082278537*^9, + 3.941002091026224*^9}, {3.941005604446062*^9, 3.9410056280492363`*^9}, { + 3.941005702954153*^9, 3.941005712874386*^9}, {3.941005747843405*^9, + 3.94100575324975*^9}, {3.941009187354603*^9, 3.941009247364457*^9}, { + 3.94100966318116*^9, 3.941009680024501*^9}, {3.941091600565372*^9, + 3.9410916014166613`*^9}, {3.941091731467869*^9, 3.941091794275579*^9}, { + 3.941091841698888*^9, 3.94109184990349*^9}, {3.94110656901536*^9, + 3.941106579582962*^9}, {3.941106650936283*^9, 3.94110669207623*^9}, + 3.941106732865182*^9, {3.941120562846257*^9, 3.941120568623769*^9}, { + 3.941120627216084*^9, 3.941120628259906*^9}, {3.941120719254148*^9, + 3.941120719910901*^9}, {3.941120781889386*^9, 3.941120787474683*^9}, { + 3.9411251832829638`*^9, 3.941125233701482*^9}, {3.941128545834157*^9, + 3.9411285503249607`*^9}, {3.9411285973137712`*^9, 3.941128604556089*^9}, { + 3.941130823020509*^9, 3.941130836706815*^9}, {3.941132669299409*^9, + 3.9411326822525787`*^9}, {3.9411333416570683`*^9, 3.941133341715454*^9}, { + 3.9411354363450203`*^9, 3.941135441093075*^9}, {3.941137102236459*^9, + 3.941137103929172*^9}, {3.941212667495749*^9, 3.9412126703613577`*^9}, { + 3.941264227933763*^9, 3.941264274028784*^9}, {3.941266728760947*^9, + 3.941266734322445*^9}, {3.941269687955462*^9, 3.9412696987061653`*^9}, { + 3.941271079546174*^9, 3.941271081196938*^9}, {3.9412719962761*^9, + 3.941271997015006*^9}, {3.9412730616699057`*^9, 3.941273066087247*^9}, { + 3.941273533132288*^9, 3.94127355265935*^9}, {3.941273899665763*^9, + 3.941273921460822*^9}, {3.9415184110422688`*^9, 3.9415184170689363`*^9}, { + 3.9415185124635487`*^9, 3.9415185185770617`*^9}, {3.9415188636598063`*^9, + 3.94151886756817*^9}, 3.9415321328707323`*^9, {3.9415427858429737`*^9, + 3.941542828000198*^9}, {3.941542872244955*^9, 3.941542873488117*^9}, { + 3.941543280452444*^9, 3.941543353814756*^9}, {3.941543921314495*^9, + 3.941543944142756*^9}, {3.94154588614583*^9, 3.941545886200872*^9}, { + 3.941551072132766*^9, 3.94155107423029*^9}, {3.941622928218151*^9, + 3.941622975931859*^9}, {3.9416232368015337`*^9, 3.941623242079863*^9}, { + 3.980418501299036*^9, 3.980418510848222*^9}, {3.980419223612973*^9, + 3.9804192259502373`*^9}, {3.980419424952941*^9, 3.9804194250073843`*^9}, { + 3.9804234906671753`*^9, 3.980423505726005*^9}, {3.980441355886915*^9, + 3.980441368363199*^9}, {3.982829754504801*^9, 3.982829782740342*^9}, { + 3.9828299614012003`*^9, 3.982829964662109*^9}, {3.982831344310981*^9, + 3.9828313473575497`*^9}, {3.98285198331588*^9, 3.982851984615147*^9}, { + 3.9828527440353117`*^9, 3.9828527456692553`*^9}}, + CellLabel->"In[3]:=",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], + +Cell[BoxData["0.1`"], "Output", + CellChangeTimes->{ + 3.941009688547415*^9, 3.941091609619776*^9, {3.941091721815781*^9, + 3.94109175661007*^9}, 3.941091800122217*^9, 3.941091861807825*^9, + 3.941094505048383*^9, 3.941094632399669*^9, 3.94109500239986*^9, + 3.941106598058303*^9, 3.94110669394636*^9, 3.941106733977233*^9, + 3.9411070572842493`*^9, 3.941108055401798*^9, 3.941110920195258*^9, + 3.941111135388945*^9, 3.9411154343472643`*^9, 3.941120680145395*^9, + 3.941120754512067*^9, 3.941120792306068*^9, 3.941125270776736*^9, + 3.9411285314437933`*^9, 3.94112865354068*^9, 3.9411305706981773`*^9, + 3.941130863732583*^9, 3.941131412892272*^9, 3.941132715845481*^9, + 3.941133367217663*^9, 3.94113549000552*^9, 3.9412642619733667`*^9, + 3.941264321927586*^9, 3.941266776146008*^9, 3.941269726592196*^9, + 3.9412704321241703`*^9, 3.941271127788968*^9, 3.941271764441196*^9, + 3.941271938828134*^9, 3.941272048248835*^9, 3.9412730959363823`*^9, + 3.941273591507408*^9, {3.941518418753319*^9, 3.941518436017467*^9}, + 3.941518506514503*^9, 3.9415186678213663`*^9, 3.94151878816772*^9, + 3.941518930271064*^9, 3.941524789151843*^9, 3.941525052529055*^9, + 3.941525223263277*^9, 3.941525310950933*^9, 3.9415257007103243`*^9, + 3.94152899981022*^9, 3.941531065665744*^9, 3.9415322221566772`*^9, + 3.941543605943892*^9, 3.9415439146525593`*^9, 3.941543993887024*^9, + 3.941545930879993*^9, 3.94162301201434*^9, 3.941623323243279*^9, + 3.980419544580164*^9, 3.980420976435289*^9, 3.980421442630149*^9, + 3.9804217996122704`*^9, 3.9804223560539*^9, 3.980423483943228*^9, + 3.980423570934939*^9, 3.9804323880265083`*^9, 3.980432889684306*^9, + 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, + 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, + 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, + 3.9828527873122396`*^9}, + CellLabel->"Out[8]=",ExpressionUUID->"09638d36-e084-4afc-bc77-821a997aa418"], + +Cell["\<\ +1. - 0.5*Cos(0.5 - yl)* + Sin(31.41592653589794*(-0.4 + xl))* + Sin(0.1 - 4*zl)\ +\>", "Output", + CellChangeTimes->{ + 3.941009688547415*^9, 3.941091609619776*^9, {3.941091721815781*^9, + 3.94109175661007*^9}, 3.941091800122217*^9, 3.941091861807825*^9, + 3.941094505048383*^9, 3.941094632399669*^9, 3.94109500239986*^9, + 3.941106598058303*^9, 3.94110669394636*^9, 3.941106733977233*^9, + 3.9411070572842493`*^9, 3.941108055401798*^9, 3.941110920195258*^9, + 3.941111135388945*^9, 3.9411154343472643`*^9, 3.941120680145395*^9, + 3.941120754512067*^9, 3.941120792306068*^9, 3.941125270776736*^9, + 3.9411285314437933`*^9, 3.94112865354068*^9, 3.9411305706981773`*^9, + 3.941130863732583*^9, 3.941131412892272*^9, 3.941132715845481*^9, + 3.941133367217663*^9, 3.94113549000552*^9, 3.9412642619733667`*^9, + 3.941264321927586*^9, 3.941266776146008*^9, 3.941269726592196*^9, + 3.9412704321241703`*^9, 3.941271127788968*^9, 3.941271764441196*^9, + 3.941271938828134*^9, 3.941272048248835*^9, 3.9412730959363823`*^9, + 3.941273591507408*^9, {3.941518418753319*^9, 3.941518436017467*^9}, + 3.941518506514503*^9, 3.9415186678213663`*^9, 3.94151878816772*^9, + 3.941518930271064*^9, 3.941524789151843*^9, 3.941525052529055*^9, + 3.941525223263277*^9, 3.941525310950933*^9, 3.9415257007103243`*^9, + 3.94152899981022*^9, 3.941531065665744*^9, 3.9415322221566772`*^9, + 3.941543605943892*^9, 3.9415439146525593`*^9, 3.941543993887024*^9, + 3.941545930879993*^9, 3.94162301201434*^9, 3.941623323243279*^9, + 3.980419544580164*^9, 3.980420976435289*^9, 3.980421442630149*^9, + 3.9804217996122704`*^9, 3.9804223560539*^9, 3.980423483943228*^9, + 3.980423570934939*^9, 3.9804323880265083`*^9, 3.980432889684306*^9, + 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, + 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, + 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, + 3.9828527873668756`*^9}, + CellLabel-> + "Out[17]//CForm=",ExpressionUUID->"fe74f41e-c333-4ebc-97bc-a1af72f7317e"] +}, Open ]], + +Cell[BoxData[""], "Input", + CellChangeTimes->{{3.9804234827382107`*^9, 3.980423485860519*^9}}, + CellLabel->"In[18]:=",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], + +Cell[BoxData[ + RowBox[{ + RowBox[{"Export", "[", + RowBox[{ + RowBox[{"FileNameJoin", "[", + RowBox[{"{", + RowBox[{ + RowBox[{"NotebookDirectory", "[", "]"}], ",", "\"\\""}], + "}"}], "]"}], ",", + RowBox[{"ToLowerCase", "[", + RowBox[{"ToString", "[", + RowBox[{ + RowBox[{"CForm", "[", + RowBox[{"MmsDens", "[", + RowBox[{"xl", ",", "zl", ",", "yl", ",", "t"}], "]"}], "]"}], ",", + "InputForm"}], "]"}], "]"}]}], "]"}], ";"}]], "Input", + CellChangeTimes->{{3.941091108047451*^9, 3.941091108047735*^9}, + 3.941091893938613*^9, {3.941091943764895*^9, 3.941091953659176*^9}, { + 3.94109205520127*^9, 3.9410920828692217`*^9}, {3.941543505174944*^9, + 3.941543506958555*^9}, {3.941551089773295*^9, 3.941551093286003*^9}, { + 3.9804213870984488`*^9, 3.980421390947422*^9}, {3.9804222978401527`*^9, + 3.980422306130024*^9}}, + CellLabel->"In[19]:=",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], + +Cell[BoxData[ + RowBox[{ + RowBox[{"Export", "[", + RowBox[{ + RowBox[{"FileNameJoin", "[", + RowBox[{"{", + RowBox[{ + RowBox[{"NotebookDirectory", "[", "]"}], ",", "\"\\""}], + "}"}], "]"}], ",", + RowBox[{"ToLowerCase", "[", + RowBox[{"ToString", "[", + RowBox[{ + RowBox[{"CForm", "[", + RowBox[{"Smms", "[", + RowBox[{"xl", ",", "zl", ",", "yl", ",", "t"}], "]"}], "]"}], ",", + "InputForm"}], "]"}], "]"}]}], "]"}], ";"}]], "Input", + CellChangeTimes->{{3.941092152330538*^9, 3.941092164437331*^9}, { + 3.941543525003409*^9, 3.9415435486676207`*^9}, {3.94155108160419*^9, + 3.941551083792343*^9}, {3.9804213936372538`*^9, 3.980421397635703*^9}, { + 3.980422311434009*^9, 3.980422315912444*^9}}, + CellLabel->"In[20]:=",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] +}, +WindowSize->{513, 627}, +WindowMargins->{{Automatic, 0}, {Automatic, 0}}, +FrontEndVersion->"14.3 for Linux x86 (64-bit) (July 8, 2025)", +StyleDefinitions->"Default.nb", +ExpressionUUID->"ee53c5d0-dbab-4b20-a961-e0f5716cf87c" +] +(* End of Notebook Content *) + +(* Internal cache information *) +(*CellTagsOutline +CellTagsIndex->{} +*) +(*CellTagsIndex +CellTagsIndex->{} +*) +(*NotebookFileOutline +Notebook[{ +Cell[CellGroupData[{ +Cell[580, 22, 285, 5, 51, "Input",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], +Cell[868, 29, 817, 14, 53, "Output",ExpressionUUID->"0e0ce5db-9968-4678-bade-a56ea533da98"] +}, Open ]], +Cell[CellGroupData[{ +Cell[1722, 48, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], +Cell[CellGroupData[{ +Cell[2066, 57, 766, 15, 23, "Print",ExpressionUUID->"473cff57-8647-4b4c-bf0c-4d5eaa3b6b82"], +Cell[2835, 74, 785, 15, 23, "Print",ExpressionUUID->"f5b098b0-d445-4178-844e-9ad69a9178f4"], +Cell[3623, 91, 780, 15, 30, "Print",ExpressionUUID->"3f9194e7-81e0-4b9d-9d98-51875d993cd6"] +}, Open ]] +}, Open ]], +Cell[CellGroupData[{ +Cell[4452, 112, 4255, 76, 374, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], +Cell[8710, 190, 2000, 29, 33, "Output",ExpressionUUID->"09638d36-e084-4afc-bc77-821a997aa418"], +Cell[10713, 221, 2089, 34, 80, "Output",ExpressionUUID->"fe74f41e-c333-4ebc-97bc-a1af72f7317e"] +}, Open ]], +Cell[12817, 258, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], +Cell[12993, 262, 984, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], +Cell[13980, 286, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] +} +] +*) + diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp b/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp new file mode 100644 index 000000000..cab67fc7a --- /dev/null +++ b/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp @@ -0,0 +1,67 @@ +nout = 50 +timestep = 0.1 + + + + + +minvalue= (-2.0+0.5) / (nx - 2*2) +maxvalue= (nx-3+0.5) / (nx - 2*2) +xmax = 0.6 +xmin = 0.4 +xl = (xmax - xmin)*(x-minvalue)/(maxvalue-minvalue) + xmin +yl = y +zl = z + + +[input] + +error_on_unused_options = false + +[mesh] + +extrapolate_y = false + +[mesh:paralleltransform] +type = fci + +[mesh] + +symmetricGlobalX = true + +[solver] +mxstep = 10000 +rtol = 1e-6 +atol = 1e-12 +mms = true # Run with MMS sources and output diagnostics +mms_initialise = true +type = cvode + + +[hermes] +components = h+ + + +Nnorm = 1e18 +Bnorm = 1 +Tnorm = 5 + +[h+] # Ions +type = evolve_density, anomalous_diffusion_3d +charge = 1.0 +AA = 1.0 + +mms = true + +anomalous_D = 1.0 +anomalous_D_par = 2000 + +use_finite_difference = true + +[Nh+] + +solution = 1. - 0.5*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + +source = (-0.000020877633788978686*(1.3333333333333333*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl) + 1.3888888888888888*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))/(1 + 0.1111111111111111*power(xl,2)) - 1.0438816894489344e-8*((-15.70796326794897*cos(31.41592653589794*(-0.4 + xl))*cos(0.5 - yl)*sin(0.1 - 4*zl))/xl + 493.4802200544682*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (8.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(xl,2)) + +bndry_all = dirichlet_o2(`Nh+:solution`) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/runtest b/tests/integrated/3D-Axial-circular-conduction-fci/runtest new file mode 100755 index 000000000..cae56249c --- /dev/null +++ b/tests/integrated/3D-Axial-circular-conduction-fci/runtest @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 + +# Python script to run and analyse MMS test + +from __future__ import division +from __future__ import print_function +import numpy as np +try: + from builtins import str +except: + pass + +from boututils.run_wrapper import shell, launch_safe, getmpirun +from boutdata.collect import collect + +from numpy import sqrt, max, abs, mean, array, log, concatenate + +import tarfile + + +gridpath = "../../../../grids/mms_axial_circular_fci/" +#archive_path = "MMS_Circle_fci_XZ.tar.xz" + +#try: +# with tarfile.open(gridpath + archive_path, "r:xz") as tar: +# tar.extractall(path=gridpath) +# print("Successfully extracted the grids!") +#except: +# raise FileNotFoundError("Could not fine mms slab y file to extract") + + +#def gridname(nx): +# return gridpath + f"circular_{int(nx+4)}_{4}_{int(nx*8)}.nc" + +def gridname(nx): + return gridpath + f"Axial_circular_q_{int(nx)}_{int(4*nx)}_0.4_0.6_3.0_0.0.fci.grid.nc" + + +# List of NY values to use +#nxlist = [36, 68, 132, 260] #, 640, 1280, 2560, 5120] +nxlist = [16,32] +nout = 10 +timestep = 1e5 / nout + +nproc = 1 + +varnames = ["Nh+"] + +results = {} +for var in varnames: + results[var] = {"l2":[], "inf":[]} + +for ny in nxlist: + args = "mesh:file="+gridname(ny)+" nout="+str(nout)+" timestep="+str(timestep) + " nx="+str(ny+4) + + print("Running with " + args) + + # Delete old data + shell("rm data/BOUT.dmp.*.nc") + + # Command to run + cmd = "../../../hermes-3 " + args + # Launch using MPI + s, out = launch_safe(cmd, nproc=nproc, pipe=True) + + # Save output to log file + f = open("run.log."+str(ny), "w") + f.write(out) + f.close() + + # Collect data + for var in varnames: + E = collect("E_"+var, tind=[nout,nout], path="data", info=False) + print(str(np.array(E).shape)) + E = E[0,2:-2,1:-1,:] + + l2 = sqrt(mean(E**2)) + linf = max(abs(E)) + results[var]["l2"].append( l2 ) + results[var]["inf"].append( linf ) + + print("Error norm %s: l-2 %f l-inf %f" % (var, l2, linf)) + +# Calculate grid spacing +dy = 1. / array(nxlist) + +success = True + +for var in varnames: + l2 = results[var]["l2"] + order = log(l2[-1] / l2[-2]) / log(dy[-1] / dy[-2]) + print("Convergence order %s = %f" % (var, order)) + + if order < 1.8: + success = False + +# plot errors +try: + import matplotlib.pyplot as plt + + for var in varnames: + l2 = results[var]["l2"] + inf = results[var]["inf"] + order = log(l2[-1] / l2[-2]) / log(dy[-1] / dy[-2]) + + plt.plot(dy, l2, '-o', label=r'$l_2$ ('+var+')') + plt.plot(dy, inf, '-x', label=r'$l_\infty$ ('+var+')') + plt.plot(dy, l2[-1]*(dy/dy[-1])**order, '--', label="Order %.1f" % (order)) + + plt.legend(loc="upper left") + plt.grid() + + plt.yscale('log') + plt.xscale('log') + + plt.xlabel(r'Mesh spacing $\delta y$') + plt.ylabel("Error norm") + + plt.savefig("fluid_norm.pdf") + plt.savefig("fluid_norm.png") + + #plt.show() + plt.close() +except: + # Plotting could fail for any number of reasons, and the actual + # error raised may depend on, among other things, the current + # matplotlib backend, so catch everything + pass + +if success: + print(" => Test passed") + exit(0) +else: + print(" => Test failed") + exit(1) From ea43b25ac90de9a4734dad4d4e1e3e516a01ec19 Mon Sep 17 00:00:00 2001 From: totork Date: Fri, 20 Mar 2026 12:40:03 +0100 Subject: [PATCH 14/21] Add 3D test to CMake file --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index caf1be409..99f0cf1fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,6 +306,8 @@ if(HERMES_TESTS) DEPENDS setup-test) endif() endfunction() + hermes_add_integrated_test(3D-Axial-circular-conduction-fci + REQUIRES BOUT_ENABLE_METRIC_3D) hermes_add_integrated_test(2D-axial-circular-fci REQUIRES BOUT_ENABLE_METRIC_3D) hermes_add_integrated_test(2D-vorticity-inversion-fci From d9b899067c9768aa90fe7102f58003fe56129f8e Mon Sep 17 00:00:00 2001 From: totork Date: Fri, 20 Mar 2026 13:54:58 +0100 Subject: [PATCH 15/21] Adjust 3D Test to use pressure and proper normalization --- .../3D-Axial-circular-conduction-fci/axial.m | 12 +- .../axial_notebook.nb | 177 ++++++++++-------- .../data/BOUT.inp | 20 +- .../3D-Axial-circular-conduction-fci/runtest | 4 +- 4 files changed, 114 insertions(+), 99 deletions(-) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/axial.m b/tests/integrated/3D-Axial-circular-conduction-fci/axial.m index 852e558e7..c42f042eb 100644 --- a/tests/integrated/3D-Axial-circular-conduction-fci/axial.m +++ b/tests/integrated/3D-Axial-circular-conduction-fci/axial.m @@ -47,20 +47,18 @@ Define normalised rho and MMS solution in terms of mode numbers \ given above *) -MmsDens[x_, z_, y_, t_] = amp*Sin[2.0*Pi*kx*xn[x]]*Sin[kz*z - phz]*Cos[ky*y- phy]+offset; -MmsUpar[x_, z_, y_, t_]=1; +MmsN[x_, z_, y_, t_] = N0/Nnorm; +MmsT[x_, z_, y_, t_] = (Tamp*Sin[2.0*Pi*kx*xn[x]]*Sin[kz*z - phz]*Cos[ky*y- phy]+T0)/Tnorm; +MmsP[x_, z_, y_, t_] = MmsN[x,z,y,t]*MmsT[x,z,y,t]; rhos = 0.0002284697436697996 -Bnorm = 1.0 qe = 1.60217663*^-19 Me = 9.1093837*^-31 e0 = 8.85418781*^-12 Omegaci = qe * Bnorm / (1836.0*Me) -pflux[x_, z_, y_, t_]=MmsDens[x, z, y, t]; -(*Smms[x_, z_, y_, t_]=D[MmsDens[x,z,y,t],t]-d2dpar2[MmsDens,x,z,y,t]-Laplaceperpe[MmsDens,x,z,y,t];*) -Smms[x_, z_, y_, t_]=D[MmsDens[x,z,y,t],t]-Dperp/(rhos*rhos*Omegaci) * LaplacePerp[MmsDens,x,z,y,t] * (rhos*rhos)- - Dpar/(rhos*rhos*Omegaci)*d2dpar2[MmsDens,x,z,y,t]* (rhos*rhos); +Smms[x_, z_, y_, t_]=D[MmsP[x,z,y,t],t]-(2.0 / 3.0) * Chiperp/(rhos*rhos*Omegaci) * MmsN[x,z,y,t] * LaplacePerp[MmsT,x,z,y,t] * (rhos*rhos)- + Chipar/(rhos*rhos*Omegaci)*d2dpar2[MmsP,x,z,y,t]* (rhos*rhos); Print["Finished MMS Terms"]; diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb b/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb index 1f1d24b2b..92d2c03cb 100644 --- a/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb +++ b/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb @@ -10,10 +10,10 @@ NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] -NotebookDataLength[ 16342, 341] -NotebookOptionsPosition[ 14836, 308] -NotebookOutlinePosition[ 15223, 324] -CellTagsIndexPosition[ 15180, 321] +NotebookDataLength[ 17281, 358] +NotebookOptionsPosition[ 15774, 325] +NotebookOutlinePosition[ 16161, 341] +CellTagsIndexPosition[ 16118, 338] WindowFrame->Normal*) (* Beginning of Notebook Content *) @@ -27,21 +27,22 @@ Cell[BoxData[ CellChangeTimes->{{3.941091023755059*^9, 3.941091026844414*^9}}, CellLabel->"In[1]:=",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], -Cell[BoxData["\<\"/viper/u1/toto/soft/hermes-3/build_new/tests/integrated/2D-\ -axial-circular-fci\"\>"], "Output", +Cell[BoxData["\<\"/viper/u1/toto/soft/hermes-3/build/tests/integrated/3D-\ +Axial-circular-conduction-fci\"\>"], "Output", CellChangeTimes->CompressedData[" -1:eJwVy1kowwEcwPHxMLNG26zYJVeMB1JWayXNgwchhCgzZLnKtVjzgMgRC1PU -lBQNY9gaC+XIPXeOB8ymZA/4L1HacuT3e/j2efqGltZmy71IJFIydEZfuKNI -CcknozjEF6x3yrRUMHX/8hA9tdoa6GDhRroBZexfRDPAZo73IBPcbI2cQytq -NLsscFWYlBMIjgg7pGgWhTzEBp9ahqO5oID6K0IvU8YFPNCuCE9HDeVvGjRV -dpLAB0tc4i7Uh6oYCAYzVfQ6KVh2olKiXaYDfRH4OifiFoNnllIF+vb4bUXP -Jw7ZJeDFPCcOHW8SJ6LVn3lb6Lsx4g8N8vRM3YIU/rAF5emFVpS/1qizgbmd -T3uoa5J6j6pF0040gzgOfABnI41mO9gksi07wKUxecoj2O0ZuHkGP3SVZCeY -P1PnRj9ebKO0IkJCO/DdRtWSDDFtBn4zj0Dp0rYoPzCbHZuDDlWbtWi/qj3e -H3TdTbcyQSUzZgN1d5N7A0A1/0iLFlSt61H3D/cI/RkxpukMhCT5SuNAWWFf -L2ifoPJrEbxW9wUYwRXTTi76D+TiDJ0= +1:eJwVy01ImgEcx3Hr4EzcUIuVqdFWlO2wGCQ8CGsY0SFWbFGxIHtjsVXQy6TC +DhUbvVBSMygwiGDDldPKsKKCXuhd1yp6OdTsBWIeqkeiwIxc7Pc/fPmcvk+K +KjKKAzgcTjLaEA4f8DSs+lpUEBkEq9z5Rj5MXdleI387XJ+EMHc2zUqKVrbi +RLAuPPCrGM41xFjIj+WGpRA4pXyVGQp7lF805Fset0sCT+u746RQwf/HkNsp +/QoZPNJGpZHWDxcGMjV/PUEOCz2qZvIBX9sZAd/ohJUa+H5dV0s2j66a8+C5 +hZEWwI2JIi15cXLnIDe/rUkK4dZQeDzZX6N6SZZdZ8+Tl7boezLstvXHPuTJ +uydImVnpIOXT1SYXzGo6XSY93/l/SD0z4CbT2V+hh/BnjM1+BGsY1/gxHOsr +TjmBLbede3/hlamE64bvBit95NWZq1eQx6oFq0ELpF6drhIM4rfLWFKoaYx9 +CDMkzzPJrjK7kezQfX7xCHoOBhrEsFb8bJb0tXDbgqFe7jSSOaUzZtLnlzpJ +f4/ttcnKqpN2DMdkyFPvGdmuKPGOwF19e7ANTo4uZpGN+48XvdDZlMjcwP8F +2xY3 "], - CellLabel->"Out[1]=",ExpressionUUID->"0e0ce5db-9968-4678-bade-a56ea533da98"] + CellLabel->"Out[1]=",ExpressionUUID->"8d78eaab-22e3-4119-a42b-b47f5e37e07d"] }, Open ]], Cell[CellGroupData[{ @@ -57,60 +58,70 @@ Cell[CellGroupData[{ Cell[BoxData["\<\"Computing MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzFsoswEcx/GR42JjzsflUA4XSIjl9NwgtZIkZHt5JeWcidQu5hCzKexC -oXYhh4XhwphEksjzlguhVxg5az2KiyVD/r+Lb5+7b8TfluJaBx6Pl0uNO7pP -8mUc43TXx0JJ+anCi9TdRxshT1AX703eOA+PiEhuQb0Ala3WPV94P1cSQOYl -OMphxVOjLohs09rjQkhWVZkBFf8840LJWMGUFH4OMDrobBGnhpE5p2P90E38 -MhxOmnu7WmXkUYOtE/pPd8zLyZijsZAqskW/ooC+tgYWtk8nBVeTdtFBIswt -m82C74NLO7Cn0PADT/SZc+fksdq0DvWpW4dwl32YuSQ30pb3oZfr5gWsL8p+ -gtaTxMArMlytWbWQ/CjD2jX55zsr/wbf7uizB1Lz/OjySJ7d2T9ggck06SHn -mEjF7S4sSDdLPAwcU5k5zkGZ3CXWk1Q1GUugtC9lAn65CZMFpMQ7VCUie5Tb -27CZr9T4kAJxzQQc+iydh9qiURYaLULpzCLH7AT8v4bZ3/lW6Cdkbcvkq/+b -zwqpLY4vhb+8mP+k +1:eJwVzE1IkwEcx/ElOW24Tae5TN3wBdIdNCLDxpw+HpwIAxGRFLcyiaBVSoti +sMNaQ+cmmDsMVNghnI7pnAdXhjhkhdYTeBCVRNvE12I8QR5WuJT+v8OXz+1b +dL+n5cEFHo9XT42kXBoT6Djm4r6Nhcr2DWMm6TooDUCe6KEii9xNHXojIbkp ++xQ098Y/5cCDyVYp2VCRoocdx49deeQzZ7I8n2Qtnbeh8auwvIAsE73VwtN+ +xgVTo/KqQrJ2w90H0+U/h2Tk/GtTr45cNSRewtzxF349eW3VnX+P7PHMGmFO +wsDC5+PXr3aRSclKJay7M1EDTwZmlqC1yXcO1z2qyS1yzR56Dz1Vi19ghD30 +7pAfbgWXYWbawjZ81Kw+hvH1yivfSZndMRclBSW+dzHy7lmNZhffV6Wbh6Tj +xxH/iNzcT/6FjaHQWIaeY4qNexHYWD2vzPBxTKdqhIM6Pb9MSFqeBFqh1nZz +FP5LF98QkcqsAouEtJrDYfhUYHZkkyJ59ygcPG3zQ2fzMAsDUbHWO80xS9Jv +Mag+08ThZTGbCJK/cn9nz5LOFkUbNFsNHxNk+LOp+g/5HxDmCbk= "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"473cff57-8647-4b4c-bf0c-4d5eaa3b6b82"], +In[2]:=",ExpressionUUID->"45859d2b-593a-4b74-a7f4-45c0ebe6be10"], Cell[BoxData["\<\"Finished MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzE1ImgEcx3EXWU1My97LKa2gGqPGqGhS1nNZEQgRIdtIWxsRrJWRsRh4 -cCabWWB5CErwMGqJZXXI5hiTiNjoCTqMikbNYmkvyBPUQUJX9P8dvnxu3/xX -uuaOOzwer46aiLvrEGg4Jv7IzELF8219CmkPFnogT9T5IJU85NtGJSQ3a5mF -ht7wWjoMzrRkkU9L47Twxclbew7ZNxwrySNZY+sTqN9ILpGSxaLPKhj9xNgh -PyCvuEfWbo9/hEnyM5uM9A2+79WQm12RAZg59c6tJYs2x/Nekjrnoh6mR7pY -2D/1KLedjEl+lcG6Z19q4OXQ/Ao0Nbpu4JazeuYP+dvi/QqdFT/W4Sobmt4n -v1Uu/IQpid/34Jsm5QkMb5Vl/yVlFutSgBQUuJYPyLbrmvpDfD8U7oRI6+lx -wjG5cxS7gg1er0Oo5Zj7+n+rsKHKpxC6OKa1eoKDGm1CcTJp7Pa0QJW5fBL+ -TxI/FpGKVKlRQpoMfj/sERisaaRI/noSjkTVbjjcNMZCT0Csmp7jmJWs3QOo -vK4PwwwxG1kgzzMv0hbJeOdDNbwFuoD/aw== +1:eJwVzEFIkwEchvElajp0m9Nm6XJUQnOHlHBhY9O+DjmCgYiMCreyiKCVShND +2mEtqbkJ1g6CDnYIl0Ob8+BqIsmwUPqCHWKTopqjuS0ZX1CHFVsL/+/h4Xd7 +jl0f6r15gMfjnadmSirdfAPHlCbHWai6HDOLSNdusx/yBLcUNWSibOqpmOQW +7YvQMpx9Vwd35/vqyQunSozwSuaO6wh5z1loaSRZa/9ZaP5Q3SIl5YLnOph/ +wrhgWVymPEp2xaYfwwrZ3lQTGXo0NmwgI6bcfSiZG10wkicj043XyCHPshnW +5UwsHJlraxggC+KtVnju0gsN/D2xFIa2i77/MOpRz38mP9qDr6FH+eY93GBT +3q/k6pnAJhQdXPsCb/d0ZmA22nr4G9lkd6zESf4J36sd8mpR053A92Hzdop0 +/EiXp8ntZOEv1AaD7iojxxw3f9+A2o6QqsrHMf3qGQ4ajOXyatJ6198HdePt +s/BfhfC0gFTVSK1i0mZZX4eDfIujlhTIbszCybx+ATp7nrHQHxfqvC85Jlz/ +aQd2Fruz8JCQzQXIn5Jftcuks1ehhxab6W2OTA486PhD7gMPSQl5 "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"f5b098b0-d445-4178-844e-9ad69a9178f4"], +In[2]:=",ExpressionUUID->"77fe6265-86fc-4eae-9145-6eef491d5f10"], -Cell[BoxData["9.579629665962438`*^7"], "Print", +Cell[BoxData[ + RowBox[{"9.579629665962438`*^7", " ", "Bnorm"}]], "Print", CellChangeTimes->CompressedData[" -1:eJwVzE1ImgEcx3EnqzkpTWu1VVNWwWqHOaJiSW9Ph4qBIENihdobMagtI6MI -PDiTzSyoPAQVeAhdknN1mNWIImJs7Ak8jIqiMul9yDOog0Rm7P87fPncvk+a -Da9b7/B4vApqnH9/UqjjmLtHVhYq6zaNSaTjOMcHeaK3zyRkKG54REpyXpsX -mjrDP1Lg8bQmjax6ztfD+rN3jkdk12A0L4NkzdpiaFxPzMskc0VTKnj9iXHA -uKC88DFZvjn2EQrkf4dl5GJ/X6eODLRHemGqq2dGTz4NjGU0kgbnnBGmRNpZ -2O16kd5ERqW/FLDizedSeDnwdRVaXnlu4YazZHqH/GPzL0Bn4fJvuMaeuPfI -70WzP2HSvaVd2KYuO4PhDcXDfVJms38LksJsz/wB2RArrQ7h+yFn64S0n5/G -n5JbR9ErWOP3TyboOSbLeLgGa14uKhM8HKMtGeegTh+fm0ia3/s0UGUtmIA3 -AnG+iFRKMs1S0mJaWYEdQpM9mRTJWybg0HXtDBxUj7LQFxSr3F84ZjVt+wCW -xarD8IGYjcyS/1IvkufISKWiFv4Hv54AEw== +1:eJxTTMoPSmVkYGBwAuKZTJyzuWLfOrI8bjkFoq0irxYLAOlJT1TWgmgGvnQt +QSD9gLV/ghCQfru6YzWIril4fUQERD9ZHiIOpN30mOJAdNTznEmSQLqo+7em +NJA+1RBjCaKLT/NqygBpDb5FviD6V7vjJBDNek/eVBZI21+d1gaiOeRf9ssB +6R3NlQWxQPpc9rdyEC22pGxVHJBWPzdNOgFI58/bUAyiRb5lnwLRJUsMpBKB +9G+h4/og2iFimS2I/tS57gCIbvJa8Q9EX5lns/wmkL7UsXU7iJ5nuvckiD50 +6unSO0B6p9n6YyBagH33bRCdFWD3HES/vqIvcRdIy3V0bbkHpLmUV2y7D6Tj +/9q6PwCZ26hy7SmQ7nrxjO0ZkL72+PcPEO2xdetsnri3jkrFjw6BaA+LHVY8 +K946xtjMfAuiY+PYNHiBdEPu2hAQ7dtiMgtE/+HgN+ID0laCMg1CQLqpZt8+ +EJ3HVdMlDKT55JNngeieX2GrQHR3wMRTIHrtPX7fpWveOh4Qv3EfRNv9dX8N +okX5T31bD6TfiX0U3gCku4O0wkB0TVP24W9A+teRWovvQBoAEsIJ9Q== "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"3f9194e7-81e0-4b9d-9d98-51875d993cd6"] +In[2]:=",ExpressionUUID->"88d136f7-c2f0-4cec-b6ff-c7d3167da825"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ + RowBox[{ + RowBox[{"Tnorm", " ", "=", " ", "5.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"Nnorm", " ", "=", " ", + RowBox[{"10", "^", "18"}]}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"Bnorm", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"AA", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"kx", " ", "=", "1.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ @@ -120,7 +131,7 @@ Cell[BoxData[{ RowBox[{ RowBox[{"omega", "=", "0.1"}], ";"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"amp", "=", "0.5"}], ";"}], "\[IndentingNewLine]", + RowBox[{"Tamp", "=", "5.0"}], ";"}], "\[IndentingNewLine]", RowBox[{"phz", " ", "=", " ", "0.1"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"phy", " ", "=", "0.5"}], ";"}], "\[IndentingNewLine]", @@ -131,11 +142,14 @@ Cell[BoxData[{ RowBox[{ RowBox[{"xmax", "=", "0.6"}], ";"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"offset", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{"T0", " ", "=", " ", "20.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{ + RowBox[{"N0", " ", "=", " ", + RowBox[{"10", "^", "19"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"Dperp", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{"Chiperp", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"Dpar", " ", "=", " ", "2000"}], ";"}], "\[IndentingNewLine]", + RowBox[{"Chipar", " ", "=", " ", "0.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ @@ -145,7 +159,7 @@ Cell[BoxData[{ "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"CForm", "[", - RowBox[{"MmsDens", "[", + RowBox[{"MmsP", "[", RowBox[{"xl", ",", "zl", ",", "yl", ",", "t"}], "]"}], "]"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]"}], "Input", CellChangeTimes->{{3.941001710751292*^9, 3.941001799493569*^9}, { @@ -185,7 +199,10 @@ Cell[BoxData[{ 3.980441368363199*^9}, {3.982829754504801*^9, 3.982829782740342*^9}, { 3.9828299614012003`*^9, 3.982829964662109*^9}, {3.982831344310981*^9, 3.9828313473575497`*^9}, {3.98285198331588*^9, 3.982851984615147*^9}, { - 3.9828527440353117`*^9, 3.9828527456692553`*^9}}, + 3.9828527440353117`*^9, 3.9828527456692553`*^9}, {3.9829961854197617`*^9, + 3.982996259211157*^9}, {3.982996290397106*^9, 3.98299631633951*^9}, { + 3.982996835891934*^9, 3.982996849912133*^9}, 3.982996879955332*^9, { + 3.982997208861528*^9, 3.982997216510427*^9}}, CellLabel->"In[3]:=",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], Cell[BoxData["0.1`"], "Output", @@ -216,13 +233,13 @@ Cell[BoxData["0.1`"], "Output", 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, - 3.9828527873122396`*^9}, - CellLabel->"Out[8]=",ExpressionUUID->"09638d36-e084-4afc-bc77-821a997aa418"], + 3.9828527873122396`*^9, 3.9829970217485867`*^9, 3.982997958253395*^9}, + CellLabel->"Out[12]=",ExpressionUUID->"6210aa98-cd31-4f91-898f-decc0e9a4b08"], Cell["\<\ -1. - 0.5*Cos(0.5 - yl)* - Sin(31.41592653589794*(-0.4 + xl))* - Sin(0.1 - 4*zl)\ +2.*(20. - 5.*Cos(0.5 - yl)* + Sin(31.41592653589794*(-0.4 + xl))* + Sin(0.1 - 4*zl))\ \>", "Output", CellChangeTimes->{ 3.941009688547415*^9, 3.941091609619776*^9, {3.941091721815781*^9, @@ -251,14 +268,14 @@ Cell["\<\ 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, - 3.9828527873668756`*^9}, + 3.9828527873122396`*^9, 3.9829970217485867`*^9, 3.982997958303314*^9}, CellLabel-> - "Out[17]//CForm=",ExpressionUUID->"fe74f41e-c333-4ebc-97bc-a1af72f7317e"] + "Out[22]//CForm=",ExpressionUUID->"a4cdb2c3-c78d-45cd-a5bd-49c879795f3c"] }, Open ]], Cell[BoxData[""], "Input", CellChangeTimes->{{3.9804234827382107`*^9, 3.980423485860519*^9}}, - CellLabel->"In[18]:=",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], + CellLabel->"In[23]:=",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], Cell[BoxData[ RowBox[{ @@ -273,7 +290,7 @@ Cell[BoxData[ RowBox[{"ToString", "[", RowBox[{ RowBox[{"CForm", "[", - RowBox[{"MmsDens", "[", + RowBox[{"MmsP", "[", RowBox[{"xl", ",", "zl", ",", "yl", ",", "t"}], "]"}], "]"}], ",", "InputForm"}], "]"}], "]"}]}], "]"}], ";"}]], "Input", CellChangeTimes->{{3.941091108047451*^9, 3.941091108047735*^9}, @@ -281,8 +298,8 @@ Cell[BoxData[ 3.94109205520127*^9, 3.9410920828692217`*^9}, {3.941543505174944*^9, 3.941543506958555*^9}, {3.941551089773295*^9, 3.941551093286003*^9}, { 3.9804213870984488`*^9, 3.980421390947422*^9}, {3.9804222978401527`*^9, - 3.980422306130024*^9}}, - CellLabel->"In[19]:=",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], + 3.980422306130024*^9}, 3.982996996609498*^9}, + CellLabel->"In[24]:=",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], Cell[BoxData[ RowBox[{ @@ -304,7 +321,7 @@ Cell[BoxData[ 3.941543525003409*^9, 3.9415435486676207`*^9}, {3.94155108160419*^9, 3.941551083792343*^9}, {3.9804213936372538`*^9, 3.980421397635703*^9}, { 3.980422311434009*^9, 3.980422315912444*^9}}, - CellLabel->"In[20]:=",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] + CellLabel->"In[25]:=",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] }, WindowSize->{513, 627}, WindowMargins->{{Automatic, 0}, {Automatic, 0}}, @@ -325,24 +342,24 @@ CellTagsIndex->{} Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 285, 5, 51, "Input",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], -Cell[868, 29, 817, 14, 53, "Output",ExpressionUUID->"0e0ce5db-9968-4678-bade-a56ea533da98"] +Cell[868, 29, 857, 15, 53, "Output",ExpressionUUID->"8d78eaab-22e3-4119-a42b-b47f5e37e07d"] }, Open ]], Cell[CellGroupData[{ -Cell[1722, 48, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], +Cell[1762, 49, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], Cell[CellGroupData[{ -Cell[2066, 57, 766, 15, 23, "Print",ExpressionUUID->"473cff57-8647-4b4c-bf0c-4d5eaa3b6b82"], -Cell[2835, 74, 785, 15, 23, "Print",ExpressionUUID->"f5b098b0-d445-4178-844e-9ad69a9178f4"], -Cell[3623, 91, 780, 15, 30, "Print",ExpressionUUID->"3f9194e7-81e0-4b9d-9d98-51875d993cd6"] +Cell[2106, 58, 802, 15, 23, "Print",ExpressionUUID->"45859d2b-593a-4b74-a7f4-45c0ebe6be10"], +Cell[2911, 75, 801, 15, 23, "Print",ExpressionUUID->"77fe6265-86fc-4eae-9145-6eef491d5f10"], +Cell[3715, 92, 826, 16, 30, "Print",ExpressionUUID->"88d136f7-c2f0-4cec-b6ff-c7d3167da825"] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[4452, 112, 4255, 76, 374, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], -Cell[8710, 190, 2000, 29, 33, "Output",ExpressionUUID->"09638d36-e084-4afc-bc77-821a997aa418"], -Cell[10713, 221, 2089, 34, 80, "Output",ExpressionUUID->"fe74f41e-c333-4ebc-97bc-a1af72f7317e"] +Cell[4590, 114, 4934, 91, 474, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], +Cell[9527, 207, 2047, 29, 33, "Output",ExpressionUUID->"6210aa98-cd31-4f91-898f-decc0e9a4b08"], +Cell[11577, 238, 2144, 34, 80, "Output",ExpressionUUID->"a4cdb2c3-c78d-45cd-a5bd-49c879795f3c"] }, Open ]], -Cell[12817, 258, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], -Cell[12993, 262, 984, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], -Cell[13980, 286, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] +Cell[13736, 275, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], +Cell[13912, 279, 1003, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], +Cell[14918, 303, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] } ] *) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp b/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp index cab67fc7a..dae884eb8 100644 --- a/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp +++ b/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp @@ -31,7 +31,7 @@ symmetricGlobalX = true [solver] mxstep = 10000 -rtol = 1e-6 +rtol = 1e-8 atol = 1e-12 mms = true # Run with MMS sources and output diagnostics mms_initialise = true @@ -47,21 +47,21 @@ Bnorm = 1 Tnorm = 5 [h+] # Ions -type = evolve_density, anomalous_diffusion_3d +type = fixed_density, evolve_pressure, anomalous_diffusion_3d charge = 1.0 AA = 1.0 mms = true +density = 1e19 +anomalous_chi = 1.0 -anomalous_D = 1.0 -anomalous_D_par = 2000 +thermal_conduction = false +use_finite_difference = false -use_finite_difference = true +[Ph+] -[Nh+] +solution = 2.*(20. - 5.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) -solution = 1. - 0.5*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) +source = 0. - 6.959211262992895e-8*((-31.41592653589794*cos(31.41592653589794*(-0.4 + xl))*cos(0.5 - yl)*sin(0.1 - 4*zl))/xl + 986.9604401089366*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (16.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(xl,2)) -source = (-0.000020877633788978686*(1.3333333333333333*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl) + 1.3888888888888888*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))/(1 + 0.1111111111111111*power(xl,2)) - 1.0438816894489344e-8*((-15.70796326794897*cos(31.41592653589794*(-0.4 + xl))*cos(0.5 - yl)*sin(0.1 - 4*zl))/xl + 493.4802200544682*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (8.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(xl,2)) - -bndry_all = dirichlet_o2(`Nh+:solution`) +bndry_all = dirichlet_o2(`Ph+:solution`) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/runtest b/tests/integrated/3D-Axial-circular-conduction-fci/runtest index cae56249c..69afcbc8a 100755 --- a/tests/integrated/3D-Axial-circular-conduction-fci/runtest +++ b/tests/integrated/3D-Axial-circular-conduction-fci/runtest @@ -40,11 +40,11 @@ def gridname(nx): #nxlist = [36, 68, 132, 260] #, 640, 1280, 2560, 5120] nxlist = [16,32] nout = 10 -timestep = 1e5 / nout +timestep = 1e6 / nout nproc = 1 -varnames = ["Nh+"] +varnames = ["Ph+"] results = {} for var in varnames: From b4e3aefe2f7c7ce9040671976f532a46ca530bad Mon Sep 17 00:00:00 2001 From: totork Date: Sat, 21 Mar 2026 02:03:21 +0100 Subject: [PATCH 16/21] Add proper heat conduction to test --- .../3D-Axial-circular-conduction-fci/axial.m | 20 ++- .../axial_notebook.nb | 142 +++++++++--------- .../data/BOUT.inp | 45 +++++- .../3D-Axial-circular-conduction-fci/runtest | 2 +- 4 files changed, 132 insertions(+), 77 deletions(-) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/axial.m b/tests/integrated/3D-Axial-circular-conduction-fci/axial.m index c42f042eb..ba329ac96 100644 --- a/tests/integrated/3D-Axial-circular-conduction-fci/axial.m +++ b/tests/integrated/3D-Axial-circular-conduction-fci/axial.m @@ -39,6 +39,8 @@ xn[x_] = (x-xmin)/(xmax-xmin); + +divparkgradparb[f_,h_, x_, z_, y_, t_]=pgrad[]; d2dpar2[f_, x_, z_, y_, t_] = (D[D[f[x, z, y, t], y], y] + 2/q[x]*D[D[f[x, z, y, t], y], z] + 1/q[x]^2*D[D[f[x, z, y, t], z], z])/absb[x]^2; @@ -56,9 +58,25 @@ e0 = 8.85418781*^-12 Omegaci = qe * Bnorm / (1836.0*Me) +logN[x_, z_, y_, t_]=Log[MmsN[x,z,y,t]*Nnorm]; +logT[x_, z_, y_, t_]=Log[MmsT[x,z,y,t]*Tnorm]; + +coulog[x_, z_, y_, t_]=30.4 - 0.5*logN[x,z,y,t]+(5.0/4.0)*logT[x,z,y,t]-Sqrt[1.0/(10^5)+(1.0/16.0)*(logT[x,z,y,t]-2.0)^2]; +vsq[x_, z_, y_, t_] = 2.0 * MmsT[x,z,y,t]*Tnorm * qe / Me; + +nu[x_, z_, y_, t_] = ((qe^4)*MmsN[x, z, y, t]*Nnorm * coulog[x, z, y, t] * 2.0 /(3.0 *((Pi*2.0*vsq[x,z,y,t])^1.5)*((e0*Me)^2)))/Omegaci; + +tau[x_, z_, y_, t_] = 1.0 / nu[x,z,y,t]; + +kappa[x_, z_, y_, t_] = (3.16/Sqrt[2.0])*MmsP[x,z,y,t]*tau[x,z,y,t]/AA; + +qpar[x_, z_, y_, t_]=kappa[x,z,y,t]*pgrad[MmsT,x,z,y,t]; +divqpar[x_, z_, y_, t_]=pgrad[qpar,x,z,y,t]; + Smms[x_, z_, y_, t_]=D[MmsP[x,z,y,t],t]-(2.0 / 3.0) * Chiperp/(rhos*rhos*Omegaci) * MmsN[x,z,y,t] * LaplacePerp[MmsT,x,z,y,t] * (rhos*rhos)- - Chipar/(rhos*rhos*Omegaci)*d2dpar2[MmsP,x,z,y,t]* (rhos*rhos); + Chipar/(rhos*rhos*Omegaci)*d2dpar2[MmsP,x,z,y,t]* (rhos*rhos)- + (2.0/3.0)*divqpar[x,z,y,t]*(rhos*rhos); Print["Finished MMS Terms"]; diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb b/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb index 92d2c03cb..76a5be243 100644 --- a/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb +++ b/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb @@ -10,10 +10,10 @@ NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] -NotebookDataLength[ 17281, 358] -NotebookOptionsPosition[ 15774, 325] -NotebookOutlinePosition[ 16161, 341] -CellTagsIndexPosition[ 16118, 338] +NotebookDataLength[ 17555, 364] +NotebookOptionsPosition[ 16048, 331] +NotebookOutlinePosition[ 16435, 347] +CellTagsIndexPosition[ 16392, 344] WindowFrame->Normal*) (* Beginning of Notebook Content *) @@ -30,19 +30,19 @@ Cell[BoxData[ Cell[BoxData["\<\"/viper/u1/toto/soft/hermes-3/build/tests/integrated/3D-\ Axial-circular-conduction-fci\"\>"], "Output", CellChangeTimes->CompressedData[" -1:eJwVy01ImgEcx3Hr4EzcUIuVqdFWlO2wGCQ8CGsY0SFWbFGxIHtjsVXQy6TC -DhUbvVBSMygwiGDDldPKsKKCXuhd1yp6OdTsBWIeqkeiwIxc7Pc/fPmcvk+K -KjKKAzgcTjLaEA4f8DSs+lpUEBkEq9z5Rj5MXdleI387XJ+EMHc2zUqKVrbi -RLAuPPCrGM41xFjIj+WGpRA4pXyVGQp7lF805Fset0sCT+u746RQwf/HkNsp -/QoZPNJGpZHWDxcGMjV/PUEOCz2qZvIBX9sZAd/ohJUa+H5dV0s2j66a8+C5 -hZEWwI2JIi15cXLnIDe/rUkK4dZQeDzZX6N6SZZdZ8+Tl7boezLstvXHPuTJ -uydImVnpIOXT1SYXzGo6XSY93/l/SD0z4CbT2V+hh/BnjM1+BGsY1/gxHOsr -TjmBLbede3/hlamE64bvBit95NWZq1eQx6oFq0ELpF6drhIM4rfLWFKoaYx9 -CDMkzzPJrjK7kezQfX7xCHoOBhrEsFb8bJb0tXDbgqFe7jSSOaUzZtLnlzpJ -f4/ttcnKqpN2DMdkyFPvGdmuKPGOwF19e7ANTo4uZpGN+48XvdDZlMjcwP8F -2xY3 +1:eJwVy01IkwEAxvHVYc21YpuSzm3RFzY7FEGDl0HF28FAVEw0DJpfJGVCWUNl +HVIMNXJkGyksCKFYupy1MZMKsshSt/zC8qAtFUY7mO8IhTXRouc5/Pmd/vur +rhdVb5PJZGfRlPrFgsIqieuain0p8Eas3K2EuaOz43QyFLmphheH831UMzqT +rYG3Mrc/0ML3TVn99Mo156c0+MZ8ujgddpvvWOk5hdylg9HbXdl6aFL+Fehs +To/JABdtB/Op7/Kqk+aWT5wwwsq4pY3uUNo698JCu7rOCi9N2BtpW2DMWwZ/ +9Qv6Cjg1VGWjq8ubITr9ZFxXCWcGMo/RngbLSVq7fv4D/e0/9I9mbNx9Ng8V +xq4havCaQ9T4tt4TgSWt0c80/lT5nTqE3hgtkL6k/4DPs/zBRdggRF4twcHH +1TnLsH2jc+4nXPPUyGOwtK8uSddWIo9UZZKoGkv5SB1igUXVhz9okKja2nx4 +FyzSHS2mrtqgm963txzfDeMLvU1a2Kg9MkyT7fJ7qdBhDLvphavvvDS5pQ/T +rW5/nscniWe+Opdo2oHECu0w1SRewm+OjlQ/fB0YKaHN83tGEjDcekr4Ax/u +jLtUA5LYEi0M0M280jn6H76tIug= "], - CellLabel->"Out[1]=",ExpressionUUID->"8d78eaab-22e3-4119-a42b-b47f5e37e07d"] + CellLabel->"Out[1]=",ExpressionUUID->"6a0edd36-9522-4c15-a915-aae89762bb3d"] }, Open ]], Cell[CellGroupData[{ @@ -58,55 +58,58 @@ Cell[CellGroupData[{ Cell[BoxData["\<\"Computing MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzE1IkwEcx/ElOW24Tae5TN3wBdIdNCLDxpw+HpwIAxGRFLcyiaBVSoti -sMNaQ+cmmDsMVNghnI7pnAdXhjhkhdYTeBCVRNvE12I8QR5WuJT+v8OXz+1b -dL+n5cEFHo9XT42kXBoT6Djm4r6Nhcr2DWMm6TooDUCe6KEii9xNHXojIbkp -+xQ098Y/5cCDyVYp2VCRoocdx49deeQzZ7I8n2Qtnbeh8auwvIAsE73VwtN+ -xgVTo/KqQrJ2w90H0+U/h2Tk/GtTr45cNSRewtzxF349eW3VnX+P7PHMGmFO -wsDC5+PXr3aRSclKJay7M1EDTwZmlqC1yXcO1z2qyS1yzR56Dz1Vi19ghD30 -7pAfbgWXYWbawjZ81Kw+hvH1yivfSZndMRclBSW+dzHy7lmNZhffV6Wbh6Tj -xxH/iNzcT/6FjaHQWIaeY4qNexHYWD2vzPBxTKdqhIM6Pb9MSFqeBFqh1nZz -FP5LF98QkcqsAouEtJrDYfhUYHZkkyJ59ygcPG3zQ2fzMAsDUbHWO80xS9Jv -Mag+08ThZTGbCJK/cn9nz5LOFkUbNFsNHxNk+LOp+g/5HxDmCbk= +1:eJwVzFtIUwEcx/GjqOmYm85raY5SSH1IEQ0bap4HLwSDISIm7mRGCM4bLhRh +D2uJzi2wJogXmBCaQ1tTcKVIQ0y8nMAHcVJoU7zLOIE9rHAq/X8PXz5v3zu1 +zWUvAhiGKaIGA8OGRWqBDTro5KHiiVsbQVoOU+yQkdSlR5J7wb1vZaQwaZyE +uhbvUjQ8HC+PI4vvB3Kw6qTBcpNsNfvTEkheX/0Qar+HpyWSqZL3SnjRzVpg +sEeec5t85O7vgqHys94kcvZ1R4uaXNf42mHsaNsER95b70+oIZutU1oY7dPw +8OVo5q1npF+2kgELKz/kwz89nxag4bHtGm5a88Z/khtG5xdozfm6Bhf5o7Ed +cu6BYxlG3JjfhvWqghPo3cyI/0UmGU0zHlKUbPu8Sz69yi/Zw/dVytYRaTo9 +Djkmtw78/2Cp0zks5gT2rnZ/EZbmzirENoGtzhsUoJoLSQ0n9Y32cqjszB6C +l6HSLAmpiEzUy0iDzuWCTSKdKYqUyJ8PwTcXFRPQrHrHQ7tHqhz7KLALcT92 +YcFViRfGSHmfg/wdex41RZrL0iugzqD55iNdqx25f8lVTtUntgtsT83INGQG +HG74H5XaFc8= "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"45859d2b-593a-4b74-a7f4-45c0ebe6be10"], +In[2]:=",ExpressionUUID->"398a195f-6aad-41a7-b629-263d5a0f4b70"], Cell[BoxData["\<\"Finished MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzEFIkwEchvElajp0m9Nm6XJUQnOHlHBhY9O+DjmCgYiMCreyiKCVShND -2mEtqbkJ1g6CDnYIl0Ob8+BqIsmwUPqCHWKTopqjuS0ZX1CHFVsL/+/h4Xd7 -jl0f6r15gMfjnadmSirdfAPHlCbHWai6HDOLSNdusx/yBLcUNWSibOqpmOQW -7YvQMpx9Vwd35/vqyQunSozwSuaO6wh5z1loaSRZa/9ZaP5Q3SIl5YLnOph/ -wrhgWVymPEp2xaYfwwrZ3lQTGXo0NmwgI6bcfSiZG10wkicj043XyCHPshnW -5UwsHJlraxggC+KtVnju0gsN/D2xFIa2i77/MOpRz38mP9qDr6FH+eY93GBT -3q/k6pnAJhQdXPsCb/d0ZmA22nr4G9lkd6zESf4J36sd8mpR053A92Hzdop0 -/EiXp8ntZOEv1AaD7iojxxw3f9+A2o6QqsrHMf3qGQ4ajOXyatJ6198HdePt -s/BfhfC0gFTVSK1i0mZZX4eDfIujlhTIbszCybx+ATp7nrHQHxfqvC85Jlz/ -aQd2Fruz8JCQzQXIn5Jftcuks1ehhxab6W2OTA486PhD7gMPSQl5 +1:eJwVzG8o3AEcx/GjMbvOHYdj8+cayp8HIyEu/34PjFZXlyST+2FaamfILUvd +g3PEuVvhlELdSsyFw9Vus9Yu2Rp+yoPlZNmO5n/XT/HgttzI9/Pg3evZ++Gz +1ornAQKBoJQaDbw3LlTzzJ2DHg4qnrq1YaTlMNkOBeKm9HByP2hgUErys8ZZ +qGvzfouEh9OV0eTjR4EsrDlpttwn283+tFiS09fmQ+1GaFocmSqeUMKrPsYC +gzzynHiy2D3SC0PkZwMJ5FJ3Z5ua3NT4XkPZZMcMS6ZsjsTWk63WRS2M9Gk4 ++Goy80ED6ZeuZsCS6neF8LJ/fhkanthu4Ja1YPon+cPo/AitOV/W4Qp3NPWL +/JS78B2G3f28C1+oik6gdysj5jeZYDS995DCJNuHPbLuurBsH9+u5O0j0nR6 +HHxMbh/4/8Fyp3NcxPJMovbPCizPW1KIbDxTWzDKQzUbnBpK6l/aK6GyJ3sM +/g+RZIlJRXicXkoadC4XbBHqTBGkWN44Bt9cVc1As2qIg3aPRDk1xzPL0Tt7 +sOi6zAujJJxvgTyXXUQskuaK9CqoM2i++kjXWmfeX3KNVQ2L7DzTX//WAWXN +Dje8BZViFbs= "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"77fe6265-86fc-4eae-9145-6eef491d5f10"], +In[2]:=",ExpressionUUID->"37bf1239-886f-4dee-8279-2e82ec73ea63"], Cell[BoxData[ RowBox[{"9.579629665962438`*^7", " ", "Bnorm"}]], "Print", CellChangeTimes->CompressedData[" -1:eJxTTMoPSmVkYGBwAuKZTJyzuWLfOrI8bjkFoq0irxYLAOlJT1TWgmgGvnQt -QSD9gLV/ghCQfru6YzWIril4fUQERD9ZHiIOpN30mOJAdNTznEmSQLqo+7em -NJA+1RBjCaKLT/NqygBpDb5FviD6V7vjJBDNek/eVBZI21+d1gaiOeRf9ssB -6R3NlQWxQPpc9rdyEC22pGxVHJBWPzdNOgFI58/bUAyiRb5lnwLRJUsMpBKB -9G+h4/og2iFimS2I/tS57gCIbvJa8Q9EX5lns/wmkL7UsXU7iJ5nuvckiD50 -6unSO0B6p9n6YyBagH33bRCdFWD3HES/vqIvcRdIy3V0bbkHpLmUV2y7D6Tj -/9q6PwCZ26hy7SmQ7nrxjO0ZkL72+PcPEO2xdetsnri3jkrFjw6BaA+LHVY8 -K946xtjMfAuiY+PYNHiBdEPu2hAQ7dtiMgtE/+HgN+ID0laCMg1CQLqpZt8+ -EJ3HVdMlDKT55JNngeieX2GrQHR3wMRTIHrtPX7fpWveOh4Qv3EfRNv9dX8N -okX5T31bD6TfiX0U3gCku4O0wkB0TVP24W9A+teRWovvQBoAEsIJ9Q== +1:eJwVzFtIUwEcx/EpajrmptO85GWkgs4HjdDQoeZ5KEUYDJGR4Y43QmiV4sQQ +9rCW1NwEc4GgwgLxMtR5AZdKOESl9Ag+iJNEm+I1GSewhxkuxf/v4cvn7Xu/ +rrH8RYBAIHhC9QaG9Qs1PBN01M5BRaVbF0Faj9McUCBuyIwkD4K7PklJfsw0 +BvVN3pVoeDxSEUs+zQpk4fOzV9Z4stnilyeQnKEqH+rWw+WJZIZ4QAmvPjJW +GOyR5SaRj909H2Co7LwrmZx739akITe0vrcwZrB1lCXTN3oSashG25QORvu0 +HGwZfHCvlvRLf2TD4mfDhfBvx8QiNJbZb+CWrWBkh9w0OWehLXdhDS5xJ0N7 +5Pyjye8w4s63XfhSVXQGvVvZcb/IZJN5xkMKU+1f98nq68KSA3zfpW2fkObf +pyGn5PaR/x8sdTr7RSzPpOgOl2Bp3pxCZOeZqoJeHmrYkIxw0vDaUQGV7Tl9 +8H+o5KGYVEQmGqSkUe9ywTdCvTmKFMvq+2DnlXoUWlTdHHR4JMqhcZ5ZjP25 +D4uuS7zwroTzTZJ/Yi6ipkhLeaYa6o3aZR/pWm3LuyRXWdVnkYNnOmq+TEO1 +fMYNbwGVnxW7 "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"88d136f7-c2f0-4cec-b6ff-c7d3167da825"] +In[2]:=",ExpressionUUID->"f0557e62-7f3b-45eb-9b06-93eb4fb5567c"] }, Open ]] }, Open ]], @@ -131,7 +134,7 @@ Cell[BoxData[{ RowBox[{ RowBox[{"omega", "=", "0.1"}], ";"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"Tamp", "=", "5.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{"Tamp", "=", "0.1"}], ";"}], "\[IndentingNewLine]", RowBox[{"phz", " ", "=", " ", "0.1"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"phy", " ", "=", "0.5"}], ";"}], "\[IndentingNewLine]", @@ -142,7 +145,7 @@ Cell[BoxData[{ RowBox[{ RowBox[{"xmax", "=", "0.6"}], ";"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"T0", " ", "=", " ", "20.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{"T0", " ", "=", " ", "5.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"N0", " ", "=", " ", RowBox[{"10", "^", "19"}]}], ";"}], "\[IndentingNewLine]", @@ -202,7 +205,8 @@ Cell[BoxData[{ 3.9828527440353117`*^9, 3.9828527456692553`*^9}, {3.9829961854197617`*^9, 3.982996259211157*^9}, {3.982996290397106*^9, 3.98299631633951*^9}, { 3.982996835891934*^9, 3.982996849912133*^9}, 3.982996879955332*^9, { - 3.982997208861528*^9, 3.982997216510427*^9}}, + 3.982997208861528*^9, 3.982997216510427*^9}, {3.983042174356776*^9, + 3.9830421802111893`*^9}}, CellLabel->"In[3]:=",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], Cell[BoxData["0.1`"], "Output", @@ -233,11 +237,12 @@ Cell[BoxData["0.1`"], "Output", 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, - 3.9828527873122396`*^9, 3.9829970217485867`*^9, 3.982997958253395*^9}, - CellLabel->"Out[12]=",ExpressionUUID->"6210aa98-cd31-4f91-898f-decc0e9a4b08"], + 3.9828527873122396`*^9, 3.9829970217485867`*^9, 3.982997958253395*^9, + 3.983041693006072*^9, 3.983041935188232*^9, 3.983042223678401*^9}, + CellLabel->"Out[12]=",ExpressionUUID->"bc72b8e8-af13-45dd-ada3-2d3f42471a51"], Cell["\<\ -2.*(20. - 5.*Cos(0.5 - yl)* +2.*(5. - 0.1*Cos(0.5 - yl)* Sin(31.41592653589794*(-0.4 + xl))* Sin(0.1 - 4*zl))\ \>", "Output", @@ -268,9 +273,10 @@ Cell["\<\ 3.980434519150025*^9, 3.9804346457616987`*^9, 3.980434773645422*^9, 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, - 3.9828527873122396`*^9, 3.9829970217485867`*^9, 3.982997958303314*^9}, + 3.9828527873122396`*^9, 3.9829970217485867`*^9, 3.982997958253395*^9, + 3.983041693006072*^9, 3.983041935188232*^9, 3.983042223735612*^9}, CellLabel-> - "Out[22]//CForm=",ExpressionUUID->"a4cdb2c3-c78d-45cd-a5bd-49c879795f3c"] + "Out[22]//CForm=",ExpressionUUID->"076e3f53-3be9-40ca-b5d3-084eb480cf64"] }, Open ]], Cell[BoxData[""], "Input", @@ -342,24 +348,24 @@ CellTagsIndex->{} Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 285, 5, 51, "Input",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], -Cell[868, 29, 857, 15, 53, "Output",ExpressionUUID->"8d78eaab-22e3-4119-a42b-b47f5e37e07d"] +Cell[868, 29, 881, 15, 53, "Output",ExpressionUUID->"6a0edd36-9522-4c15-a915-aae89762bb3d"] }, Open ]], Cell[CellGroupData[{ -Cell[1762, 49, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], +Cell[1786, 49, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], Cell[CellGroupData[{ -Cell[2106, 58, 802, 15, 23, "Print",ExpressionUUID->"45859d2b-593a-4b74-a7f4-45c0ebe6be10"], -Cell[2911, 75, 801, 15, 23, "Print",ExpressionUUID->"77fe6265-86fc-4eae-9145-6eef491d5f10"], -Cell[3715, 92, 826, 16, 30, "Print",ExpressionUUID->"88d136f7-c2f0-4cec-b6ff-c7d3167da825"] +Cell[2130, 58, 823, 16, 23, "Print",ExpressionUUID->"398a195f-6aad-41a7-b629-263d5a0f4b70"], +Cell[2956, 76, 822, 16, 23, "Print",ExpressionUUID->"37bf1239-886f-4dee-8279-2e82ec73ea63"], +Cell[3781, 94, 843, 17, 30, "Print",ExpressionUUID->"f0557e62-7f3b-45eb-9b06-93eb4fb5567c"] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[4590, 114, 4934, 91, 474, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], -Cell[9527, 207, 2047, 29, 33, "Output",ExpressionUUID->"6210aa98-cd31-4f91-898f-decc0e9a4b08"], -Cell[11577, 238, 2144, 34, 80, "Output",ExpressionUUID->"a4cdb2c3-c78d-45cd-a5bd-49c879795f3c"] +Cell[4673, 117, 4985, 92, 474, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], +Cell[9661, 211, 2117, 30, 33, "Output",ExpressionUUID->"bc72b8e8-af13-45dd-ada3-2d3f42471a51"], +Cell[11781, 243, 2214, 35, 80, "Output",ExpressionUUID->"076e3f53-3be9-40ca-b5d3-084eb480cf64"] }, Open ]], -Cell[13736, 275, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], -Cell[13912, 279, 1003, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], -Cell[14918, 303, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] +Cell[14010, 281, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], +Cell[14186, 285, 1003, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], +Cell[15192, 309, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] } ] *) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp b/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp index dae884eb8..8092e8447 100644 --- a/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp +++ b/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp @@ -31,15 +31,15 @@ symmetricGlobalX = true [solver] mxstep = 10000 -rtol = 1e-8 -atol = 1e-12 +rtol = 1e-5 +atol = 1e-8 mms = true # Run with MMS sources and output diagnostics mms_initialise = true type = cvode [hermes] -components = h+ +components = h+,collisions Nnorm = 1e18 @@ -55,13 +55,44 @@ mms = true density = 1e19 anomalous_chi = 1.0 -thermal_conduction = false +thermal_conduction = true use_finite_difference = false [Ph+] -solution = 2.*(20. - 5.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) - -source = 0. - 6.959211262992895e-8*((-31.41592653589794*cos(31.41592653589794*(-0.4 + xl))*cos(0.5 - yl)*sin(0.1 - 4*zl))/xl + 986.9604401089366*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (16.*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(xl,2)) +solution = 2.*(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) + +source = 0. - 6.959211262992895e-8*((-0.6283185307179587*cos(31.41592653589794*(-0.4 + xl))*cos(0.5 - yl)*sin(0.1 - 4*zl))/xl + 19.73920880217873*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (0.32000000000000006*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(x +l,2)) - (3.479894918169595e-8*((20.83160976589444*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5)*(0.02666666666 +666667*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl) + 0.020000000000000004*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0 +.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592 +653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))) - (5.207902441473 +61*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),1 +.5)*(0.02666666666666667*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794*(-0.4 + xl))*s +in(0.5 - yl)*sin(0.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 +- yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))) + - (20.83160976589444*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5)*(0.02666666666666667*cos(0.5 - yl)*cos(0.1 + - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl))*((-0.125*sin(31. +41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl))/(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) + (0.00625*(-2 +. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)) +/(sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2))*(5. - 0.1*cos(0.5 - yl)*sin(31 +.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))))/(sqrt(1 + 0.1111111111111111*power(xl,2))*power(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. ++ log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + +xl))*sin(0.1 - 4*zl)),2)) + 0.3333333333333333*((20.83160976589444*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2. +5)*(0.08000000000000002*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl) + 0.10666666666666667*cos(0.5 - yl)*sin(31.41592653589794*(- +0.4 + xl))*sin(0.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - +yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))) + + (20.83160976589444*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))* +sin(0.1 - 4*zl),1.5)*(0.02666666666666667*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.415926535897 +94*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log( +5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*s +in(0.1 - 4*zl)))) - (20.83160976589444*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5)*(0.02666666666666667*cos( +0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)) +*((0.5*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)))/(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) +- (0.025*cos(0.5 - yl)*cos(0.1 - 4*zl)*(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))*sin(31.41592653589794*( +-0.4 + xl)))/(sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2))*(5. - 0.1*cos(0.5 +- yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))))/(sqrt(1 + 0.1111111111111111*power(xl,2))*power(8.525441616556563 - sqrt(0.00001 + 0.062 +5*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589 +794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)))))/sqrt(1 + 0.1111111111111111*power(xl,2)) bndry_all = dirichlet_o2(`Ph+:solution`) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/runtest b/tests/integrated/3D-Axial-circular-conduction-fci/runtest index 69afcbc8a..04d160a86 100755 --- a/tests/integrated/3D-Axial-circular-conduction-fci/runtest +++ b/tests/integrated/3D-Axial-circular-conduction-fci/runtest @@ -40,7 +40,7 @@ def gridname(nx): #nxlist = [36, 68, 132, 260] #, 640, 1280, 2560, 5120] nxlist = [16,32] nout = 10 -timestep = 1e6 / nout +timestep = 1e4 / nout nproc = 1 From 36ebb4d54b66ca3bc84d16912b941bf1d05e5972 Mon Sep 17 00:00:00 2001 From: totork Date: Sat, 21 Mar 2026 02:42:22 +0100 Subject: [PATCH 17/21] Corret mass in MMS test --- .../axial_notebook.nb | 145 +++++++++--------- .../data/BOUT.inp | 85 +++++----- .../3D-Axial-circular-conduction-fci/runtest | 2 +- 3 files changed, 118 insertions(+), 114 deletions(-) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb b/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb index 76a5be243..7e4519755 100644 --- a/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb +++ b/tests/integrated/3D-Axial-circular-conduction-fci/axial_notebook.nb @@ -10,10 +10,10 @@ NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] -NotebookDataLength[ 17555, 364] -NotebookOptionsPosition[ 16048, 331] -NotebookOutlinePosition[ 16435, 347] -CellTagsIndexPosition[ 16392, 344] +NotebookDataLength[ 17715, 367] +NotebookOptionsPosition[ 16208, 334] +NotebookOutlinePosition[ 16595, 350] +CellTagsIndexPosition[ 16552, 347] WindowFrame->Normal*) (* Beginning of Notebook Content *) @@ -30,19 +30,19 @@ Cell[BoxData[ Cell[BoxData["\<\"/viper/u1/toto/soft/hermes-3/build/tests/integrated/3D-\ Axial-circular-conduction-fci\"\>"], "Output", CellChangeTimes->CompressedData[" -1:eJwVy01IkwEAxvHVYc21YpuSzm3RFzY7FEGDl0HF28FAVEw0DJpfJGVCWUNl -HVIMNXJkGyksCKFYupy1MZMKsshSt/zC8qAtFUY7mO8IhTXRouc5/Pmd/vur -rhdVb5PJZGfRlPrFgsIqieuain0p8Eas3K2EuaOz43QyFLmphheH831UMzqT -rYG3Mrc/0ML3TVn99Mo156c0+MZ8ujgddpvvWOk5hdylg9HbXdl6aFL+Fehs -To/JABdtB/Op7/Kqk+aWT5wwwsq4pY3uUNo698JCu7rOCi9N2BtpW2DMWwZ/ -9Qv6Cjg1VGWjq8ubITr9ZFxXCWcGMo/RngbLSVq7fv4D/e0/9I9mbNx9Ng8V -xq4havCaQ9T4tt4TgSWt0c80/lT5nTqE3hgtkL6k/4DPs/zBRdggRF4twcHH -1TnLsH2jc+4nXPPUyGOwtK8uSddWIo9UZZKoGkv5SB1igUXVhz9okKja2nx4 -FyzSHS2mrtqgm963txzfDeMLvU1a2Kg9MkyT7fJ7qdBhDLvphavvvDS5pQ/T -rW5/nscniWe+Opdo2oHECu0w1SRewm+OjlQ/fB0YKaHN83tGEjDcekr4Ax/u -jLtUA5LYEi0M0M280jn6H76tIug= +1:eJwVy01IkwEAxvHVYc21ZJuSzW3RFzY7JEGDMah4O0iIiomGQfOLpFQoa6Ss +Q4qiRo5sI4UFYRRLl7M2ZlJBFlnqlpmYO2hLhdEO5jtCYU206HkOf36n//7q +q8U12yQSyRk0rXy+ILOIwrqqcl8KvBarcMlh3vjsJP0SjFxXwgujBV6qGp/J +VsGbmdvvqeG75qxBevmK42M6fG08VZIBe41tFnpWJnVqYPRWT7YWGuR/TXQ2 +t8+gg4vWgwXUe2nVQfMqpo7rYVXc3EF3yK3de2GRTdlggRenbE20wz/hKYe/ +Bk3aSjg9Um2lq8ubQfr18aSmCs4MZebQvkbzCVq/fu49/e079I/u2bj9dB7K +9D0jVOcxBqn+zQ13BJa2Rz/R+BP5d2o39cdoofg54wd8luULLMJGU+TlEhx+ +WJO7DDs3usM/4Zq7VhqDZQMNSbq2EnmgKBcFxUTKB2oXCs2KAfwBnUiVlpbD +u2Cx5mgJddYHXPSurfVYKowv9DerYZP6yChNdkrvpEG7PuSi5+veemhySxui +W72+fLdXFE5/cyzR9AOJFdplqE28gHP2rjQffOUfK6Ut87vHEjDUftL0B97f +GXcqhkShNVrkp5v5ZWH6KFzXlgr/A+x4JzQ= "], - CellLabel->"Out[1]=",ExpressionUUID->"6a0edd36-9522-4c15-a915-aae89762bb3d"] + CellLabel->"Out[1]=",ExpressionUUID->"27a5f241-d41f-49cc-8b6a-b8b248eb2116"] }, Open ]], Cell[CellGroupData[{ @@ -58,58 +58,58 @@ Cell[CellGroupData[{ Cell[BoxData["\<\"Computing MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzFtIUwEcx/GjqOmYm85raY5SSH1IEQ0bap4HLwSDISIm7mRGCM4bLhRh -D2uJzi2wJogXmBCaQ1tTcKVIQ0y8nMAHcVJoU7zLOIE9rHAq/X8PXz5v3zu1 -zWUvAhiGKaIGA8OGRWqBDTro5KHiiVsbQVoOU+yQkdSlR5J7wb1vZaQwaZyE -uhbvUjQ8HC+PI4vvB3Kw6qTBcpNsNfvTEkheX/0Qar+HpyWSqZL3SnjRzVpg -sEeec5t85O7vgqHys94kcvZ1R4uaXNf42mHsaNsER95b70+oIZutU1oY7dPw -8OVo5q1npF+2kgELKz/kwz89nxag4bHtGm5a88Z/khtG5xdozfm6Bhf5o7Ed -cu6BYxlG3JjfhvWqghPo3cyI/0UmGU0zHlKUbPu8Sz69yi/Zw/dVytYRaTo9 -Djkmtw78/2Cp0zks5gT2rnZ/EZbmzirENoGtzhsUoJoLSQ0n9Y32cqjszB6C -l6HSLAmpiEzUy0iDzuWCTSKdKYqUyJ8PwTcXFRPQrHrHQ7tHqhz7KLALcT92 -YcFViRfGSHmfg/wdex41RZrL0iugzqD55iNdqx25f8lVTtUntgtsT83INGQG -HG74H5XaFc8= +1:eJwVzFtIUwEcx/GTqOmYZzpvlebIhJwPKpGhQ83zoiIMhoikuKMVITRNcWEI +e1hTam6BNUG8wITwMtQ5haZGNIaK2Ql8CCdJOsVrMY5gDzNcRv/fw5fP2/fG +w5bKx5cYhimlBsKihyRakQvf7xKgqsanjyVtBxlOyLCNWXHkbkTPGzkpTpon +oaE1sJwAD8arksnS7DAe1h432a6SbdaQMoUUjHUFUP81RplKZrLv1PD8FWeD +EX5F3nXynq/vJYxS/OpJIxc6O1q15Jou+BwmjbRP8OSttb6UBrLFPqOHCUGd +AJ+N5F57QIbkn3Ngyf2xIvi7e9oLTRWOf3DdXji+SX4zu+ehPe/TF7goHI5u +kR/uulZg7OWPP+ATTfExDKznXNkm08yW935SctMxt0PWXxSV7eL7ImPjkLT8 +PIo8Ijf2Q39guds9JOVFLl2/twjL8xdUUofI1RUOiFDLR2bGkMZmZxVUd90Z +hH+jZLdZUhWXapSTJoPHA59KDJZ4klU8GoSvz6snoFXzVoBOv0w9OiVy3uTv +O7D4oiwAE2VC0EWeJJ3Gz5DWyqxqaDDploKkZ7Uj/4xc5TW9UqfIdTcMz0Km +3+WDc0pvJ0v+B1jNGds= "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"398a195f-6aad-41a7-b629-263d5a0f4b70"], +In[2]:=",ExpressionUUID->"ee153324-c97e-4280-bed4-3e2c1ef6ccca"], Cell[BoxData["\<\"Finished MMS Terms\"\>"], "Print", CellChangeTimes->CompressedData[" -1:eJwVzG8o3AEcx/GjMbvOHYdj8+cayp8HIyEu/34PjFZXlyST+2FaamfILUvd -g3PEuVvhlELdSsyFw9Vus9Yu2Rp+yoPlZNmO5n/XT/HgttzI9/Pg3evZ++Gz -1ornAQKBoJQaDbw3LlTzzJ2DHg4qnrq1YaTlMNkOBeKm9HByP2hgUErys8ZZ -qGvzfouEh9OV0eTjR4EsrDlpttwn283+tFiS09fmQ+1GaFocmSqeUMKrPsYC -gzzynHiy2D3SC0PkZwMJ5FJ3Z5ua3NT4XkPZZMcMS6ZsjsTWk63WRS2M9Gk4 -+Goy80ED6ZeuZsCS6neF8LJ/fhkanthu4Ja1YPon+cPo/AitOV/W4Qp3NPWL -/JS78B2G3f28C1+oik6gdysj5jeZYDS995DCJNuHPbLuurBsH9+u5O0j0nR6 -HHxMbh/4/8Fyp3NcxPJMovbPCizPW1KIbDxTWzDKQzUbnBpK6l/aK6GyJ3sM -/g+RZIlJRXicXkoadC4XbBHqTBGkWN44Bt9cVc1As2qIg3aPRDk1xzPL0Tt7 -sOi6zAujJJxvgTyXXUQskuaK9CqoM2i++kjXWmfeX3KNVQ2L7DzTX//WAWXN -Dje8BZViFbs= +1:eJwVzF1IUwEchvGTpK0xz3TazI8cpZB6kREaNtQ8NyrBYMiQCneyJAJXKU0M +YRdrSu1D0CZIKiwIzaGtKbQypGEWZSfwQtwo1Cn5sWScIC9OsmX0fy8efnfP +yRttDTcPMQxTSw0lHR2RG0Xu8GaPALVXQuY00r1V6IMMe6skndxI7utXkeKk +fRJa2mMfM+HWuCGLrD2TxMOr0dvubPKeK1GcSwrWpgvQ/DW1OI8sYp/pYPwR +54bJEU35CfJiaPAhlGl2+/LJme6udiO5aJLuQ/Vo5wRPnl4czG0m2zxTZpgp +mQTYMXo25zqZUH0uhTWXn1fBPcfLOWi75P0Hlz2V49/JJXvgDfSUv/sC54Xt +sVXy7Xn/J5h2ZHYFtuqrozC2XHp8jcy3O19FSHmB9/U6ee2gqm4D3weF4W3S ++XMnZYcMbyb2YX0gMKLgRe6U+cc8rK+Y0Sq8ItdUOSRCI59SlEpa7/gMUNdT +Ngz/ypTnWFKbnmdVkTZLMAjvyi3ODJLVtAzD3njjBHTpHwvQF1Hqxl6I3FzW +t3VYfVAXg8eUguQnf6l/Z0yRroaSRmixmT5IZHChq+IPucDrBxQ+kXM0P52G +zBN/CBqk990s+R9bXhpH "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"37bf1239-886f-4dee-8279-2e82ec73ea63"], +In[2]:=",ExpressionUUID->"fae6fdea-629c-4f55-b870-4501123a3e0b"], Cell[BoxData[ RowBox[{"9.579629665962438`*^7", " ", "Bnorm"}]], "Print", CellChangeTimes->CompressedData[" -1:eJwVzFtIUwEcx/EpajrmptO85GWkgs4HjdDQoeZ5KEUYDJGR4Y43QmiV4sQQ -9rCW1NwEc4GgwgLxMtR5AZdKOESl9Ag+iJNEm+I1GSewhxkuxf/v4cvn7Xu/ -rrH8RYBAIHhC9QaG9Qs1PBN01M5BRaVbF0Faj9McUCBuyIwkD4K7PklJfsw0 -BvVN3pVoeDxSEUs+zQpk4fOzV9Z4stnilyeQnKEqH+rWw+WJZIZ4QAmvPjJW -GOyR5SaRj909H2Co7LwrmZx739akITe0vrcwZrB1lCXTN3oSashG25QORvu0 -HGwZfHCvlvRLf2TD4mfDhfBvx8QiNJbZb+CWrWBkh9w0OWehLXdhDS5xJ0N7 -5Pyjye8w4s63XfhSVXQGvVvZcb/IZJN5xkMKU+1f98nq68KSA3zfpW2fkObf -pyGn5PaR/x8sdTr7RSzPpOgOl2Bp3pxCZOeZqoJeHmrYkIxw0vDaUQGV7Tl9 -8H+o5KGYVEQmGqSkUe9ywTdCvTmKFMvq+2DnlXoUWlTdHHR4JMqhcZ5ZjP25 -D4uuS7zwroTzTZJ/Yi6ipkhLeaYa6o3aZR/pWm3LuyRXWdVnkYNnOmq+TEO1 -fMYNbwGVnxW7 +1:eJwVzF1IUwEchvGjpM0xz3SampqjEvy40BAVG2qdG5VgMETExB2tCKFZigtF +2MWcUnMT1AWSCgtCc2lrE1oa0RAVsxN4EU4MdUp+JeMIdbHCqfh/Lx5+d8/V ++82VD8MYhimjhsKjRqRakbuw0y1A1V2fPoa07aY7IcM2ZseS2xF9/QpSnDRP +QkNLYCEe7o5XJZJlOeE8rD1osl0mW62hrBRSMNbdhPrv0VmpZCb7Wg2Pn3M2 +GOFXFlwhb/kGn0GJ8rAvjZzp6mjRksu6YDtMGG2b4MmM5cGUBrLZ7tbD+KBO +gE9HbyTfI0OKr7nwds2bEvi35/0sNN1xnMEVe/H4T/KH2TMN7QVfvsE5YW9s +g/xU6FqEMRc/r8NHmtIDGFjJTdok08yWD35Set3xcYusPy0p38a3M311j7T8 +3o/cJ1d3Qv9hhcczIuNF7pr+1xysKJpRyRwiV1c8JEItH5kZTRofO6ugujt/ +GJ5I5HksqYpNNSpIk8HrhU+kBkscySofDMPe4+oJaNUMCNDpl6vH3oncbOLa +Fiw9LQ/AS3Ih6CKPEv7EuUlrZXY1NJh080HSu9RR9I9c4jUvZE6R62l4NQWZ +ly4flLxd6GLJc1b1GbE= "], CellLabel-> "During evaluation of \ -In[2]:=",ExpressionUUID->"f0557e62-7f3b-45eb-9b06-93eb4fb5567c"] +In[2]:=",ExpressionUUID->"882e0d34-442a-4d04-8521-72d08310709b"] }, Open ]] }, Open ]], @@ -124,7 +124,8 @@ Cell[BoxData[{ RowBox[{ RowBox[{"Bnorm", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"AA", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{"AA", " ", "=", " ", + RowBox[{"1.0", "/", "1836.0"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"kx", " ", "=", "1.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ @@ -150,7 +151,7 @@ Cell[BoxData[{ RowBox[{"N0", " ", "=", " ", RowBox[{"10", "^", "19"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ - RowBox[{"Chiperp", " ", "=", " ", "1.0"}], ";"}], "\[IndentingNewLine]", + RowBox[{"Chiperp", " ", "=", " ", "0.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Chipar", " ", "=", " ", "0.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ @@ -206,7 +207,7 @@ Cell[BoxData[{ 3.982996259211157*^9}, {3.982996290397106*^9, 3.98299631633951*^9}, { 3.982996835891934*^9, 3.982996849912133*^9}, 3.982996879955332*^9, { 3.982997208861528*^9, 3.982997216510427*^9}, {3.983042174356776*^9, - 3.9830421802111893`*^9}}, + 3.9830421802111893`*^9}, {3.98304561106677*^9, 3.983045628709486*^9}}, CellLabel->"In[3]:=",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], Cell[BoxData["0.1`"], "Output", @@ -238,8 +239,9 @@ Cell[BoxData["0.1`"], "Output", 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, 3.9828527873122396`*^9, 3.9829970217485867`*^9, 3.982997958253395*^9, - 3.983041693006072*^9, 3.983041935188232*^9, 3.983042223678401*^9}, - CellLabel->"Out[12]=",ExpressionUUID->"bc72b8e8-af13-45dd-ada3-2d3f42471a51"], + 3.983041693006072*^9, 3.983041935188232*^9, 3.983042223678401*^9, + 3.9830456641790857`*^9}, + CellLabel->"Out[12]=",ExpressionUUID->"baae0d55-cf15-4553-b79e-331e2afe970e"], Cell["\<\ 2.*(5. - 0.1*Cos(0.5 - yl)* @@ -274,9 +276,10 @@ Cell["\<\ 3.980435031800393*^9, 3.982830187261292*^9, 3.982831363420928*^9, 3.9828314519018393`*^9, 3.982852024070077*^9, 3.982852257490657*^9, 3.9828527873122396`*^9, 3.9829970217485867`*^9, 3.982997958253395*^9, - 3.983041693006072*^9, 3.983041935188232*^9, 3.983042223735612*^9}, + 3.983041693006072*^9, 3.983041935188232*^9, 3.983042223678401*^9, + 3.983045664235873*^9}, CellLabel-> - "Out[22]//CForm=",ExpressionUUID->"076e3f53-3be9-40ca-b5d3-084eb480cf64"] + "Out[22]//CForm=",ExpressionUUID->"b2eb15f6-30a9-4f3f-84e6-81ed416fedbc"] }, Open ]], Cell[BoxData[""], "Input", @@ -330,7 +333,7 @@ Cell[BoxData[ CellLabel->"In[25]:=",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] }, WindowSize->{513, 627}, -WindowMargins->{{Automatic, 0}, {Automatic, 0}}, +WindowMargins->{{0, Automatic}, {Automatic, 0}}, FrontEndVersion->"14.3 for Linux x86 (64-bit) (July 8, 2025)", StyleDefinitions->"Default.nb", ExpressionUUID->"ee53c5d0-dbab-4b20-a961-e0f5716cf87c" @@ -348,24 +351,24 @@ CellTagsIndex->{} Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 285, 5, 51, "Input",ExpressionUUID->"a48e709c-4f46-4e32-b340-a589ee6f1552"], -Cell[868, 29, 881, 15, 53, "Output",ExpressionUUID->"6a0edd36-9522-4c15-a915-aae89762bb3d"] +Cell[868, 29, 889, 15, 53, "Output",ExpressionUUID->"27a5f241-d41f-49cc-8b6a-b8b248eb2116"] }, Open ]], Cell[CellGroupData[{ -Cell[1786, 49, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], +Cell[1794, 49, 319, 5, 29, "Input",ExpressionUUID->"9f707231-815c-446a-a783-4c26634eb7ef"], Cell[CellGroupData[{ -Cell[2130, 58, 823, 16, 23, "Print",ExpressionUUID->"398a195f-6aad-41a7-b629-263d5a0f4b70"], -Cell[2956, 76, 822, 16, 23, "Print",ExpressionUUID->"37bf1239-886f-4dee-8279-2e82ec73ea63"], -Cell[3781, 94, 843, 17, 30, "Print",ExpressionUUID->"f0557e62-7f3b-45eb-9b06-93eb4fb5567c"] +Cell[2138, 58, 831, 16, 23, "Print",ExpressionUUID->"ee153324-c97e-4280-bed4-3e2c1ef6ccca"], +Cell[2972, 76, 830, 16, 23, "Print",ExpressionUUID->"fae6fdea-629c-4f55-b870-4501123a3e0b"], +Cell[3805, 94, 851, 17, 30, "Print",ExpressionUUID->"882e0d34-442a-4d04-8521-72d08310709b"] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[4673, 117, 4985, 92, 474, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], -Cell[9661, 211, 2117, 30, 33, "Output",ExpressionUUID->"bc72b8e8-af13-45dd-ada3-2d3f42471a51"], -Cell[11781, 243, 2214, 35, 80, "Output",ExpressionUUID->"076e3f53-3be9-40ca-b5d3-084eb480cf64"] +Cell[4705, 117, 5059, 93, 476, "Input",ExpressionUUID->"595ab9b8-3e80-4f0d-9d22-14a98dc670e3"], +Cell[9767, 212, 2145, 31, 33, "Output",ExpressionUUID->"baae0d55-cf15-4553-b79e-331e2afe970e"], +Cell[11915, 245, 2240, 36, 80, "Output",ExpressionUUID->"b2eb15f6-30a9-4f3f-84e6-81ed416fedbc"] }, Open ]], -Cell[14010, 281, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], -Cell[14186, 285, 1003, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], -Cell[15192, 309, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] +Cell[14170, 284, 173, 2, 29, "Input",ExpressionUUID->"0c455491-396e-4fa5-bafb-c4d65177fdbe"], +Cell[14346, 288, 1003, 22, 97, "Input",ExpressionUUID->"cd5ebc8a-fccb-4775-844a-8c1ba286b63e"], +Cell[15352, 312, 852, 20, 97, "Input",ExpressionUUID->"7cc82ed0-d87d-45ee-84ec-f81154fbf211"] } ] *) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp b/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp index 8092e8447..5f30feab3 100644 --- a/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp +++ b/tests/integrated/3D-Axial-circular-conduction-fci/data/BOUT.inp @@ -39,60 +39,61 @@ type = cvode [hermes] -components = h+,collisions +components = e,collisions Nnorm = 1e18 Bnorm = 1 Tnorm = 5 -[h+] # Ions -type = fixed_density, evolve_pressure, anomalous_diffusion_3d -charge = 1.0 -AA = 1.0 +[e] # Ions +type = fixed_density, evolve_pressure +charge = -1.0 +AA = 1.0/1836.0 mms = true density = 1e19 -anomalous_chi = 1.0 - thermal_conduction = true use_finite_difference = false -[Ph+] +[Pe] solution = 2.*(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) -source = 0. - 6.959211262992895e-8*((-0.6283185307179587*cos(31.41592653589794*(-0.4 + xl))*cos(0.5 - yl)*sin(0.1 - 4*zl))/xl + 19.73920880217873*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl) + (0.32000000000000006*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl))/power(x -l,2)) - (3.479894918169595e-8*((20.83160976589444*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5)*(0.02666666666 -666667*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl) + 0.020000000000000004*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0 -.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592 -653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))) - (5.207902441473 -61*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),1 -.5)*(0.02666666666666667*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794*(-0.4 + xl))*s -in(0.5 - yl)*sin(0.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 -- yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))) - - (20.83160976589444*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5)*(0.02666666666666667*cos(0.5 - yl)*cos(0.1 - - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl))*((-0.125*sin(31. -41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl))/(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) + (0.00625*(-2 -. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)) -/(sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2))*(5. - 0.1*cos(0.5 - yl)*sin(31 -.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))))/(sqrt(1 + 0.1111111111111111*power(xl,2))*power(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. -+ log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + -xl))*sin(0.1 - 4*zl)),2)) + 0.3333333333333333*((20.83160976589444*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2. -5)*(0.08000000000000002*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl) + 0.10666666666666667*cos(0.5 - yl)*sin(31.41592653589794*(- -0.4 + xl))*sin(0.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - -yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))) + - (20.83160976589444*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))* -sin(0.1 - 4*zl),1.5)*(0.02666666666666667*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.415926535897 -94*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log( -5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*s -in(0.1 - 4*zl)))) - (20.83160976589444*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5)*(0.02666666666666667*cos( -0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)) -*((0.5*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)))/(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) -- (0.025*cos(0.5 - yl)*cos(0.1 - 4*zl)*(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))*sin(31.41592653589794*( --0.4 + xl)))/(sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2))*(5. - 0.1*cos(0.5 -- yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))))/(sqrt(1 + 0.1111111111111111*power(xl,2))*power(8.525441616556563 - sqrt(0.00001 + 0.062 -5*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589 -794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)))))/sqrt(1 + 0.1111111111111111*power(xl,2)) - -bndry_all = dirichlet_o2(`Ph+:solution`) +source = 0. - (3.479894918169595e-8*((38246.83553018219*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5)*(0.02666666666666 +667*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl) + 0.020000000000000004*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 +- 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653 +589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))) - (9561.708882545547 +*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),1.5 +)*(0.02666666666666667*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794*(-0.4 + xl))*sin +(0.5 - yl)*sin(0.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - +yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))) - + (38246.83553018219*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5)*(0.02666666666666667*cos(0.5 - yl)*cos(0.1 - + 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl))*((-0.125*sin(31.41 +592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl))/(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) + (0.00625*(-2. ++ log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl))/( +sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2))*(5. - 0.1*cos(0.5 - yl)*sin(31.4 +1592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))))/(sqrt(1 + 0.1111111111111111*power(xl,2))*power(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + +log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl +))*sin(0.1 - 4*zl)),2)) + 0.3333333333333333*((38246.83553018219*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5) +*(0.08000000000000002*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl) + 0.10666666666666667*cos(0.5 - yl)*sin(31.41592653589794*(-0. +4 + xl))*sin(0.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl +)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))) + ( +38246.83553018219*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl))*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*si +n(0.1 - 4*zl),1.5)*(0.02666666666666667*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794 +*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl)))/(sqrt(1 + 0.1111111111111111*power(xl,2))*(8.525441616556563 - sqrt(0.00001 + 0.0625*power(-2. + log(5. + - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin +(0.1 - 4*zl)))) - (38246.83553018219*power(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl),2.5)*(0.02666666666666667*cos(0. +5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)) - 0.020000000000000004*sin(31.41592653589794*(-0.4 + xl))*sin(0.5 - yl)*sin(0.1 - 4*zl))*( +(0.5*cos(0.5 - yl)*cos(0.1 - 4*zl)*sin(31.41592653589794*(-0.4 + xl)))/(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)) - +(0.025*cos(0.5 - yl)*cos(0.1 - 4*zl)*(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))*sin(31.41592653589794*(-0 +.4 + xl)))/(sqrt(0.00001 + 0.0625*power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2))*(5. - 0.1*cos(0.5 - +yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)))))/(sqrt(1 + 0.1111111111111111*power(xl,2))*power(8.525441616556563 - sqrt(0.00001 + 0.0625* +power(-2. + log(5. - 0.1*cos(0.5 - yl)*sin(31.41592653589794*(-0.4 + xl))*sin(0.1 - 4*zl)),2)) + 1.25*log(5. - 0.1*cos(0.5 - yl)*sin(31.4159265358979 +4*(-0.4 + xl))*sin(0.1 - 4*zl)),2)))))/sqrt(1 + 0.1111111111111111*power(xl,2)) + + + + + +bndry_all = dirichlet_o2(`Pe:solution`) diff --git a/tests/integrated/3D-Axial-circular-conduction-fci/runtest b/tests/integrated/3D-Axial-circular-conduction-fci/runtest index 04d160a86..fd80a6452 100755 --- a/tests/integrated/3D-Axial-circular-conduction-fci/runtest +++ b/tests/integrated/3D-Axial-circular-conduction-fci/runtest @@ -44,7 +44,7 @@ timestep = 1e4 / nout nproc = 1 -varnames = ["Ph+"] +varnames = ["Pe"] results = {} for var in varnames: From 5febca36ba97b1b1803b3b1a417f7c8ee4440e6a Mon Sep 17 00:00:00 2001 From: totork <116705180+totork@users.noreply.github.com> Date: Fri, 24 Apr 2026 16:40:41 +0200 Subject: [PATCH 18/21] Update .github/workflows/tests.yml Co-authored-by: David Bold --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index abe7a8074..ff76cbf10 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,8 +56,7 @@ jobs: - name: Install pip packages run: | - ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils - python -m pip install git+https://github.com/boutproject/zoidberg@better-metric + ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils 'git+https://github.com/boutproject/zoidberg@better-metric' # Add the pip install location to the runner's PATH echo ~/.local/bin >> $GITHUB_PATH - name: Build and run tests From af80f9c9bf4f34774d0015bba72836a31325eb5d Mon Sep 17 00:00:00 2001 From: totork Date: Wed, 6 May 2026 00:16:39 +0200 Subject: [PATCH 19/21] Fix CI --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ff76cbf10..c319ee705 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,7 +56,7 @@ jobs: - name: Install pip packages run: | - ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils 'git+https://github.com/boutproject/zoidberg@better-metric' + ./.pip_install_for_tests.sh 'netcdf4~=1.5' 'boutdata==0.3.0' boututils 'git+https://github.com/boutproject/zoidberg' # Add the pip install location to the runner's PATH echo ~/.local/bin >> $GITHUB_PATH - name: Build and run tests From 3dee5a3e1fb0bf546b86eaedebc7128969accbdc Mon Sep 17 00:00:00 2001 From: totork Date: Sat, 23 May 2026 00:04:37 +0200 Subject: [PATCH 20/21] Add zonal average for zonal neumann BC --- include/vorticity.hxx | 3 +++ src/vorticity.cxx | 26 +++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/include/vorticity.hxx b/include/vorticity.hxx index a70328d3b..10929cb1e 100644 --- a/include/vorticity.hxx +++ b/include/vorticity.hxx @@ -129,6 +129,9 @@ private: bool phi_sheath_dissipation; ///< Dissipation at the sheath if phi < 0 bool damp_core_vorticity; ///< Damp axisymmetric component of vorticity + std::unique_ptr phiSolver_zonalneumann; + bool zonal_neumann; + bool phi_boundary_relax; ///< Relax boundary to zero-gradient BoutReal phi_boundary_timescale; ///< Relaxation timescale [normalised] BoutReal phi_boundary_last_update; ///< Time when last updated diff --git a/src/vorticity.cxx b/src/vorticity.cxx index 10f02f332..0085488ac 100644 --- a/src/vorticity.cxx +++ b/src/vorticity.cxx @@ -260,7 +260,14 @@ Vorticity::Vorticity(std::string name, Options& alloptions, Solver* solver) { mesh->communicate(logB); logB.applyParallelBoundary("parallel_neumann_o2"); - + zonal_neumann = options["zonal_neumann"] + .doc("Do a second laplace solve for the zonal neumann?") + .withDefault(false); + + if (zonal_neumann) { + phiSolver_zonalneumann = Laplacian::create(&options["laplacian_zonalneumann"]); + } + } @@ -538,6 +545,23 @@ void Vorticity::transform(Options& state) { } } + if (zonal_neumann) { + auto coord = mesh->getCoordinates(); + Field2D avg_phi = DC(phi); + if ( mesh->firstX() ) { + for (int j = mesh->ystart; j <= mesh->yend; j++) { + for (int k = 0; k < mesh->LocalNz; k++) { + phi_plus_pi(mesh->xstart - 1, j, k) = 0.5 * ( avg_phi(mesh->xstart - 1 ,j) + avg_phi(mesh->xstart ,j) ) + + 0.5 * (Pi_hat(mesh->xstart - 1, j, k) + Pi_hat(mesh->xstart, j, k)); + phi_plus_pi(mesh->xstart - 2, j, k) = phi_plus_pi(mesh->xstart - 1, j, k); + } + } + } + phiSolver_zonalneumann->setCoefC(average_atomic_mass / SQ(coord->Bxy)); + const auto tosolve = Vort * (Bsq / average_atomic_mass); + phi = phiSolver_zonalneumann->solve(tosolve, phi_plus_pi) - Pi_hat; + } + // Ensure that potential is set in the communication guard cells mesh->communicate(phi); From 1d89a49eb45ed161d01eaa1b27851642f0b5969d Mon Sep 17 00:00:00 2001 From: totork Date: Sat, 23 May 2026 15:38:31 +0200 Subject: [PATCH 21/21] More vortiicity Fci changes --- include/vorticity.hxx | 2 +- src/vorticity.cxx | 63 +++++++++++++++++-------------------------- 2 files changed, 25 insertions(+), 40 deletions(-) diff --git a/include/vorticity.hxx b/include/vorticity.hxx index 10929cb1e..7b28d5de3 100644 --- a/include/vorticity.hxx +++ b/include/vorticity.hxx @@ -136,7 +136,7 @@ private: BoutReal phi_boundary_timescale; ///< Relaxation timescale [normalised] BoutReal phi_boundary_last_update; ///< Time when last updated bool phi_core_averagey; ///< Average phi core boundary in Y? - + Field3D zeroes; bool split_n0; // Split phi into n=0 and n!=0 components LaplaceXY* laplacexy; // Laplacian solver in X-Y (n=0) Field3D logB; diff --git a/src/vorticity.cxx b/src/vorticity.cxx index 0085488ac..0cbf3101b 100644 --- a/src/vorticity.cxx +++ b/src/vorticity.cxx @@ -1,6 +1,9 @@ #include "../include/vorticity.hxx" #include "../include/div_ops.hxx" +#include "../include/hermes_build_config.hxx" +#include "../include/hermes_utils.hxx" + #include #include @@ -14,11 +17,6 @@ using bout::globals::mesh; namespace { -BoutReal floor(BoutReal value, BoutReal min) { - if (value < min) - return min; - return value; -} Ind3D indexAt(const Field3D& f, int x, int y, int z) { int ny = f.getNy(); @@ -216,6 +214,12 @@ Vorticity::Vorticity(std::string name, Options& alloptions, Solver* solver) { Curlb_B = 0.0; } } + + zeroes = 0.0; + zeroes.applyBoundary("neumann"); + mesh->communicate(zeroes); + zeroes.applyParallelBoundary("parallel_neumann_o1"); + } if (Options::root()["mesh"]["paralleltransform"]["type"].as() @@ -427,40 +431,13 @@ void Vorticity::transform(Options& state) { Te = 0.0; } - // Sheath multiplier Te -> phi (2.84522 for Deuterium if Ti = 0) - if ( mesh->firstX()) { - for (int j = mesh->ystart; j <= mesh->yend; j++) { - BoutReal teavg = 0.0; // Average Te in Z - - for (int k = 0; k < mesh->LocalNz; k++) { - teavg += Te(mesh->xstart, j, k); - } - teavg /= mesh->LocalNz; - BoutReal phivalue = sheathmult * teavg; - - // Set midpoint (boundary) value - for (int k = 0; k < mesh->LocalNz; k++) { - phi(mesh->xstart - 1, j, k) = 2. * phivalue - phi(mesh->xstart, j, k); - - // Note: This seems to make a difference, but don't know why. - // Without this, get convergence failures with no apparent instability - // (all fields apparently smooth, well behaved) - phi(mesh->xstart - 2, j, k) = phi(mesh->xstart - 1, j, k); - } - } - } if ( mesh->lastX()) { for (int j = mesh->ystart; j <= mesh->yend; j++) { - BoutReal teavg = 0.0; // Average Te in Z - - for (int k = 0; k < mesh->LocalNz; k++) { - teavg += Te(mesh->xend, j, k); - } - teavg /= mesh->LocalNz; - BoutReal phivalue = sheathmult * teavg; // Set midpoint (boundary) value for (int k = 0; k < mesh->LocalNz; k++) { + BoutReal phivalue = sheathmult * 0.5 * (Te(mesh->xend, j, k) + Te(mesh->xend + 1, j, k)); + phi(mesh->xend + 1, j, k) = 2. * phivalue - phi(mesh->xend, j, k); // Note: This seems to make a difference, but don't know why. @@ -798,11 +775,13 @@ void Vorticity::finally(const Options& state) { const Field3D N = get(species["density"]); const Field3D NV = get(species["momentum"]); + const Field3D V = get(species["velocity"]); const BoutReal A = get(species["AA"]); - // Note: Using NV rather than N*V so that the cell boundary flux is correct - const Field3D jpar = (Z / A) * NV; - ddt(Vort) += Div_par(jpar); + + Field3D flow_ylow = 0.0; + ddt(Vort) += Z * FV::Div_par_mod(N, V, zeroes, flow_ylow, false, + false, true); if (state["fields"].isSet("Apar_flutter")) { // Magnetic flutter term @@ -811,7 +790,7 @@ void Vorticity::finally(const Options& state) { // Div_par(jpar) = B * Grad_par(jpar / B) // Using the approximation for small delta-B/B // b dot Grad(jpar) = Grad_par(jpar) + [jpar, Apar] - ddt(Vort) += coord->Bxy * bracket(jpar / coord->Bxy, Apar_flutter, BRACKET_ARAKAWA); + ddt(Vort) += coord->Bxy * bracket(Z*NV / coord->Bxy, Apar_flutter, BRACKET_ARAKAWA); } } @@ -836,7 +815,13 @@ void Vorticity::finally(const Options& state) { // Adds dissipation term like in other equations, but depending on gradient of // potential Field3D sound_speed = get(state["sound_speed"]); - ddt(Vort) -= FV::Div_par(-phi, 0.0, sound_speed); + Field3D dummy1; + zeroes = 0.0; + zeroes.applyBoundary("neumann"); + mesh->communicate(zeroes); + zeroes.applyParallelBoundary("parallel_neumann_o1"); + ddt(Vort) -= FV::Div_par_mod(-phi, zeroes, sound_speed, dummy1, false, + false, true); } if (hyper > 0) {