Skip to content
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

Intensive and extensive projections #1235

Open
IvarStefansson opened this issue Oct 7, 2024 · 1 comment
Open

Intensive and extensive projections #1235

IvarStefansson opened this issue Oct 7, 2024 · 1 comment
Assignees
Labels
user group Issue to be worked on in the internal user group.

Comments

@IvarStefansson
Copy link
Contributor

IvarStefansson commented Oct 7, 2024

We have mortar projection matrices for intensive and extensive quantities, respectively secondary_to_mortar_avg and secondary_to_mortar_int etc. I suspect we use them somewhat randomly in the code. This issue consists of

  1. understanding the difference, and its implications for the physical systems covered by the PorePy models
  2. explaining it to other users (possibly in a tutorial)
  3. browsing the code for all uses and verify or fix.

Tasks

No tasks being tracked yet.
@IvarStefansson IvarStefansson added the user group Issue to be worked on in the internal user group. label Oct 7, 2024
@mikeljordan
Copy link
Contributor

mikeljordan commented Oct 31, 2024

Projection of Intensive Quantity from Primary grid to Secondary grid

Considering the intersection of the porepy paper and also what is currently implemented in porepy, I have the following mathematical deduction and would also serve as base for what proceeds into the tutorial about projections. Here, I would discuss only the mathematics behind the projection of intensive quantity from primary to secondary grid through the mortal (or interface) grid in a mixed dimensional domain. Hence, the discussion would be about these two methods: primary_to_mortar_avg and mortar_to_secondary_avg (For completeness, note that the projection process for extensive quantities follows a similar structure).

Projection from Primary Grid to Mortar Grid:
The primary_to_mortar_avg function projects intensive quantities (such as pressure) from the primary grid faces (e.g., matrix grid faces) onto the mortar grid cells (interface grid cells) by averaging. Each mortar cell receives contributions from the primary grid faces it overlaps.

Let's assume that:

  • $f$ represent the values on the primary grid faces (e.g., pressures).
  • $P$ be the projection matrix of size $N_m \times N_p$,
    where:
  • $N_m$ is the number of mortar grid cells (on both sides),
  • $N_p$ is the number of primary grid faces.

The projection operation is represented by matrix-vector multiplication:

$$m=Pf -------- (1)$$

where:

  • $m$ is the vector of values on the mortar grid cells,
  • $P$ contains entries $P_{ij}$ that are weighted based on the contribution of primary face j to mortar cell i. In porepy, this is a simple piecewise-constant matrix with $0\leq P_{ij}\leq 1$, for all i and j.

In summary, each mortar cell value $m_i$ is calculated as:

$$m_i = \sum_{j\in N_p} P_{ij} f_j, \;\;\;\forall i =1,2,...,N_m -----(2)$$

where each $f_j$ represents a primary grid face value.

Projection from Mortar Grid to Secondary Grid:
The mortar_to_secondary_avg function projects intensive quantities from the mortar grid cells (interface grid cells) to the secondary grid cells (e.g., fractures) by averaging. Each secondary cell receives contributions from the mortar grid cells that overlap it.

Here, let's assume that:

  • $m$ represent the vector of values on the mortar grid cells obtained from (1) above.
  • $Q$ be the projection matrix of size $N_s \times N_m$, where:
  • $N_s$ is the number of secondary grid cells,
  • $N_m$ is the number of mortar grid cells.

The projection operation is represented by matrix-vector multiplication:

$$s=Qm$$

where:

  • $s$ is the resulting vector of values on the secondary grid cells,
  • $Q$ contains entries $Q_{ki}$ that are weighted based on the contribution of mortar cell i to secondary cell k. Hence, each secondary cell value $s_k$ is calculated as:
$$s_k=\sum_{i\in N_m}Q_{ki} m_i, \;\;\; \forall k = 1,2,...,N_s -------(3)$$

where each $m_i$ represents a mortar grid cell value. Substituting (2) into (3), it is not hard to arrive at:

$$s_k = \sum_{i\in N_m} \sum_{j\in N_p} Q_{ki} P_{ij} f_j,\; \; \; \forall k=1,2,...,N_s.$$

Important Note: we should keep in mind that, similar methods exit for the projections of intensive quantities from secondary-to-mortar (secondary_to_mortar_avg) and then from mortar-to-primary (mortar_to_primary_avg)

Based on the above information, it is not hard to initialize the starting intensive quantities, derive expected results on secondary grid using the values on the mortar (side) grids by averaging, and then for consistency, we can compare the expected and the projection results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user group Issue to be worked on in the internal user group.
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants