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

Question The Neumann Boundary Value in PDE #1990

Open
tony21248772 opened this issue Jun 18, 2024 · 3 comments
Open

Question The Neumann Boundary Value in PDE #1990

tony21248772 opened this issue Jun 18, 2024 · 3 comments
Labels

Comments

@tony21248772
Copy link

image

Copy link

boring-cyborg bot commented Jun 18, 2024

Thanks for posting! It might take a while before we look at your issue, so don't worry if there seems to be no feedback. We'll get to it.

@lballabio
Copy link
Owner

The Neumann condition fixes the value $V$ of the first derivative on the boundary. On a finite-difference grid, the derivative at the (e.g., left) boundary is the one-sided numerical derivative $\displaystyle\frac{u_1 - u_0}{h}$ where $h$ is the distance between the corresponding nodes on the grid. So the Neumann condition can be written as

$$\frac{u_1 - u_0}{h} = V$$

and in order to enforce it, in applyAfterApplying we modify the value of $u_0$ by setting it as

$$u_0 = u_1 - h \times V$$

which is equivalent to the above.
Now, the code in applyAfterApplying seems to be missing the $h$, but that's because the documentation of the NeumannBC class says:

//! Neumann boundary condition (i.e., constant derivative)
/*! \warning The value passed must not be the value of the derivative.
             Instead, it must be comprehensive of the grid step
             between the first two points--i.e., it must be the
             difference between f[0] and f[1].

that is, the variable value_ stored in the class corresponds to $h \times V$.

Copy link
Contributor

This issue was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.

@github-actions github-actions bot added the stale label Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants