@@ -118,12 +118,13 @@ end
118
118
function transform_variables! (u_transformed, u, mesh:: Union{TreeMesh{2}, P4estMesh{2}} ,
119
119
equations_parabolic:: AbstractEquationsParabolic ,
120
120
dg:: DG , parabolic_scheme, cache, cache_parabolic)
121
+ transformation = gradient_variable_transformation (equations_parabolic)
122
+
121
123
@threaded for element in eachelement (dg, cache)
122
124
# Calculate volume terms in one element
123
125
for j in eachnode (dg), i in eachnode (dg)
124
126
u_node = get_node_vars (u, equations_parabolic, dg, i, j, element)
125
- u_transformed_node = gradient_variable_transformation (equations_parabolic)(u_node,
126
- equations_parabolic)
127
+ u_transformed_node = transformation (u_node, equations_parabolic)
127
128
set_node_vars! (u_transformed, u_transformed_node, equations_parabolic, dg,
128
129
i, j, element)
129
130
end
@@ -168,30 +169,31 @@ function prolong2interfaces!(cache_parabolic, flux_viscous,
168
169
equations_parabolic:: AbstractEquationsParabolic ,
169
170
surface_integral, dg:: DG , cache)
170
171
@unpack interfaces = cache_parabolic
171
- @unpack orientations = interfaces
172
+ @unpack orientations, neighbor_ids = interfaces
173
+ interfaces_u = interfaces. u
172
174
173
175
flux_viscous_x, flux_viscous_y = flux_viscous
174
176
175
177
@threaded for interface in eachinterface (dg, cache)
176
- left_element = interfaces . neighbor_ids[1 , interface]
177
- right_element = interfaces . neighbor_ids[2 , interface]
178
+ left_element = neighbor_ids[1 , interface]
179
+ right_element = neighbor_ids[2 , interface]
178
180
179
181
if orientations[interface] == 1
180
182
# interface in x-direction
181
183
for j in eachnode (dg), v in eachvariable (equations_parabolic)
182
- # OBS! `interfaces.u ` stores the interpolated *fluxes* and *not the solution*!
183
- interfaces . u [1 , v, j, interface] = flux_viscous_x[v, nnodes (dg), j,
184
+ # OBS! `interfaces_u ` stores the interpolated *fluxes* and *not the solution*!
185
+ interfaces_u [1 , v, j, interface] = flux_viscous_x[v, nnodes (dg), j,
184
186
left_element]
185
- interfaces . u [2 , v, j, interface] = flux_viscous_x[v, 1 , j,
187
+ interfaces_u [2 , v, j, interface] = flux_viscous_x[v, 1 , j,
186
188
right_element]
187
189
end
188
190
else # if orientations[interface] == 2
189
191
# interface in y-direction
190
192
for i in eachnode (dg), v in eachvariable (equations_parabolic)
191
- # OBS! `interfaces.u ` stores the interpolated *fluxes* and *not the solution*!
192
- interfaces . u [1 , v, i, interface] = flux_viscous_y[v, i, nnodes (dg),
193
+ # OBS! `interfaces_u ` stores the interpolated *fluxes* and *not the solution*!
194
+ interfaces_u [1 , v, i, interface] = flux_viscous_y[v, i, nnodes (dg),
193
195
left_element]
194
- interfaces . u [2 , v, i, interface] = flux_viscous_y[v, i, 1 ,
196
+ interfaces_u [2 , v, i, interface] = flux_viscous_y[v, i, 1 ,
195
197
right_element]
196
198
end
197
199
end
@@ -244,41 +246,42 @@ function prolong2boundaries!(cache_parabolic, flux_viscous,
244
246
equations_parabolic:: AbstractEquationsParabolic ,
245
247
surface_integral, dg:: DG , cache)
246
248
@unpack boundaries = cache_parabolic
247
- @unpack orientations, neighbor_sides = boundaries
249
+ @unpack orientations, neighbor_sides, neighbor_ids = boundaries
250
+ boundaries_u = boundaries. u
248
251
flux_viscous_x, flux_viscous_y = flux_viscous
249
252
250
253
@threaded for boundary in eachboundary (dg, cache_parabolic)
251
- element = boundaries . neighbor_ids[boundary]
254
+ element = neighbor_ids[boundary]
252
255
253
256
if orientations[boundary] == 1
254
257
# boundary in x-direction
255
258
if neighbor_sides[boundary] == 1
256
259
# element in -x direction of boundary
257
260
for l in eachnode (dg), v in eachvariable (equations_parabolic)
258
- # OBS! `boundaries.u ` stores the interpolated *fluxes* and *not the solution*!
259
- boundaries . u [1 , v, l, boundary] = flux_viscous_x[v, nnodes (dg), l,
261
+ # OBS! `boundaries_u ` stores the interpolated *fluxes* and *not the solution*!
262
+ boundaries_u [1 , v, l, boundary] = flux_viscous_x[v, nnodes (dg), l,
260
263
element]
261
264
end
262
265
else # Element in +x direction of boundary
263
266
for l in eachnode (dg), v in eachvariable (equations_parabolic)
264
- # OBS! `boundaries.u ` stores the interpolated *fluxes* and *not the solution*!
265
- boundaries . u [2 , v, l, boundary] = flux_viscous_x[v, 1 , l, element]
267
+ # OBS! `boundaries_u ` stores the interpolated *fluxes* and *not the solution*!
268
+ boundaries_u [2 , v, l, boundary] = flux_viscous_x[v, 1 , l, element]
266
269
end
267
270
end
268
271
else # if orientations[boundary] == 2
269
272
# boundary in y-direction
270
273
if neighbor_sides[boundary] == 1
271
274
# element in -y direction of boundary
272
275
for l in eachnode (dg), v in eachvariable (equations_parabolic)
273
- # OBS! `boundaries.u ` stores the interpolated *fluxes* and *not the solution*!
274
- boundaries . u [1 , v, l, boundary] = flux_viscous_y[v, l, nnodes (dg),
276
+ # OBS! `boundaries_u ` stores the interpolated *fluxes* and *not the solution*!
277
+ boundaries_u [1 , v, l, boundary] = flux_viscous_y[v, l, nnodes (dg),
275
278
element]
276
279
end
277
280
else
278
281
# element in +y direction of boundary
279
282
for l in eachnode (dg), v in eachvariable (equations_parabolic)
280
- # OBS! `boundaries.u ` stores the interpolated *fluxes* and *not the solution*!
281
- boundaries . u [2 , v, l, boundary] = flux_viscous_y[v, l, 1 , element]
283
+ # OBS! `boundaries_u ` stores the interpolated *fluxes* and *not the solution*!
284
+ boundaries_u [2 , v, l, boundary] = flux_viscous_y[v, l, 1 , element]
282
285
end
283
286
end
284
287
end
@@ -608,7 +611,7 @@ function prolong2mortars!(cache, flux_viscous::Tuple{AbstractArray, AbstractArra
608
611
end
609
612
610
613
# NOTE: Use analogy to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms.
611
- # Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for
614
+ # Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for
612
615
# hyperbolic terms with conserved terms only, i.e., no nonconservative terms.
613
616
function calc_mortar_flux! (surface_flux_values,
614
617
mesh:: TreeMesh{2} ,
934
937
# where f(u) is the inviscid flux and g(u) is the viscous flux.
935
938
function apply_jacobian_parabolic! (du, mesh:: Union{TreeMesh{2}, P4estMesh{2}} ,
936
939
equations:: AbstractEquationsParabolic , dg:: DG , cache)
940
+ @unpack inverse_jacobian = cache. elements
941
+
937
942
@threaded for element in eachelement (dg, cache)
938
- factor = cache . elements . inverse_jacobian[element]
943
+ factor = inverse_jacobian[element]
939
944
940
945
for j in eachnode (dg), i in eachnode (dg)
941
946
for v in eachvariable (equations)
0 commit comments