Skip to content

Commit

Permalink
Merge branch 'elmerice' into glads_gl
Browse files Browse the repository at this point in the history
  • Loading branch information
RupertGladstone committed Oct 16, 2024
2 parents 85ff151 + b1e79a0 commit 1bd4a7b
Show file tree
Hide file tree
Showing 314 changed files with 3,529 additions and 2,092 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-macos-homebrew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ jobs:
run: |
cd ${GITHUB_WORKSPACE}/build
ctest . \
-L "quick|elmerice-fast" \
-LE slow \
-j$(sysctl -n hw.logicalcpu) \
--timeout 180
--timeout 300
- name: re-run tests
if: always() && (steps.run-ctest.outcome == 'failure')
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/build-windows-mingw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

runs-on: windows-latest

name: MSYS2 (${{ matrix.umfpack }} UMFPACK, ${{ matrix.msystem }})
name: MSYS2 (${{ matrix.dependencies }} dependencies, ${{ matrix.msystem }})

defaults:
run:
Expand All @@ -31,10 +31,11 @@ jobs:
matrix:
# msystem: [MINGW64, CLANG64]
msystem: [MINGW64]
umfpack: [internal, external]
dependencies: [bundled, external]
include:
- umfpack: external
umfpack-cmake-flags: "-DEXTERNAL_UMFPACK=ON"
- dependencies: external
external-packages: parpack:p
external-cmake-flags: -DEXTERNAL_UMFPACK=ON -DEXTERNAL_ARPACK=ON -DEXTERNAL_PARPACK=ON

steps:
- name: get CPU name
Expand Down Expand Up @@ -83,6 +84,7 @@ jobs:
unixodbc:p
utf8cpp:p
opencascade:p
${{ matrix.external-packages }}
- name: install MSMPI
uses: mpi4py/setup-mpi@v1
Expand Down Expand Up @@ -121,7 +123,7 @@ jobs:
-DWITH_MATC=ON \
-DWITH_PARAVIEW=ON \
-DCREATE_PKGCONFIG_FILE=ON \
${{ matrix.umfpack-cmake-flags }} \
${{ matrix.external-cmake-flags }} \
..
- name: build
Expand All @@ -142,9 +144,9 @@ jobs:
run: |
cd ${GITHUB_WORKSPACE}/build
ctest . \
-L "quick|elmerice-fast" \
-LE slow \
-j$(nproc) \
--timeout 180
--timeout 300
- name: re-run tests
if: always() && (steps.run-ctest.outcome == 'failure')
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,19 @@ jobs:
$([ "${{ matrix.mpi }}" == "with" ] && echo "libhypre-dev") \
$([ "${{ matrix.mpi }}" == "with" ] && echo "libopenmpi-dev libmumps-dev libparmetis-dev") \
$([ "${{ matrix.compiler }}" == "gcc" ] && echo "libsuitesparse-dev") \
$([ "${{ matrix.compiler }}" == "gcc" ] && [ "${{ matrix.mpi }}" == "with" ] && echo "librocalution-dev") \
libqwt-qt5-dev qtscript5-dev libqt5svg5-dev \
libvtk9-qt-dev libglvnd-dev \
occt-misc libocct-data-exchange-dev libocct-draw-dev \
$([ "${{ matrix.mpi }}" == "with" ] && echo "trilinos-all-dev libptscotch-dev")
- name: configure
# CHOLMOD requires a working OpenMP package. So, disable it for clang.
# CHOLMOD and rocALUTION require a working OpenMP package. So, disable them for clang.
run: |
# work around error in the rocALUTION CMake config file distributed by Ubuntu
if [ "${{ matrix.compiler }}" == "gcc" ] && [ "${{ matrix.mpi }}" == "with" ]; then
sudo sed -i '/find_dependency(HIP)/d' /usr/lib/x86_64-linux-gnu/cmake/rocalution/rocalution-config.cmake
fi
mkdir ${GITHUB_WORKSPACE}/build
cd ${GITHUB_WORKSPACE}/build
cmake \
Expand All @@ -106,6 +111,7 @@ jobs:
$([ "${{ matrix.mpi }}" == "with" ] && echo "-DWITH_Mumps=ON" || echo "-DWITH_Mumps=OFF") \
$([ "${{ matrix.compiler }}" == "gcc" ] && echo "-DWITH_CHOLMOD=ON" || echo "-DWITH_CHOLMOD=OFF") \
$([ "${{ matrix.mpi }}" == "with" ] && echo "-DWITH_Hypre=ON -DHYPRE_INCLUDE_DIR=/usr/include/hypre" || echo "-DWITH_Hypre=OFF") \
$([ "${{ matrix.compiler }}" == "gcc" ] && [ "${{ matrix.mpi }}" == "with" ] && echo "-DWITH_ROCALUTION=ON" || echo "-DWITH_ROCALUTION=OFF") \
$([ "${{ matrix.mpi }}" == "with" ] && echo "-DWITH_ElmerIce=ON" || echo "-DWITH_ElmerIce=OFF") \
-DWITH_ELMERGUI=ON \
-DWITH_VTK=ON \
Expand Down Expand Up @@ -135,9 +141,9 @@ jobs:
run: |
cd ${GITHUB_WORKSPACE}/build
ctest . \
-L "quick|elmerice-fast" \
-LE slow \
-j$(nproc) \
--timeout 180
--timeout 300
- name: Re-run tests
if: always() && (steps.run-ctest.outcome == 'failure')
Expand Down
76 changes: 44 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ SET(WITH_MKL FALSE CACHE BOOL "Use Intel Math Kernel library")
SET(WITH_Mumps FALSE CACHE BOOL "Use Mumps sparse direct solver")
SET(WITH_Hypre FALSE CACHE BOOL "Use Hypre linear algebra library")
SET(WITH_CHOLMOD FALSE CACHE BOOL "Use CHOLMOD linear algebra library")
SET(WITH_UMFPACK TRUE CACHE BOOL "Use UMFPACK for LU factorization")
SET(WITH_ELMERGUI FALSE CACHE BOOL "Include ElmerGUI")
SET(WITH_ElmerIce FALSE CACHE BOOL "Include ElmerIce")
SET(WITH_XIOS FALSE CACHE BOOL "Include XIOS")
Expand Down Expand Up @@ -227,6 +228,10 @@ ENDIF(WITH_MPI)

IF (WITH_ROCALUTION)

IF(NOT WITH_MPI)
MESSAGE(FATAL_ERROR "Building with rocALUTION requires MPI")
ENDIF()

MESSAGE(STATUS "------------------------------------------------")
MESSAGE(STATUS "Looking for rocALUTION installation")

Expand All @@ -238,12 +243,6 @@ IF (WITH_ROCALUTION)

SET(HAVE_ROCALUTION TRUE CACHE BOOL "")
MARK_AS_ADVANCED(HAVE_ROCALUTION)
INCLUDE_DIRECTORIES("${ROCALUTION_INCLUDE_DIR}")
MESSAGE(STATUS " ---------------------------------")
MESSAGE(STATUS " ROCALTUION: " "${HAVE_ROCALUTION}")
MESSAGE(STATUS " ROCALTUON_INCLUDE_DIR: " "${ROCALUTION_INCLUDE_DIR}")
MESSAGE(STATUS " ROCALTUON_LIBRARY: " "${ROCALUTION_LIBRARY}")
# LINK_DIRECTORIES("${ROCALUTION_LINK_DIRECTORIES}")
ENDIF()


Expand Down Expand Up @@ -626,29 +625,35 @@ IF(WITH_ElmerIce)
ADD_SUBDIRECTORY(elmerice)
ENDIF(WITH_ElmerIce)

IF (EXTERNAL_UMFPACK)
MESSAGE(STATUS "Using external UMFPACK instead of built-in")
FIND_PACKAGE(UMFPACK REQUIRED)

# Check for size of "SuiteSparse_long"
INCLUDE(CheckTypeSize)
SET(old_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
SET(old_CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES})
LIST(APPEND CMAKE_REQUIRED_INCLUDES "${UMFPACK_INCLUDE_DIR}")
LIST(APPEND CMAKE_EXTRA_INCLUDE_FILES "umfpack.h")
CHECK_TYPE_SIZE("SuiteSparse_long" SIZEOF_SUITESPARSE_LONG LANGUAGE C)
SET(CMAKE_REQUIRED_INCLUDES ${old_CMAKE_REQUIRED_INCLUDES})
SET(CMAKE_EXTRA_INCLUDE_FILES ${old_CMAKE_EXTRA_INCLUDE_FILES})
IF (HAVE_SIZEOF_SUITESPARSE_LONG)
IF (SIZEOF_SUITESPARSE_LONG EQUAL 4)
SET(UMFPACK_LONG_FORTRAN_TYPE "C_INT32_T")
ELSE()
SET(UMFPACK_LONG_FORTRAN_TYPE "C_INT64_T")
IF (WITH_UMFPACK)
IF (EXTERNAL_UMFPACK)
MESSAGE(STATUS "Using external UMFPACK instead of built-in")
FIND_PACKAGE(UMFPACK REQUIRED)

# Check for size of "SuiteSparse_long"
INCLUDE(CheckTypeSize)
SET(old_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
SET(old_CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES})
LIST(APPEND CMAKE_REQUIRED_INCLUDES "${UMFPACK_INCLUDE_DIR}")
LIST(APPEND CMAKE_EXTRA_INCLUDE_FILES "umfpack.h")
CHECK_TYPE_SIZE("SuiteSparse_long" SIZEOF_SUITESPARSE_LONG LANGUAGE C)
SET(CMAKE_REQUIRED_INCLUDES ${old_CMAKE_REQUIRED_INCLUDES})
SET(CMAKE_EXTRA_INCLUDE_FILES ${old_CMAKE_EXTRA_INCLUDE_FILES})
IF (HAVE_SIZEOF_SUITESPARSE_LONG)
IF (SIZEOF_SUITESPARSE_LONG EQUAL 4)
SET(UMFPACK_LONG_FORTRAN_TYPE "C_INT32_T")
ELSE()
SET(UMFPACK_LONG_FORTRAN_TYPE "C_INT64_T")
ENDIF()
ENDIF()
ELSE()
MESSAGE(STATUS "Using built-in UMFPACK")
ADD_SUBDIRECTORY(umfpack)
ENDIF()
SET(HAVE_UMFPACK ON)
MARK_AS_ADVANCED(HAVE_UMFPACK)
ELSE()
MESSAGE(STATUS "Using built-in UMFPACK")
ADD_SUBDIRECTORY(umfpack)
MESSAGE(STATUS "Building without UMFPACK")
ENDIF()
IF(NOT DEFINED UMFPACK_LONG_FORTRAN_TYPE)
# Old versions of UMFPACK before "SuiteSparse_long" was defined used "long"
Expand Down Expand Up @@ -708,13 +713,16 @@ MESSAGE(STATUS "------------------------------------------------")
MESSAGE(STATUS " BLAS library: " "${BLAS_LIBRARIES}")
MESSAGE(STATUS " LAPACK library: " "${LAPACK_LIBRARIES}")
MESSAGE(STATUS "------------------------------------------------")
IF(UMFPACK_FOUND)
MESSAGE(STATUS " UMFPACK library: " "${UMFPACK_LIBRARIES}")
MESSAGE(STATUS " UMFPACK headers: " "${UMFPACK_INCLUDE_DIR}")
MARK_AS_ADVANCED(HAVE_UMFPACK)
MESSAGE(STATUS "------------------------------------------------")
IF(WITH_UMFPACK)
IF(UMFPACK_FOUND)
MESSAGE(STATUS " UMFPACK library: " "${UMFPACK_LIBRARIES}")
MESSAGE(STATUS " UMFPACK headers: " "${UMFPACK_INCLUDE_DIR}")
MESSAGE(STATUS "------------------------------------------------")
ELSE()
MESSAGE(STATUS " UMFPACK library: Using internal Elmer library")
ENDIF()
ELSE()
MESSAGE(STATUS " UMFPACK library: Using internal Elmer library")
MESSAGE(STATUS " UMFPACK library: Building without UMFPACK")
ENDIF()
IF(CHOLMOD_FOUND AND SPQR_FOUND)
MESSAGE(STATUS " CHOLMOD library: " "${CHOLMOD_LIBRARIES}")
Expand Down Expand Up @@ -825,6 +833,10 @@ IF(HAVE_EXTOPTIM)
MESSAGE(STATUS "------------------------------------------------")
ENDIF(HAVE_EXTOPTIM)

IF(NOT HAVE_UMFPACK AND NOT HAVE_MUMPS)
MESSAGE(WARNING "Elmer is configured without backend for direct solvers (UMFPACK or MUMPS).\n"
"Are you sure this is intended?")
ENDIF()


