# Solving a system of PDEs and defining equations

**URL:** <https://discourse.julialang.org/t/solving-a-system-of-pdes-and-defining-equations/104444>\
**Category:** General Usage\
**Tags:** question\
**Created:** [September 30, 2023, 11:18pm UTC](https://discourse.julialang.org/t/solving-a-system-of-pdes-and-defining-equations/104444 "2023-09-30T23:18:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reza\_AO](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/reza_ao/32/51137_2.png) [@Reza\_AO](https://discourse.julialang.org/u/Reza_AO)\
**Post date:** [September 30, 2023, 11:18pm UTC](https://discourse.julialang.org/t/solving-a-system-of-pdes-and-defining-equations/104444/1 "2023-09-30T23:18:13Z")

</div>

Hi  
I want to solve a system of equation with one PDE which is heat-diffusion equation and one ODE which is Arrhenius equation:

```julia
eq = [ρ*Cp*Dt(T(t,x,y)) ~ kx*Dxx(T(t,x,y)) + ky*Dyy(T(t,x,y)) - H*W*Dt(c(t,x,y)),
    -Dt(c(t,x,y)) ~ A*c(t,x,y)*exp(-E/(Rc*T(t,x,y)))]

```

I want to determine T and c.  
for this system, The Temperature in the ODE is the average temperature in the whole domain and c is a function of time only.  
My problems are:

1. How can I implement or define the average Temperature for the second equation (instead of T which is computed for each node)?
2. When I write c(t) I get error and the error vanishes when I define it as c(t,x,y)
3. I got a boundary condition which is conduction-convection balance:

` -kx*Dx(T(t,Le,y)) ~ h * (T(t,Le,y)- T_ext)`  
Le is the length of the domain which is on the right boundary.  
Is defining the boundary condition like this ok since there is Temperature in it?

ps: Every parameter in the equation is constant except T and c.  
Thanks

---

<div class="post-metadata">

**Author:** ![xtalax](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xtalax/32/35293_2.png) [@xtalax](https://discourse.julialang.org/u/xtalax)\
**Post date:** [October 3, 2023, 1:46pm UTC](https://discourse.julialang.org/t/solving-a-system-of-pdes-and-defining-equations/104444/2 "2023-10-03T13:46:52Z")

</div>

1. You might be able to do this by using an integral over the domain, look up the integral definition of the mean, and see the integrals section of the docs [Solving PIDEs (Integrals) · MethodOfLines.jl](https://docs.sciml.ai/MethodOfLines/stable/tutorials/PIDE/)
2. I will have to check this out, can you post the code to reproduce in an issue?
3. This BC is fine.

---

<div class="post-metadata">

**Author:** ![Reza\_AO](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/reza_ao/32/51137_2.png) [@Reza\_AO](https://discourse.julialang.org/u/Reza_AO)\
**Post date:** [October 5, 2023, 3:25pm UTC](https://discourse.julialang.org/t/solving-a-system-of-pdes-and-defining-equations/104444/3 "2023-10-05T15:25:51Z")

</div>

Thanks for your reply.  
It might be right but since the temperature is the output of the network, is it possible to do so?

---

<div class="post-metadata">

**Author:** ![xtalax](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xtalax/32/35293_2.png) [@xtalax](https://discourse.julialang.org/u/xtalax)\
**Post date:** [October 6, 2023, 11:23pm UTC](https://discourse.julialang.org/t/solving-a-system-of-pdes-and-defining-equations/104444/4 "2023-10-06T23:23:00Z")

</div>

if you are referring to 1, yes, absolutely. Give it a go and let me know if your run in to trouble.
