diff --git a/.github/workflows/common-workflow.yml b/.github/workflows/common-workflow.yml index 6a9d48ae5..6327b2b52 100644 --- a/.github/workflows/common-workflow.yml +++ b/.github/workflows/common-workflow.yml @@ -6,7 +6,7 @@ on: os: required: true type: string - build_type: + build_type: required: true type: string build_command: @@ -29,80 +29,80 @@ on: type: string env: ISSM_DIR: ${{ github.workspace }} - + jobs: build: - name: build-ISSM-${{ inputs.os }}-${{ inputs.build_type}} + name: build-ISSM-${{ inputs.os }}-${{ inputs.build_type }} runs-on: ${{ inputs.os }} outputs: - test_matrix: ${{ steps.creatTestMatrix.outputs.test_output }} + test_matrix: ${{ steps.createTestMatrix.outputs.test_output }} steps: - - name: Check out repository code + - name: Check out copy of repository uses: actions/checkout@v4 - - - name: Cache externalpackages + + - name: Cache external packages uses: actions/cache@v3 id: cache-externalpackages env: - cache-name: cache-externalpackages-${{ inputs.build_type}} + cache-name: cache-externalpackages-${{ inputs.build_type }} with: path: | ${{ env.ISSM_DIR }}/externalpackages/ !${{ env.ISSM_DIR }}/externalpackages/petsc/src/ key: ${{ runner.os }}-build-${{ env.cache-name }} - - - name: Prepare External Packages - if: ${{ steps.cache-externalpackages.outputs.cache-hit != 'true'}} + + - name: Prepare external packages + if: ${{ steps.cache-externalpackages.outputs.cache-hit != 'true' }} run: | ${{ inputs.ext_install_command }} - name: Get MATLAB - if: ${{inputs.interface == 'matlab'}} - id: setup-matlab + if: ${{ inputs.interface == 'matlab' }} + id: setup-matlab uses: matlab-actions/setup-matlab@v2 with: release: R2023b cache: true - - name: Prepare python + - name: Prepare Python if: contains( inputs.interface, 'python') uses: actions/setup-python@v5 id: setup-python with: python-version: ${{ inputs.python_version }} - - name: Install dependencies - if: contains( inputs.interface, 'python') + - name: Install Python dependencies + if: contains(inputs.interface, 'python') run: | sudo apt-get install libpython${{ inputs.python_version }}-dev sudo apt-get install python3-dev python -m pip install --upgrade pip sudo apt-get update && sudo apt-get install -y python-tk python3-tk - python -m pip install numpy scipy matplotlib nose + python -m pip install numpy==2.1.0 scipy matplotlib nose - - name: build ISSM + - name: Build ISSM run: | export MATLAB_ROOT=${{ steps.setup-matlab.outputs.matlabroot }} export PYTHON_ROOT=${{ env.pythonLocation }} export NUMPY_ROOT=${{ env.LD_LIBRARY_PATH }}/python3.11/site-packages/numpy - ${{ inputs.build_command}} + ${{ inputs.build_command }} - name: Compile ISSM run: make -j4 install - name: Compress ISSM artifact - run: tar --exclude='./externalpackages/petsc/src' -cvf ISSM_artifact-${{ runner.os }}-${{ inputs.build_type}}.tar -C ${{ env.ISSM_DIR }}/ . - + run: tar --exclude='./externalpackages/petsc/src' -cvf ISSM_artifact-${{ runner.os }}-${{ inputs.build_type }}.tar -C ${{ env.ISSM_DIR }}/ . + - name: Upload ISSM artifact uses: actions/upload-artifact@v4 with: name: ISSM-${{ runner.os }}-${{ inputs.build_type }} path: ISSM_artifact-${{ runner.os }}-${{ inputs.build_type }}.tar - compression-level: 1 - - id: creatTestMatrix + compression-level: 1 + - id: createTestMatrix run: | TESTS='${{ inputs.test_cases }}' - echo "test_output=$(jq -cn --argjson values "$TESTS" '{test_cases: $values}')" >> $GITHUB_OUTPUT + echo "test_output=$(jq -cn --argjson values "$TESTS" '{test_cases: $values}')" >> $GITHUB_OUTPUT test: runs-on: ${{ inputs.os }} needs: build @@ -113,26 +113,26 @@ jobs: - name: Download ISSM artifact uses: actions/download-artifact@v4 with: - name: ISSM-${{ runner.os }}-${{ inputs.build_type}} + name: ISSM-${{ runner.os }}-${{ inputs.build_type }} path: ${{ env.ISSM_DIR }} - - - name: uncompress ISSM artifact + + - name: Unpack ISSM artifact run: | - tar -xvf ISSM_artifact-${{ runner.os }}-${{ inputs.build_type}}.tar + tar -xvf ISSM_artifact-${{ runner.os }}-${{ inputs.build_type }}.tar source $ISSM_DIR/etc/environment.sh working-directory: ${{ env.ISSM_DIR }} shell: 'bash' - + - name: Get MATLAB - if: ${{inputs.interface == 'matlab'}} - id: setup-matlab + if: ${{ inputs.interface == 'matlab' }} + id: setup-matlab uses: matlab-actions/setup-matlab@v2 with: release: R2023b cache: true - + - name: Creating matlab_ci.m - if: ${{inputs.interface == 'matlab'}} + if: ${{ inputs.interface == 'matlab' }} run: | cat > ${ISSM_DIR}/matlab_ci.m << EOF % Go to the test directory @@ -143,43 +143,43 @@ jobs: devpath; % Run tests - runme('exclude',[IdFromString('Dakota')],${{inputs.additional_options}} 'id',[${{matrix.test_cases}}],'quitonerror',1); + runme('exclude',[IdFromString('Dakota')],${{ inputs.additional_options }} 'id',[${{ matrix.test_cases }}],'quitonerror',1); quit(0); EOF cat ${ISSM_DIR}/matlab_ci.m - + - name: Get run-matlab-command - if: ${{inputs.interface == 'matlab'}} + if: ${{ inputs.interface == 'matlab' }} run: | wget -O /usr/local/bin/run-matlab-command https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v2/glnxa64/run-matlab-command chmod +x /usr/local/bin/run-matlab-command - + - name: Run MATLAB tests if: ${{inputs.interface == 'matlab'}} run: | source $ISSM_DIR/etc/environment.sh LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6:$ISSM_DIR/externalpackages/petsc/install/lib/libmpi.so:$ISSM_DIR/externalpackages/petsc/install/lib/libmpifort.so run-matlab-command "matlab_ci" - - - name: Prepare python - if: contains( inputs.interface, 'python') + + - name: Prepare Python + if: contains(inputs.interface, 'python') uses: actions/setup-python@v5 id: setup-python with: python-version: ${{ inputs.python_version }} - - name: Install dependencies + - name: Install Python dependencies if: contains( inputs.interface, 'python') run: | python -m pip install --upgrade pip sudo apt-get update && sudo apt-get install -y python-tk python3-tk - python -m pip install numpy scipy matplotlib nose netCDF4 + python -m pip install numpy==2.1.0 scipy matplotlib nose netCDF4 - name: Run Python tests - if: contains( inputs.interface, 'python') + if: contains(inputs.interface, 'python') run: | export PYTHONPATH="${ISSM_DIR}/src/m/dev:${PYTHONPATH}" - export PYTHONSTARTUP="${PYTHONPATH}/devpath.py" + export PYTHONSTARTUP="${ISSM_DIR}/src/m/dev/devpath.py" export PYTHONUNBUFFERED=1 source $ISSM_DIR/etc/environment.sh cd $ISSM_DIR/test/NightlyRun - LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6:$ISSM_DIR/externalpackages/petsc/install/lib/libmpi.so:$ISSM_DIR/externalpackages/petsc/install/lib/libmpifort.so ./runme.py --output=nightly --rank=1 --numprocs=1 --id {{matrix.test_cases}} --exclude Dakota 234 418 420 + LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6:$ISSM_DIR/externalpackages/petsc/install/lib/libmpi.so:$ISSM_DIR/externalpackages/petsc/install/lib/libmpifort.so ./runme.py --output=nightly --rank=1 --numprocs=1 --id ${{ matrix.test_cases }} --exclude Dakota 234 418 420 diff --git a/.github/workflows/ubuntu-python.yml b/.github/workflows/ubuntu-python.yml index ab2033715..18e3a8f84 100644 --- a/.github/workflows/ubuntu-python.yml +++ b/.github/workflows/ubuntu-python.yml @@ -44,7 +44,7 @@ jobs: cd $ISSM_DIR/externalpackages/m1qn3 && ./install-linux.sh cd $ISSM_DIR/externalpackages/petsc && ./install-3.22-linux.sh cd $ISSM_DIR/externalpackages/semic && ./install.sh - test_cases: '["range(101,216)", "range(217,400)", "range(401, 900)"]' + test_cases: '["101:399", "401:899"]' additional_options: " " secrets: inherit name: build-test-ubuntu-python diff --git a/jenkins/jenkins.sh b/jenkins/jenkins.sh index 3d8cda187..ac3a6538e 100755 --- a/jenkins/jenkins.sh +++ b/jenkins/jenkins.sh @@ -397,7 +397,7 @@ if [ $PYTHON_TEST -eq 1 ]; then else export PYTHONPATH="${ISSM_DIR}/src/m/dev:${PYTHONPATH}" fi - export PYTHONSTARTUP="${PYTHONPATH}/devpath.py" + export PYTHONSTARTUP="${ISSM_DIR}/src/m/dev/devpath.py" export PYTHONUNBUFFERED=1 # We don't want Python to buffer otherwise issm.exe output is not captured for (( i=1;i<=$NUMCPUS_RUN;i++ )) do diff --git a/jenkins/mac-intel-full b/jenkins/mac-intel-full index c56255514..0b449d1ad 100755 --- a/jenkins/mac-intel-full +++ b/jenkins/mac-intel-full @@ -23,7 +23,7 @@ ISSM_CONFIG='\ --with-python-version=3.9 \ --with-python-dir=/System/Volumes/Data/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9 \ --with-python-numpy-dir=${HOME}/.venv/issm/lib/python3.9/site-packages/numpy \ - --with-fortran-lib="-L/usr/local/Cellar/gcc/14.1.0_2/lib/gcc/current -lgfortran" \ + --with-fortran-lib="-L/usr/local/Cellar/gcc/14.2.0_1/lib/gcc/current -lgfortran" \ --with-mpi-include=${ISSM_DIR}/externalpackages/petsc/install/include \ --with-mpi-libflags="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lmpi -lmpicxx -lmpifort" \ --with-blas-lapack-dir=${ISSM_DIR}/externalpackages/petsc/install \ @@ -59,7 +59,7 @@ EXTERNALPACKAGES=" hdf5 install-1.sh netcdf install-4.sh proj install-6.sh - gdal install-3-python.sh + gdal install-3-mac-python.sh gshhg install.sh gmt install-6-mac.sh gmsh install-4-mac.sh diff --git a/src/m/geometry/GetAreas.py b/src/m/geometry/GetAreas.py index 83e4b6bc7..8f2815be7 100644 --- a/src/m/geometry/GetAreas.py +++ b/src/m/geometry/GetAreas.py @@ -2,36 +2,34 @@ def GetAreas(index, x, y, z=np.array([])): - """ - GETAREAS - compute areas or volumes of elements + """GetAreas - compute areas or volumes of elements - compute areas of triangular elements or volumes - of pentahedrons + compute areas of triangular elements or volumes of pentahedrons - Usage: - areas =GetAreas(index, x, y) - volumes = GetAreas(index, x, y, z) + Usage: + areas = GetAreas(index, x, y) + volumes = GetAreas(index, x, y, z) - Examples: - areas =GetAreas(md.mesh.elements, md.mesh.x, md.mesh.y) - volumes = GetAreas(md.mesh.elements, md.mesh.x, md.mesh.y, md.z) + Examples: + areas = GetAreas(md.mesh.elements, md.mesh.x, md.mesh.y) + volumes = GetAreas(md.mesh.elements, md.mesh.x, md.mesh.y, md.z) """ - #get number of elements and number of nodes - nels = np.size(index, axis=0) - nods = np.size(x) + # Get number of elements and number of nodes + nels = np.shape(index)[0] + nods = np.shape(x)[0] - #some checks - if np.size(y) != nods or (z and np.size(z) != nods): - raise TypeError("GetAreas error message: x, y and z do not have the same length.") + # Some checks + if np.shape(y)[0] != nods or (z and np.shape(z)[0] != nods): + raise TypeError('GetAreas error message: x, y and z do not have the same length.') if np.max(index) > nods: - raise TypeError("GetAreas error message: index should not have values above %d." % nods) - if (not z and np.size(index, axis=1) != 3): - raise TypeError("GetAreas error message: index should have 3 columns for 2d meshes.") - if (z and np.size(index, axis=1) != 6): - raise TypeError("GetAreas error message: index should have 6 columns for 3d meshes.") + raise TypeError('GetAreas error message: index should not have values above {}.'.format(nods)) + if (not z and np.shape(index)[1] != 3): + raise TypeError('GetAreas error message: index should have 3 columns for 2d meshes.') + if (z and np.shape(index)[1] != 6): + raise TypeError('GetAreas error message: index should have 6 columns for 3d meshes.') - #initialization + # Initialization areas = np.zeros(nels) x1 = x[index[:, 0] - 1] x2 = x[index[:, 1] - 1] @@ -40,12 +38,12 @@ def GetAreas(index, x, y, z=np.array([])): y2 = y[index[:, 1] - 1] y3 = y[index[:, 2] - 1] - #compute the volume of each element + # Compute the volume of each element if not z: - #compute the surface of the triangle + # Compute the surface of the triangle areas = (0.5 * ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1))) else: - #V = area(triangle) * 1 / 3(z1 + z2 + z3) + # V = area(triangle) * 1/3(z1 + z2 + z3) thickness = np.mean(z[index[:, 3:6] - 1]) - np.mean(z[index[:, 0:3] - 1]) areas = (0.5 * ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1))) * thickness diff --git a/src/m/mesh/rifts/meshprocessrifts.py b/src/m/mesh/rifts/meshprocessrifts.py index 648384790..0d4052b7a 100644 --- a/src/m/mesh/rifts/meshprocessrifts.py +++ b/src/m/mesh/rifts/meshprocessrifts.py @@ -7,7 +7,7 @@ def meshprocessrifts(md, domainoutline): - """MESHPROCESSRIFTS - process mesh when rifts are present + """meshprocessrifts - process mesh when rifts are present split rifts inside mesh (rifts are defined by presence of segments inside the domain outline) @@ -28,20 +28,20 @@ def meshprocessrifts(md, domainoutline): md.mesh.segments = md.mesh.segments.astype(int) md.mesh.segmentmarkers = md.mesh.segmentmarkers.astype(int) if not isinstance(md.rifts.riftstruct, list) or not md.rifts.riftstruct: - raise RuntimeError("ProcessRifts did not find any rift") + raise RuntimeError('ProcessRifts did not find any rift') - #Fill in rest of fields: + # Fill in rest of fields md.mesh.numberofelements = np.size(md.mesh.elements, axis=0) md.mesh.numberofvertices = np.size(md.mesh.x) md.mesh.vertexonboundary = np.zeros(np.size(md.mesh.x), int) md.mesh.vertexonboundary[md.mesh.segments[:, 0:2] - 1] = 1 - #get coordinates of rift tips + # Get coordinates of rift tips for rift in md.rifts.riftstruct: rift['tip1coordinates'] = np.hstack((md.mesh.x[rift['tips'][0, 0].astype(int) - 1].reshape(-1, ), md.mesh.y[rift['tips'][0, 0].astype(int) - 1].reshape(-1, ))) rift['tip2coordinates'] = np.hstack((md.mesh.x[rift['tips'][0, 1].astype(int) - 1].reshape(-1, ), md.mesh.y[rift['tips'][0, 1].astype(int) - 1].reshape(-1, ))) - #In case we have rifts that open up the domain outline, we need to open them: + # In case we have rifts that open up the domain outline, we need to open them flags = ContourToMesh(md.mesh.elements, md.mesh.x, md.mesh.y, domainoutline, 'node', 0) found = 0 for rift in md.rifts.riftstruct: @@ -54,7 +54,7 @@ def meshprocessrifts(md, domainoutline): if found: md = meshprocessoutsiderifts(md, domainoutline) - #get elements that are not correctly oriented in the correct direction: + # Get elements that are not correctly oriented in the correct direction aires = GetAreas(md.mesh.elements, md.mesh.x, md.mesh.y) pos = np.nonzero(aires < 0)[0] md.mesh.elements[pos, :] = np.vstack((md.mesh.elements[pos, 1], md.mesh.elements[pos, 0], md.mesh.elements[pos, 2])).T diff --git a/src/m/os/issmscpin.m b/src/m/os/issmscpin.m index 3c084d0fe..6ce37f7c8 100644 --- a/src/m/os/issmscpin.m +++ b/src/m/os/issmscpin.m @@ -5,7 +5,7 @@ function issmscpin(host, login,port,path, packages) % % NOTE: If users again have issues with file list (i.e. % -% {,,...} +% {,,...,} % % ), note that this a bash'ism and default shell should be checked. View file % history for potential fix (i.e. some combination of -O and -T options). diff --git a/src/m/os/issmscpin.py b/src/m/os/issmscpin.py index 34ede3056..0637ac1dd 100644 --- a/src/m/os/issmscpin.py +++ b/src/m/os/issmscpin.py @@ -12,7 +12,7 @@ def issmscpin(host, login, port, path, packages): NOTE: If users again have issues with file list (i.e. - {,,...} + {,,...,} ), note that this a bash'ism and default shell should be checked. View file history for potential fix (i.e. some combination of -O and -T options). diff --git a/src/m/plot/plotmodel.py b/src/m/plot/plotmodel.py index 3b26f18cc..0b2c4849d 100644 --- a/src/m/plot/plotmodel.py +++ b/src/m/plot/plotmodel.py @@ -12,13 +12,12 @@ def plotmodel(md, *args): - ''' - PLOTMODEL - At command prompt, type 'plotdoc()' for additional + """plotmodel - At command prompt, type 'plotdoc()' for additional documentation. TODO: - Fix 'plotdoc()', as it is not currently working. - ''' + """ #First process options options = plotoptions(*args)