-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplementation of Ad projection operators #1182
Comments
Some of the functionality in |
That's an interesting comment. Is there any chance this approach can help us with representation of tensors and their products? |
Perhaps, it depends on what you mean. I suggest we discuss in person. |
Implementing this will require three main steps, each split into separate tasks. Preparatory steps
Implementation of the new projection operators
Inclusion of the new slicers in the Ad operator system
|
Benchmarking (to be updated)Observations from benchmarking using Running flow_benchmark_2d_case3, with a grid of 24K cells in the matrix, ~800 mortar cells
Conclusion so far: It seems the projection update project can make an impact. |
This may be a stupid question: How will the slicing work for non-matching mortar grids? |
It will be more complicated, involving not only slicing, but weighted sums over rows. I haven't worked out the details, but if it gets too complicated, it could be that we end up using the old solution for non-matching grids, at least until we start using these in earnest. |
Benchmarking of the actual slicing and reconstructionThere turned out to be two natural ways to implement these operations:
Comments:
The benchmarks:Two md geometries were considered:
We test both restriction to and prolongation from each subdomain. This is representative for both subdomain and mortar projections, with the assumption that we treat the task of identifying indices to project to and from different from the task of mapping. By similar reasoning, mapping to sets of domains is also covered. We comment below on time for initialization, and of mapping of vectors, sparse matrices and AdArrays. In Option 2, initialization entails construction of a projection matrix, while Option 1 only stores passed information during initialization. Thus the relative importance of initialization cost depends on how many times a restriction/prolongation object is used; currently this is often only once, but future caching (#1181) may change this. ResultsSummarized as follows:
Conclusions
Next steps
|
Update, finally: Projections from mortar to secondary cannot use the slicing trick straight away, since even for conforming grids, this is a mapping from two mortar cells to one a single lower-dimensional cell. In retrospect, this is fairly obvious. In the conforming case, it could be possible to do some clever tricks with indices that exploit that there is a 2-1 correspondence between mortar and secondary grids (as opposed to some-some for non-conforming grids). However, the benefit of doing this is unclear, while the cost measured in development time and code complexity may be substantial. For now, the goal of the project is therefore to roll out the slicing projections for subdomains, and for mapping of mortars to primary in the conforming case. Mapping from mortar to secondary will stay in matrix form, as will all mortar mappings for non-conforming grids. However, we will also change the implementation so that the projection matrices are created on demand, rather than at initialization (this should cut a substantial part of the computational cost). |
When rolling out the new operator to the full set of constitutive laws, the following issue popped up: In contrast to the other Ad operators, the slicer operator cannot act as the right operand in an expression Alternatives:
If option 5 still seems like a good solution in a few days, I will go with that. |
Decision: Go with 5. |
Background
In the Ad operator framework, the classes
SubdomainProjection
,MortarProjection
,Trace
andInvTrace
all represent mappings betweeen grid entities of various kinds. These are all implemented as projection matrices that, during parsing of an operator tree, are left multiplied with arrays and matrices. This is unsatisfactory for two reasons:Suggested change
The projection methods, say
SubdomainProjection.face_restriction()
, now returnpp.ad.SparseArrays
s. Instead, it should return a new slicer-object that roughly looks like this:Comments:
SubdomainProjection
,MortarProjection
etc.pp.models.geometry.basis
, research is needed.Regarding the divergence class
The class
pp.ad.Divergence
represents a differential operator rather than a mapping. This cannot readily be implemented as slicing, and although improvements should be possible there as well, it will not be part of this issue.Dependencies
This can be done independently of #1179, #1181, but should not be done in parallel.
The text was updated successfully, but these errors were encountered: