Skip to content

Embedded Interfaces#101

Draft
Pawel024 wants to merge 7 commits into
fem-1d-embedded-in-2dfrom
embedded-interfaces
Draft

Embedded Interfaces#101
Pawel024 wants to merge 7 commits into
fem-1d-embedded-in-2dfrom
embedded-interfaces

Conversation

@Pawel024

Copy link
Copy Markdown
Collaborator

No description provided.

@Pawel024
Pawel024 changed the base branch from main to fem-1d-embedded-in-2d July 25, 2026 08:26
@Pawel024
Pawel024 requested a review from Copilot July 25, 2026 08:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::Contribution and refactor DiscreteSystem to 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>();
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

Successfully merging this pull request may close these issues.

2 participants