Mercurial > repos > public > sbplib_julia
comparison Notes.md @ 1649:b02917bcd7d5 feature/grids/curvilinear
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 26 Jun 2024 12:41:03 +0200 |
parents | e551fe1fff14 |
children | 3714a391545a |
comparison
equal
deleted
inserted
replaced
1645:64452a678e7a | 1649:b02917bcd7d5 |
---|---|
1 # Notes | 1 # Notes |
2 | |
3 ## How to dispatch for different operators | |
4 We have a problem in how dispatch for different operators work. | |
5 * We want to keep the types simple and flat (Awkward to forward `apply`) | |
6 * We want to dispatch SATs on the parameters of the continuous operator. (a * div for example) | |
7 * We want to allow keeping the same stencil_set across different calls. (maybe not so bad for the user to be responsible) | |
8 | |
9 Could remove the current opset idea and introduce a description of continuous operators | |
10 ```julia | |
11 abstract type DifferentialOperator end | |
12 | |
13 struct Laplace <: DifferentialOperator end | |
14 struct Advection <: DifferentialOperator | |
15 v | |
16 end | |
17 | |
18 difference_operator(::Laplace, grid, stencil_set) = ... # Returns a plain LazyTensor. Replaces the current `laplace()` function. | |
19 sat_tensors(::Laplace, grid, stencil_set, bc) = ... | |
20 | |
21 sat(::DifferentialOperator, grid, stencil_set, bc) = ... | |
22 ``` | |
23 | |
24 | |
25 ### Update 2024-06-26 | |
26 We will run into trouble if we start assuming things about the coupling | |
27 between the continuous and discrete setting. We could add representations of | |
28 continuous operators but we will also need representations of discrete | |
29 operators. Ideally it should be possible to ignore the continuous | |
30 representations and only work with the discrete operators without losing | |
31 functionality. The discrete representations does not have to be LazyTensors. | |
32 The could be used as inputs to methods for `sat`, `difference_operator` and so | |
33 on. | |
34 | |
35 To see need for a fully functional discrete layer we can consider the | |
36 optimization of material parameters or something similar. In this case we do | |
37 not necessarily want to handle continuous objects. | |
2 | 38 |
3 ## Reading operators | 39 ## Reading operators |
4 | 40 |
5 Jonatan's suggestion is to add methods to `Laplace`, `SecondDerivative` and | 41 Jonatan's suggestion is to add methods to `Laplace`, `SecondDerivative` and |
6 similar functions that take in a filename from which to read stencils. These | 42 similar functions that take in a filename from which to read stencils. These |