## Non-constant boundary condition for thermal PDE solve

Hello, I am trying to solve a heat transfer problem which contains a 3D geometry. I am using thermal model. I want to use ‘heat transfer cofficient’ as a boundary condition in such a way that it is a non-constant B.C. w.r.t. location on my 3D geometry. I use the function handle and wrap another function called ‘getcoldcofficient’ in it so that I can pass more arguments than only ‘location’ and ‘state’. The ‘h_c’ here is a row vector containing different values which I want to apply on face of my geometry.

cold_coff = …

@(location,state) getcoldcofficient(location,state,h_c);

thermalBC(model2,"Face",[7,8,9,10],"ConvectionCoefficient",cold_coff,"AmbientTemperature",?);

The function ‘getcoldcofficient’ is defined as follows, It extracts the location i, then converts it into a usable index value for my row vector ‘h_c’

function hc = getcoldcofficient(location,state,h_c)

i = round(1000*abs(location.z));

if i == 0

hc = h_c(1);

else

hc = h_c(i);

end

end

Now the issue is that my ‘Ambient temperature’ is also changing at each location and is not a constant, I also have it as a row vector Tc. I want to use a similar function to ‘getcoldcofficient’ to get my ambient temperature at each corresponding index i. But I am not able to do this since ‘Ambient temperature’ only accepts a double type as an input and not a function handle.

To summarize, I want both heat transfer cofficient and its ambient temperature to be no-constant BCs on faces. Can someone help me with this ? Thanks.Hello, I am trying to solve a heat transfer problem which contains a 3D geometry. I am using thermal model. I want to use ‘heat transfer cofficient’ as a boundary condition in such a way that it is a non-constant B.C. w.r.t. location on my 3D geometry. I use the function handle and wrap another function called ‘getcoldcofficient’ in it so that I can pass more arguments than only ‘location’ and ‘state’. The ‘h_c’ here is a row vector containing different values which I want to apply on face of my geometry.

cold_coff = …

@(location,state) getcoldcofficient(location,state,h_c);

thermalBC(model2,"Face",[7,8,9,10],"ConvectionCoefficient",cold_coff,"AmbientTemperature",?);

The function ‘getcoldcofficient’ is defined as follows, It extracts the location i, then converts it into a usable index value for my row vector ‘h_c’

function hc = getcoldcofficient(location,state,h_c)

i = round(1000*abs(location.z));

if i == 0

hc = h_c(1);

else

hc = h_c(i);

end

end

Now the issue is that my ‘Ambient temperature’ is also changing at each location and is not a constant, I also have it as a row vector Tc. I want to use a similar function to ‘getcoldcofficient’ to get my ambient temperature at each corresponding index i. But I am not able to do this since ‘Ambient temperature’ only accepts a double type as an input and not a function handle.

To summarize, I want both heat transfer cofficient and its ambient temperature to be no-constant BCs on faces. Can someone help me with this ? Thanks. Hello, I am trying to solve a heat transfer problem which contains a 3D geometry. I am using thermal model. I want to use ‘heat transfer cofficient’ as a boundary condition in such a way that it is a non-constant B.C. w.r.t. location on my 3D geometry. I use the function handle and wrap another function called ‘getcoldcofficient’ in it so that I can pass more arguments than only ‘location’ and ‘state’. The ‘h_c’ here is a row vector containing different values which I want to apply on face of my geometry.

cold_coff = …

@(location,state) getcoldcofficient(location,state,h_c);

thermalBC(model2,"Face",[7,8,9,10],"ConvectionCoefficient",cold_coff,"AmbientTemperature",?);

The function ‘getcoldcofficient’ is defined as follows, It extracts the location i, then converts it into a usable index value for my row vector ‘h_c’

function hc = getcoldcofficient(location,state,h_c)

i = round(1000*abs(location.z));

if i == 0

hc = h_c(1);

else

hc = h_c(i);

end

end

Now the issue is that my ‘Ambient temperature’ is also changing at each location and is not a constant, I also have it as a row vector Tc. I want to use a similar function to ‘getcoldcofficient’ to get my ambient temperature at each corresponding index i. But I am not able to do this since ‘Ambient temperature’ only accepts a double type as an input and not a function handle.

To summarize, I want both heat transfer cofficient and its ambient temperature to be no-constant BCs on faces. Can someone help me with this ? Thanks. pde MATLAB Answers — New Questions