# Packaging
Expand Down
6 changes: 4 additions & 2 deletions ElmerGUI/Application/plugins/egconvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4969,8 +4969,10 @@ static int LoadGmshInput41(struct FemType *data,struct BoundaryType *bound,
printf("Physical tag offset for %dD is %d\n",tagdim,phystagoffset[tagdim]);
}

tagoffset[meshdim] = maxphystag[meshdim];
tagoffset[meshdim-1] = phystagoffset[0];
if(meshdim>0) {
tagoffset[meshdim] = maxphystag[meshdim];
tagoffset[meshdim-1] = phystagoffset[0];
}
for(tagdim=meshdim-2;tagdim>=0;tagdim--) {
tagoffset[tagdim] = tagoffset[tagdim+1]+MAX(0,maxtag[tagdim+1]);
printf("Geometric tag offset for %dD is %d\n",tagdim,tagoffset[tagdim]);
Expand Down
66 changes: 58 additions & 8 deletions ElmerGUI/Application/plugins/egmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,8 @@ void InitializeKnots(struct FemType *data)
data->nodalexists = FALSE;
/* data->invtopoexists = FALSE; */
data->partitiontableexists = FALSE;

data->maxpartitiontable = 0;

data->invtopo.created = FALSE;
data->nodalgraph2.created = FALSE;
data->dualgraph.created = FALSE;
Expand Down Expand Up @@ -2457,19 +2458,19 @@ int FindCorners(struct GridType *grid,struct CellType *cell,
continue;

/* point (i,j) must now be a corner */
if(cellno = grid->numbered[j][i]) {
if((cellno = grid->numbered[j][i])) {
elem = GetElementIndex(&(cell)[cellno],1,1);
ind = BOTLEFT;
}
else if(cellno = grid->numbered[j][i-1]) {
else if((cellno = grid->numbered[j][i-1])) {
elem = GetElementIndex(&(cell)[cellno],cell[cellno].xelem,1);
ind = BOTRIGHT;
}
else if(cellno = grid->numbered[j-1][i]) {
else if((cellno = grid->numbered[j-1][i])) {
elem = GetElementIndex(&(cell)[cellno],1,cell[cellno].yelem);
ind = TOPLEFT;
}
else if(cellno = grid->numbered[j-1][i-1]) {
else if((cellno = grid->numbered[j-1][i-1])) {
elem = GetElementIndex(&(cell)[cellno],cell[cellno].xelem,cell[cellno].yelem);
ind = TOPRIGHT;
}
Expand Down Expand Up @@ -9906,7 +9907,7 @@ int CreateDualGraph(struct FemType *data,int unconnected,int info)
int *invrow,*invcol;
struct CRSType *dualgraph;

printf("Creating a dual graph of the finite element mesh\n");
if(info) printf("Creating a dual graph of the finite element mesh\n");

dualgraph = &data->dualgraph;
if(dualgraph->created) {
Expand All @@ -9924,7 +9925,7 @@ int CreateDualGraph(struct FemType *data,int unconnected,int info)
/* If a dual graph only for the unconnected nodes is requested do that.
Basically the connected nodes are omitted in the graph. */
if( unconnected ) {
printf("Removing connected nodes from the dual graph\n");
if(info) printf("Removing connected nodes from the dual graph\n");
if( data->nodeconnectexist ) {
if(info) printf("Creating connected elements list from the connected nodes\n");
SetConnectedElements(data,info);
Expand Down Expand Up @@ -10034,6 +10035,7 @@ int CreateDualGraph(struct FemType *data,int unconnected,int info)
}
else {
dualsize = freeelements;
if(info) printf("Allocating for the dual graph for %d with %d connections\n",dualsize,totcon);
dualrow = Ivector(0,dualsize);
for(i=1;i<=dualsize;i++)
dualrow[i] = 0;
Expand All @@ -10053,7 +10055,7 @@ int CreateDualGraph(struct FemType *data,int unconnected,int info)
goto omstart;
}

if( orphanelements ) {
if( orphanelements && info ) {
printf("There are %d elements in the dual mesh that are not connected!\n",orphanelements);
if(unconnected) printf("The orphan elements are likely caused by the hybrid partitioning\n");
}
Expand Down Expand Up @@ -10160,3 +10162,51 @@ int MeshTypeStatistics(struct FemType *data,int info)
return(0);
}

int BoundingBox(struct FemType *data,int nomesh,int nomeshes,int info)
{
int i;
Real xmin, xmax, ymin, ymax, zmin, zmax, sidemax;

xmin = xmax = data->x[1];
ymin = ymax = data->y[1];
zmin = zmax = data->z[1];

for(i=1; i<=data->noknots; i++){
xmax = MAX( xmax, data->x[i] );
xmin = MIN( xmin, data->x[i] );
ymax = MAX( ymax, data->y[i] );
ymin = MIN( ymin, data->y[i] );
zmax = MAX( zmax, data->z[i] );
zmin = MIN( zmin, data->z[i] );
}
sidemax = MAX(xmax-xmin,ymax-ymin);
sidemax = MAX(sidemax,zmax-zmin);

if(nomeshes > 1) {
printf("Bounding box of all nodes in mesh[%d] of [%d] meshes:\n",nomesh,nomeshes);
}
else {
printf("Bounding box of all nodes in mesh:\n");
}

printf("X:[%g,%g] ",xmin,xmax);
printf("Y:[%g,%g] ",ymin,ymax);
printf("Z:[%g,%g]\n",zmin,zmax);

if(sidemax > 49.9) {
printf("\nNotice: the longest bounding box side length of [%g] is greater than 50.\n",sidemax);
printf("ElmerGUI includes a library of material properties, defined in SI units. If using ElmerGUI, \n");
printf("then the geometry is expected to have meters as length. Geometry that exceeds 50 meters \n");
printf("in length or width or height may not be intended. Many Geometry generators assume \n");
printf("millimeters as the basic unit of length. Scaling the geometry from millimeters to meters \n");
printf("may be the desired action. For more help, search the Elmer users forum for posts \n");
printf("about SI units, or for posts about Coordinate Scaling.\n");
printf("Scaling can be accomplished in at least three ways, as follows:\n");
printf(" 1. Define the original geometry in meters, not millimeters.\n");
printf(" 2. Call ElmerGrid with -scale 0.001 0.001 0.001 as an option.\n");
printf(" 3. Add Coordinate Scaling = 0.001 to the simulation section of the sif file.\n");
printf("If using Elmer to analyze large geometry, such as a glacier, then ignore this notice.\n\n");
}

return(0);
}
1 change: 1 addition & 0 deletions ElmerGUI/Application/plugins/egmesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ int DestroyDualGraph(struct FemType *data,int info);
int CreateInverseTopology(struct FemType *data,int info);
int DestroyInverseTopology(struct FemType *data,int info);
int MeshTypeStatistics(struct FemType *data,int info);
int BoundingBox(struct FemType *data,int nomesh,int nomeshes,int info);
2 changes: 1 addition & 1 deletion ElmerGUI/Application/plugins/egnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ void SetCellData(struct GridType *grid,struct CellType *cell,int info)

for(j=1;j<= grid->ycells ;j++) /* cells direction up */
for(i=1;i<= grid->xcells; i++) /* cells direction right */
if( cnew = grid->numbered[j][i] ) { /* if cell is occupied */
if( (cnew = grid->numbered[j][i]) ) { /* if cell is occupied */

/* Initialize the numbering to zero */
cell[cnew].left1st = 0;
Expand Down
8 changes: 4 additions & 4 deletions elmergrid/src/egmesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -2458,19 +2458,19 @@ int FindCorners(struct GridType *grid,struct CellType *cell,
continue;

/* point (i,j) must now be a corner */
if(cellno = grid->numbered[j][i]) {
if((cellno = grid->numbered[j][i])) {
elem = GetElementIndex(&(cell)[cellno],1,1);
ind = BOTLEFT;
}
else if(cellno = grid->numbered[j][i-1]) {
else if((cellno = grid->numbered[j][i-1])) {
elem = GetElementIndex(&(cell)[cellno],cell[cellno].xelem,1);
ind = BOTRIGHT;
}
else if(cellno = grid->numbered[j-1][i]) {
else if((cellno = grid->numbered[j-1][i])) {
elem = GetElementIndex(&(cell)[cellno],1,cell[cellno].yelem);
ind = TOPLEFT;
}
else if(cellno = grid->numbered[j-1][i-1]) {
else if((cellno = grid->numbered[j-1][i-1])) {
elem = GetElementIndex(&(cell)[cellno],cell[cellno].xelem,cell[cellno].yelem);
ind = TOPRIGHT;
}
Expand Down
Loading

0 comments on commit 1bd4a7b

Please sign in to comment.