From 7d7359cb7489d96091e4b2a5b164c792630ca769 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 11 Dec 2024 11:41:10 +0000 Subject: [PATCH] Remove variable_error checking from maths library --- CMakeLists.txt | 1 - source/fortran/constraint_equations.f90 | 5 +-- source/fortran/iteration_variables.f90 | 9 ++---- source/fortran/maths_library.f90 | 42 ------------------------- source/fortran/output.f90 | 4 --- 5 files changed, 3 insertions(+), 58 deletions(-) delete mode 100644 source/fortran/maths_library.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 000b25dd..8d7ea488 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,6 @@ LIST(APPEND PROCESS_SRCS ife_variables.f90 heat_transport_variables.f90 buildings_variables.f90 - maths_library.f90 iteration_variables.f90 water_usage_variables.f90 constraint_equations.f90 diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index 109b499d..444bdfbc 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -47,7 +47,6 @@ subroutine constraint_eqns(m,ieqn,cc,con,err,symbol,units) !! !! 1. use numerics, only: icc - use maths_library, only: variable_error implicit none @@ -307,9 +306,7 @@ subroutine constraint_eqns(m,ieqn,cc,con,err,symbol,units) if (present(units)) units(i) = tmp_units end if - ! Crude method of catching NaN errors - !if ((abs(cc(i)) > 9.99D99).or.(cc(i) /= cc(i))) then - if (variable_error(cc(i))) then + if (isnan(cc(i)).or.(abs(cc(i))>9.99D99)) then ! Add debugging lines as appropriate... select case (icc(i)) diff --git a/source/fortran/iteration_variables.f90 b/source/fortran/iteration_variables.f90 index 948a04c0..48cc0dd1 100755 --- a/source/fortran/iteration_variables.f90 +++ b/source/fortran/iteration_variables.f90 @@ -3933,7 +3933,6 @@ subroutine loadxc ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! use constants, only: nout - use maths_library, only: variable_error use error_handling, only: idiags, fdiags, report_error use numerics, only: nvar, xcm, ixc, name_xc, lablxc, scafc, scale use physics_variables, only: i_plasma_current @@ -4152,10 +4151,7 @@ subroutine loadxc call report_error(55) end if - ! Crude method of catching NaN errors - - !if ( (abs(xcm(i)) > 9.99D99).or.(xcm(i) /= xcm(i)) ) then - if ( variable_error(xcm(i)) ) then + if ((isnan(xcm(i)).or.(abs(xcm(i))>9.99D99))) then idiags(1) = i ; idiags(2) = ixc(i) ; fdiags(1) = xcm(i) call report_error(56) end if @@ -4190,7 +4186,6 @@ subroutine convxc(xc,nn) use error_handling, only: idiags, fdiags, report_error use numerics, only: ipnvars, scale, ixc, lablxc - use maths_library, only: variable_error #ifndef dp use, intrinsic :: iso_fortran_env, only: dp=>real64 #endif @@ -4406,7 +4401,7 @@ subroutine convxc(xc,nn) ! Crude method of catching NaN errors !if ((abs(xc(i)) > 9.99D99).or.(xc(i) /= xc(i))) then - if(variable_error(xc(i)))then + if (isnan(xc(i)).or.(abs(xc(i))>9.99D99)) then idiags(1) = i ; idiags(2) = ixc(i) ; fdiags(1) = xc(i) call report_error(59) end if diff --git a/source/fortran/maths_library.f90 b/source/fortran/maths_library.f90 deleted file mode 100644 index a4fccc1e..00000000 --- a/source/fortran/maths_library.f90 +++ /dev/null @@ -1,42 +0,0 @@ -module maths_library - - !! Library of mathematical and numerical routines - !! author: P J Knight, CCFE, Culham Science Centre - !! N/A - !! This module contains a large number of routines to enable - !! PROCESS to perform a variety of numerical procedures, including - !! linear algebra, zero finding, integration and minimisation. - !! The module is an amalgamation of the contents of several - !! different pre-existing PROCESS source files, which themselves - !! were derived from a number of different numerical libraries - !! including BLAS and MINPAC. - !! http://en.wikipedia.org/wiki/Gamma_function - ! - ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -#ifndef dp - use, intrinsic :: iso_fortran_env, only: dp=>real64 -#endif - - !use process_output - - implicit none - -contains - - ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - ! ------------------------------------------------------------------------ - pure function variable_error(variable) - real(dp), intent(in) ::variable - logical::variable_error - - if((variable/=variable).or.(variable<-9.99D99).or.(variable>9.99D99))then - variable_error = .TRUE. - else - variable_error = .FALSE. - end if - - end function variable_error - -end module maths_library diff --git a/source/fortran/output.f90 b/source/fortran/output.f90 index 5e5200db..c40763bb 100755 --- a/source/fortran/output.f90 +++ b/source/fortran/output.f90 @@ -422,7 +422,6 @@ subroutine ovarre(file,descr,varnam,value,output_flag) use numerics, only: name_xc use global_variables, only: icase, vlabel use constants, only: mfile, nout - use maths_library, only: variable_error implicit none ! Arguments @@ -502,7 +501,6 @@ subroutine ovarin(file,descr,varnam,value,output_flag) use numerics, only: name_xc, icc, ioptimz use global_variables, only: xlabel_2, iscan_global use constants, only: mfile, nout - use maths_library, only: variable_error implicit none ! Arguments @@ -619,7 +617,6 @@ subroutine ocosts(file,ccode,descr,value) ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! use constants, only: pi, mfile, nplot, twopi - use maths_library, only: variable_error implicit none ! Arguments @@ -667,7 +664,6 @@ subroutine obuild(file,descr,thick,total,variable_name) use numerics, only: boundl, boundu use constants, only: electron_charge - use maths_library, only: variable_error implicit none ! Arguments