From e7a47611d9c748223df26ae506378590281d537b Mon Sep 17 00:00:00 2001 From: JGonzalez Date: Mon, 9 Mar 2026 18:07:06 +0100 Subject: [PATCH] This is now an iterative process, which makes things better --- src/modules/mesh/moduleMesh@boundaryParticle.f90 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/mesh/moduleMesh@boundaryParticle.f90 b/src/modules/mesh/moduleMesh@boundaryParticle.f90 index ba01430..c51c26d 100644 --- a/src/modules/mesh/moduleMesh@boundaryParticle.f90 +++ b/src/modules/mesh/moduleMesh@boundaryParticle.f90 @@ -387,13 +387,15 @@ submodule(moduleMesh) boundaryParticle end do + ! Correction for this time step alpha = 1.d0 - density_incident/density_rest - ! Limit alpha between 0 and 1 - alpha = min(alpha, 1.d0) - alpha = max(alpha, 0.d0) + ! Apply correction with a factor of 0.1 to avoid fast changes + self%alpha(edge%n) = self%alpha(edge%n) + 0.1d0 * alpha - self%alpha(edge%n) = alpha + ! Limit alpha between 0 and 1 + self%alpha(edge%n) = min(self%alpha(edge%n), 1.d0) + self%alpha(edge%n) = max(self%alpha(edge%n), 0.d0) deallocate(density_nodes)