Skip to content

Feature/111 inflow outflow bcs #112

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

Open
wants to merge 4 commits into
base: v0.1.0-dev
Choose a base branch
from

Conversation

fluidnumerics-joe
Copy link
Member

@fluidnumerics-joe fluidnumerics-joe commented Apr 15, 2025

This PR adds inflow and outflow boundary condition integer parameters and overridable type bound procedures in the template model classes for 2D and 3D models.

Resolves #111

@fluidnumerics-joe fluidnumerics-joe changed the base branch from main to v0.1.0-dev April 15, 2025 19:41
Copy link

codecov bot commented Apr 15, 2025

Codecov Report

Attention: Patch coverage is 4.19580% with 274 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/SELF_CIGLES3D_t.f90 0.00% 216 Missing ⚠️
src/SELF_DGModel3D_t.f90 15.38% 33 Missing ⚠️
src/SELF_DGModel2D_t.f90 20.00% 24 Missing ⚠️
src/cpu/SELF_CIGLES3D.f90 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@fluidnumerics-joe fluidnumerics-joe marked this pull request as ready for review April 24, 2025 02:18
@fluidnumerics-joe fluidnumerics-joe self-assigned this Apr 24, 2025
Copy link
Collaborator

@garrettbyrd garrettbyrd left a comment

Choose a reason for hiding this comment

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

It would make sense to add some simple tests for each of the new BCs in 2D and 3D to satisfy codecov.

This would likely be under a new PR, but with the variety of BCs available it could be useful to add a dedicated "Boundary Conditions" page under "Mesh Generation" in the docs.

!!
!! \begin{equation}
!! \overleftrightarrow{f} = \begin{pmatrix}
!! \rho u \hat{x} + \rho v \hat{y} + \rho w \hat{z} \\
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consistent spacing

Suggested change
!! \rho u \hat{x} + \rho v \hat{y} + \rho w \hat{z} \\
!! \rho u \hat{x} + \rho v \hat{y} + \rho w \hat{z} \\

integer :: ndiagnostics

! Model parameters
real(prec) :: p0 = 10.0_prec**(5) ! Reference pressure for potential temperature ()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you want Pascal as the unit here?

Suggested change
real(prec) :: p0 = 10.0_prec**(5) ! Reference pressure for potential temperature ()
real(prec) :: p0 = 10.0_prec**(5) ! Reference pressure for potential temperature (Pa)

nhat = this%geometry%nhat%boundary(i,j,iEl,1,1:2)

this%solution%extBoundary(i,j,iEl,1:this%nvar) = &
this%hbc2d_noslip(this%solution%boundary(i,j,iEl,1:this%nvar),nhat)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Capitalize for consistency

Suggested change
this%hbc2d_noslip(this%solution%boundary(i,j,iEl,1:this%nvar),nhat)
this%hbc2d_NoSlip(this%solution%boundary(i,j,iEl,1:this%nvar),nhat)

nhat = this%geometry%nhat%boundary(i,j,iEl,1,1:2)

this%solutiongradient%extBoundary(i,j,iEl,1:this%nvar,1:2) = &
this%pbc2d_noslip(this%solution%boundary(i,j,iEl,1:this%nvar),nhat)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
this%pbc2d_noslip(this%solution%boundary(i,j,iEl,1:this%nvar),nhat)
this%pbc2d_NoSlip(this%solution%boundary(i,j,iEl,1:this%nvar),nhat)

@fluidnumerics-joe
Copy link
Member Author

It would make sense to add some simple tests for each of the new BCs in 2D and 3D to satisfy codecov.

This would likely be under a new PR, but with the variety of BCs available it could be useful to add a dedicated "Boundary Conditions" page under "Mesh Generation" in the docs.

While I agree with this, I've been thinking on this issue of the ever growing number of potential boundary conditions.
As I'm writing this, I'm inclined to kill this PR in favor of a different approach here.

What I'd propose is a new module with a class defined for mapping boundary conditions to procedure pointers. This class would be something like

type SELF_BoundaryCondition
  procedure(SELF_BCFunction),pointer :: bcfunction
  integer :: bcflag_id
  character(len=SELF_BCNAME_LENGTH) :: bcflag_name

We could set such a class up as a linked list which could allow for dynamic insertion of boundary conditions on the fly.. Having methods like register_boundary_condition that could add a new procedure pointer with a new flag id and name would be kinda neat. With this approach, the boundary condition loops could be changed to something like

do concurrent(j=1:4,iel=1:this%mesh%nElem)

      bcid = this%mesh%sideInfo(5,j,iEl) ! Boundary Condition ID
      e2 = this%mesh%sideInfo(3,j,iEl) ! Neighboring Element ID

      if(e2 == 0) then
        ! Get a function pointer for the boundary condition id
        bfunc = this%boundaryconditions%GetBCFunc_for_id( bcid )
        
          do i = 1,this%solution%interp%N+1 ! Loop over quadrature points
            x = this%geometry%x%boundary(i,j,iEl,1,1:2)

            this%solution%extBoundary(i,j,iEl,1:this%nvar) = bcfunc(x,this%t)
      endif

    enddo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add inflow and outflow in-built boundary condition methods and mesh flags
2 participants