Variable density in heat diffusion equation

6 visualizaciones (últimos 30 días)
Matthew Hunt
Matthew Hunt el 30 de Mayo de 2018
Comentada: Torsten el 1 de Jun. de 2018
Suppose I have a heat diffusion equation:
rho(x)*c(x)*dT/dt=d/dx(k(x)*dT/dx)
Where rho(x) is the density, c(x) is the heat capacity and k(x) is thermal diffusivity, all being position dependent. Would I need to specify these as vectors in pdepe instead of simple numbers?
  1 comentario
Torsten
Torsten el 30 de Mayo de 2018
Just like the initial conditions: as simple numbers dependent on x.

Iniciar sesión para comentar.

Respuestas (2)

Matthew Hunt
Matthew Hunt el 31 de Mayo de 2018
So I do the interp1 trick you demonstrated before?

Matthew Hunt
Matthew Hunt el 31 de Mayo de 2018
So I used the following code:
function [CC, FF, SS]=battery_GE(x,t,u,DuDx)
global rho; global c_th; global a_1;global k; global epsilon; global c_1;
global D; global a_2; global sigma; global b; global c_2; global x_vector;
D_var=interp1(x_vector,D,x);
k_var=interp1(x_vector,k,x);
sigma_var=interp1(x_vector,sigma,x);
epsilon_var=interp1(x_vector,epsilon,x);
rho_var=interp1(x_vector,rho,x);
c_var=interp1(x_vector,c_th,x);
CC=[rho_var.*c_var; 0; 1];
FF=[a_1*k_var; epsilon; c_1*D_var].*DuDx;
SS=[a_2*sigma_var.*DuDx(2); -b*u(3);c_2*(DuDx(3)-(b*u(3)./epsilon_var)-DuDx(1))];
And I got the following error messages:
Error using vertcat Dimensions of arrays being concatenated are not consistent.
Error in battery_model>battery_GE (line 83)
FF=[a_1*k_var; epsilon; c_1*D_var].*DuDx;
Error in pdepe (line 246)
[c,f,s] = feval(pde,xi(1),t(1),U,Ux,varargin{:});
Error in battery_model (line 50)
sol = pdepe(m,@battery_GE,@battery_ic,@battery_bc,x,t);
What went wrong?
  2 comentarios
Matthew Hunt
Matthew Hunt el 31 de Mayo de 2018
I see the error.
Torsten
Torsten el 1 de Jun. de 2018
FF=[a_1*k_var; epsilon_var; c_1*D_var].*DuDx;
instead of
FF=[a_1*k_var; epsilon; c_1*D_var].*DuDx;
Best wishes
Torsten.

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics and Optimization en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by