Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify LaplaceDiffusion1D, LaplaceDiffusion2D, and LaplaceDiffusion3D BCs #1421

Merged
merged 9 commits into from
Apr 28, 2024

Conversation

jlchan
Copy link
Contributor

@jlchan jlchan commented May 2, 2023

Closes #1418

@jlchan jlchan linked an issue May 2, 2023 that may be closed by this pull request
Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sloede What's your take on this? If I remember correctly, we wanted to keep some dimension-agnostic code like this in each dimension-specific source file to make it easier to read, e.g.,

# TODO: Taal dimension agnostic
function calc_boundary_flux!(cache, t, boundary_condition::BoundaryConditionPeriodic,
mesh::TreeMesh{1}, equations, surface_integral, dg::DG)
@assert isempty(eachboundary(dg, cache))
end

@codecov
Copy link

codecov bot commented May 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.55%. Comparing base (b4fb1db) to head (553bcca).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1421      +/-   ##
==========================================
+ Coverage   89.52%   89.55%   +0.03%     
==========================================
  Files         448      448              
  Lines       35995    35979      -16     
==========================================
- Hits        32223    32219       -4     
+ Misses       3772     3760      -12     
Flag Coverage Δ
unittests 89.55% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@DanielDoehring DanielDoehring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case we also would like to delete the 3D stuff as well (which moved in in the mean time).

# Dirichlet-type boundary condition for use with a parabolic solver in weak form
@inline function (boundary_condition::BoundaryConditionDirichlet)(flux_inner, u_inner,
normal::AbstractVector,
x, t,
operator_type::Gradient,
equations_parabolic::LaplaceDiffusion3D)
return boundary_condition.boundary_value_function(x, t, equations_parabolic)
end
@inline function (boundary_condition::BoundaryConditionDirichlet)(flux_inner, u_inner,
normal::AbstractVector,
x, t,
operator_type::Divergence,
equations_parabolic::LaplaceDiffusion3D)
return flux_inner
end
@inline function (boundary_condition::BoundaryConditionNeumann)(flux_inner, u_inner,
normal::AbstractVector,
x, t,
operator_type::Divergence,
equations_parabolic::LaplaceDiffusion3D)
return boundary_condition.boundary_normal_flux_function(x, t, equations_parabolic)
end
@inline function (boundary_condition::BoundaryConditionNeumann)(flux_inner, u_inner,
normal::AbstractVector,
x, t,
operator_type::Gradient,
equations_parabolic::LaplaceDiffusion3D)
return flux_inner
end

@DanielDoehring DanielDoehring added the refactoring Refactoring code without functional changes label Apr 7, 2024
@DanielDoehring DanielDoehring changed the title Unify LaplaceDiffusion1D and LaplaceDiffusion2D BCs Unify LaplaceDiffusion1D, LaplaceDiffusion2D, and LaplaceDiffusion3D BCs Apr 7, 2024
DanielDoehring
DanielDoehring previously approved these changes Apr 7, 2024
@ranocha ranocha requested a review from sloede April 9, 2024 14:45
@ranocha
Copy link
Member

ranocha commented Apr 9, 2024

@sloede What's your take on this? If I remember correctly, we wanted to keep some dimension-agnostic code like this in each dimension-specific source file to make it easier to read, e.g.,

# TODO: Taal dimension agnostic
function calc_boundary_flux!(cache, t, boundary_condition::BoundaryConditionPeriodic,
mesh::TreeMesh{1}, equations, surface_integral, dg::DG)
@assert isempty(eachboundary(dg, cache))
end

I would like to see a review from @sloede before merging this.

Copy link
Member

@sloede sloede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the remaining issue resolved, this LGTM

src/equations/laplace_diffusion_3d.jl Show resolved Hide resolved
Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
@sloede sloede enabled auto-merge (squash) April 26, 2024 08:38
@DanielDoehring DanielDoehring self-requested a review April 26, 2024 08:59
@ranocha ranocha disabled auto-merge April 28, 2024 10:05
@ranocha ranocha merged commit 73a1513 into trixi-framework:main Apr 28, 2024
21 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactoring code without functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

General versions of boundary fluxes grad/div for 1D/2D/3D
4 participants