Skip to content

[SolidMechanics] Add component for source term integration based on new FEM framework#6196

Open
th-skam wants to merge 2 commits into
sofa-framework:masterfrom
th-skam:sourceTerm
Open

[SolidMechanics] Add component for source term integration based on new FEM framework#6196
th-skam wants to merge 2 commits into
sofa-framework:masterfrom
th-skam:sourceTerm

Conversation

@th-skam

@th-skam th-skam commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This is to allow integrating a source term (load) on the rhs of the PDE. Let's say we have

$$\frac{\partial^2 u}{\partial x^2} = f$$

So $f$ is force per unit volume (provided by the user) and is sampled at the nodes. We integrate it with a quadrature rule to compute nodal forces $F_i$.

I modelled the component after FEMMass though I only implemented addForce for now. For my current use-case, the source terms are set on the reference configuration and are only explicit contributions. It's been tested through the verification process with MMS.

Discussion

There's some similarity with what FEMMass is doing. It would be worthwhile to discuss a possible code factorization of these components even with this PR.
And, on top of that, perhaps we could factorize the computations in the scene: one component handling the matrix assembly and the other one responsible for using it to compute addForce. This way, if there are more than one source terms, we do not visit the elements/quadratures multiple times. That's to be seen.

Fixes #6166

@th-skam th-skam added pr: status to review To notify reviewers to review this pull-request pr: enhancement About a possible enhancement pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI labels Jul 21, 2026
@bakpaul

bakpaul commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

I am not a FEM expert so I don't feel confident to review this PR. Nevertheless I checked to make sure this is compatible with higher order element and it seems ton be the case. So it is fine by me given that @alxbilger and/or @hugtalbot review it.

Could you add an example ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI pr: enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new SourceTermFEMForceField

2 participants