Segmentation Fault with WhitneyAVSolver

Clearly defined bug reports and their fixes
Post Reply
bit0fun
Posts: 1
Joined: 26 Mar 2019, 03:17
Antispam: Yes

Segmentation Fault with WhitneyAVSolver

Post by bit0fun »

I've been trying to get this software suite compiled for some time, and finally have a possible port for QT5 that doesn't blow up in my face during compilation.

However, nearly all of the test cases work except for what appears to be the ones related to the WhitneyAVSolver. I've been focusing upon the mgdyn_anisotropic_rel test, and found a segmentation fault most likely due to some null pointer. While I'm not anywhere familiar with fortran, I've tried to figure out some things that may be helpful for solving this issue. Understandably I'm doing this with Arch linux which already makes things a little more complicated, but I've gotten this far. Give I really only wanted the E&M simulations, I would think it's important to make sure this works properly.

I will note that none of the solver code has been modified, only the ElmerGUI directory files have been changed to compile it with Qt5.

I have tried to compile with and without MUMPS, VTK, MPI, none of which will yeild a result that satisfies those tests.

Software Versions:
Linux Kernel: 5.0.3
Open CASCADE Community edition: 0.18.3-1
Qt5: 5.12.2-1
Paraview: 5.6.0-5 (Compiled with VTK 8.2 or VTK7.1.1, I can't recall )
Scotch: 6.0.6-1
Mumps: 5.2.1-3
Hypre: 2.15.1-1


Here are my cmake flags for the build:

Code: Select all

cmake -DWITH_ELMERGUI:BOOL=TRUE \
-DWITH_MPI:BOOL=FALSE \
-DWITH_QT5:BOOL=TRUE \
-DWITH_VTK:BOOL=FALSE \
-DWITH_OCC:BOOL=TRUE \
-DWITH_Hypre:BOOL=TRUE \
-DWITH_PARAVIEW:BOOL=TRUE \
-DCMAKE_INSTALL_PREFIX:PATH=/opt/elmerfem \
-DWITH_Mumps:BOOL=TRUE \
-DCMAKE_BUILD_TYPE=Debug \
../elmerfem-qt5
Here's the output from the mgdyn_anisotropic_rel test:

Code: Select all

ELMER SOLVER (v 8.4) STARTED AT: 2019/03/25 20:10:03
ParCommInit:  Initialize #PEs:            1
MAIN: 
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 8.4 (Rev: ed16b68f, Compiled: 2019-03-25)
MAIN:  Running one task without MPI parallelization.
MAIN:  Running with just one thread per task.
MAIN: =============================================================
MAIN: 
MAIN: 
MAIN: -------------------------------------
MAIN: Reading Model: cyl-case.sif
LoadInputFile: Scanning input file: cyl-case.sif
LoadInputFile: Loading input file: cyl-case.sif
Loading user function library: [reluctivity]...[reluct]
Model Input:  Unlisted keyword: [a {e}] in section: [boundary condition 1]
Model Input:  Unlisted keyword: [a] in section: [boundary condition 1]
Model Input:  Unlisted keyword: [use biorthogonal basis] in section: [solver 1]
Loading user function library: [MagnetoDynamics]...[WhitneyAVSolver_Init0]
Loading user function library: [MagnetoDynamics]...[MagnetoDynamicsCalcFields_Init0]
Loading user function library: [SaveData]...[SaveScalars_Init0]
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver_Init0]
LoadMesh: Base mesh name: ./cylinders
LoadMesh: Elapsed REAL time:     0.1105 (s)
MAIN: -------------------------------------
Loading user function library: [MagnetoDynamics]...[WhitneyAVSolver_Init]
Loading user function library: [MagnetoDynamics]...[WhitneyAVSolver_bulk]
Loading user function library: [MagnetoDynamics]...[WhitneyAVSolver]
OptimizeBandwidth: ---------------------------------------------------------
OptimizeBandwidth: Computing matrix structure for: mag...done.
OptimizeBandwidth: Half bandwidth without optimization: 20408
OptimizeBandwidth: ---------------------------------------------------------
Loading user function library: [MagnetoDynamics]...[MagnetoDynamicsCalcFields_Init]
Loading user function library: [MagnetoDynamics]...[MagnetoDynamicsCalcFields_bulk]
Loading user function library: [MagnetoDynamics]...[MagnetoDynamicsCalcFields]
OptimizeBandwidth: ---------------------------------------------------------
OptimizeBandwidth: Computing matrix structure for: computeb...done.
OptimizeBandwidth: Half bandwidth without optimization: 3144
OptimizeBandwidth: 
OptimizeBandwidth: Bandwidth Optimization ...done.
OptimizeBandwidth: Half bandwidth after optimization: 502
OptimizeBandwidth: ---------------------------------------------------------
Loading user function library: [SaveData]...[SaveScalars_Init]
Loading user function library: [SaveData]...[SaveScalars]
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver_Init]
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver_bulk]
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver]
MAIN: 
MAIN: -------------------------------------
MAIN:  Steady state iteration:            1
MAIN: -------------------------------------
MAIN: 
SingleSolver: Attempting to call solver
SingleSolver: Solver Equation string is: mag
WhitneyAVSolver: Solving the AV equations with edge elements
WhitneyAVSolver: Using Piola Transformed element basis functions

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f41e6841dff in ???
#1  0x7f41e8a991b3 in reluct_
	at /home/bit0fun/git/elmerfem-qt5/fem/tests/mgdyn_anisotropic_rel/reluctivity.F90:14
#2  0x7f41e8ce95cc in __loadmod_MOD_execrealarrayfunction
	at /home/bit0fun/git/elmerfem-qt5/fem/src/LoadMod.F90:399
#3  0x7f41e8caf2e4 in __lists_MOD_listgetrealarray
	at /home/bit0fun/git/elmerfem-qt5/fem/src/Lists.F90:6548
#4  0x7f41e91e44f3 in __defutils_MOD_getrealarray
	at /home/bit0fun/git/elmerfem-qt5/fem/src/DefUtils.F90:1240
#5  0x7f41e8a826e3 in dosolve
	at /home/bit0fun/git/elmerfem-qt5/fem/src/modules/MagnetoDynamics/WhitneyAVSolver.F90:575
#6  0x7f41e8a87824 in whitneyavsolver_
	at /home/bit0fun/git/elmerfem-qt5/fem/src/modules/MagnetoDynamics/WhitneyAVSolver.F90:446
#7  0x7f41e8ce9284 in __loadmod_MOD_execsolver
	at /home/bit0fun/git/elmerfem-qt5/fem/src/LoadMod.F90:449
#8  0x7f41e8f9bb1c in __mainutils_MOD_singlesolver
	at /home/bit0fun/git/elmerfem-qt5/fem/src/MainUtils.F90:5123
#9  0x7f41e8f99ad9 in __mainutils_MOD_solveractivate
	at /home/bit0fun/git/elmerfem-qt5/fem/src/MainUtils.F90:5359
#10  0x7f41e8fac25d in solvecoupled
	at /home/bit0fun/git/elmerfem-qt5/fem/src/MainUtils.F90:3061
#11  0x7f41e8fad6bd in __mainutils_MOD_solveequations
	at /home/bit0fun/git/elmerfem-qt5/fem/src/MainUtils.F90:2763
#12  0x7f41e932971b in execsimulation
	at /home/bit0fun/git/elmerfem-qt5/fem/src/ElmerSolver.F90:2339
#13  0x7f41e93227c8 in elmersolver_
	at /home/bit0fun/git/elmerfem-qt5/fem/src/ElmerSolver.F90:601
#14  0x56499c1bd478 in solver
	at /home/bit0fun/git/elmerfem-qt5/fem/src/Solver.F90:69
#15  0x56499c1bd745 in main
	at /home/bit0fun/git/elmerfem-qt5/fem/src/Solver.F90:34
Looking at the reluctivity.F90 file and using GDB to step through it, it appears that anything but Y(1,1) cannot be written to. I can write to the value within GDB, but the segmentation fault occurs on line 12, or line 14 with line 12 commented out as shown above. This leads me to think there is some sort of pointer problem or allocation problem as this function is converted to a C function pointer from the WhitneyAVSolver fortran file. I'm not 100% certain, but I wanted to provide as much detail as possible.

If there is anything I've missed, or could help explain more please let me know.
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Segmentation Fault with WhitneyAVSolver

Post by raback »

Hi

The problem is somewhat puzzling. The test case runs through for me, as well as on travis, see
https://travis-ci.org/ElmerCSC/elmerfem ... tification
(only slow tests are skipped)

You could perhaps try to remove the "CONTIG" parameter in reluctivity.F90.

Is the unisotrophy relevant in your case?

-Peter
Post Reply