Skip to content

Improve accuracy of traction-free BC to 2nd order - #68

Merged
ilateur merged 1 commit into
devfrom
accurate-elasticForce-BC
Apr 9, 2025
Merged

Improve accuracy of traction-free BC to 2nd order#68
ilateur merged 1 commit into
devfrom
accurate-elasticForce-BC

Conversation

@ilateur

@ilateur ilateur commented Apr 8, 2025

Copy link
Copy Markdown
Collaborator

Previously, the traction-free boundary conditions used to be applied using a central difference scheme, combined with an average of two cells as approximation. So for the cell at the left boundary at index i, the derivative in the x direction was approximated by a central difference using a step size of only half a cell:

dσ/dx ≈ (σ(i + ½) - σ(i - ½)) / (2 c/2)

The left side is determined by the boundary conditions: σ(i - ½) = 0
The right side is in between cells. To approximate this value, we use the average of the known cells:

σ(i + ½) ≈ (σ(i + 1) + σ(i)) / 2

Which yielded the previous derivative at the boundary:

dσ/dx ≈ (σ(i + 1) + σ(i)) / (2 c)

The new way uses a custom 2nd order accurate stencil:

dσ/dx = (σ(i + 1) + 3 σ(i) - 4 σ(i - ½)) / (3 c) + O(c²)

Then σ(i - ½) = 0 is is used to impose the boundary condition.

Besides being more correct than before, this way also seems to be much more stable. Sadly, it is not magic, and it is still possible to have unstable simulations.

@ilateur ilateur added the enhancement New feature or request label Apr 8, 2025
@ilateur
ilateur requested review from DiegoDeGusem and lamoreel April 8, 2025 13:18
@ilateur ilateur self-assigned this Apr 8, 2025
@DiegoDeGusem

Copy link
Copy Markdown
Contributor

What if you try an even higher order stencil? Would that be magical 🤔

@ilateur

ilateur commented Apr 9, 2025

Copy link
Copy Markdown
Collaborator Author

I can try, but I'd have to calculate one first. Perhaps it's better, but I doubt it will be fully stable.

@ilateur
ilateur merged commit c7680a5 into dev Apr 9, 2025
@ilateur
ilateur deleted the accurate-elasticForce-BC branch April 9, 2025 10:43
gyuyoungpark pushed a commit to gyuyoungpark/mumax-plus-extensions that referenced this pull request Mar 1, 2026
Improve accuracy of traction-free BC to 2nd order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants