Good morning everyone,
I am attempting
to write a program which projects a solution vector from mesh A to mesh B. Both
meshes are parallel distributed and have different geometries (the first is
adaptively refined, the latter has uniform grid size). In addition, the
solution uses Q1 elements on mesh A and is to be piecewise constant on mesh B.
I have attempted to use VectorTools::project() for this purpose.
- - I create a child of the Function class which takes in a solution vector and its corresponding mesh (both parallel distributed). This function allows the solution vector to be evaluated at any coordinate within the domain (and should also consider ghost elements).
- - I insert this as a parameter into the project() function. This is projected onto a non-ghosted vector, which is then assigned to a ghosted vector and is subsequently compressed.
The resulting vector correctly projects to some elements, however other elements appear to be set to 0 (incorrectly). In addition, the number of elements that are zero and their locations vary with the number of processors used. I suspect that it may be something to do with project() not being able to handle ghost elements but I’m not sure. It is very possible that the Function used to evaluate the input vector at any coordinate is incorrect, i have included it in a text file below. I have tried using both FEFieldFunction() and later find_all_active_cells_around_point() but to no avail (the latter appears to return empty for these zeroed elements, even after I perturb the coordinate by a significant amount when no cell is found or use a high tolerance).
I then attempted the following crude workaround:
- serialize the vector and triangulation
- project them to a new serial vector using project()
- scatter them back onto the parallel mesh
Unfortunately, this also failed. I am having difficulty copying the parallel mesh onto a serial one, which appears far more involved than I originally thought.
On a sidenote I have attempted to use interpolate() as well and was still unsuccessful (I encountered the same issue with elements set to 0 at the same locations for a given number of cores used).
Any help would be very, very much appreciated
Best wishes,
Daniel Rivlin