Mercurial > repos > public > sbplib_julia
comparison Notes.md @ 1382:1aee4e6206c2 feature/variable_derivatives
Merge
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 08 Jun 2023 15:51:52 +0200 |
parents | e9dfc1998d31 |
children | bdcdbd4ea9cd 88e738d807cb |
comparison
equal
deleted
inserted
replaced
1376:2ad2de55061a | 1382:1aee4e6206c2 |
---|---|
69 If possible the goal should be for the parsing to get all the way to the | 69 If possible the goal should be for the parsing to get all the way to the |
70 stencils so that a user calls `read_stencil_set` and gets a | 70 stencils so that a user calls `read_stencil_set` and gets a |
71 dictionary-structure containing stencils, tuples, scalars and other types | 71 dictionary-structure containing stencils, tuples, scalars and other types |
72 ready for input to the methods creating the operators. | 72 ready for input to the methods creating the operators. |
73 | 73 |
74 ## Variable second derivative | |
75 | |
76 2020-12-08 after discussion with Vidar: | |
77 We will have to handle the variable second derivative in a new variant of | |
78 VolumeOperator, "SecondDerivativeVariable?". Somehow it needs to know about | |
79 the coefficients. They should be provided as an AbstractVector. Where they are | |
80 provided is another question. It could be that you provide a reference to the | |
81 array to the constructor of SecondDerivativeVariable. If that array is mutable | |
82 you are free to change it whenever and the changes should propagate | |
83 accordingly. Another option is that the counter part to "Laplace" for this | |
84 variable second derivate returns a function or acts like a functions that | |
85 takes an Abstract array and returns a SecondDerivativeVariable with the | |
86 appropriate array. This would allow syntax like `D2(a)*v`. Can this be made | |
87 performant? | |
88 | |
89 For the 1d case we can have a constructor | |
90 `SecondDerivativeVariable(D2::SecondDerivativeVariable, a)` that just creates | |
91 a copy with a different `a`. | |
92 | |
93 Apart from just the second derivative in 1D we need operators for higher | |
94 dimensions. What happens if a=a(x,y)? Maybe this can be solved orthogonally to | |
95 the `D2(a)*v` issue, meaning that if a constant nD version of | |
96 SecondDerivativeVariable is available then maybe it can be wrapped to support | |
97 function like syntax. We might have to implement `SecondDerivativeVariable` | |
98 for N dimensions which takes a N dimensional a. If this could be easily | |
99 closured to allow D(a) syntax we would have come a long way. | |
100 | |
101 For `Laplace` which might use a variable D2 if it is on a curvilinear grid we | |
102 might want to choose how to calculate the metric coefficients. They could be | |
103 known on closed form, they could be calculated from the grid coordinates or | |
104 they could be provided as a vector. Which way you want to do it might change | |
105 depending on for example if you are memory bound or compute bound. This choice | |
106 cannot be done on the grid since the grid shouldn't care about the computer | |
107 architecture. The most sensible option seems to be to have an argument to the | |
108 `Laplace` function which controls how the coefficients are gotten from the | |
109 grid. The argument could for example be a function which is to be applied to | |
110 the grid. | |
111 | |
112 What happens if the grid or the varible coefficient is dependent on time? | |
113 Maybe it becomes important to support `D(a)` or even `D(t,a)` syntax in a more | |
114 general way. | |
115 | |
116 ``` | |
117 g = TimeDependentGrid() | |
118 L = Laplace(g) | |
119 function Laplace(g::TimeDependentGrid) | |
120 g_logical = logical(g) # g_logical is time independent | |
121 ... Build a L(a) assuming we can do that ... | |
122 a(t) = metric_coeffs(g,t) | |
123 return t->L(a(t)) | |
124 end | |
125 ``` | |
126 | |
127 ## Known size of range and domain? | 74 ## Known size of range and domain? |
128 Is there any reason to use a trait to differentiate between fixed size and unknown size? | 75 Is there any reason to use a trait to differentiate between fixed size and unknown size? |
129 | 76 |
130 When do we need to know the size of the range and domain? | 77 When do we need to know the size of the range and domain? |
131 * When indexing to provide boundschecking? | 78 * When indexing to provide boundschecking? |