From a836dc29880e25035b6ef1e7837ae3c6a9e679ba Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 19 Sep 2024 11:34:33 +0200 Subject: [PATCH 1/4] updates error checking for reading in parameters --- src/shared/read_parameter_file.F90 | 4 ++-- src/shared/read_source_file.f90 | 12 ++++++++++++ src/shared/read_value_parameters.f90 | 12 ++++++------ src/specfem2D/setup_sources_receivers.F90 | 10 ++++++---- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/shared/read_parameter_file.F90 b/src/shared/read_parameter_file.F90 index 3ededff71..9e65d0274 100644 --- a/src/shared/read_parameter_file.F90 +++ b/src/shared/read_parameter_file.F90 @@ -1395,8 +1395,8 @@ subroutine read_parameter_file_only() if (some_parameters_missing_from_Par_file) then write(*,*) - write(*,*) 'All the above parameters are missing from your Par_file.' - write(*,*) 'Please cut and paste them somewhere in your Par_file (any place is fine), change their values if needed' + write(*,*) 'All the above parameters are either in a wrong number format or missing from your Par_file.' + write(*,*) 'Please correct or cut&paste them somewhere in your Par_file (any place is fine), change their values if needed' write(*,*) '(the above values are just default values), and restart your run.' write(*,*) call stop_the_code('Error: some parameters are missing in your Par_file, it is incomplete or in an older format, & diff --git a/src/shared/read_source_file.f90 b/src/shared/read_source_file.f90 index 674b7d316..c91e0e62c 100644 --- a/src/shared/read_source_file.f90 +++ b/src/shared/read_source_file.f90 @@ -52,6 +52,7 @@ subroutine read_source_file(NSOURCES,BROADCAST_AFTER_READ) character(len=256) string_read character(len=MAX_STRING_LEN) :: source_filename,path_to_add integer, parameter :: IIN_SOURCE = 22 + logical :: stf_exists ! user output if (myrank == 0) then @@ -315,6 +316,17 @@ subroutine read_source_file(NSOURCES,BROADCAST_AFTER_READ) write(IMAIN,*) ' Multiplying factor = ',factor(i_source) write(IMAIN,*) + ! check if external stf file exists + if (time_function_type(i_source) == 8) then + inquire(file=trim(name_of_source_file(i_source)),exist=stf_exists) + if (.not. stf_exists) then + write(*,*) '' + write(*,*) 'Error external source time function file: ',trim(name_of_source_file(i_source)),' not found.' + write(*,*) '' + call stop_the_code('Error reading SOURCE file: could not find specified external source time function file') + endif + endif + enddo ! do i_source= 1,NSOURCES close(IIN_SOURCE) diff --git a/src/shared/read_value_parameters.f90 b/src/shared/read_value_parameters.f90 index b07e4b5a0..8721919eb 100644 --- a/src/shared/read_value_parameters.f90 +++ b/src/shared/read_value_parameters.f90 @@ -197,7 +197,7 @@ subroutine read_value_integer_p(value_to_read, name) call param_read(string_read, len(string_read), name, len(name), ierr) if (ierr /= 0) return - read(string_read,*) value_to_read + read(string_read,*,iostat=ierr) value_to_read end subroutine read_value_integer_p @@ -217,7 +217,7 @@ subroutine read_value_double_precision_p(value_to_read, name) call param_read(string_read, len(string_read), name, len(name), ierr) if (ierr /= 0) return - read(string_read,*) value_to_read + read(string_read,*,iostat=ierr) value_to_read end subroutine read_value_double_precision_p @@ -237,7 +237,7 @@ subroutine read_value_logical_p(value_to_read, name) call param_read(string_read, len(string_read), name, len(name), ierr) if (ierr /= 0) return - read(string_read,*) value_to_read + read(string_read,*,iostat=ierr) value_to_read end subroutine read_value_logical_p @@ -277,7 +277,7 @@ subroutine read_value_integer_next_p(value_to_read, name) call param_read_nextparam(string_read, len(string_read), name, len(name), ierr) if (ierr /= 0) return - read(string_read,*) value_to_read + read(string_read,*,iostat=ierr) value_to_read end subroutine read_value_integer_next_p @@ -297,7 +297,7 @@ subroutine read_value_double_prec_next_p(value_to_read, name) call param_read_nextparam(string_read, len(string_read), name, len(name), ierr) if (ierr /= 0) return - read(string_read,*) value_to_read + read(string_read,*,iostat=ierr) value_to_read end subroutine read_value_double_prec_next_p @@ -317,7 +317,7 @@ subroutine read_value_logical_next_p(value_to_read, name) call param_read_nextparam(string_read, len(string_read), name, len(name), ierr) if (ierr /= 0) return - read(string_read,*) value_to_read + read(string_read,*,iostat=ierr) value_to_read end subroutine read_value_logical_next_p diff --git a/src/specfem2D/setup_sources_receivers.F90 b/src/specfem2D/setup_sources_receivers.F90 index b4f083d22..ce0cb3a96 100644 --- a/src/specfem2D/setup_sources_receivers.F90 +++ b/src/specfem2D/setup_sources_receivers.F90 @@ -140,10 +140,12 @@ subroutine setup_sources() ! user output if (not_in_mesh_domain) then - write(IMAIN,*) 'Source ',i - write(IMAIN,*) ' Position (x,z) of the source = ',x_source(i),z_source(i) - write(IMAIN,*) 'Invalid position, mesh dimensions are: xmin/max = ',xmin,xmax,'zmin/zmax',zmin,zmax - write(IMAIN,*) 'Please fix source location, exiting...' + write(IMAIN,*) 'Error: Source ',i + write(IMAIN,*) ' Position (x,z) of the source = ',x_source(i),z_source(i) + write(IMAIN,*) + write(IMAIN,*) ' Invalid position, mesh dimensions are: xmin/max = ',xmin,xmax,'zmin/zmax',zmin,zmax + write(IMAIN,*) ' Please fix source location, exiting...' + write(IMAIN,*) if (x_source(i) < xmin) call stop_the_code('Error: at least one source has x < xmin of the mesh') if (x_source(i) > xmax) call stop_the_code('Error: at least one source has x > xmax of the mesh') if (z_source(i) < zmin) call stop_the_code('Error: at least one source has z < zmin of the mesh') From ccab74e718bbf16d9384d8f96e18d7138b45f7d4 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 19 Sep 2024 11:56:49 +0200 Subject: [PATCH 2/4] updates github action --- .github/scripts/run_install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/scripts/run_install.sh b/.github/scripts/run_install.sh index 3d005cfd4..9d62f7bc9 100755 --- a/.github/scripts/run_install.sh +++ b/.github/scripts/run_install.sh @@ -21,7 +21,10 @@ echo # python script needs numpy #sudo apt-get install -qq python-numpy # not working, likely installed on older python version +#sudo apt-get install -qq python-matplotlib + pip install --user --upgrade pip setuptools wheel +pip install --use --upgrade importlib-resources pip install --user --upgrade matplotlib pip install --user --only-binary=numpy numpy From 23731d603bae78a94b581015c6a062acc3138ba3 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 19 Sep 2024 12:13:39 +0200 Subject: [PATCH 3/4] updates github action runner (ubuntu 22) --- .github/scripts/run_install.sh | 1 - .github/workflows/CI.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/scripts/run_install.sh b/.github/scripts/run_install.sh index 9d62f7bc9..ac9ee70ed 100755 --- a/.github/scripts/run_install.sh +++ b/.github/scripts/run_install.sh @@ -24,7 +24,6 @@ echo #sudo apt-get install -qq python-matplotlib pip install --user --upgrade pip setuptools wheel -pip install --use --upgrade importlib-resources pip install --user --upgrade matplotlib pip install --user --only-binary=numpy numpy diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 07c9405d5..7edade4fc 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -143,7 +143,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest,ubuntu-20.04] + os: [ubuntu-latest,ubuntu-22.04] steps: - uses: actions/checkout@v4 From 54b634be534d537a9ecaef7c9b4af84287a5e957 Mon Sep 17 00:00:00 2001 From: Daniel Peter Date: Thu, 19 Sep 2024 12:17:29 +0200 Subject: [PATCH 4/4] updates github action (intel oneAPI) --- .github/workflows/CI.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7edade4fc..e1db2f24b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -160,8 +160,8 @@ jobs: linuxCheck-Intel: - name: Test Intel on ubuntu-20.04 - runs-on: ubuntu-20.04 + name: Test Intel on ubuntu-22.04 + runs-on: ubuntu-22.04 needs: changesCheck steps: @@ -169,7 +169,7 @@ jobs: - name: Cache Intel oneapi packages id: cache-intel-oneapi - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: /opt/intel/oneapi key: install-${{ runner.os }}-all