Hi everyone,
I am currently trying to implement some kind of linear interpolation algorithm for a heat equation simulation. In this simulation, I want to assume that some constants vary with temperature and wish to interpolate this function for a large range of temperature values given some real physical data. Then, I would like to feed this interpolated function back into my solver so that the simulation can be solved accordingly.
For example if I assume I have some data here showing how a certain constant varies:
T k
300 130
500 120
700 110
900 100
1100 90
1300 80
How would I interpolate this so that our constant, k , is defined over a large temperature range and then feed this back into my solver?
My heavily simplified example code is shown below:
from dolfin import *
from ufl import as_tensor
k = 130 #placeholder value for interpolation
# import data here????
mesh = UnitSquareMesh(10,10)
space = FunctionSpace(mesh, 'P', 1)
kappa_space = FunctionSpace(mesh, 'CG',1)
kappa = project(k, kappa_space) #kappa is the tensor form of k
T = project(Expression("10*x[0]+100*x[1]", degree=2), Space)
print(kappa.vector().get_local())