My goal is to apply a time-dependent heat source when solving the heat transfer problem.
The partial differential equation for transient conduction heat transfer is:
and more information can be found here: Solving a Heat Transfer Problem With Temperature-Dependent Properties
All parameters are constants in my case, except the source term, f, needs to be changed along with time.
I'm following the example code here: Nonlinear Heat Transfer In a Thin Plate which gives a way to solve the transient problem, and I'm able to plot the heat data at each time point.
The problem when applying it to my case is that, in the example the source is a constant value, throughout the entire region and entire time, and related to radiation and convection (in my case they should be all zero), but I need to feed a time-dependent source (Joule heating by time-varying electric current). The source could have one of the following formats:
- Analytical: a positive value such as 1 W/m^2, within a time window such as 0< t< 1 ns, and 0 otherwise.
- Numerical: data is provided by a 1xN vector where N is the number of time points.
And the source is confined in a certain region, eg. 0< x <1 mm and 0< y<1 mm.
I have seen a similar question but unanswered: How to use a variable coefficient in PDE Toolbox to solve a parabolic equation (Matlab)
Is there a way to implement this with the PDE Toolbox? Writing code from scratch would be so complicated....
You can quite easily define and solve problems with time dependent and nonlinear PDE coefficients with the FEATool FEM Matlab Toolbox as shown here in the m-script code snippet below. Note that the heat source (sink) term f is scaled as
f*(t>2500)
which means that it will only be active after t=2500 (as the switch expression evaluates to either 0 if false or 1 if true).In the solution here you can see that the temperature of the top edge rises linearly due to the heat diffusion up from the lower boundary until t=2500 where the heat sink is activated.
Matlab FEATool Nonlinear Time dependent Heat Transfer Solution
Regarding your second point with numerical source term, you could in this case create and call your own external function which tabulates and interpolates your data, in this case it would look something like
where you have a Matlab function
my_fun.m
somewhere accessible on the Matlab paths of the formLastly, although the model is defined using m-script Matlab code here for sharing on StackOverflow you could just as easily use the Matlab FEA GUI, and even export your GUI model as m-script code if required.