Hello,

Is there a way to initialize a function in MethodOfLines so that I can “compile” it once for every parameter set, here’s an example:

```
using ModelingToolkit, MethodOfLines, LinearAlgebra, OrdinaryDiffEq, DomainSets
using ModelingToolkit: Differential
using DifferentialEquations
using ComponentArrays
using DataInterpolations
using Memoize
@parameters t,x
@parameters Tvec
@parameters α
@variables f(..)
∂_t = Differential(t)
∂_x = Differential(x)
@memoize interpf(tvec::Vector{Float64}) = LinearInterpolation(tvec, [1.,2.,3.,4.,5.])
interpnonmem(tvec::Vector{Float64}) = LinearInterpolation(tvec, [1.,2.,3.,4.,5.])
function Temperature(t,x, Tvec)
interp = interpnonmem(Tvec)
return interp(x)
end
@register_symbolic Temperature(t,x,Tvec)
eqs = [∂_x(f(t,x)) ~ α * Temperature(t,x, Tvec)]
domain = [t ∈ Interval(0.,10.), x ∈ Interval(0., 10)]
bcs = [f(t,0.) ~ 0., f(0.,x) ~ 0.]
tvec_def = [280.,290.,300.,310.,320]
α_def = 3.
ps = [Tvec => tvec_def,
α => α_def]
@named pdesys = PDESystem(eqs, bcs, domain, [t,x], [f(t,x)], ps)
discretization = MOLFiniteDifference([x => 0.025], t)
prob = discretize(pdesys, discretization)
function pde_solution(ps = [tvec_def,α_def]; prob = prob)
updated_prob = remake(prob, p = ps)
# Solution of the ODE system
sol = solve(updated_prob, TRBDF2())
sol
end
```

In this example (without Memoize), a LinearInterpolation is done at each timestep for each dx. Since it’s the same interpolation being called, wouldn’t there be a way to “initialize” it?

I tried using `Memoize`

but the performance difference was negligible. In my other “heavier” setup, the performance difference before and after adding the LinearInterpolation was huge.