Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates error checking & github actions #1242

Merged
merged 4 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/scripts/run_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ 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 --user --upgrade matplotlib
pip install --user --only-binary=numpy numpy
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest,ubuntu-20.04]
os: [ubuntu-latest,ubuntu-22.04]

steps:
- uses: actions/checkout@v4
Expand All @@ -160,16 +160,16 @@ 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:
- uses: actions/checkout@v4

- 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
Expand Down
4 changes: 2 additions & 2 deletions src/shared/read_parameter_file.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1395,8 +1395,8 @@

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'

Check warning on line 1399 in src/shared/read_parameter_file.F90

View check run for this annotation

Codecov / codecov/patch

src/shared/read_parameter_file.F90#L1398-L1399

Added lines #L1398 - L1399 were not covered by tests
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, &
Expand Down
12 changes: 12 additions & 0 deletions src/shared/read_source_file.f90
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
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
Expand Down Expand Up @@ -315,6 +316,17 @@
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')

Check warning on line 326 in src/shared/read_source_file.f90

View check run for this annotation

Codecov / codecov/patch

src/shared/read_source_file.f90#L321-L326

Added lines #L321 - L326 were not covered by tests
endif
endif

enddo ! do i_source= 1,NSOURCES
close(IIN_SOURCE)

Expand Down
12 changes: 6 additions & 6 deletions src/shared/read_value_parameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
10 changes: 6 additions & 4 deletions src/specfem2D/setup_sources_receivers.F90
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@

! 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,*)

Check warning on line 148 in src/specfem2D/setup_sources_receivers.F90

View check run for this annotation

Codecov / codecov/patch

src/specfem2D/setup_sources_receivers.F90#L143-L148

Added lines #L143 - L148 were not covered by tests
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')
Expand Down