Added center point procedure to edge and eps in inside to avoid some rounding errors

This commit is contained in:
Jorge Gonzalez 2026-03-04 10:41:55 +01:00
commit 600f7305bd
9 changed files with 129 additions and 25 deletions

View file

@ -28,6 +28,7 @@ MODULE moduleMesh2DCyl
PROCEDURE, PASS:: getNodes => getNodes2DCyl
PROCEDURE, PASS:: intersection => intersection2DCylEdge
PROCEDURE, PASS:: randPos => randPosEdge
procedure, pass:: center => centerEdgeSegm
procedure, nopass:: fPsi => fPsiSegm
END TYPE meshEdge2DCyl
@ -225,19 +226,37 @@ MODULE moduleMesh2DCyl
IMPLICIT NONE
CLASS(meshEdge2DCyl), INTENT(in):: self
REAL(8):: rnd
REAL(8):: r(1:3)
REAL(8):: p1(1:2), p2(1:2)
real(8):: Xi(1:3)
real(8):: r(1:3)
real(8):: fPsi(1:2)
rnd = random()
Xi = 0.d0
Xi(1) = random()
p1 = (/self%z(1), self%r(1) /)
p2 = (/self%z(2), self%r(2) /)
r(1:2) = (1.D0 - rnd)*p1 + rnd*p2
r(3) = 0.D0
fPsi = self%fPsi(Xi, 2)
r = (/dot_product(fPsi, self%z), &
dot_product(fPsi, self%r), &
0.d0/)
END FUNCTION randPosEdge
function centerEdgeSegm(self) result(r)
use moduleMeshCommon, only: cenSeg
implicit none
class(meshEdge2DCyl), intent(in):: self
real(8):: r(1:3)
real(8):: fPsi(1:2)
fPsi = self%fPsi(cenSeg, 2)
r = (/dot_product(fPsi, self%z), &
dot_product(fPsi, self%r), &
0.d0/)
end function centerEdgeSegm
!CELL FUNCTIONS
!QUAD FUNCTIONS
!Init element
@ -456,9 +475,12 @@ MODULE moduleMesh2DCyl
REAL(8), INTENT(in):: Xi(1:3)
LOGICAL:: ins
real(8):: eps
ins = (Xi(1) >= -1.D0 .AND. Xi(1) <= 1.D0) .AND. &
(Xi(2) >= -1.D0 .AND. Xi(2) <= 1.D0)
eps = 1.0d-10
ins = (Xi(1) >= -1.D0-eps .AND. Xi(1) <= 1.D0+eps) .AND. &
(Xi(2) >= -1.D0-eps .AND. Xi(2) <= 1.D0+eps)
END FUNCTION insideQuad