|||
Thefollowing are the FORTRAN programs (FORTRAN 90) thatwere used to compute the real root of a nonlinear equations system, byusing the gradients method.
…
CALL GRADIENTS (X01,X02, YT1, YT2, XP, YP, ZP, X, Y, Z, CT)
…
SUBROUTINE GRADIENTS (X01,X02, YT1, YT2, XP, YP, ZP, X, Y, Z, CT)
C X01, X02 are the given initial values
C YT1, YT2 are the final solutions
C XP, YP, ZP are the coordinates of thecalculation points
C X, Y, Z are the coordinates of the eightnodal points of the a curved quadrilateral element
C CT is the anisotropic tensor
C EPS is a stopping criterion
IMPLICIT NONE
DOUBLE PRECISION X(8), Y(8), Z(8), X01, X02, YT1,YT2, XP, YP, ZP, EPS, Y1, Y2
DOUBLE PRECISION F, F1, F2, CT(3, 3)
INTEGER L
L=5000
EPS=1.0E-35
YT1=X01
YT2=X02
CALL DSNSE(EPS, YT1,YT2, Y1, Y2, L, XP, YP, ZP, X, Y, Z, CT)
IF(L.GT.0) THEN
WRITE(11,*) 'iteration number = ',5000-L
ENDIF
RETURN
END
SUBROUTINE DSNSE(EPS,YT1, YT2, Y1, Y2, L, XP, YP, ZP, X, Y, Z, CT)
IMPLICIT NONE
DOUBLE PRECISION EPS, YT1, YT2, Y1, Y2, X(8), Y(8), Z(8), XP, YP, ZP, F, D, S, CT(3, 3)
INTEGER L
5 CALL FS(YT1, YT2, F, Y1, Y2, XP, YP, ZP, X, Y, Z, CT)
IF(DSQRT(F).GE.EPS) THEN
L=L-1
IF(L.EQ.0) RETURN
D=Y1**2+Y2**2
IF(D.EQ.0)THEN
L=-1
RETURN
ENDIF
S=F/D
YT1=YT1-S*Y1
YT2=YT2-S*Y2
GOTO 5
ENDIF
RETURN
END
SUBROUTINE FS(YT1,YT2, F, Y1, Y2, XP, YP, ZP, X, Y, Z, CT)
IMPLICIT NONE
DOUBLE PRECISION YT1, YT2, Y1, Y2, X(8), Y(8), Z(8), XP, YP, ZP, F, XK, YK, ZK
DOUBLE PRECISION F1, F2, DF1, DF2, DX1, DY1, DZ1, DX2,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