# PDESystem & MOL

**URL:** <https://discourse.julialang.org/t/pdesystem-mol/111283>\
**Category:** Modelling & Simulations\
**Created:** [March 7, 2024, 9:43am UTC](https://discourse.julialang.org/t/pdesystem-mol/111283 "2024-03-07T09:43:14Z")\
**Posts on this page:** 3\
**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 7, 2024, 9:43am UTC](https://discourse.julialang.org/t/pdesystem-mol/111283/1 "2024-03-07T09:43:14Z")

</div>

I’m trying to formulate a PDE system for solution via MethodOfLines.jl. In the last step, I need to use the `PDESystem` constructor. It is not clear to me what the arguments of that function need to be. Here is what I have done, and which is accepted:

```julia
@named gas_lift = PDESystem(eqs,bcs,doms,[t,x],[p(t,x),ṁ_ℓf, ṁ_a2t, ṁ_t2p])

```

However, I get an error message when I run the `discretize` function.

**Question** :

1. What is required of the 5th argument, the `dvs` – dependent variables; `[p(t,x),ṁ_ℓf, ṁ_a2t, ṁ_t2p]` in the example above? Do I list those that I want to find the values of, or the entire list?
2. In my case, I have a _large_ number of variables in `(t,x)` and a large number of variables in `t`. I have 3 PDEs, a number of algebraic equations within the volume, and a number of algebraic equations in the BCs. I have already used the `@variables` macro of MTK to specify variables. Do I need to repeat _all_ variables here?

---

<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 7, 2024, 7:00pm UTC](https://discourse.julialang.org/t/pdesystem-mol/111283/2 "2024-03-07T19:00:55Z")

</div>

> [@BLI](#):
>
> What is required of the 5th argument, the `dvs` – dependent variables; `[p(t,x),ṁ_ℓf, ṁ_a2t, ṁ_t2p]` in the example above? Do I list those that I want to find the values of, or the entire list?

The whole list.

> [@BLI](#):
>
> In my case, I have a _large_ number of variables in `(t,x)` and a large number of variables in `t`. I have 3 PDEs, a number of algebraic equations within the volume, and a number of algebraic equations in the BCs. I have already used the `@variables` macro of MTK to specify variables. Do I need to repeat _all_ variables here?

Yes, though you can just slap that array down if you define the variables in an array.

---

<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 8, 2024, 5:05pm UTC](https://discourse.julialang.org/t/pdesystem-mol/111283/3 "2024-03-08T17:05:21Z")

</div>

I had defined variables in an array…

```julia
vars = @variables begin
    # Distributed variables
    m̌_ℓ(..), [description = "Liquid bulk density, kg/m^3"]
    ṁ_ℓ(..), [description = "Liquid mass flow rate, kg/s"]
    m̌_g(..), [description = "Gas bulk density, kg/m^3"]
    ṁ_g(..), [description = "Gas mass flow rate, kg/s"]
...
# Temporal variables
    ṁ_ℓf(t), [description = "Liquid mass flow rate from reservoir formation, kg/s"]
    p_f(t), [description = "Reservoir formation pressure, Pa"]

```

However, I assume the `dvs` needs to be in the following form:

```julia
dvs = [m̌_ℓ(t,x), ṁ_ℓ(t,x), m̌_g(t,x), ... ṁ_g(t,x), ...ṁ_ℓf, p_f, ...]

```

In any way, creating the `PDESystem(...)` seems to work, i.e., does not give an error message.
