Hi. I wanted to solve two different heat diffusion equations(coupled) and solve them. For this I need 2 seperate domains for equations and I want to solve them in parallel in 2 independent Neural Networks. How can I solve this problem? especially since there is an Interface condition here.

why do you want to use PINNs to solve this?

Just define two OptimizationProblems with NeuralPDE and then add an `additional_loss`

term for the boundary handling. It is rather straightforward really from the two parts if you give it a go. What did you try?

Itās for my Masterās degree thesis.

I have tried it. But there are two Optimization problems which must be run in parallel. I donāt know how to run them in parallel. I have seen the examples on NeuralPDE, but none of them were solved in parallel. One thing that I was trying to do but I failed was that I made two different PDESystems as inner systems and wanted to connect them by another PDESystem like what is done by ODE in Lorenz Equations. Unfortunately, it doesnāt work the same (Expectedly) but I donāt understand why itās made possible to define inner systems in PDESystems while they canāt be connected.

Many Thanks

Define a new OptimizationProblem which calls both of the cost functions.

You realize that a PINN is going to be an absurdly inefficient way to solve a diffusion equation, right? Standard PDE solvers are really good at this, since people have spent decades optimizing solution methods for Poisson equationsā¦

Unfortunately, my supervisor insists on solving it by PINN and I canāt argue with him. There are more efficient and less time consuming methods ofcourse but itās already late for the change of direction.

Thanks. The problem Iām having right now is that I want them to be run in parallel in res line;

```
res1 = Optimization.solve(prob1 ,Adam(0.001); callback = callback, maxiters=1000)
res2 = Optimization.solve(prob2 ,Adam(0.001); callback = callback, maxiters=1000)
```

Since there are two problems which should be solved in parallel, I donāt want them to run separately. Do I need Parallel computing to run them together?

For defining a new OptimizationProblem I donāt have any clue what to do.

`newf(x,p) = prob1.f(x,p) + prob2.f(x,p)`

?

Here is my code. I still havenāt defined the additional Interface boundary condition.

```
using NeuralPDE, Flux, ModelingToolkit, DiffEqFlux
using Cuba, CUDA, QuasiMonteCarlo, IfElse, Optimization
@parameters t x
@variables T1(..) T2(..)
# First order derivatives
Dt = Differential(t)
Dx = Differential(x)
# Second order derivatives
Dxx = Differential(x)^2
#First Prob implementation
domain1 = [ t ā IntervalDomain(0,10),
x ā IntervalDomain(0.0,0.02)]
Ļ1 = 2719
k1 = 202.4
cp1 = 871
q1 = 10^7
bc1 =[T1(0,x) ~ 300,
Dx(T1(t,0)) ~ 0,
Dx(T1(t,0.02))~0]
eq1 = Ļ1*cp1*Dt(T1(t,x)) ~ k1*Dxx(T1(t,x))+ q1
n1 = 25
chain1 = Flux.Chain(Flux.Dense(2,n1,Flux.relu),
Flux.Dense(n1,n1,Flux.relu),
Flux.Dense(n1,n1,Flux.relu),
Flux.Dense(n1,1))
initĪø1 = DiffEqFlux.initial_params(chain1) |> gpu
strategy = NeuralPDE.QuasiRandomTraining(100; #points
sampling_alg = UniformSample(),
resampling = false,
minibatch = 8)
discretization1 = PhysicsInformedNN(chain1,
strategy,
init_params = initĪø1)
@named pde_system1 = PDESystem(eqs = eq1,bcs = bc1,domain = domain1,ivs=[t,x],dvs = T1(t,x))
prob1 = NeuralPDE.discretize(pde_system1,discretization1)
#Second prob implementation
domain2 = [ t ā IntervalDomain(0,10),
x ā IntervalDomain(0.02,0.04)]
bc2 =[T2(0,x) ~ 300,
Dx(T2(t,0.04)) ~ 0,
Dx(T2(t,0))~0
]
Ļ2 = 8978
k2 = 387.6
cp2 = 381
eq2 = Ļ2*cp2*Dt(T2(t,x))~ k2*Dxx(T2(t,x))
n2 = 20
chain2= Flux.Chain(Flux.Dense(2,n2,Flux.relu),
Flux.Dense(n2,n2,Flux.relu),
Flux.Dense(n2,n2,Flux.relu),
Flux.Dense(n2,1))
initĪø2 = DiffEqFlux.initial_params(chain2) |> gpu
discretization2 = PhysicsInformedNN(chain2,
strategy,
init_params = initĪø2)
@named pde_system2 = PDESystem(eqs = eq2,bcs = bc2,domain = domain2,ivs=[t,x],dvs = T2(t,x))
prob2 = NeuralPDE.discretize(pde_system2,discretization2)
callback = function (p,l)
println("Current loss is: $l")/
return false
end
res = Optimization.solve(prob?? ,Adam(0.001); callback = callback, maxiters=1000)
```

I know there are a few things wrong with this code, especially they canāt be coupled because of how I defined the BCs. But I just want to know how can I run these two in parallel? I canāt use the cost function until the res line runs to achieve T1 and T2.

You canāt just make up syntax . See the documentation.

Define the third optimization problem using the first twoā¦

What is made up? . The PDESystem Syntax is like this. I have seen it on Modelingtoolkit.jl.

At the same time, I know what U are saying and I donāt. How can I make a new prob using the first two when I donāt have any other relationship to define a new problem?

Thanks for your time.

The only solution I have on my mind is that when I define problems, I define a new loss function which calls both problems loss functions then make a new problem. Do U know if it is possible to do so with symbolic_discretize or not?

Not right now.

No, those values are not keyword arguments. They are positional in all of the docs.

You know the relationship because you just built it.

Thatās what I am describing.

No, just do it as I showed.

Thanks.

I apologize for asking so many questions. After defining the new loss function like what U mentioned

for defining new optimization problem surely, I need to define u0 from the init parameters produced. Since there are two different init parameters, Is it logical for me to vcat them? Or should I do something else?

```
f_ = OptimizationFunction(newf, Optimization.AutoZygote())
prob = Optimization.OptimizationProblem(f_, u0??)
```

Thanks

yes, and then you slice them in `newf`

.

What is the purpose of slicing them in newf? Canāt I just give the problem f_ and u0? newf is my new loss function which is the sum of the prob1 and prob2 loss functions.

yes but you want to give different coefficients (`u0`

parts) to `prob1.f`

and `prob2.f`

? Thatās the reason for concatenating `u0`

?