MethodOfLines.jl icon indicating copy to clipboard operation
MethodOfLines.jl copied to clipboard

Can a parameter be used as a domain boundary?

Open GHE-HS opened this issue 2 years ago • 4 comments

Hi,

While modeling a heat exchanger thanks to this (amazing) package, I tried to use a parameter as a boundary of the domain I am discretizing on.

The reason being that later on I could more easily do parametric study of the length of said heat exchanger by simply swapping the parameter without having to discretize again.

However, when I try to do something like:

domains = [t ∈ Interval(0.0, 1.0),
x ∈ Interval(0.0, L)]

I get the error

ERROR: TypeError: non-boolean (Num) used in boolean context

When trying to perform symbolic_discretize on the PDESystem

Is there any workaround? Is it something doable in the first place?

Thanks

GHE-HS avatar Jul 28 '23 14:07 GHE-HS

Unfortunately this straight up will not work, until the generated ODEFunction is size invariant. Generated functions are not currently invariant under domain size so there is no way to get this to work outside of re-discretizing every time L changes

xtalax avatar Jul 28 '23 22:07 xtalax

Thanks for the answer!

I was thinking that what I might end up doing is a change of variable, even though I would rather not do that if I can avoid it!

GHE-HS avatar Jul 31 '23 12:07 GHE-HS

I'm afraid that'd be what I recommend, best of luck! Could you consider posting your model when you get it running so I can add a tutorial for this?

xtalax avatar Jul 31 '23 12:07 xtalax

Thanks! I will share a simplified version if I end up doing that, absolutely

GHE-HS avatar Jul 31 '23 13:07 GHE-HS