|
291 | 291 | secondary_i_node_index, secondary_j_node_index, |
292 | 292 | secondary_direction_index, |
293 | 293 | secondary_element_index) |
| 294 | + calc_interface_flux!(surface_flux_values, mesh, have_nonconservative_terms, |
| 295 | + combine_conservative_and_nonconservative_fluxes(surface_integral.surface_flux, |
| 296 | + equations), |
| 297 | + equations, surface_integral, dg, cache, interface_index, |
| 298 | + normal_direction, primary_i_node_index, primary_j_node_index, |
| 299 | + primary_direction_index, primary_element_index, |
| 300 | + secondary_i_node_index, secondary_j_node_index, |
| 301 | + secondary_direction_index, secondary_element_index) |
| 302 | + return nothing |
| 303 | +end |
| 304 | + |
| 305 | +@inline function calc_interface_flux!(surface_flux_values, |
| 306 | + mesh::Union{P4estMesh{3}, T8codeMesh{3}}, |
| 307 | + have_nonconservative_terms::True, |
| 308 | + combine_conservative_and_nonconservative_fluxes::False, |
| 309 | + equations, |
| 310 | + surface_integral, dg::DG, cache, |
| 311 | + interface_index, normal_direction, |
| 312 | + primary_i_node_index, primary_j_node_index, |
| 313 | + primary_direction_index, primary_element_index, |
| 314 | + secondary_i_node_index, secondary_j_node_index, |
| 315 | + secondary_direction_index, |
| 316 | + secondary_element_index) |
294 | 317 | @unpack u = cache.interfaces |
295 | 318 | surface_flux, nonconservative_flux = surface_integral.surface_flux |
296 | 319 |
|
|
320 | 343 | return nothing |
321 | 344 | end |
322 | 345 |
|
| 346 | +@inline function calc_interface_flux!(surface_flux_values, |
| 347 | + mesh::Union{P4estMesh{3}, T8codeMesh{3}}, |
| 348 | + have_nonconservative_terms::True, |
| 349 | + combine_conservative_and_nonconservative_fluxes::True, |
| 350 | + equations, |
| 351 | + surface_integral, dg::DG, cache, |
| 352 | + interface_index, normal_direction, |
| 353 | + primary_i_node_index, primary_j_node_index, |
| 354 | + primary_direction_index, primary_element_index, |
| 355 | + secondary_i_node_index, secondary_j_node_index, |
| 356 | + secondary_direction_index, |
| 357 | + secondary_element_index) |
| 358 | + @unpack u = cache.interfaces |
| 359 | + @unpack surface_flux = surface_integral |
| 360 | + u_ll, u_rr = get_surface_node_vars(u, equations, dg, primary_i_node_index, |
| 361 | + primary_j_node_index, interface_index) |
| 362 | + |
| 363 | + flux_left, flux_right = surface_flux(u_ll, u_rr, normal_direction, equations) |
| 364 | + |
| 365 | + # Store the flux with nonconservative terms on the primary and secondary elements |
| 366 | + for v in eachvariable(equations) |
| 367 | + surface_flux_values[v, primary_i_node_index, primary_j_node_index, |
| 368 | + primary_direction_index, primary_element_index] = flux_left[v] |
| 369 | + surface_flux_values[v, secondary_i_node_index, secondary_j_node_index, |
| 370 | + secondary_direction_index, secondary_element_index] = -flux_right[v] |
| 371 | + end |
| 372 | + |
| 373 | + return nothing |
| 374 | +end |
| 375 | + |
323 | 376 | function prolong2boundaries!(cache, u, |
324 | 377 | mesh::Union{P4estMesh{3}, T8codeMesh{3}}, |
325 | 378 | equations, surface_integral, dg::DG) |
|
452 | 505 | k_index, i_node_index, j_node_index, |
453 | 506 | direction_index, |
454 | 507 | element_index, boundary_index) |
| 508 | + calc_boundary_flux!(surface_flux_values, t, boundary_condition, mesh, |
| 509 | + nonconservative_terms, |
| 510 | + combine_conservative_and_nonconservative_fluxes(surface_integral.surface_flux, |
| 511 | + equations), |
| 512 | + equations, |
| 513 | + surface_integral, dg, cache, |
| 514 | + i_index, j_index, k_index, i_node_index, j_node_index, |
| 515 | + direction_index, element_index, boundary_index) |
| 516 | + return nothing |
| 517 | +end |
| 518 | + |
| 519 | +@inline function calc_boundary_flux!(surface_flux_values, t, boundary_condition, |
| 520 | + mesh::Union{P4estMesh{3}, T8codeMesh{3}}, |
| 521 | + nonconservative_terms::True, |
| 522 | + combine_conservative_and_nonconservative_fluxes::False, |
| 523 | + equations, |
| 524 | + surface_integral, dg::DG, cache, i_index, j_index, |
| 525 | + k_index, i_node_index, j_node_index, |
| 526 | + direction_index, |
| 527 | + element_index, boundary_index) |
455 | 528 | @unpack boundaries = cache |
456 | 529 | @unpack node_coordinates, contravariant_vectors = cache.elements |
457 | 530 | @unpack surface_flux = surface_integral |
|
486 | 559 | return nothing |
487 | 560 | end |
488 | 561 |
|
| 562 | +@inline function calc_boundary_flux!(surface_flux_values, t, boundary_condition, |
| 563 | + mesh::Union{P4estMesh{3}, T8codeMesh{3}}, |
| 564 | + nonconservative_terms::True, |
| 565 | + combine_conservative_and_nonconservative_fluxes::True, |
| 566 | + equations, |
| 567 | + surface_integral, dg::DG, cache, i_index, j_index, |
| 568 | + k_index, i_node_index, j_node_index, |
| 569 | + direction_index, |
| 570 | + element_index, boundary_index) |
| 571 | + @unpack boundaries = cache |
| 572 | + @unpack node_coordinates, contravariant_vectors = cache.elements |
| 573 | + @unpack surface_flux = surface_integral |
| 574 | + |
| 575 | + # Extract solution data from boundary container |
| 576 | + u_inner = get_node_vars(boundaries.u, equations, dg, i_node_index, j_node_index, |
| 577 | + boundary_index) |
| 578 | + |
| 579 | + # Outward-pointing normal direction (not normalized) |
| 580 | + normal_direction = get_normal_direction(direction_index, contravariant_vectors, |
| 581 | + i_index, j_index, k_index, element_index) |
| 582 | + |
| 583 | + # Coordinates at boundary node |
| 584 | + x = get_node_coords(node_coordinates, equations, dg, |
| 585 | + i_index, j_index, k_index, element_index) |
| 586 | + |
| 587 | + # Call pointwise numerical flux functions for the conservative and nonconservative part |
| 588 | + # in the normal direction on the boundary |
| 589 | + flux = boundary_condition(u_inner, normal_direction, x, t, |
| 590 | + surface_flux, equations) |
| 591 | + |
| 592 | + # Copy flux to element storage in the correct orientation |
| 593 | + for v in eachvariable(equations) |
| 594 | + surface_flux_values[v, i_node_index, j_node_index, |
| 595 | + direction_index, element_index] = flux[v] |
| 596 | + end |
| 597 | + |
| 598 | + return nothing |
| 599 | +end |
| 600 | + |
489 | 601 | function prolong2mortars!(cache, u, |
490 | 602 | mesh::Union{P4estMesh{3}, T8codeMesh{3}}, equations, |
491 | 603 | mortar_l2::LobattoLegendreMortarL2, |
|
0 commit comments