2
$\begingroup$

Edit:

I am trying to solve $$\frac{\partial u}{\partial t}+u\frac{\partial u}{\partial x}=\nu\frac{\partial^{2}u}{\partial x^{2}}\\ u(0,t)=0\nonumber \\ u(1,t)=0\nonumber \\ u(x,0)=\sin(\pi x)\\ 0<x<1,\; t>0$$ I take $u_n(x,t)$ as an approximation to $u(x,t)$ $$u_{n}(x,t)=\sum_{n=-4}^{2^j-1}\phi_{n}(x)c_{n}(t),\quad j\in \mathbb{N}$$ Here $\phi_n(x)$ are basis functions and i need to find the coeffiicients $c_n$. If i take the weight functions as $\phi_k(x)$ then weighted integral form of my problem will be as follows:

$$\int_{0}^{1}\phi_{k}(x)\sum_{n}\phi_{n}(x)c_{n}^{'}(t)dx+\int_{0}^{1}\phi_{k}(x)\left(\sum_{n}\phi_{n}(x)c_{n}(t)\right)\left(\sum_{l}\phi'_{l}(x)c_{l}(t)\right)dx\\-\int_{0}^{1}\phi_{k}(x)\nu\sum_{n}\phi''_{n}(x)c_{n}(t)dx=0$$ Now, set $$\delta_{k,n}=\int_{0}^{1}\phi_{k}\phi_{n}dx,\quad\Omega_{k,n}^{0,2}=\int_{0}^{1}\phi_{k}\phi''_{n},\quad\Omega_{k,n,l}^{0,0,1}=\int_{0}^{1}\phi_{k}\phi_{n}\phi'_{l}dx$$ Therefore discretized version of my problem becomes. $$\sum_{n=-4}^{0}c'_{n}(t)\delta_{k,n}+\sum_{n=-4}^{0}c_{n}(t)\sum_{l=-4}^{0}c_{l}(t)\Omega_{k,n,l}^{0,0,1}-\nu\sum_{n=-4}^{0}c_{n}(t)\Omega_{k,n}^{0,2}=0$$ $$\left\{ \mathbf{c}_{n}'(t)\right\} \left[\delta_{k,n}\right]+\left\{ \mathbf{c}_{n}(t)\right\} \left[\mathbf{c}_{l}(t)\Omega_{k,n,l}^{0,0,1}\right]-\nu\left\{ \mathbf{c}_{n}(t)\right\} \left[\Omega_{k,n}^{0,2}\right]=0\\ $$ Here i know the values of $\delta_{k,n}$, $\Omega_{k,n,l}^{0,0,1}$, $\Omega_{k,n}^{0,2}$ and $\nu$. Also $-4 \leq k,n,l \leq 2^j-1$. Approximating $c'_{n}(t),c_{n}(t)$ by $$c'_{n}(t)=\frac{c_{n}^{i+1}-c_{n}^{i}}{h}$$ $$c_{n}(t)=\frac{c_{n}^{i+1}+c_{n}^{i}}{2}$$ I get $$\mathbf c_{n}^{i+1}\left(\frac{\delta_{k,n}}{h}+\frac{\mathbf c_{l}\Omega_{k,n,l}^{0,0,1}}{2}-\nu\frac{\Omega_{k,n}^{0,2}}{2}\right)=\mathbf c_{n}^{i}\left(\frac{\delta_{k,n}}{h}-\frac{\mathbf c_{l}\Omega_{k,n,l}^{0,0,1}}{2}+\nu\frac{\Omega_{k,n}^{0,2}}{2}\right)$$ I know $c_n^i$ for $i=1$ from initial condition and i want to find $c_{n}^{i+1}$

If $c_l$ not get into the job i could find the $c_n$. But i am confused with $c_l$.

$\endgroup$
  • $\begingroup$ You write your differential equations as a single equation (you sum over $n=-4\ldots 0$). I suppose what you really meant to say is that you have 5 separate equations, without the sum, right? $\endgroup$ – Wolfgang Bangerth Oct 14 '13 at 14:10
  • $\begingroup$ Actually there is sum sign, for a more compact appearance i dropped sum signs and for simplicity i take $n=-4...0$.In fact the indices $n,k,l$ expand from $-4$ to $2^j-1$ where $j\in \mathbb{Z}$ $\endgroup$ – Ömer Oct 14 '13 at 14:22
  • 2
    $\begingroup$ But that makes no sense. You need to have one differential equation per variable, not one equation for all of them. $\endgroup$ – Wolfgang Bangerth Oct 15 '13 at 1:07
  • $\begingroup$ That is what i have learnt from the papers about subject. To be more clear also i edited my question. (I could not edit my first comment, there is a typo there, $j\in \mathbb{N}$ $\endgroup$ – Ömer Oct 15 '13 at 6:02
  • $\begingroup$ I would call your $\phi_k$ a test function (rather than a weight function). Then you "test" against all $\phi_k$ and, thus, you get as much equations as you have test functions. $\endgroup$ – Jan Oct 15 '13 at 10:37
7
$\begingroup$

What you describe as your time discretization is called the Crank-Nicolson scheme. For nonlinear differential equations it leads, as you have observed, to a nonlinear algebraic system that needs to be solved at each time step. The typical approach is to solve it with a Newton method -- in your case, that requires to solve a nonlinear system in 5 variables. Any introductory book on numerical methods will explain several different methods of doing that.

Equations such as yours are pretty straightforward and without great difficulty. Rather than implementing a numerical scheme yourself, may I suggest you simply describe the system of differential equations to Maple, Mathematica or Matlab and let them solve it to essentially any accuracy you desire?

$\endgroup$
5
$\begingroup$

As it looks to me your formulation of the discrete system is incomplete. You need to

  1. state your equation at each (grid?) point associated with $n$
  2. put back the summation over $l$ (grid) points in your last equation
  3. assign a time index $i+1$ or $i$ to your $c_l$s

In this way, you get a nonlinear (if you take $c_l^{n+1}$) or linear (if you take $c_l^{n}$) system of equations.

Depending on your discretization, the resulting system will have no / one / or multiple solutions. If it has one, you can use standard linear solvers or a Newton scheme to solve it. If not, you need more considerations and maybe a remodelling of your system.

You should also try, to write your equation system in matrix/vector form, which I find easier to handle than the formulation with the summations and indices.

$\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.