0
$\begingroup$

I am attempting to set up a Neumann boundary condition for a PDE that evaluates differently for different times. I am using Piecewise to do this. Here is the Boundary condition:

$$U^{3/2}[x=L,t] = -\frac{c_2}{c_1}\frac{\partial U}{\partial x}[x=L,t] $$

In this problem, the initial condition is defined to be:

$$U[x,t=0] = z\:(a\:constant) $$

One can see that at t=0, there is an inconsistency at x = L. I have been seeking a work around for this, First by introducing the BC as piecewise defined, such that at t = 0, the derivative of the surface at the edge is 0, and at t > 0 it is as seen above. Here is the code I have been using for the definition of the boundary condition:

BC = -C2/C1 (D[u[x, t], x] /. x -> L) == 
    Piecewise[{ {1, t = 0}, {((u[x, t])^(3/2) /. x -> L), t > 0 } } ] 

This is the output: $$-1. u^{(1,0)}(1,t)=\left( \begin{array}{cc} \begin{array}{cc} u(1,t)^{3/2} & t>0 \\ 1 & t\leq 0 \\ 0 & True \\ \end{array} \\ \end{array} \right) $$

Beyond that I don't understand the third line "0 True", this is not working to generate a consitent boundary condition at x=L and t=0 for NDSolve. Am I using [Piecewise] incorrectly, or misapplying it here?

$\endgroup$
3
$\begingroup$

The fundamental boundary condition problem is this: D[u[x, t] is required to be zero at x == L, t = 0 but to be one at t infinitesimal larger. Instead, a smooth transitions is required, both on physical and mathematical grounds. For instance,

C1 = 1/10; C2 = 1/10; L = 1; tfinal34 = 4;  
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) == (1 - Exp[-10 t]) u[L, t]^(3/2)};
IC34 = u[x, 0] == 1;
FDsol4 = NDSolve[{GovEqFD, BC34, IC34}, u[x, t], {x, 0, L}, {t, 0, tfinal34}] // First;
Plot3D[u[x, t] /. FDsol4, {x, 0, L}, {t, 0, tfinal34}, PlotRange -> All]

enter image description here

produces the desired solution.

Addendum: Steady State Solution

It may be of interest to compute the steady state solution, obtained simply by deleting time dependence from the PDE.

s = NDSolve[{C2 Sqrt[v[x]] D[v[x], {x, 2}] + C2 (1/(2 Sqrt[ v[x]])) (D[v[x], x])^2 +    
    C1 (v[x] - 1) D[v[x], x] == 0, v[0] == 1, -C2/C1 (D[v[x], x] /. x -> L)== v[L]^(3/2)}, 
    v[x], {x, 0, L}, Method -> {"Shooting", 
    "StartingInitialConditions" -> {v[0] == 1, v'[0] == -1/4}}] // First;
Plot[{Evaluate[u[x, t] /. FDsol4 /. t -> {1, 2, 4}], v[x] /. s}, {x, 0, L}, 
    AxesLabel -> {x, "u, v"}]

enter image description here

The red curve is the steady state solution. The time-dependent solution converges to it at about t == 10.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.