50
50
RealT
51
51
end
52
52
53
- have_nonconservative_terms (:: IdealMhdMultiIonEquations1D ) = True ()
54
-
55
53
function varnames (:: typeof (cons2cons), equations:: IdealMhdMultiIonEquations1D )
56
54
cons = (" B1" , " B2" , " B3" )
57
55
for i in eachcomponent (equations)
@@ -74,28 +72,9 @@ function varnames(::typeof(cons2prim), equations::IdealMhdMultiIonEquations1D)
74
72
return prim
75
73
end
76
74
77
- # """
78
- # initial_condition_convergence_test(x, t, equations::IdealMhdMultiIonEquations1D)
79
-
80
- # An Alfvén wave as smooth initial condition used for convergence tests.
81
- # """
82
- # function initial_condition_convergence_test(x, t, equations::IdealMhdMultiIonEquations1D)
83
- # # smooth Alfvén wave test from Derigs et al. FLASH (2016)
84
- # # domain must be set to [0, 1], γ = 5/3
85
-
86
- # rho = 1.0
87
- # prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i-1) * (1-2)/(1-2^ncomponents(equations)) * rho for i in eachcomponent(equations))
88
- # v1 = 0.0
89
- # si, co = sincos(2 * pi * x[1])
90
- # v2 = 0.1 * si
91
- # v3 = 0.1 * co
92
- # p = 0.1
93
- # B1 = 1.0
94
- # B2 = v2
95
- # B3 = v3
96
- # prim_other = SVector{7, real(equations)}(v1, v2, v3, p, B1, B2, B3)
97
- # return prim2cons(vcat(prim_other, prim_rho), equations)
98
- # end
75
+ function default_analysis_integrals (:: AbstractIdealGlmMhdMultiIonEquations )
76
+ (entropy_timederivative,)
77
+ end
99
78
100
79
"""
101
80
initial_condition_weak_blast_wave(x, t, equations::IdealMhdMultiIonEquations1D)
@@ -137,8 +116,6 @@ function initial_condition_weak_blast_wave(x, t, equations::IdealMhdMultiIonEqua
137
116
return prim2cons (SVector (prim), equations)
138
117
end
139
118
140
- # TODO : Add initial condition equilibrium
141
-
142
119
# Calculate 1D flux in for a single point
143
120
@inline function flux (u, orientation:: Integer , equations:: IdealMhdMultiIonEquations1D )
144
121
B1, B2, B3 = magnetic_field (u, equations)
176
153
return SVector (f)
177
154
end
178
155
179
- """
180
- Standard source terms of the multi-ion MHD equations
181
- """
182
- function source_terms_lorentz (u, x, t, equations:: IdealMhdMultiIonEquations1D )
183
- @unpack charge_to_mass = equations
184
- B1, B2, B3 = magnetic_field (u, equations)
185
- v1_plus, v2_plus, v3_plus, vk1_plus, vk2_plus, vk3_plus = charge_averaged_velocities (u,
186
- equations)
187
-
188
- s = zero (MVector{nvariables (equations), eltype (u)})
189
- for k in eachcomponent (equations)
190
- rho, rho_v1, rho_v2, rho_v3, rho_e = get_component (k, u, equations)
191
- v1 = rho_v1 / rho
192
- v2 = rho_v2 / rho
193
- v3 = rho_v3 / rho
194
- v1_diff = v1_plus - v1
195
- v2_diff = v2_plus - v2
196
- v3_diff = v3_plus - v3
197
- r_rho = charge_to_mass[k] * rho
198
- s2 = r_rho * (v2_diff * B3 - v3_diff * B2)
199
- s3 = r_rho * (v3_diff * B1 - v1_diff * B3)
200
- s4 = r_rho * (v1_diff * B2 - v2_diff * B1)
201
- s5 = v1 * s2 + v2 * s3 + v3 * s4
202
-
203
- set_component! (s, k, 0 , s2, s3, s4, s5, equations)
204
- end
205
-
206
- return SVector (s)
207
- end
208
-
209
156
"""
210
157
Total entropy-conserving non-conservative two-point "flux"" as described in
211
158
- Rueda-Ramírez et al. (2023)
@@ -630,71 +577,4 @@ Compute the fastest wave speed for ideal MHD equations: c_f, the fast magnetoaco
630
577
631
578
return c_f
632
579
end
633
-
634
- """
635
- Routine to compute the charge-averaged velocities:
636
- * v*_plus: Charge-averaged velocity
637
- * vk*_plus: Contribution of each species to the charge-averaged velocity
638
- """
639
- @inline function charge_averaged_velocities (u, equations:: IdealMhdMultiIonEquations1D )
640
- total_electron_charge = zero (real (equations))
641
-
642
- vk1_plus = zero (MVector{ncomponents (equations), eltype (u)})
643
- vk2_plus = zero (MVector{ncomponents (equations), eltype (u)})
644
- vk3_plus = zero (MVector{ncomponents (equations), eltype (u)})
645
-
646
- for k in eachcomponent (equations)
647
- rho, rho_v1, rho_v2, rho_v3, _ = get_component (k, u,
648
- equations:: IdealMhdMultiIonEquations1D )
649
-
650
- total_electron_charge += rho * equations. charge_to_mass[k]
651
- vk1_plus[k] = rho_v1 * equations. charge_to_mass[k]
652
- vk2_plus[k] = rho_v2 * equations. charge_to_mass[k]
653
- vk3_plus[k] = rho_v3 * equations. charge_to_mass[k]
654
- end
655
- vk1_plus ./= total_electron_charge
656
- vk2_plus ./= total_electron_charge
657
- vk3_plus ./= total_electron_charge
658
- v1_plus = sum (vk1_plus)
659
- v2_plus = sum (vk2_plus)
660
- v3_plus = sum (vk3_plus)
661
-
662
- return v1_plus, v2_plus, v3_plus, SVector (vk1_plus), SVector (vk2_plus),
663
- SVector (vk3_plus)
664
- end
665
-
666
- """
667
- Get the flow variables of component k
668
- """
669
- @inline function get_component (k, u, equations:: IdealMhdMultiIonEquations1D )
670
- # The first 3 entries of u contain the magnetic field. The following entries contain the density, momentum (3 entries), and energy of each component.
671
- return SVector (u[3 + (k - 1 ) * 5 + 1 ],
672
- u[3 + (k - 1 ) * 5 + 2 ],
673
- u[3 + (k - 1 ) * 5 + 3 ],
674
- u[3 + (k - 1 ) * 5 + 4 ],
675
- u[3 + (k - 1 ) * 5 + 5 ])
676
- end
677
-
678
- """
679
- Set the flow variables of component k
680
- """
681
- @inline function set_component! (u, k, u1, u2, u3, u4, u5,
682
- equations:: IdealMhdMultiIonEquations1D )
683
- # The first 3 entries of u contain the magnetic field. The following entries contain the density, momentum (3 entries), and energy of each component.
684
- u[3 + (k - 1 ) * 5 + 1 ] = u1
685
- u[3 + (k - 1 ) * 5 + 2 ] = u2
686
- u[3 + (k - 1 ) * 5 + 3 ] = u3
687
- u[3 + (k - 1 ) * 5 + 4 ] = u4
688
- u[3 + (k - 1 ) * 5 + 5 ] = u5
689
- end
690
-
691
- magnetic_field (u, equations:: IdealMhdMultiIonEquations1D ) = SVector (u[1 ], u[2 ], u[3 ])
692
-
693
- @inline function density (u, equations:: IdealMhdMultiIonEquations1D )
694
- rho = zero (real (equations))
695
- for k in eachcomponent (equations)
696
- rho += u[3 + (k - 1 ) * 5 + 1 ]
697
- end
698
- return rho
699
- end
700
580
end # @muladd
0 commit comments