Skip to content

PeriodicDirichletBC for integrating periodic ODEs #4

Open

Description

@mrhardman

Create a new PeriodicDirichletBC <: AbstractBoundaryCondition to modify how periodic boundary conditions are treated for integration. See #3. In #3 we set both constants in the domain as with a normal Dirichlet boundary condition, but because the system is periodic, the value of these constants must be identical. In a future implementation we could set the first row of the 1D matrix to be

(1, 0, 0, ..., 0, -1)

and set the last row to be

(0, 0, ...., 0, 0, 1)

so that the above code would be modified to

    # form the weak RHS
    mul!(weak_rhs,mass_matrix,f)
    # impose the PeriodicDirichlet BC to fix the constant offset
    weak_rhs[1] = 0.0
    weak_rhs[end] = exact_phi[end]
    # solve the system
    ldiv!(phi, lu_Laplacian, weak_rhs)

In this modified version, there is clearly only one available constant to set when integrating ODEs with periodic boundary conditions. However, we still require the same number of lines of code, and the need for an additional boundary condition type means that we defer the implementation of the feature this way to a future PR where it is explicitly required.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions