# Passing vectors of data into MTK/MoL problem as parameter

**URL:** https://discourse.julialang.org/t/passing-vectors-of-data-into-mtk-mol-problem-as-parameter/96578
**Category:** Modelling & Simulations
**Created:** [March 24, 2023, 8:07pm UTC](https://discourse.julialang.org/t/passing-vectors-of-data-into-mtk-mol-problem-as-parameter/96578 "2023-03-24T20:07:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![johnb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnb/32/44115_2.png) [@johnb](https://discourse.julialang.org/u/johnb)
#### Post date: [March 24, 2023, 8:07pm UTC](https://discourse.julialang.org/t/passing-vectors-of-data-into-mtk-mol-problem-as-parameter/96578/1 "2023-03-24T20:07:44Z")

</div>

I have been able to use vectors of data that I’ve passed through DataInterpolations as inputs/boundary conditions to a ModelingToolkit/MethodOfLines problem, but I would like to use the data vectors as MTK parameters to automate changing my system conditions. I’ve been struggling for a while now and I can’t find any documentation on how to do this. Is there something I’m missing or should I look for a different way to adjust my system inputs?

I’ve adapted one of the tutorials from MethodOfLines to show what I’m trying to do, and verified that it creates the same errors.

```julia
using DifferentialEquations, ModelingToolkit, MethodOfLines, DomainSets, DataInterpolations

input_temperature = [1 2 2 3 2 1]
input_time = [0 1 2 3 4 5]
# Parameters, variables, and derivatives
@parameters input_temperature, input_time
@variables t, x, u(..)
params = [input_temperature => input_temperature, input_time => input_time]
Dt = Differential(t)
Dxx = Differential(x)^2

# 1D PDE and boundary conditions
eq = Dt(u(t, x)) ~ Dxx(u(t, x))
bcs = [u(0, x) ~ cos(x),
        u(t, 0) ~ LinearInterpolation(input_temperature, input_time),
        u(t, 1) ~ exp(-t) * cos(1)]

# Space and time domains
domains = [t ∈ Interval(0.0, input_time[end]),
           x ∈ Interval(0.0, 1.0)]

# PDE system

@named pdesys = PDESystem(eq, bcs, domains, [t, x], [u(t, x)], params)

# Method of lines discretization
dx = 0.1
order = 2
discretization = MOLFiniteDifference([x => dx], t)

# Convert the PDE problem into an ODE problem
prob = discretize(pdesys,discretization)

# Solve ODE problem
using OrdinaryDiffEq
sol = solve(prob, Tsit5(), saveat=0.2)

#Ideally, I would be able to do something like this to modify timeseries data 
newprob = remake(prob, p = [[3 3 2 1 4], [0 2 4 5 8]])
sol2 = solve(newprob, Tsit5(), saveat=0.2)

```

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [March 24, 2023, 10:55pm UTC](https://discourse.julialang.org/t/passing-vectors-of-data-into-mtk-mol-problem-as-parameter/96578/2 "2023-03-24T22:55:58Z")

</div>

This doesn’t work right now but we plan to have a solution by JuliaCon.

---

<div class="post-metadata">

### Author: ![johnb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnb/32/44115_2.png) [@johnb](https://discourse.julialang.org/u/johnb)
#### Post date: [March 24, 2023, 11:05pm UTC](https://discourse.julialang.org/t/passing-vectors-of-data-into-mtk-mol-problem-as-parameter/96578/3 "2023-03-24T23:05:26Z")

</div>

Okay, thanks! I’ll work on an alternative until then.
