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

Example of high-order FEM for vector PDEs via the SStruct interface + Reassembly for time marching #1223

Open
abettini99 opened this issue Jan 31, 2025 · 0 comments

Comments

@abettini99
Copy link

abettini99 commented Jan 31, 2025

Hi,

I'd like to solve a system of PDEs that can be block-matrix-ed into:

[ A00, A01 ] [u] = [f0]
[ A10, A11 ] [v]   [f1]

where the off-diagonals are non-zero, via a high-order FEM approach.

Taking inspiration from ex16.c, can I naturally build this coupled system of equations by increasing the size of the HYPRE_SStructVariable from

HYPRE_SStructVariable vars[9] = {HYPRE_SSTRUCT_VARIABLE_NODE,
                                 HYPRE_SSTRUCT_VARIABLE_XFACE,
                                 HYPRE_SSTRUCT_VARIABLE_XFACE,
                                 HYPRE_SSTRUCT_VARIABLE_YFACE,
                                 HYPRE_SSTRUCT_VARIABLE_YFACE,
                                 HYPRE_SSTRUCT_VARIABLE_CELL,
                                 HYPRE_SSTRUCT_VARIABLE_CELL,
                                 HYPRE_SSTRUCT_VARIABLE_CELL,
                                 HYPRE_SSTRUCT_VARIABLE_CELL};

to something along the lines of

HYPRE_SStructVariable vars[18] = {HYPRE_SSTRUCT_VARIABLE_NODE,
                                  HYPRE_SSTRUCT_VARIABLE_XFACE,
                                  HYPRE_SSTRUCT_VARIABLE_XFACE,
                                  HYPRE_SSTRUCT_VARIABLE_YFACE,
                                  HYPRE_SSTRUCT_VARIABLE_YFACE,
                                  HYPRE_SSTRUCT_VARIABLE_CELL,
                                  HYPRE_SSTRUCT_VARIABLE_CELL,
                                  HYPRE_SSTRUCT_VARIABLE_CELL,
                                  HYPRE_SSTRUCT_VARIABLE_CELL,

                                  HYPRE_SSTRUCT_VARIABLE_NODE,
                                  HYPRE_SSTRUCT_VARIABLE_XFACE,
                                  HYPRE_SSTRUCT_VARIABLE_XFACE,
                                  HYPRE_SSTRUCT_VARIABLE_YFACE,
                                  HYPRE_SSTRUCT_VARIABLE_YFACE,
                                  HYPRE_SSTRUCT_VARIABLE_CELL,
                                  HYPRE_SSTRUCT_VARIABLE_CELL,
                                  HYPRE_SSTRUCT_VARIABLE_CELL,
                                  HYPRE_SSTRUCT_VARIABLE_CELL};

and the ordering from

int ordering[48] = { 0,-1,-1,   3, 0,-1,   4, 0,-1,   0,+1,-1,
                     1,-1, 0,   5, 0, 0,   6, 0, 0,   1,+1, 0,
                     2,-1, 0,   7, 0, 0,   8, 0, 0,   2,+1, 0,
                     0,-1,+1,   3, 0,+1,   4, 0,+1,   0,+1,+1  };

to something along the lines of

int ordering[96] = {  0,-1,-1,    3, 0,-1,    4, 0,-1,    0,+1,-1,
                      1,-1, 0,    5, 0, 0,    6, 0, 0,    1,+1, 0,           <-- u-
                      2,-1, 0,    7, 0, 0,    8, 0, 0,    2,+1, 0,               variable
                      0,-1,+1,    3, 0,+1,    4, 0,+1,    0,+1,+1,

                      9,-1,-1,   12, 0,-1,   13, 0,-1,    9,+1,-1,
                     10,-1, 0,   14, 0, 0,   15, 0, 0,   10,+1, 0,           <-- v-
                     11,-1, 0,   16, 0, 0,   17, 0, 0,   11,+1, 0,               variable
                      9,-1,+1,   12, 0,+1,   13, 0,+1,    9,+1,+1  };

to effectively represent the nodal solution on a grid like (following the (order# : variable#) notation):

[12:0]-[13:3]-[14:4]-[15:0]     [28:9]--[29:12]-[30:13]-[31:9]
   |                    |          |                       |
   |                    |          |                       |
[8:2]  [9:7] [10:8] [11:2]      [24:11] [25:16] [26:17] [27:11]
   |                    |          |                       |
   |                    |          |                       |
[4:1]  [5:5]  [6:6]  [7:1]      [20:10] [21:14] [22:15] [23:10]
   |                    |          |                       |
   |                    |          |                       |
[0:0]--[1:3]--[2:4]--[3:0]      [16:9]--[17:12]-[18:13]-[19:9]
        u-solution                         v-solution

? Then all i'd have to do is pass the 32x32 stiffness matrices and 32x1 forcing/load vectors (or the relevant size for even-higher-order FEM). Mostly my issue is not fully understanding how the HYPRE_SStructVariables are treated in the back of HYPRE. One of the things that may not be necessarily reflected correctly here is that the grids can be slightly staggered with differing number of gridpoints in the x and y direction for both variables (e.g. for satisfying LBB conditions of some variable p using high-order polys for u and v).

On that note, is there a way to do a reassembly of the load-vectors / matrix without re-declaring/creating+re-initializing a new vector (and destroying the old one)? It is mostly for time marching in which the RHS changes.

  • Andrea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant