Description
Summary
This issue describes an implementation of a mapping (a rigid body motion) to reference domains for general grids, also those that are embedded in higher dimensions.
Problem statement
For both discretization and some parameter assignment (e.g. permeability), a mapping of embedded grids down to their natural coordinate system are needed. Right now, such projections are carried out ad hoc, and there is no guarantee that two mappings applied to the same grid will result in the same mapping (in practice, the mappings seem to be constant).
Proposed solution
Define a mapping to a reference system, and assign this to all grids during initialization. For grids that are not considered embedded in a higher dimension, an identity mapping will be sufficient. For ideas on how to fixate the mapping, see comments related to TangentialNormalProjection
below.
Translation to the origin (perhaps of the lower left corner of the mapped domain) should be included in addition to rotation.
Necessary steps to implement the mappings.
For 2d grids embedded in 3d, the task is fairly straighforward, under an assumption that the grid is not rotated or translated after initialization.
For 1d grids the task is more complex, since, in several places 1d grids are implemented in an hoc way (grid coordinates are changed after initialization). The best option likely is to use the function fracs.msh_2_grid.create_embedded_line_grid()
to create all 1d grids, and store the rotation there.
EK's gut feeling is we need not bother about the MortarGrid
s, but this should be considered somewhat more carefully before a decision to ignore is made.
Updates in other parts of the code
When a mapping to reference coordinates, it is natural to put it in use where natural. Known candidate places are:
mpfa.py
for 2d grids, see here- The
TangentialNormalProjection
is effectively a mapping to the tangential plane of a 2d (and 1d) manifold of co-dimension 1. It could be beneficial to merge this with the reference mapping.
NOTE: The mapping inTangentialNormalProjection
could also be a natural way to define the reference mapping in the first place, see in particular the effort made to construct a somewhat reasonable basis
Besides this, it is advised to look for usage of the method pp.map_geometry.map_grid()
, perhaps also for pp.map_geometry.rotation_matrix
although the latter is more likely to be used on a point cloud, likely during mesh contsruction.
Longer term perspectives
If we ever allow lower-dimensional domains to be non-planar, a reference mapping per grid will not be sufficient; the natural option is perhaps to evalutate them per cell instead. This will not happen in the near future, but should be kept in mind under implementation.