# MethodOfLines & functions in BCs

**URL:** <https://discourse.julialang.org/t/methodoflines-functions-in-bcs/111260>\
**Category:** Modelling & Simulations\
**Created:** [March 6, 2024, 8:54pm UTC](https://discourse.julialang.org/t/methodoflines-functions-in-bcs/111260 "2024-03-06T20:54:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [March 6, 2024, 8:54pm UTC](https://discourse.julialang.org/t/methodoflines-functions-in-bcs/111260/1 "2024-03-06T20:54:25Z")

</div>

I’m trying to implement a distributed model using MethodOfLines with:

- 3 PDEs + a number of AEs within the volume
- a number of Boundary conditions

In the boundary conditions, some flows depend on valve signals, e.g., as:

```julia
function f_v(u)
    if u < 1/20
        return 0
    elseif u < 1/2
        return (11.1*u-0.556)/30
    else
        return (50u-20)/30
    end
end

```

which is used as follows in the Boundary Conditions…

```julia
...
    ṁ ~ K*f_v(u_v)*sqrt(Δp_v),
...

```

where `ṁ`, `u_v`, `Δp_v` are defined as MTK variables of time, and `K` is an MTK parameter.  
leading to an error message as follows:

```julia
TypeError: non-boolean (Num) used in boolean context

Stacktrace:
 [1] f_v(u::Num)...

```

- What is the problem here?
- How can I get around the problem?

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [March 7, 2024, 8:45am UTC](https://discourse.julialang.org/t/methodoflines-functions-in-bcs/111260/2 "2024-03-07T08:45:07Z")

</div>

Ah… I figured it out: I needed to `@register_symbolical` the function. I never thought about that – I’ve only done that in the past with functions of time.

Anyways, now MTK/MethodOfLines accepts that part of the model.
