Some global L2 projection refactoring - #872
Conversation
|
jenkins build this with downstreams please |
There was a problem hiding this comment.
Pull request overview
This PR refactors the global L2 projection implementation by encapsulating the legacy (version 1) projection machinery within GlbL2projector.C, and extends projection assembly to account for element activation time (skipping elements not yet “born” and omitting fully inactive patches).
Changes:
- Refactors global L2 projection internals (moves legacy v1 integrand/container classes into an anonymous namespace; centralizes global solver controls under
namespace GlbL2). - Adds element-age awareness to L2 matrix assembly (skip inactive elements; reject “separate projection basis” when element activation is enabled).
- Skips inactive/empty patches during projection and adds a
gl2option alias for continuous global L2 projection.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/SIM/SIMoptions.C | Adds parsing support for gl2 as a projection method option. |
| src/SIM/SIMbase.C | Skips inactive patches during projection and refactors patch iteration/printing behavior. |
| src/ASM/GlbL2projector.h | Removes legacy v1 class declarations from the header; introduces namespace GlbL2 globals and time level plumbing in L2Integrand. |
| src/ASM/GlbL2projector.C | Implements the new structure (v1 internals hidden in anonymous namespace) and threads time into L2 integrands. |
| src/ASM/ASMs3Drecovery.C | Skips not-yet-active elements during L2 assembly and disallows separate projection basis with activation. |
| src/ASM/ASMs3DLag.C | Same as above for Lag-based 3D assembly; minor integration loop refactor. |
| src/ASM/ASMs2Drecovery.C | Skips inactive elements during L2 assembly; refactors monomial evaluation helper. |
| src/ASM/ASMs2DLag.C | Same as above for Lag-based 2D assembly. |
| src/ASM/ASMs1D.C | Skips inactive elements during L2 assembly and disallows separate projection basis with activation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/SIM/SIMbase.C:2444
- In the SIMoptions::CGL2 (version 1) branch, on success the code assigns
values = loc_valuesand thencontinues, which skips the injection/interleaving logic used by other projection methods. In multi-patch models this will overwritevaluesper patch and return with only the last patch’s data. Consider either (a) disallowing CGL2 for multi-patch explicitly, or (b) removing thecontinueand usinginjectPatchSolution(...)so each patch contributes to the finalvalues.
case SIMoptions::CGL2:
// Continuous global L2-projection (version 1)
if (myModel.size() > 1 && pch->separateProjectionBasis())
std::cerr <<" *** L2 projection of explicit functions onto a separate"
<<" basis is not available for multi-patch models."
<< std::endl;
else if (pch->globalL2projection(ftmp,
L2FuncIntegrand(*pch,*f,adm,time),true))
{
values = loc_values;
continue;
}
return false;
|
jenkins build this with downstreams please |
fa2992e to
296fdad
Compare
|
jenkins build this with downstreams please |
|
jenkins build this with downstreams ifem-stokes=348 ifem-navierstokes=273 ifem-fsi=102 ifem-boussinesq=164 ifem-shellex=52 please |
|
jenkins build this with downstreams ifem-stokes=348 ifem-navierstokes=273 ifem-fsi=102 ifem-boussinesq=164 ifem-shellex=52 ifem-printconcrete=2 please |
to anonymous namespace of the GlbL2projector.C file, to clarify that these classes are not meant for outside usage. Added: Current time as a member in class L2Integrand. Changed: Use a pointer in the (new) GlbL2 namespace to pass the right ProcessAdm object to PETSc when doing L2-projection instead of passing it through the L2Integrand objects, which do not need to know about this.
and flag the non-zero contributions in the projection matrix
Changed: Allow CGL2 version 1 when projecting functions.
…node. Added: Another ASMbase::injectNodalVec() doing it for a single node only.
1a9997a to
5d85c3e
Compare
|
jenkins build this with downstreams ifem-stokes=348 ifem-navierstokes=273 ifem-fsi=102 ifem-boussinesq=164 ifem-shellex=52 ifem-printconcrete=2 please |
patch-level element activation is used), initialize the control/nodal point values for non-active elements which are connected to active elements based on the average values. This is then used to enhance the global L2-projection.
This is used in the getAge() method, which now optionally can return 0.0 for unborn elements directly coupled to born elements. Added: ASMbase::inActiveElement() returning true if the element is not active yet, and not connected to active elements either. Changed: Use std::accumulate to calculate number of elements.
and replace PETScMatrix::solveMultipleRhs() by an override. For use in the global L2-projection.
Added: Some debug print in ASMs?D::evalSolution().
was added in commit 6252350, to facilitate checking the real effect of it on various models.
|
Replaced by #885 |
The classes for handling version 1 of the global L2 projection is now placed in anonymous namespace in the file
GlbL2projection.Cto stress that these are purely internal items and are not supposed to be exposed to the outside apps.Then account for possibly element age when doing the projection (omitting elements not born yet) , and skip entirely patches which have no activated elements.