Recent content by hanabachi

  1. H

    I Crank Nicolson method to solve a PDE

    the nonlinear terms comes from the nonlinear PDE, and that what I got from Crank-Nicolson method
  2. H

    I Crank Nicolson method to solve a PDE

    b is RHS and A should be the factors a,b and c that I forgot to replace them in this experssion RHS= (1+2*0.003*r)*U(i,N)+0.003*r*U(i+1,N)+0.003*r*U(i-1,N)-r*dx*U(i,N)*(U(i,N)-U(i-1,N));
  3. H

    I Crank Nicolson method to solve a PDE

    Yes, that what it should looks like
  4. H

    I Crank Nicolson method to solve a PDE

    yes, here it is \begin{array}{l} \frac{U_{i}^{n+1/2} -U_{i}^{n}}{\Delta t/2} =-U_{i}^{n}\frac{U_{i}^{n} -U_{i-1}^{n}}{\Delta x} \ +0.003\ \frac{U_{i+1}^{n} -2*U_{i}^{n} +U_{i-1}^{n}}{\Delta x^{2}}\\ \\ \frac{U_{i}^{n+1} -U_{i}^{n+1/2}}{\Delta t/2} =-U_{i}^{n+1}\frac{U_{i}^{n+1}...
  5. H

    I Crank Nicolson method to solve a PDE

    Yes, this is what I'm using to solve the pde. please check the attached file
  6. H

    I Crank Nicolson method to solve a PDE

    0 should be negative signs (-), so the equation is the multiplication of U by its first derivative dU/dx. So the equation is not linear
  7. H

    I Crank Nicolson method to solve a PDE

    actually the equation is dU/dt=0U*du/dx+0.003*dU2/dx2
  8. H

    I Crank Nicolson method to solve a PDE

    I used this dt = 1/3300
  9. H

    I Crank Nicolson method to solve a PDE

    Here is the code %% Crank-Nicolson Method clear variables close all % 1. Space steps xa = 0; xb = 1; dx = 1/40; N = (xb-xa)/dx ; x = xa:dx:xb; %2.Time steps ta = 0; tb = 0.5; dt = 1/3300; M = (tb-ta)/dt ; t = ta:dt:tb; %3. Controling Parameters %4. Define equations A, B , C and phi(x,t) A =...
  10. H

    I Crank Nicolson method to solve a PDE

    I though the code is visible in the attached files. Thank you for letting me know
  11. H

    I Crank Nicolson method to solve a PDE

    Hello, I wrote a code to solve a non-linear PDE using Canrk nicolson method, but I'm still not able to get a correct final results. can anyone tell me what wrong with it?
Back
Top