Time for action – comparing with analytical solution

  1. First we type in the physical constants given by the problem. Let us use Q = 10 kiloWatts per meter cubed (kW m-3), k = 319 Watts per Kelvin per meter (W K-1 m-1), L = 0.5 meter and T0 = 273 Kelvin:
    octave:8> Q=10000; k = 319; L=0.5; T_0=273;
    
  2. We then need to specify the number of grid points (including the boundary grid points):
    octave:9>N_grids = 20;
    

    This gives a grid spacing of

    Time for action – comparing with analytical solution

    :

    octave:10> delta = L/(N_grid-1);
    
  3. From this, we can set the source term and boundary values:
    octave:11> b = -Q/k*delta^2*ones(N_grids,1);
    octave:12> b(1)=b(N_grids)=T_0;
    
  4. Next, we need the coefficient matrix which we ...

Get GNU Octave now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.