-
Notifications
You must be signed in to change notification settings - Fork 95
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
Multiple boundary conditions and third derivative #2798
Comments
Hi @ThitiACHR, thanks @dschwoerer ! BOUT++ sets boundary conditions by setting the value of the boundary cells: The boundary is at cell edges, half-way between cell centers. The default methods are 2nd-order accurate, so only use one boundary cell. In that case only one boundary condition can be applied. To apply two boundary conditions on the same boundary (e.g on p and p''') there must be two boundary cells, which are only used for 4th-order finite difference methods. e.g The final cell in Y inside the domain is at y = mesh->yend. We have cells like this:
where | marks cell edges, and |X| is the boundary location. See e.g. This iterates over the boundary, ensuring that only the processors at the boundary apply the boundary condition:
Then sets each of the boundary conditions, starting with
and sets the boundary condition using a mid-point method:
That boundary condition is only applying one (Dirichlet) boundary condition, setting |
Hi @dschwoerer and @bendudson Thank you for your very informative reply. I would like to discuss some more about the model. Could you send me the Slack invitation link to my email: [email protected]? @bendudson |
Hi @bendudson [mesh] [mesh:ddy] # using 4th order central finite different for DDY and D2DY2 [p] To impose the boundary conditions, I set the values in the boundary cells as shown below, to make
The result is shown below. The simulation gives me such that p' = 0 at y=mesh->ystart as expected, but p''' is not 0. I think this is because the value of D2DY2(p) in the boundary cells is not followed as I set above. This is what you meant. Do I understand correctly? If you have time, please point this out. |
You need to manually do the taylor expansion around the point of the boundary, and then set the appropriate terms for the inversion, to then extrapolate into the boundary. I tried to write it up here: That you could use as a starting point, to set all the desired quantities. Note that for setting third order derivatives, you need a relative high order scheme. calling DDX/D2DX2 computes the derivate and gives you a field that contains the derivative. Of course you can change that field, but there is no code in BOUT++ to do the inverse and get back to the original field. So updating the original field via the operators will not work. |
I want to make sure I understand correctly. There will be two things I have to be aware of.
In this context what does the inversion mean? Thank you in advance. |
I am not sure I get what you are trying to say. Consider the following 1d grid. The numbers are the cells, the Assume you want to write a BC for where the This gives you a linear system of equation, for your coefficients. I have linked a script that does the inversion for you. It does not right now allow for setting 3rd derivatives, but should be easily extendable to do so. I hope that helps. Verifying the derivative is of course helpful :-) |
I apologize for making you confused. This is what I meant
where the values of
where we know that at I have seen in your stencils.md, you call |
Since my work relates to the calculation of gradient and curvature, the first and second derivative, respectively, I have to set the boundary conditions as follows:
My questions are
I am new to BOUT++. If anyone knows how to do it, please help. All answers are welcome.
The text was updated successfully, but these errors were encountered: