MagnetoDynamics: SIGSEGV: Segmentation fault

Numerical methods and mathematical models of Elmer
Post Reply
aminer
Posts: 4
Joined: 24 Jan 2018, 01:52
Antispam: Yes

MagnetoDynamics: SIGSEGV: Segmentation fault

Post by aminer »

Hello,
I have a new installation of Elmer on a new system, and each time I run MagnetoDynamics I get a segmentation fault. This happens for a new model I have created, as well as old models that I used on an older setup. On this setup I was able to run magnetodynamics2d simulations, but can not get any 3d ones.
Any advice?

Version: ELMER SOLVER (v 8.3)
Linux Mint, 18
Installation method as outlined on https://www.csc.fi/web/elmer/binaries for launchpad.

From Terminal:

ELMER SOLVER (v 8.3) STARTED AT: 2018/01/23 14:42:18
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.3 (Rev: unknown, Compiled: 2018-01-13)
MAIN: HYPRE library linked in.
MAIN: MUMPS library linked in.
MAIN: =============================================================
MAIN:
MAIN:
MAIN: -------------------------------------
MAIN: Reading Model: case.sif
LoadInputFile: Scanning input file: case.sif
LoadInputFile: Loading input file: case.sif
Model Input: Unlisted keyword: [p] in section: [initial condition 1]
Model Input: Unlisted keyword: [p {e}] in section: [initial condition 1]
Model Input: Unlisted keyword: [p {e}] in section: [boundary condition 1]
WARNING:: LoadInputFile: > Material 3 < not used in any Body!
Loading user function library: [MagnetoDynamics]...[WhitneyAVSolver_Init0]
Loading user function library: [MagnetoDynamics]...[MagnetoDynamicsCalcFields_Init0]

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

Backtrace for this error:
#0 0x7F92B121EE08
#1 0x7F92B121DF90
#2 0x7F92B0E6E4AF
#3 0x7F92B12FF445
#4 0x7F92B157BC38
#5 0x7F92B157E8C4
#6 0x7F92A4A18830
#7 0x7F92B16258A1
#8 0x7F92B18F8292
#9 0x4010F5 in MAIN__ at Solver.F90:69
Segmentation fault
aminer
Posts: 4
Joined: 24 Jan 2018, 01:52
Antispam: Yes

Re: MagnetoDynamics: SIGSEGV: Segmentation fault

Post by aminer »

I now installed virtualbox and the mint/ElmerFEM virutalbox appliance into a windows 7 host.

Both my new 3d problem with MagnetoDynamics, and my older problem that solved on an earlier version of ElmerSolver still fail with a segmentation fault. However, the seem to progress a bit further than before. Executing the solver it proceeds to 'loadmesh' and 'splitmesh' steps, before failing.

My 2d MagnetoDynamics problem solves with not problems in the virtualbox version, as it did in my own Mint installation.
.sif file attached.

I ran three of the test files from elmerfem/tests/, and they ran without issue. (mgdyn_wire, mgdyn_wire2, mgdyn_steady).

I am stumped. Any thoughts?
Attachments
case.sif
(2.61 KiB) Downloaded 407 times
aminer
Posts: 4
Joined: 24 Jan 2018, 01:52
Antispam: Yes

Re: MagnetoDynamics: SIGSEGV: Segmentation fault

Post by aminer »

Still no progress, anyone out there install Elmer in Linux Mint and get MgDyn to work?

My latest efforts:
In the Elmer VM (Linux Mint):
-mgdyn_airgap: solves ok
-mgdyn_airgap_force: solves ok

In my installation on Linux Mint:
-mgdyn_airgap: Fails with segmentation fault
-mgdyn_airgap_force: Fails with segmentation fault

Has there been something changed in 8.3 that now causes my old models to no longer run?
Is there an installation issue that makes the test cases work in the VM, but fail in a linux Mint installation (installed per the instructions on the CSC site?)
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: MagnetoDynamics: SIGSEGV: Segmentation fault

Post by raback »

Hi

I think there was a memory leak introduced that should be fixed very soon. That resulted to monotonically increasing memory consumption. I'm not aware of any other new bugs.

-Peter
swilske
Posts: 4
Joined: 08 Mar 2018, 15:48
Antispam: Yes

Re: MagnetoDynamics: SIGSEGV: Segmentation fault

Post by swilske »

Hi, i am new to elmer.

I am trying to simulate an reluctance motor.
I have a similar problem with my own project and a sample project from the forum :
topic: viewtopic.php?f=3&t=4966&sid=d39e55b827 ... aae1da7d14
project: download/file.php?id=3156&sid=d39e55b82 ... aae1da7d14.

I changed the output level to 4 to get the more information.

Here is the program call with gdb and a backtrace. I hope this may help.

Code: Select all

zyklus@grid:~/theses/computation/test$ gdb --args ElmerSolver Transient.sif 
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ElmerSolver...done.
(gdb) run
Starting program: /usr/bin/ElmerSolver Transient.sif
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ELMER SOLVER (v 8.3) STARTED AT: 2018/03/08 14:02:28
[New Thread 0x7fffee9ec700 (LWP 15597)]
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.3 (Rev: unknown, Compiled: 2018-03-06)
MAIN:  HYPRE library linked in.
MAIN:  MUMPS library linked in.
MAIN: =============================================================
MAIN: 
MAIN: 
MAIN: -------------------------------------
MAIN: Reading Model: Transient.sif
LoadInputFile: Scanning input file: Transient.sif
LoadInputFile: Loading input file: Transient.sif
Model Input:  Unlisted keyword: [circuit model depth] in section: [simulation]
Model Input:  Unlisted keyword: [torque groups] in section: [body 9]
Model Input:  Unlisted keyword: [use original coordinates] in section: [solver 1]
Model Input:  Unlisted keyword: [calculate magnetic torque] in section: [solver 3]
Model Input:  Unlisted keyword: [a] in section: [boundary condition 1]
Loading user function library: [RigidMeshMapper]...[RigidMeshMapper_Init0]
Loading user function library: [MagnetoDynamics2D]...[MagnetoDynamics2D_Init0]
Loading user function library: [MagnetoDynamics]...[MagnetoDynamicsCalcFields_Init0]

Thread 1 "ElmerSolver" received signal SIGSEGV, Segmentation fault.
0x00007ffff74fa445 in _gfortran_string_len_trim () from /usr/lib/x86_64-linux-gnu/libgfortran.so.3
(gdb) backtrace
#0  0x00007ffff74fa445 in _gfortran_string_len_trim () from /usr/lib/x86_64-linux-gnu/libgfortran.so.3
#1  0x00007ffff77778c9 in lists::listfind (list=0x9ec250, name=<Fehler beim Lesen der Variable: value requires 84403 bytes, which is more than max-value-size>, found=32767, 
    _name=_name@entry=10120512) at /build/elmerfem-csc-YZ8Gkb/elmerfem-csc-8.3-0ppa0/fem/src/Lists.F90:1692
#2  0x00007ffff777a595 in lists::listgetintegerarray (__result=<Fehler beim Lesen der Variable: Location address is not set.>, list=<optimized out>, 
    name=<Fehler beim Lesen der Variable: value requires 180528 bytes, which is more than max-value-size>, found=<optimized out>, 
    unfoundfatal=<Fehler beim Lesen der Variable: Cannot access memory at address 0xe>, _name=10120512) at /build/elmerfem-csc-YZ8Gkb/elmerfem-csc-8.3-0ppa0/fem/src/Lists.F90:2805
#3  0x00007fffe146d831 in magnetodynamicscalcfields_init0_ () from /usr/bin/../lib/elmersolver/MagnetoDynamics.so
#4  0x00007ffff7823b12 in modeldescription::loadmodel (modelname=<Fehler beim Lesen der Variable: value requires 579012 bytes, which is more than max-value-size>, boundariesonly=.FALSE., 
    numprocs=1, mype=0, meshindex=0, _modelname=_modelname@entry=128) at /build/elmerfem-csc-YZ8Gkb/elmerfem-csc-8.3-0ppa0/fem/src/ModelDescription.F90:2129
