Embedded Interfaces#101
Draft
Pawel024 wants to merge 7 commits into
Draft
Conversation
…populated node map
… one linear system
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends MiTo’s FEM infrastructure to support multi-domain / embedded-interface problems by allowing multiple function spaces (and weakforms) to contribute to a single discrete linear system, while also upgrading Dirichlet handling to carry prescribed values. It adds a PETSc-backed regression test for a hybrid-dimensional diffusion problem with a continuous embedded interface.
Changes:
- Introduce
mito::fem::Contributionand refactorDiscreteSystemto assemble multiple contributions into one linear system. - Upgrade Dirichlet constraints/discretizers/function spaces to track constrained nodes and their prescribed values (for lifting / solution reconstruction).
- Add a new FEM test case for hybrid-dimensional diffusion with an embedded continuous interface and hook it into the PETSc test suite.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/mito.lib/fem/hybrid_dimensional_diffusion_continuous.cc | Adds regression test for hybrid-dimensional diffusion with an embedded continuous interface. |
| lib/mito/manifolds/Manifold.h | Exposes coordinate_system() accessor needed by discretizers for constraint value evaluation. |
| lib/mito/fem/FunctionSpace.h | Stores constrained values (not just nodes) and adds constructor for shared node maps. |
| lib/mito/fem/forward.h | Adds Contribution and updates DiscreteSystem forward declaration to variadic contributions. |
| lib/mito/fem/factories.h | Adds function space factory overload for shared node maps and discrete system factory for multiple contributions. |
| lib/mito/fem/elements/tri2/DiscretizerCG.h | Populates constrained values by evaluating Dirichlet function at node/midpoint coordinates. |
| lib/mito/fem/elements/tri1/DiscretizerCG.h | Populates constrained values by evaluating Dirichlet function at node coordinates. |
| lib/mito/fem/elements/seg1/DiscretizerCG.h | Populates constrained values for 1D constraints domain (node set) via coordinate evaluation. |
| lib/mito/fem/elements/Discretizer.h | Updates discretizer API to pass constrained values instead of constrained node sets. |
| lib/mito/fem/DiscreteSystem.h | Core refactor: unify multiple function spaces into one system; apply lifting for constrained DOFs; fill constrained solution values. |
| lib/mito/fem/api.h | Updates public API types/factories to match the new multi-contribution DiscreteSystem. |
| lib/mito/constraints/Dirichlet.h | Adds value_type alias for constraint-prescribed value type propagation. |
| .cmake/mito_tests_mito_lib.cmake | Registers the new FEM test in the PETSc-enabled test list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+142
to
+150
| // merge the constrained nodes and their prescribed values of all the function spaces | ||
| std::apply( | ||
| [&](const auto &... contribution) { | ||
| (_constrained_values.insert( | ||
| contribution.space.constrained_values().begin(), | ||
| contribution.space.constrained_values().end()), | ||
| ...); | ||
| }, | ||
| _contributions); |
Comment on lines
63
to
+67
| auto it = node_map.find(node); | ||
| // add the node to the constrained nodes | ||
| constrained_nodes.insert(it->second); | ||
| // add the node to the constrained nodes with the value of the constraint | ||
| // function at the node coordinates | ||
| constrained_values.insert( | ||
| { it->second, function(coord_system.coordinates(node->point())) }); |
Comment on lines
93
to
+97
| auto it = node_map.find(node); | ||
| // add the node to the constrained nodes | ||
| constrained_nodes.insert(it->second); | ||
| // add the node to the constrained nodes with the value of the constraint | ||
| // function at the node coordinates | ||
| constrained_values.insert( | ||
| { it->second, function(coord_system.coordinates(node->point())) }); |
Comment on lines
61
to
+65
| auto it = node_map.find(node); | ||
| // add the node to the constrained nodes | ||
| constrained_nodes.insert(it->second); | ||
| // add the node to the constrained nodes with the value of the constraint function | ||
| // at the node coordinates | ||
| constrained_values.insert( | ||
| { it->second, function(coord_system.coordinates(node->point())) }); |
Comment on lines
+141
to
+143
| // the interface mesh on the layer line y = 0 | ||
| const auto interface_row = parameters.y_segments / 2; | ||
| auto interface_mesh = mito::mesh::mesh<segment_t>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.