A Understanding dummy variable in solution of 1D heat equation

Atr cheema
Messages
67
Reaction score
0
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 https://ibb.co/ctF8Fw 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.
 
Physics news on Phys.org
You should not give it a value. It should be integrated from 0 to t.
 
  • Like
Likes Atr cheema
Orodruin said:
You should not give it a value. It should be integrated from 0 to t.
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!.
 
I have implemented it in MATLAB with following code
Code:
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.
 
In your function fun, ftau does not depend on tau...
What is the function ##f(t)## that you are trying to use?
 
Orodruin said:
In your function fun, ftau does not depend on tau...
What is the function ##f(t)## that you are trying to use?
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)##.
 
Atr cheema said:
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)##.
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.
 
Back
Top