I have a question concerning how to solve a 1D PDE with inconsistent boundary conditions using mathematica. The function U is in x and t, with two derivatives in x and one in t. Here is what the PDE looks like (foam drainage): $$ c_1 U \frac{\delta U}{\delta x} + c_2 (\frac{1}{2\sqrt{U}} (\frac{\partial U}{\partial x})^{2} + \sqrt{U}\frac{\partial^2 U}{\partial x^2}) - \frac{\partial U}{\partial x} = \frac{\partial U}{\partial t} $$
Where C1 and C2 are constant parameters. (Yes, this could be simplified somewhat). We need three boundary conditions. For the IC
$$U[x,t=0] = z\:(a\:constant) $$
For the BCs there is first: $$U[x=0,t] = z\:(the\:same\:constant) $$
and the BC that is causing me to lose sleep:
$$U^{3/2}[x=L,t] = -\frac{c_2}{c_1}\frac{\partial U}{\partial x}[x=L,t]
$$
that is, at U[x=L,t] the first derivative in x is non-zero (it is "z^(3/2)", in my code, z = 1), but U[x,t=0] is constant (and so a derivative in x for U[x=L,t=0] should be zero). Thus the inconsistent boundary conditions.
In order to clarify what I am doing, here is the code block I built up from the heat equation step by step. I didn't have any problems until adding the Neumann BC for this problem:
C1 = 0.1;
C2 = 0.1;
L = 1;
tfinal34 = 1;
GovEqFD =
C2 Sqrt[u[x, t]] D[u[x, t], {x, 2}] +
C2 (1/(2 Sqrt[ u[x, t]])) (D[u[x, t], x])^2 +
C1 (u[x, t] - 1) D[u[x, t], x] - D[u[x, t], t] == 0
BC34 =
{u[0, t] == 1,
-C2/C1 (D[u[x, t], x] /. x -> L) == (u[L, t])^(3/2) /. x -> L)]}
IC34 = u[x, 0] == 1
EqsFD4 = Join[{GovEqFD}, BC34, {IC34}]
FDsol4 = NDSolve[EqsFD4, u[x, t], {x, 0, L}, {t, 0, tfinal34}]
In order to try to find a solution around the inconsistent boundary conditions I have looked into the Method of Lines, but to be honest, I haven't gone too far into trying to figure out how to code it yet. It's not clear to me from the documentation exactly how complicated it would be to use FDM on the above governing equation.
In attempting a work around, I have thought to use WhenEvent to define the boundary condition @ t= 0 and also for t>0. I didn't have any problem with using WhenEvent in terms of getting warnings.
I changed the list for BC34 to:
BC34 =
{u[0, t] == 1,
-C2/C1 (D[u[x, t], x] /. {x -> L,t -> 0}) == 0,
WhenEvent[
(t > 0), (-C2/C1 (D[u[x, t], x] /. x -> L) ==
(u[L, t])^(3/2) /. x -> L)]}
As I said there were no warnings, and I saw that beloved output for the interpolating function. However, in plotting I see the solution is the same unstable plane it shouldn't be for the inconsistent solution. It seems that the BC remains -C2/C1 (D[u[x, t], x] /. x -> L) == 0, for times greater than t==0. Can someone help me understand if I am using WhenEvent incorrectly, or how I might implement it in this case to resolve the inconsistency in the BC @ x=L and IC? Or perhaps suggest other solution strategies?
If there is anyway I can clarify my question, formatting, or the information I am providing, please let me know.
Method -> {"MethodOfLines", "DifferentiateBoundaryConditions" -> {True, "ScaleFactor" -> 1}}
is enough to solve your problem. (The warning will still be there, but don't worry about it. ) $\endgroup$