From 8ac1891b3c8eb81b576cc7364707110d7a7820cd Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 20 Oct 2011 16:46:11 +0000 Subject: [PATCH] moved DAMASK_NaN to prec.f90 respectively prec_single.f90 as it is precision dependent --- code/constitutive_nonlocal.f90 | 8 ++++---- code/math.f90 | 6 +----- code/prec.f90 | 7 +++++++ code/prec_single.f90 | 15 +++++++++++---- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/code/constitutive_nonlocal.f90 b/code/constitutive_nonlocal.f90 index 6ab5dc748..8f1d7d00d 100644 --- a/code/constitutive_nonlocal.f90 +++ b/code/constitutive_nonlocal.f90 @@ -1489,7 +1489,8 @@ subroutine constitutive_nonlocal_dotState(dotState, Tstar_v, Fe, Fp, Temperature use prec, only: pReal, & pInt, & - p_vec + p_vec, & + DAMASK_NaN use numerics, only: numerics_integrationMode use IO, only: IO_error use debug, only: debug_verbosity, & @@ -1507,8 +1508,7 @@ use math, only: math_norm3, & math_Mandel6to33, & math_QuaternionDisorientation, & math_qRot, & - pi, & - NaN + pi use mesh, only: mesh_NcpElems, & mesh_maxNips, & mesh_maxNipNeighbors, & @@ -1694,7 +1694,7 @@ if (any(1.2_pReal * constitutive_nonlocal_v(1:ns,1:4,g,ip,el) * timestep & write(6,*) '<< CONST >> CFL condition not fullfilled' endif #endif - dotState%p = 0.0_pReal/0.0_pReal + dotState%p = DAMASK_NaN return endif diff --git a/code/math.f90 b/code/math.f90 index fbaadd47c..72b006d50 100644 --- a/code/math.f90 +++ b/code/math.f90 @@ -23,13 +23,12 @@ !############################################################## - use prec, only: pReal,pInt + use prec, only: pReal,pInt,DAMASK_NaN implicit none real(pReal), parameter :: pi = 3.14159265358979323846264338327950288419716939937510_pReal real(pReal), parameter :: inDeg = 180.0_pReal/pi real(pReal), parameter :: inRad = pi/180.0_pReal - real(pReal), parameter :: DAMASK_NaN = Z'7FF0000000000001' ! *** 3x3 Identity *** real(pReal), dimension(3,3), parameter :: math_I3 = & reshape( (/ & @@ -155,9 +154,6 @@ real(pReal), dimension(4,36), parameter :: math_symOperations = & write(6,*) '<<<+- math init -+>>>' write(6,*) '$Id$' write(6,*) - write(6,*) 'NaN: ',DAMASK_NAN - write(6,*) 'NaN /= NaN: ',DAMASK_NaN/=DAMASK_NaN - write(6,*) !$OMP END CRITICAL (write2out) if (fixedSeed > 0_pInt) then diff --git a/code/prec.f90 b/code/prec.f90 index cca18c2bb..cb43a5db7 100644 --- a/code/prec.f90 +++ b/code/prec.f90 @@ -30,6 +30,10 @@ integer, parameter :: pInt = selected_int_kind(9) ! up to +- 1e9 integer, parameter :: pLongInt = 8 ! should be 64bit real(pReal), parameter :: tol_math_check = 1.0e-8_pReal real(pReal), parameter :: tol_gravityNodePos = 1.0e-100_pReal +! NaN is precistion dependent +! from http://www.hpc.unimelb.edu.au/doc/f90lrm/dfum_035.html +! copy found in documentation/Code/Fortran +real(pReal), parameter :: DAMASK_NaN = Z'7FF0000000000001' type :: p_vec real(pReal), dimension(:), pointer :: p @@ -44,6 +48,9 @@ implicit none write(6,*) write(6,*) '<<<+- prec init -+>>>' write(6,*) '$Id$' + write(6,*) + write(6,*) 'NaN: ',DAMASK_NAN + write(6,*) 'NaN /= NaN: ',DAMASK_NaN/=DAMASK_NaN write(6,*) !$OMP END CRITICAL (write2out) diff --git a/code/prec_single.f90 b/code/prec_single.f90 index eb15cc9c3..6d77f5158 100644 --- a/code/prec_single.f90 +++ b/code/prec_single.f90 @@ -17,7 +17,7 @@ ! along with DAMASK. If not, see . ! !############################################################## -!* $Id: prec.f90 407 2009-08-31 15:09:15Z MPIE\f.roters $ +!* $Id$ !############################################################## MODULE prec !############################################################## @@ -30,7 +30,11 @@ integer, parameter :: pInt = selected_int_kind(9) ! up to +- 1e9 integer, parameter :: pLongInt = 4 ! should be 64bit real(pReal), parameter :: tol_math_check = 1.0e-5_pReal real(pReal), parameter :: tol_gravityNodePos = 1.0e-36_pReal - +! NaN is precistion dependent +! from http://www.hpc.unimelb.edu.au/doc/f90lrm/dfum_035.html +! copy can be found in documentation/Code/Fortran +real(pReal), parameter :: DAMASK_NaN = Z'7F800001' + type :: p_vec real(pReal), dimension(:), pointer :: p end type p_vec @@ -40,8 +44,11 @@ CONTAINS subroutine prec_init !$OMP CRITICAL (write2out) write(6,*) - write(6,*) '<<<+- prec init -+>>>' - write(6,*) '$Id: prec.f90 407 2009-08-31 15:09:15Z MPIE\f.roters $' + write(6,*) '<<<+- prec_single init -+>>>' + write(6,*) '$Id$' + write(6,*) + write(6,*) 'NaN: ',DAMASK_NAN + write(6,*) 'NaN /= NaN: ',DAMASK_NaN/=DAMASK_NaN write(6,*) !$OMP END CRITICAL (write2out)