Numerical Enforcing of "No-flux" Boundary Condition with Higher Order Partial Derivatives I want to numerically enforce the following boundary condition at $x=0$:
$$ \frac{\partial^3 u}{\partial x^3} = \left(\frac{3}{2}u^2-\frac{1}{2}\right)\frac{\partial u}{\partial x} $$
Is this possible with finite differences? I have the following schemes to approximate these terms:
$$\frac{\partial^3 u}{\partial x^3}|_{(0,t_n)} \approx\frac{u_3^n-3u_2^n+3u_1^n-u_0^n}{h^3} $$
$$ u|_{(0,t_n)} \approx u_0^n $$
Now for the first derivative I can come up with both first-order (to keep things relatively simple) or a third-order scheme (to keep the order of accuracy consistent) but in either case, I am not really sure how this equation will be able to be numerically enforced. Is there a simpler approximation of the third derivative that involves less points - should I look for something like that in order to proceed or is it possible to proceed with what I have so far?
My concern is that there are a lot of unknowns and essentially to make this true, I would need to make multiple assumptions about the values of $u$ around $x=0$. For example, I could probably require $u_1=u_0$ and this would lead to a zero RHS (assuming I'm using the first-order scheme to approximate the first partial derivative). Nevertheless, I would still need to make another assumption to make the third partial derivative zero. Is there some way to have one condition that zeros them out? Would that come from the specific problem I'm working on?
Just as a reference, for the first partial derivative I could use either:
$$\frac{\partial u}{\partial x}|_{(0,t_n)} \approx \frac{u_1^n-u_0^n}{h}  $$
or
$$\frac{\partial u}{\partial x}|_{(0,t_n)} \approx \frac{2u_3^n-9u_2^n+18u_1^n-11u_0^n}{6h}  $$
EDIT: For example, if I use the third-order approximation, setting the numerators of the two approximations equal to each other and zero, I could set $u_2^n = -\frac{5}{3}u_0^n$ and $u_3^n = -15u_1^n$ but I have a feeling this is going to introduce some unwanted behavior into my scheme.
 A: Finite differences can be used when you know you have good reason to believe that the solution of the differential equation will be somewhat smooth. This requires in general theoretical study.
In that case, the Taylor expansion is valid and can be used to derive the finite difference approximations you are speaking of.
In your post, you already show multiple candidates for approximating the derivatives. Take for instance a look at this Wikipedia page, which groups finite difference schemes into different categories depending on order of the approximated derivative, their "orientation" (left, right,or both) and accuracy.
Coming to your question: Note that you have an ODE here (only derivatives with respect to $x$). Typically, you transform it into a system of first order through defining $$u_0 := u, \quad u_1 := u', \quad u_2:= u''$$
you then have:
$$\begin{pmatrix}u_0 \\ u_1 \\ u_2 \end{pmatrix}' = \begin{pmatrix} u_1 \\ u_2 \\ (1.5 u_0^2 -0.5)u_1 \end{pmatrix}$$
Since the RHS is actually (as a polynomial) in $C^\infty$ and thus locally Lipschitz, thus there exists a local unique solution by Picard Lindelöf.
Making statements on the differentiability of your solution is much harder - even smooth RHS can lead to blowing up solutions.
So strictly speaking, it is very hard to tell what the regularity of your solution will be and thus to which order Taylor expansions are allowed. In practice, however, people do not bother too much about this and usually throw some Runge-Kutta methods of high order onto their problems and start looking closer into things when their solutions blow up.
