Hello, I have been trying the to model a 1-d diffusion problem, with the following governing equation:
The problem has a non-linear neumman boundary condition where heat flux is caused by convection and radiation.
This boundary condition is futher complicated by the fact that the temperature of the surrounding fluid changes over time:
I have tried numerous methods but to no avail - however, following tutorials, I feel I have gotten very close using the PDE toolbox.
k = 1.3;
rho = 2705;
C_p = 0.91*1000;
alpha = k/(rho*C_p);
T_ambient = 20;
numberOfPDE = 1;
model = createpde(numberOfPDE);
radius = 0.18;
height = radius;
surface_area = 2*pi*radius;
g = decsg([3 4 0 0 radius radius -height/2 height/2 height/2 -height/2]');
geometryFromEdges(model,g);
figure;
pdegplot(model,'EdgeLabels','on');
title 'Geometry With Edge Labels Displayed';
applyBoundaryCondition(model, 'neumann', 'edge', 3, 'g', @mygfun)
c = 1;
d = -1/alpha;
m = 0;
a = 0;
f = 0;
specifyCoefficients(model,'m',m,'d',d,'c',c,'a',a,'f',f);
setInitialConditions(model,T_ambient);
hmax = .01;
msh = generateMesh(model,'Hmax',hmax);
figure;
pdeplot(model);
axis equal
title 'Plate With Triangular Element Mesh'
xlabel 'X-coordinate, meters'
ylabel 'Y-coordinate, meters'
p = msh.Nodes;
endTime = 5000;
tlist = 0:50:endTime;
numNodes = size(p,2);
u0(1:numNodes) = T_ambient;
model.SolverOptions.RelativeTolerance = 1.0e-3;
model.SolverOptions.AbsoluteTolerance = 1.0e-4;
R = solvepde(model,tlist);
u = R.NodalSolution;
The boundary condition uses a function (mygfunc) to calculate the heat flux:
function funOut = mygfun (location,state)
sigma = 5.670373e-8;
phi = 1;
e_m = 0.9;
e_f = 1;
alpha_convection = 25;
radius = 0.18;
height = radius;
surface_area = 2*pi*radius;
k = 1.3;
T_gas = 20 + 345*log10(8*(state.time/60) + 1);
h_c = alpha_convection*(T_gas - state.u);
h_r = phi*e_m*e_f*sigma((T_gas + 273)^4 - (state.u + 273)^4);
h_total = h_c + h_r;
heatFlux = h_total*surface_area;
funOut = heatFlux/(-k);
end
However when I run the solver I recieve the following tollerance error:
I am really unfamiliar with the PDE toolbox and no expert at matlab - and ive been stuck on this for quite a while so I would really really really appreciate any help I can get.
Best,
Victor