# What's the best way to define source terms from datasets in dolfinx?

I’m solving the heat transport equation. I have a source term of the form:

``````f = alpha*Io*ufl.exp(-(alpha+beta)*(0.01-x[1])) #W/m3
``````

It seems to work properly. However, I’m trying to define a source wich could be interpolated from x,y data resulting from experimental data or another solver. I tested if I could make f as a function

``````coords= V.tabulate_dof_coordinates()
f = Function(V)
f.x.array[:] = alpha.x.array[:]*Io*np.exp(-(alpha.x.array[:]+beta.x.array[:])*(0.01-coords[:,1])
``````

However, although the function is the same, I get different results. I tried to define f as a Function to have the freedom to evaluate numpy or scipy interpolants with the dofs coordinates. The idea was something like

``````f.x.array[:] = alpha.x.array[:]*Io*MC.MC(0.01-coords[:,1])
``````

Being MC the interpolation module wich recieves dofs coordinates and returns any data interpolated from a dataset

This is my variational problem. It’s axisymmetrical.

``````a = ((rho*cp*u*v*x[0]