energy and momentum corrections and update on toroidal
TRANSCRIPT
EnergyandMomentumCorrectionsandUpdateonToroidalPreconditioning
CarlSovinecUniversityofWisconsin-Madison
NIMRODTeamMeetingAugust21-23,2019Madison,Wisconsin
Outline• Particlediffusioncorrections*
– Single-temperaturesystem– SeparateTiandTesystem– Two-fluid– Recommendations– Implementation
• Toroidalpreconditioning– 1Dtoroidalsolves– Otherideas
• ConclusionsandDiscussion
*Additionaldetailsarepostedoncptc.wisc.edu,reportUW-CPTC19-2.
Particlediffusion:Artificialdiffusioninthecontinuityequationcanaffectconservationproperties.• Thestandardmomentumdensityequation,
∂∂t
ρV( )+∇⋅ ρVV( ) = J ×B−∇p−∇⋅Π
,leadsto
∂∂t
ρV( )+∇⋅ ρVV − 1µ0BB+ I p+ B
2
2µ0
⎛
⎝⎜⎜
⎞
⎠⎟⎟+Π
⎡
⎣
⎢⎢
⎤
⎦
⎥⎥= 0
• Subtractingcenter-of-mass(COM)Vtimesthemodifiedcontinuityeqn.,
∂∂tn+∇⋅ nV −D∇n( ) = 0
ρ∂∂tV + ρV ⋅∇V = J ×B−∇p−∇⋅Π−V∇⋅ D∇ρ( )
isequivalent*totheconservativeform
*Thisassumes.∇⋅B = 0additionalterm
Artificialdiffusionalsoaffectsenergydensity.• Thestandardspecies(s)temperatureevolutionequationis
• WhenKPRADisnotused,NIMROD’ssingle-Tequationisformedasanionequation,.
• Electrontemperatureisupdatedas,fe=pe_frac.
• Totalthermalenergydensityis
• Consideringmodifiedcontinuityforthermalandkineticenergydensities,
∂∂tnsTsγ −1
⎛
⎝
⎜⎜
⎞
⎠
⎟⎟+∇⋅
nsTsγ −1
Vs⎛
⎝⎜
⎞
⎠⎟= −ps∇⋅Vs −∇⋅qs +Qs
ni = n ZeffTe =
feZeff 1− fe( )
T
neTeγ −1
+niTγ −1
⇒nT
Zeff γ −1( )fe
1− fe( )+1
⎡
⎣⎢⎢
⎤
⎦⎥⎥=niTγ −1( )
1fi
ni∂∂tT + niV ⋅∇T = − γ −1( ) niT∇⋅V +∇⋅q −Q( )+
fimV2 γ −1( )2
−TZeff
⎛
⎝
⎜⎜
⎞
⎠
⎟⎟∇ ⋅ D∇n( )
additionaltermQ = fi ηJ2 −Π:∇V( )
∂∂t
ρV 2
2+n
γ −1TiZeff
+Te⎛
⎝⎜⎜
⎞
⎠⎟⎟+B2
2µ0
⎡
⎣
⎢⎢
⎤
⎦
⎥⎥
+∇⋅ρV 2
2V + γnTs
Zs γ −1( )V +
gsneJ
⎛
⎝⎜
⎞
⎠⎟
s∑ +Π⋅V +qi +qe +
1µ0E×B
⎡
⎣⎢⎢
⎤
⎦⎥⎥
= −V ⋅∇p+ V +gsneJ
⎛
⎝⎜
⎞
⎠⎟⋅∇
nTsZs
⎛
⎝⎜⎜
⎞
⎠⎟⎟
s∑ +Π:∇V −V
2
2∇⋅ D∇ρ( ) −ηJ 2 + ghn J ⋅∇pe +Qi +Qe
FurtherconsiderationisneededforseparateTiandTeequations.
• Formally,speciesflowvelocitiesare:
• EnergydensityevolutionwithforHall-MHD,butbeforeincludingtheKEdensitycorrectionis
Vs = V +gsneJ rm ≡
Zeff memi
<<1gs ≡
rm1+ rm
, s = i
−1
1+ rm, s = e
⎧
⎨
⎪⎪
⎩
⎪⎪
gh =1− rme 1+ rm( )
E =ηJ −V ×B+ghnJ ×B−∇pe( )
RecommendationsforMHDandHall-MHD
1. WhenevolvingseparatetemperatureswithMHD,setVsinthetemperatureequationstoV.• Thisisequivalenttosettinggsto0.• JakeK.andNateFerrarohadpointed-thisout,previously.
2. WhensolvingtheHall-MHDsystem,usetwo-temperatureevolutionunless• pe_frac=0or• theclosureisβ=0.
3. FortheHall-MHDsystem,setfortheterminOhm’slaw.• ThisisanO(rm)correction.
4. SetfortheHall-MHDsystem.• ThisisalsoanO(rm)correction.
5. Withseparatetemperatures,putthekinetic-energycorrectionintotheionthermalenergy.
gh = −ge e ∇pe
gi = 0
The“two-fluid”systemincludeselectron-inertiaterms.
• Atpresent,NIMRODisnotprogrammedconsistentlywrtO(rm)terms.
• Theadvectivecontribution(seenextslides)wereprogrammedaccordingtoKrall&Trivelpiece’s*generalizedOhm’slaw.
• PressuretensorsaredefinedrelativetoVandnotVs.
• Theequationshavefewertermsbutoddimplications.
• Theadvectivetermsarenotprogrammedinanumericallystableway.
• Theimplicitleapfrogrequirestime-centeringintheB-advance.
• Thiscouldbedonebyiteration.
*PrinciplesofPlasmaPhysics,McGraw-Hill(1973).
WeneedKEdensityandflux-densityintermsofVandJ.
• Kineticenergydensityforelectron-ionplasmais
mini2Vi2 +mene2Ve2 =
min2Zeff
V +rm
ne 1+ rm( )J
⎡
⎣⎢⎢
⎤
⎦⎥⎥
2
+men2
V − 1ne 1+ rm( )
J⎡
⎣⎢⎢
⎤
⎦⎥⎥
2
=ρ2V 2 +
gm12nJ 2
• Kineticenergyflux-densityis
mini2Vi2Vi +
mene2Ve2Ve =
ρ2V 2V +
gm22n
J 2V + 2V ⋅ JJ +gi + gene
J 2J⎡
⎣⎢
⎤
⎦⎥
• Twoanalyticallyequivalentcoefficientsareusedtodistinguishterms:
gm1 = gm2 =me e2 1+ rm( ) = n ε0ω p
2
Re-derivingfirst-momentequationssetsthestageforenergy.
• UsingpressuretensorsintermsofVsisconsistentwithourTsequations.
• Sumspeciesmomentumdensityevolution:
TheNIMRODform,includingartificialparticlediffusivityis
Ps = dvms v −Vs( ) v −Vs( ) fs∫
∂∂t
ρV( )+∇⋅ ρVV + gm2n JJ⎡
⎣⎢
⎤
⎦⎥+∇⋅ Pss
∑ − J ×B = 0
ρ∂∂tV +V ⋅∇V
⎛
⎝⎜
⎞
⎠⎟= J ×B−∇ pi + pe( )− gm2J ⋅∇
Jn⎛
⎝⎜
⎞
⎠⎟−∇⋅Π−V∇⋅ D∇ρ( )
notinKT*
*SeeKimuraandMorrison,Onenergyconservationinextendedmagnetohydrodynamics,Phys.Plasmas21,082101(2014).
Ohm’slawisthesecondfirst-momentequation.
• Sumspecieschargedensityevolution:
• SolvingforEforelectron-ionplasma:
∂∂tJ +∇⋅ qsnsVsVs
s∑⎛
⎝⎜
⎞
⎠⎟+∇⋅
qsmsPs
s∑ −
qs2nsms
Vss∑ ×B =
qs2nsms
Es∑
E = 1ngm1
∂∂tJ + gm2∇⋅ VJ + JV −
1− rm2
neJJ
⎛
⎝
⎜⎜
⎞
⎠
⎟⎟
⎡
⎣
⎢⎢
⎤
⎦
⎥⎥+1ne∇⋅ giPi + gePe( )−V ×B+ ghn J ×B
Droppingtherm2termandreplacingpressuretensors,
E = 1ngm1
∂∂tJ + gm2∇⋅ VJ + JV −
1neJJ
⎛
⎝⎜
⎞
⎠⎟
⎡
⎣⎢
⎤
⎦⎥
+1ne∇⋅ gi piI+Π( )+ ge peI⎡⎣
⎤⎦+ηJ −V ×B+
ghnJ ×B
notinNIMROD
notinNIMROD
Energydensityevolutionfollows.
Therhsshouldbe0forconservation.(Tcorrectionsarealreadyincluded.)
∂∂t
ρV 2
2+gm1J
2
2n+
nγ −1( )
TiZ+Te
⎛
⎝⎜
⎞
⎠⎟+B2
2µ0
⎡
⎣
⎢⎢
⎤
⎦
⎥⎥
+∇⋅ρV 2
2V + gm2 −
gm12
⎛
⎝⎜
⎞
⎠⎟J 2Vn
+gm2nJV ⋅ J −
gm2J2
2n2J + 1
µ0E×B
⎡
⎣
⎢⎢
⎤
⎦
⎥⎥
+∇⋅γnTiZ γ −1( )
V +gineJ
⎛
⎝⎜
⎞
⎠⎟+
γnTeγ −1( )
V +geneJ
⎛
⎝⎜
⎞
⎠⎟+Π⋅ V +
giJne
⎛
⎝⎜
⎞
⎠⎟+qi +qe
⎡
⎣⎢⎢
⎤
⎦⎥⎥
=Π:∇ V +giJne
⎛
⎝⎜
⎞
⎠⎟−12mV 2 +
gm1J2
n2
⎛
⎝
⎜⎜
⎞
⎠
⎟⎟∇ ⋅ D∇n( )−ηJ 2
− gm1− gm2( )nV ⋅ Jn ×∇×Jn⎛
⎝⎜
⎞
⎠⎟+Jn⋅∇Jn
⎡
⎣⎢
⎤
⎦⎥+Qi +Qe
ConservationthroughO(rm)withthetwo-fluidsystemrequiresthefollowing:
1. ImplementingtheO(rm)contributiontoCOMVevolution
2. ImplementingionpressureandstresscontributionsinOhm’slaw
3. TheO(rm)correctiontoionviscousheating
4. TheJJterminOhm’slawneedstobeimplemented
5. Theentireelectronadvectivecontributionneedsiteration
6. Usinggm1=gm2intwo-fluidcomputations
Theparticlediffusioncorrectionsrequirecomputationofdiv(D*grad(n)).
• Itisnotdirectlyavailablefromthedensityadvance.
• Anewmass-matrixsolvegeneratesanexpansionforthisfield.
• Everythingdescribedabovefollowsforhyper-particlediffusivity,exceptthattherearetwomass-matrixsolves.
Nimuw’sfactorsforextendedMHDtermsarenowcollectedinglobal.
coefhll=ghforJxBcoefgpe=ghforgrad(pe)coefjvi,coefjve=gi,gecoefme1,coefme2=gm1,gm2
• Recommendedsettingsfordifferentmodelsareimplementedinoneplace,subroutineset_2fl_coefs.
Alarge-amplitudemagneto-acousticwavetestdemonstratestheenergycorrection.
• WaveisinaperiodicboxandstartsfromasinusoidinVwithamplitudeof.
• Nonlinearevolutionlosesresolutionovertimeinthe20cubicelementrepresentation.
Totalenergyvs.time.
3cma 10
nd_diff=0
nd_diff=0.01,nocorrection
nd_diff=0.01,corrected
V(z)att=4andatt=7.5.
n(z)att=4andatt=7.5.
Includingviscousdiffusionandthermalconductionreducesmesh-scaleoscillations.
• Alldiffusivitiesare0.01.
• Viscousheatingisturnedon.
• Thereisaslightdriftintotalenergy.
Totalenergyvs.time.
nd_diff=0.01,χ = ν =0
nd_diff=0.01,χ = ν=0.01
V(z)att=4andatt=7.5.
n(z)att=4andatt=7.5.
Toroidalpreconditioning(yetagain):Somethinghastowork.
• Directsolvesfordiagonal-in-Fourierblocksareinadequatewithsignificanttoroidalvariation.• Anisotropicthermalconduction• Magneticevolutionwithplasmasurfacedistortion
• Anumberofpreviouslydevelopedschemeshavelimitedutility.• LimitedGauss-Seidel-likeFouriercoupling• FGMRESalternatingwithdiagonal-in-φsolves
• Arecentattemptincorporates1Dsolvesoverthetoroidalangle.• Analogoustooldgl_diagapreconditioner• Alsosuggestedbysolverexperts
1DsolvesoverFourierharmonicscanbeusedinvariousways.
• AspartofanadditiveSchwarzpreconditioner• Averagetheresultswiththeresultsofdiagonal-in-Fourier(DIF)solves.
• AspartofamultiplicativeSchwarzpreconditioner• PerformoperationsequentiallywithDIF.• ForsymmetricsystemswithCG,thestepsneedtobesymmetrized.
• AlternatingwithDIFduringFGMRESsteps
Machineryhasbeendevelopedfor1DFouriersolves.• Routinesforpackingandunpackingdata
• Vector-typedatastructuresareused,butallnodesintheelementplanearelumpedintothe%arrarrays.
• Parallelcommunicationwouldneedtobedeveloped.• 1Dversionsofthematrix-freeKrylovsolves
• “Matrix-free”avoidsgeneratingdensematrices.• Ifcomplete1Dsolutionshelp,keepiterating.
• Matrix-freematrix-vectorproductroutinesthatworkwithpackeddata• OnlytheroutineforadvancingBwith3Dresistivityhasbeendeveloped.
• Itiscalledbythe1DKrylovsolves.Reorganizingthesolvertopreconditionthroughanexternalsubroutinecallisprovinghandy.
Theprimarytestcaseperforms3Dmagneticdiffusioninastraightannulus.
• The0-thorderprofilehasapproximatelyuniformJz.
• Imposedn=1sinusoidalvariationinTof~60%impliesafactorof8variationinSpitzerη.
• Onestepofresistivediffusioninduces7%axialvariationinJz.
• Problemsolvesn=0-2,12x24bilinearmesh.
precon noprec 1DFonly sluonly mult fgmr
iterations 63 57 13 15 19
3DiterationcountsusingGMREStosolvethe3Dmagneticdiffusionproblem.
Isthetoroidalvariationintheteststrongenoughtobenefitfrom1DFouriersolves?
• SecondcasedoublesvariationinT.• Upperboundonηlimitsitsvariationtoabout3000.
precon noprec 1DFonly sluonly mult fgmr
iterations 533 137 118 95 114
3DiterationcountsusingGMREStosolvethesecond3Dmagneticdiffusionproblem.
Note:• 1DFouriersolveshavebeentestedincomputationswherepoloidalcouplingisremoved->1outer3Dstep.
• 151Diterationssolvethe1Dproblemstoround-offlevel.• Performancewithpoly_degree>1issimilar,i.e.disappointing.
Ifchangingthepreconditionerdoesn’thelp,changethematrix.
• Ifstaticcondensation(matrixpartitioning)canincludetoroidalcoupling,itwouldreducethesizeofthe3Dsystems.
• Using“1”forgrid-vertexandelement-sidenodes,“2”forelementinteriors,solve:
A11− A12A22−1A21
⎛⎝⎜
⎞⎠⎟x1 = b1− A12A22
−1b2⎛⎝⎜
⎞⎠⎟
• Fullcondensationsolvestheinterior-interiorcouplingwithineachhigher-orderelement.• Implementationcouldkeepasamatrixfreeoperationandpossiblyformmatrixelementsforand.
• UseLAPACKforfactoring?
A11x1A12 , A22 A21
A22
Acompletelymatrix-freeversionteststheconcept.
• Testproblemissimilartotheonepreviouslydiscussed.• Annularmeshis6x12;poly_degreeandlphiarevaried.
• Computationalresultsarewithoutpreconditioning.
matrix full condensed
iterations 100 54
T-variation=60% poly_degree=2 lphi=3
matrix full condensed
iterations 174 68
T-variation=60% poly_degree=3 lphi=3
matrix full condensed
iterations 256 123
T-variation=80% poly_degree=3 lphi=4
ConclusionsandDiscussion• Includingenergyandmomentumcorrectionsforartificialparticlediffusionis
tractable.
• Ifthediffusionsmoothsnoisyn,increasesnoiseinT(x).
• ThermalconductioncankeepT(x)smooth.
• ConsiderationsforHall-MHD,two-temperature,andtwo-fluidsystemsaresummarizedinUW-CPTC19-2.
• Newcoefficientshelpkeeptermsconsistent.
• FurtherimplementationisneededforconservationtoO(rm).
• Toroidalpreconditioningvia1Dsolvesatnodesdoesnotlookpromising.
• Staticcondensation,includingtoroidalcouplingispossible.
• Initialtestingindicatessignificantreductioniniterations.
• Canacceleratorsmakeitfast?
fimV2 γ −1( )2
−TZeff
⎛
⎝
⎜⎜
⎞
⎠
⎟⎟∇ ⋅ D∇n( )