Variable density in heat diffusion equation

5 Ansichten (letzte 30 Tage)
Matthew Hunt
Matthew Hunt am 30 Mai 2018
Kommentiert: Torsten am 1 Jun. 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 Kommentar
Torsten
Torsten am 30 Mai 2018
Just like the initial conditions: as simple numbers dependent on x.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Matthew Hunt
Matthew Hunt am 31 Mai 2018
So I do the interp1 trick you demonstrated before?

Matthew Hunt
Matthew Hunt am 31 Mai 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 Kommentare
Matthew Hunt
Matthew Hunt am 31 Mai 2018
I see the error.
Torsten
Torsten am 1 Jun. 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics and Optimization finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by