Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A Understanding dummy variable in solution of 1D heat equation

  1. Nov 3, 2017 #1
    The solution of 1D diffusion equation on a half line (semi infinite) can be found with the help of Fourier Cosine Transform. Equation 3 is the attached figure is the solution of 1D diffusion equation (eq:1). I want to write a code for this equation in MATLAB/Python but I don't understand what value should I give for the dumy variable 'tau' .

    This variable is not defined at the start and only appears during solution process.
     
  2. jcsd
  3. Nov 3, 2017 #2

    Orodruin

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    You should not give it a value. It should be integrated from 0 to t.
     
  4. Nov 3, 2017 #3
    Can you please elaborate that how this will be implemented in the form of a code (in MATLAB or any other language). I am sorry I am still confused!!.
     
  5. Nov 7, 2017 #4
    I have implemented it in MATLAB with following code
    Code (Text):
    p = 100;      % number of steps
    ft1 =   sin(linspace(0,45,p));        
    D = 100; x = 40;
    t = 1:100;                                            
    ft2 = ft1*0.5;
    ftau = -(ft2-ft1)/10 ;                                                           %   dh/dx
    out_of_integral = sqrt(D/pi);
    fun = @(tau,ftau,t) ftau./(t-tau).*exp(-x^2./(4*D*(t-tau)));
    h = zeros(1,p);
    for i = 1:p
        q = integral(@(tau)fun(tau,ftau(i),t(i)),0,t(i));
        h(i) = q*out_of_integral;
    end
    plot(ft1)
    hold on;
    plot(ft2,'k')
    plot(ftau,'c')
    plot(h,'r')
    legend('Input','','f( \tau)','Output (observed)')
    xlabel('time(sec) at x = 40m')
    ylabel('temperature')
    But the result is little problematic i:e amplitude of observed signal at x=40 keeps on increasing with time. The input data (f(tau)) is not totally realistic but I am unable to understand this increase in observed amplitude. The result can be seen in this figure.
     
  6. Nov 7, 2017 #5

    Orodruin

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    In your function fun, ftau does not depend on tau...
    What is the function ##f(t)## that you are trying to use?
     
  7. Nov 7, 2017 #6
    If you look at equation 2 in figure attached in question, ##f(t)## is the change in ##h## at ##x=0##. I am assuming ##h(x=0,t)## to be a sine wave and ##f(t)## as change in ##h## with respect to ##x##. In the code ##ft1## represents ##h(x=0,t)##.
     
  8. Nov 7, 2017 #7

    Orodruin

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    No it doesn’t. You need to be much more careful with what you put in your script. And still that does not solve the fact that your ftau actually does not depend on tau in your integral.

    I suggest going through every line of your code and consider if it is really doing what you want it to do or not.

    Also note that you cannot assume ##h(0,t)## to have a particular form. The boundary condition at ##x=0## is a Neumann condition.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Understanding dummy variable in solution of 1D heat equation
Loading...