Description
@thomasgibson @sandreza @simonbyrne let's discuss how the PDESystem specification needs to change in order to accommodate the types of meshes that are used for Clima.
@KirillZubov @emmanuellujan should stay informed here, since we will need to make sure the PINN and finite difference methods update for any change.
The current PDE system is like:
@parameters x y θ
@variables u(..)
@derivatives Dxx''~x
@derivatives Dyy''~y
# 2D PDE
eq = Dxx(u(x,y,θ)) + Dyy(u(x,y,θ)) ~ -sin(pi*x)*sin(pi*y)
# Boundary conditions
bcs = [u(0,y) ~ 0.f0, u(1,y) ~ -sin(pi*1)*sin(pi*y),
u(x,0) ~ 0.f0, u(x,1) ~ -sin(pi*x)*sin(pi*1)]
# Space and time domains
domains = [x ∈ IntervalDomain(0.0,1.0),
y ∈ IntervalDomain(0.0,1.0)]
pde_system = PDESystem(eq,bcs,domains,[x,y],[u])
One of the difficulties that I saw was that, in this form, it's "easy" to know how to identify the boundaries and write a condition to them. However, a breakdown occurs on harder domains. An even simpler example than unstructured meshes is CircleDomain
, we we can no long write things like u(1,x) = ... for all x
, since we now have to say things like u(x,y) = ... for all x^2 + y^2 = 1
which is a fundamentally implicit specification, whereas it can be made explicit only by directly knowing a representation of the boundary.
So it looks like we need to be able to query for boundaries of domains and specify the BCs based on them. For example, maybe something like:
domains = [x ∈ IntervalDomain(0.0,1.0),
y ∈ IntervalDomain(0.0,1.0)]
bcs = [boundary(domains[1])[1] => 0.f0,
boundary(domains[1])[2] => -sin(pi*1)*sin(pi*y),
boundary(domains[2])[1] => 0.f0,
boundary(domains[2])[2] => -sin(pi*x)*sin(pi*1)]
That looks a bit awful though, but gets the point across. But the real question is:
- Does this solve the issues with BCs?
- Is there a nicer way to get the same information?