Interpolation between nodal and elemental field
Hi all, Good day! I am currently working on interploating the nodal field vector I obtained to its corresponding elemental field vector. I am doing it in a simple way by using structured mesh, the element value is just the average of its corresponding nodal values. Is it possible to generate a connectivity matrix to implement this function? I also need this matrix later on to do a reverse transformation. I am wondering is there a way in PETSc to generate this connectivity matrix between nodal and elemental mesh. Or is there any better way to accomplish this? Thanks for your kind help! Best regards, Kai
On Tue, May 16, 2023 at 10:27 AM K. Wu <[email protected]> wrote:
Hi all,
Good day!
I am currently working on interploating the nodal field vector I obtained to its corresponding elemental field vector. I am doing it in a simple way by using structured mesh, the element value is just the average of its corresponding nodal values.
Is it possible to generate a connectivity matrix to implement this function? I also need this matrix later on to do a reverse transformation.
I am wondering is there a way in PETSc to generate this connectivity matrix between nodal and elemental mesh. Or is there any better way to accomplish this?
Thanks for your kind help!
1. Are you using a PETSc DM, or your own mesh? 2. In order to define what you mean, you have to attach function spaces (or something equivalent) to the two representations. Do you mean linear interpolation between vertices and constants on cells? Thanks, Matt
Best regards, Kai
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
Hi Matt, I am using two PETSc DM, one for vertices (nodes), and one for cells (elements). I want to do the following operation: x is a global vector generated from DM vertices, with length Nn. y is a global vector generated from DM cells, with length Ne. I want to generate a sparse matrix A with size Ne x Nn, so that y = A*x. The entry of A is set to a constant value, e.g., 1/4, if the corresponding vertex belongs to the cell. Hope I make it clear, thanks! Regards, Kai Matthew Knepley <[email protected]> 于2023年5月16日周二 16:29写道:
On Tue, May 16, 2023 at 10:27 AM K. Wu <[email protected]> wrote:
Hi all,
Good day!
I am currently working on interploating the nodal field vector I obtained to its corresponding elemental field vector. I am doing it in a simple way by using structured mesh, the element value is just the average of its corresponding nodal values.
Is it possible to generate a connectivity matrix to implement this function? I also need this matrix later on to do a reverse transformation.
I am wondering is there a way in PETSc to generate this connectivity matrix between nodal and elemental mesh. Or is there any better way to accomplish this?
Thanks for your kind help!
1. Are you using a PETSc DM, or your own mesh?
2. In order to define what you mean, you have to attach function spaces (or something equivalent) to the two representations. Do you mean linear interpolation between vertices and constants on cells?
Thanks,
Matt
Best regards, Kai
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
On Tue, May 16, 2023 at 11:12 AM K. Wu <[email protected]> wrote:
Hi Matt,
I am using two PETSc DM, one for vertices (nodes), and one for cells (elements).
I assume you mean DMDA.
I want to do the following operation:
x is a global vector generated from DM vertices, with length Nn. y is a global vector generated from DM cells, with length Ne. I want to generate a sparse matrix A with size Ne x Nn, so that y = A*x.
The entry of A is set to a constant value, e.g., 1/4, if the corresponding vertex belongs to the cell.
Yes, this is straightforward. First create the matrix with the same local sizes as the vectors from the DMDAs. Each row will have the same number of nonzeros (the number of vertices on each cell), so preallocation is easy. Finally, I would loop over the vertex grid, and put in weights for (i, j, k) and +1 in each direction for cell (i, j, k). Thanks, Matt
Hope I make it clear, thanks!
Regards,
Kai
Matthew Knepley <[email protected]> 于2023年5月16日周二 16:29写道:
On Tue, May 16, 2023 at 10:27 AM K. Wu <[email protected]> wrote:
Hi all,
Good day!
I am currently working on interploating the nodal field vector I obtained to its corresponding elemental field vector. I am doing it in a simple way by using structured mesh, the element value is just the average of its corresponding nodal values.
Is it possible to generate a connectivity matrix to implement this function? I also need this matrix later on to do a reverse transformation.
I am wondering is there a way in PETSc to generate this connectivity matrix between nodal and elemental mesh. Or is there any better way to accomplish this?
Thanks for your kind help!
1. Are you using a PETSc DM, or your own mesh?
2. In order to define what you mean, you have to attach function spaces (or something equivalent) to the two representations. Do you mean linear interpolation between vertices and constants on cells?
Thanks,
Matt
Best regards, Kai
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
Got it, thanks Matt! Matthew Knepley <[email protected]> 于2023年5月16日周二 17:28写道:
On Tue, May 16, 2023 at 11:12 AM K. Wu <[email protected]> wrote:
Hi Matt,
I am using two PETSc DM, one for vertices (nodes), and one for cells (elements).
I assume you mean DMDA.
I want to do the following operation:
x is a global vector generated from DM vertices, with length Nn. y is a global vector generated from DM cells, with length Ne. I want to generate a sparse matrix A with size Ne x Nn, so that y = A*x.
The entry of A is set to a constant value, e.g., 1/4, if the corresponding vertex belongs to the cell.
Yes, this is straightforward. First create the matrix with the same local sizes as the vectors from the DMDAs. Each row will have the same number of nonzeros (the number of vertices on each cell), so preallocation is easy. Finally, I would loop over the vertex grid, and put in weights for (i, j, k) and +1 in each direction for cell (i, j, k).
Thanks,
Matt
Hope I make it clear, thanks!
Regards,
Kai
Matthew Knepley <[email protected]> 于2023年5月16日周二 16:29写道:
On Tue, May 16, 2023 at 10:27 AM K. Wu <[email protected]> wrote:
Hi all,
Good day!
I am currently working on interploating the nodal field vector I obtained to its corresponding elemental field vector. I am doing it in a simple way by using structured mesh, the element value is just the average of its corresponding nodal values.
Is it possible to generate a connectivity matrix to implement this function? I also need this matrix later on to do a reverse transformation.
I am wondering is there a way in PETSc to generate this connectivity matrix between nodal and elemental mesh. Or is there any better way to accomplish this?
Thanks for your kind help!
1. Are you using a PETSc DM, or your own mesh?
2. In order to define what you mean, you have to attach function spaces (or something equivalent) to the two representations. Do you mean linear interpolation between vertices and constants on cells?
Thanks,
Matt
Best regards, Kai
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
participants (2)
-
K. Wu -
Matthew Knepley