#5  0x00007ffff7afdbd3 in elmersolver (initialize=0) at /build/elmerfem-csc-YZ8Gkb/elmerfem-csc-8.3-0ppa0/fem/src/ElmerSolver.F90:305
#6  0x00000000004010f6 in solver () at /build/elmerfem-csc-YZ8Gkb/elmerfem-csc-8.3-0ppa0/fem/src/Solver.F90:69
#7  0x0000000000400e5f in main (argc=argc@entry=2, argv=0x7fffffffdeb4) at /build/elmerfem-csc-YZ8Gkb/elmerfem-csc-8.3-0ppa0/fem/src/Solver.F90:34
#8  0x00007ffff7054830 in __libc_start_main (main=0x400e40 <main>, argc=2, argv=0x7fffffffdba8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fffffffdb98) at ../csu/libc-start.c:291
#9  0x0000000000400e99 in _start ()
(gdb) 

As you can see, the last step before crashing is the initializations of the "MagnetoDynamicsCalcFields"-solver

Code: Select all

Loading user function library: [MagnetoDynamics]...[MagnetoDynamicsCalcFields_Init0]
The problem occurs with my own project using the "MagnetoDynamicsCalcFields" method from "MagnetoDynamic\" as well. Using the "BSolver" from "MagnetoDynamics2D" instead, i have no fault. But the results seems to be strange, but thats a different story.

In the posted "case.sif" of yours, "MagnetoDynamicsCalcFields" is used.

EDIT : Some days ago, before updating, i used "MagnetoDynamicsCalcFields" succesfully in combination with "MagnetoDynamics2D"

Just for information:
I am using ubuntu 16.04 LTS with the launchpad ppa https://launchpad.net/~elmer-csc-ubuntu ... er-csc-ppa

Stefan
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: MagnetoDynamics: SIGSEGV: Segmentation fault

Post by raback »

Hi Stefan

It would generally help to have the case. Then it can be run through a debugger.

-Peter
swilske
Posts: 4
Joined: 08 Mar 2018, 15:48
Antispam: Yes

Re: MagnetoDynamics: SIGSEGV: Segmentation fault

Post by swilske »

Hi Peter,

thanks for your fast reply. I do not want to hijack this thread. But I am not sure which case you mean. My own or the one I tested from the forum.

The console output I posted before is from this case:
Just to be sure I added my own project case file "deleteMe.sif". The mesh and result is to big to be attached. This is the version which uses the "BSolver".
deleteMe.sif
(5.16 KiB) Downloaded 351 times
I have a second version which uses "MagnetoDynamicsCalcFields" in this code block:

Code: Select all

!###########################################################
!############ header, variables, and simulation ############
!###########################################################
$ w_m = 3000/60*2*pi ! [rad/s mech.] 
$ p = 3 ! num pole 
$ w_el = w_m*p ! [rad/s el.] 
$ Id = 0 ! [A] d-current 
$ Iq = 0 ! [A] q-current 
$ Nph = 186 ! Number of phase turns 
$ Scs = 0.00154555 ! [m^2] area of the coil side 
$ Jslot = 6e6 



Header 
  CHECK KEYWORDS Warn
  Mesh DB "." "deleteMe" 
  Include Path "./includes" 
  Results Directory "./results" 
End 


Simulation 
  Coordinate Mapping(3) = 1 2 3 
  Max Output Level = 3 
  Coordinate System = Cartesian 2D 
  Coordinate Scaling = 0.001 
  Simulation Type = Transient 
  Timestepping Method = BDF 
  Timestep Sizes = $ 1/(w_el/2/pi)/4 !pro el. rotation 
  BDF Order = 2 
  Timestep Intervals = 4 
  Output Intervals = 1 
  !Interpolation Numeric Epsilon = Real 5.0e-8 
End 


Constants 
  Permittivity of Vacuum = 8.8542e-12 
End 


!###########################################################
!######################## materials ########################
!###########################################################
Material 1 
  Name = "Air" 
  Relative Permeability = 1.0  
  Electric Conductivity = 0  
End 


Material 2 
  Name = "Iron" 
  Electric Conductivity = 0.0  
  H-B Curve = Variable coupled iter 
    Real Monotone Cubic  
      Include iron_BH.txt  
    End 
End 


!###########################################################
!################### boundary conditions ###################
!###########################################################
Boundary Condition 1 
  Name = "statorOuterBorder" 
  Target Boundaries(1) = 2  
  Potential Condition = 0  
  Potential = 0  
