OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
check_nan_acc.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23
24!||====================================================================
25!|| check_nan_acc ../engine/source/output/outfile/check_nan_acc.F
26!||--- called by ------------------------------------------------------
27!|| resol ../engine/source/engine/resol.F
28!||--- calls -----------------------------------------------------
29!|| my_isnan ../engine/source/system/my_isnan.f
30!|| spmd_barrier ../engine/source/mpi/spmd_mod.F90
31!||--- uses -----------------------------------------------------
32!|| nodal_arrays_mod ../common_source/modules/nodal_arrays.F90
33!|| spmd_mod ../engine/source/mpi/spmd_mod.F90
34!||====================================================================
35 SUBROUTINE check_nan_acc(NCYCLE,NODES)
36 USE spmd_mod, ONLY : spmd_barrier
37 USE nodal_arrays_mod
38C-----------------------------------------------
39C I m p l i c i t T y p e s
40C-----------------------------------------------
41#include "implicit_f.inc"
42C-----------------------------------------------
43C C o m m o n B l o c k s
44C-----------------------------------------------
45#include "com04_c.inc"
46#include "scr07_c.inc"
47#include "task_c.inc"
48#include "units_c.inc"
49C-----------------------------------------------
50C D u m m y A r g u m e n t s
51C----------------------------------------------
52! REAL ou REAL*8
53 INTEGER, INTENT(IN) :: NCYCLE
54 TYPE(nodal_arrays_), INTENT(IN) :: NODES
55! -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*
56! NCYCLE : integer, current cycle
57! A : my_real ; dimension=NUMNOD
58! acceleration
59! AR : my_real ; dimension=numnod
60! R acceleration
61! -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*
62C-----------------------------------------------
63C L o c a l V a r i a b l e s
64C-----------------------------------------------
65 LOGICAL :: BOOL_NAN,MY_ISNAN
66 INTEGER :: N
67C-----------------------------------------------
68C S o u r c e L i n e s
69C-----------------------------------------------
70!$COMMENT
71! CHECK_NAN_ACC description
72! check if a NaN appears in A/AR arrays
73!
74! CHECK_NAN_ACC organization :
75! - check if a NaN appears in A/AR arrays
76! - if a NaN is present, print the ID node, the processor and
77! the cycle and then stop the run with MSTOP=1
78!$ENDCOMMENT
79
80 bool_nan = .false.
81 DO n=1,numnod
82 IF(my_isnan(nodes%A(1,n)).OR.my_isnan(nodes%A(2,n)).OR.my_isnan(nodes%A(3,n))) THEN
83 WRITE(iout,1000) ispmd,ncycle
84 WRITE(iout,1001) n,nodes%ITAB(n)
85 WRITE(iout,1002) nodes%A(1,n),nodes%A(2,n),nodes%A(3,n)
86
87 WRITE(istdo,1000) ispmd,ncycle
88 WRITE(istdo,1001) n,nodes%ITAB(n)
89 WRITE(istdo,1002) nodes%A(1,n),nodes%A(2,n),nodes%A(3,n)
90
91
92 bool_nan = .true.
93 ENDIF
94
95 IF(my_isnan(nodes%AR(1,n)).OR.my_isnan(nodes%AR(2,n)).OR.my_isnan(nodes%AR(3,n))) THEN
96 WRITE(iout,1003) ispmd,ncycle
97 WRITE(iout,1001) n,nodes%ITAB(n)
98 WRITE(iout,1004) nodes%AR(1,n),nodes%AR(2,n),nodes%AR(3,n)
99
100 WRITE(istdo,1003) ispmd,ncycle
101 WRITE(istdo,1001) n,nodes%ITAB(n)
102 WRITE(istdo,1004) nodes%AR(1,n),nodes%AR(2,n),nodes%AR(3,n)
103
104 bool_nan = .true.
105 ENDIF
106 ENDDO
107
108 CALL spmd_barrier()
109
110 IF(bool_nan) THEN
111 WRITE(iout,1005)
112 WRITE(istdo,1005)
113 mstop=1
114! CALL FLUSH(6)
115! CALL ARRET(2)
116 ENDIF
117
118 1000 FORMAT(3x,'NaN detected on A array on processor ID',i10,' at cycle',i10)
119 1001 FORMAT(3x,'Local node ID: ',i10,' Global node ID:',i10 )
120 1002 FORMAT(3x,'A values: ',1pe10.3,1pe10.3,1pe10.3)
121 1003 FORMAT(3x,'NaN detected on AR array on processor ID',i10,' at cycle',i10)
122 1004 FORMAT(3x,'AR values: ',1pe10.3,1pe10.3,1pe10.3)
123 1005 FORMAT(/,3x,'********************* NaN ********************* ',/,
124 . 3x,'******** I"m going to kill the run now ******** ',/,
125 . 3x,'********************* NaN ********************* ',/)
126
127
128
129 RETURN
130 END SUBROUTINE check_nan_acc
131
subroutine check_nan_acc(ncycle, nodes)
logical function my_isnan(x)
Definition my_isnan.F:30