# Solving PDE with MethodOfLines

Hi, I am new to Julia. I’m trying to solve a PDE using Method of lines but I am running into a unexpected error. `ERROR: type Term has no field lhs.` My code as follows:

``````using DifferentialEquations
using Plots
using MethodOfLines
using ModelingToolkit
using DomainSets

@parameters t,x
@variables u(..)

Dt = Differential(t)
Dx = Differential(x)
Dxx = Differential(x)^2

v = 5.0
Da = 5.0
pe = 100.0
L = 100.0
C0 = 1.0

eq = [Dt(u(t,x)) ~ -v * Dx(u(t,x)) + Da * Dxx(u(t,x))]

domain = [x ∈ Interval(0.0, 100.0), t ∈ Interval(0.0, 10.0)]

ibc = [C0 ~ -Da/v*Dx(u(t,0.0) + u(t,0.0)), Dx(u(t,L) ~ 0.0), u(0.0,x) ~ 0.0]

@named sys = PDESystem(eq, ibc, domain, [t,x], [u(t,x)] )

#sys = structural_simplify(sys)

dx = 1.0

discretization = MOLFiniteDifference([x => dx], t, approx_order = 2)
prob = discretize(sys, discretization)
sol = solve(prob, Tsit5(), saveat = 0.05)
``````

Any help would be appreciated! Thanks!

Looks like you have a typo in there:

``````ibc = [C0 ~ -Da/v*Dx(u(t,0.0) + u(t,0.0)), Dx(u(t,L)) ~ 0.0, u(0.0,x) ~ 0.0]
``````

Hi Chris, thanks for pointing out the typo. I managed to amend the boundary condition typos and still ran into the same error.

I did a bit of reading on the MethodOfLines package and found the following under the “Known Limitations”:

`That boundary conditions do not contain references to derivatives which are not in the direction of the boundary, except in time`

Since I am trying to solve the Danckwerts boundary conditions for PFR Axial Dispersion, I believe these conditions account for back mixing at the inlet layer which is obviously not in the direction of the boundary.

Once I assumed no back mixing at the inlet boundary condition, the code executed perfectly. Pretty cool!

So, if I were to improve the accuracy of the model by assuming back mixing at the inlet (therefore include a negative derivative not in the direction of the boundary) is there a way to still use the MOL and work around this issue? If not, what would you recommend?
Thanks for the help!

Open an issue. We’d need to setup the auto disxretizer to handle more cases