End 


Boundary Condition 2 
  Name = "motorSlidingSurface" 
  Target Boundaries(1) = 4  
  Discontinuous Boundary = Logical True 
  Save Line = True  
  Mortar BC = 3 
End 


!###########################################################
!####################### body forces #######################
!###########################################################
Body Force 1 
  Name = "BodyForce_Rotation" 
  Mesh Rotate 3 = Variable time, timestep size  
    Real MATC "180/pi*w_m*(tx(0)-tx(1))"  
End 


Body Force 2 
  Name = "current1+" 
  Current Density = $ Jslot 
  Calculate Potential = True 
End 


Body Force 3 
  Name = "current1-" 
  Current Density = $ -Jslot  
  Calculate Potential = True 
End 


!###########################################################
!######################### solvers #########################
!###########################################################
Solver 1 
  Exec Solver = Before Timestep 
  Procedure = "RigidMeshMapper" "RigidMeshMapper" 
  Equation = MeshDeform 
End 


Solver 2 
  Exec Solver = Always 
  Procedure = "MagnetoDynamics2D" "MagnetoDynamics2D" 
  Equation = MgDyn2D 
  Nonlinear System Convergence Tolerance = 1.0e-6 
  Nonlinear System Max Iterations = 60  
  Nonlinear System Relaxation Factor = 1  
  Nonlinear System Newton After Iterations = 7 
  Export Lagrange Multiplier = Logical True 
  Linear System Abort Not Converged = Logical False 
  Linear System Solver = Direct 
  Mortar BCs Additive = Logical True 
  Linear System Preconditioning = ILU4 
End 


Solver 3 
  Exec Solver = After Timestep 
  Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields" 
  Equation = CalcFields 
  calculate magnetic torque = Logical True 
End 


Solver 4 
  Exec Solver = After Timestep 
  Procedure = "ResultOutputSolve" "ResultOutputSolver" 
  Output File Name = "mystep"  
  Output Format = String "vtu"  
  Binary Output = Logical True  
  Single Precision = Logical True  
  Save Geometry Ids = Logical True  
End 


Solver 5 
  Exec Solver = After Timestep 
  Procedure = "SaveData" "SaveScalars" 
  Filename = "scalars.dat"  
  !Show Norm Index = 1  
End 


Solver 6 
  Exec Solver = After Timestep 
  Procedure = "SaveData" "SaveLine" 
  Equation = SaveLine 
  Filename = "line.dat"  
End 


Equation 1 
  Name = "ModelDomain" 
  Active Solvers(6) = 1 2 3 4 5 6  
End 


!###########################################################
!########################## bodies #########################
!###########################################################
Body 1 
  Name = "statorCoilStRot0" 
  Target Bodies(1) = 3  
  Equation = 1 
  Material = 1 
  Body Force  = 2 
End 


Body 2 
  Name = "statorCoilMirXStRot0" 
  Target Bodies(1) = 6  
  Equation = 1 
  Material = 1 
  Body Force  = 3 
End 


Body 3 
  Name = "statorCoilStRot1" 
  Target Bodies(1) = 4  
  Equation = 1 
  Material = 1 
End 


Body 4 
  Name = "statorCoilMirXStRot1" 
  Target Bodies(1) = 7  
  Equation = 1 
  Material = 1 
End 


Body 5 
  Name = "statorAir" 
  Target Bodies(1) = 5  
  Equation = 1 
  Material = 1 
End 


Body 6 
  Name = "rotorAir" 
  Target Bodies(1) = 1  
  Equation = 1 
  Material = 1 
  Body Force  = 1 
  R Inner = 0.04 
  R Outer = 0.0404 
End 


Body 7 
  Name = "statorIron" 
  Target Bodies(1) = 8  
  Equation = 1 
  Material = 2 
End 


Body 8 
  Name = "rotorIron" 
  Target Bodies(1) = 2  
  Equation = 1 
  Material = 2 
  Body Force  = 1 
  Torque Groups = Integer 1 
End 
Here is a screen shot of the strange things I mentioned:
step2_zoom2.png
(27.07 KiB) Not downloaded yet
step2.png
step2.png (196.57 KiB) Viewed 5473 times
Stefan
Post Reply