[SOLVED] AIFlow - Segmentation Fault with Calculate Loads

Extension of Elmer in computational glaciology
Post Reply
kfourteau
Posts: 15
Joined: 25 Jun 2020, 16:45
Antispam: Yes

[SOLVED] AIFlow - Segmentation Fault with Calculate Loads

Post by kfourteau »

Hello everyone,

I'm trying to run a simulation with the AIFlow Solver and the Caculate Loads option, but Elmer crashes with a segmentation fault.

The bug only appears when I activate the Calculate Loads option.
After looking in the code I have found that the problem comes from the fact that the BulkValues and BulkRHS variables of the solver matrix are not associated. Thus, Line 12754 of the subroutine CalculateLoads in the SolverUtils.F90 source file, the Aaid % Values and RHS variables are replaced with non associated values, which leads to the segfault during the matrix and vector multiplication (in the CRS_MatrixVectorMultiply subroutine).

I have tired to modify the source code of the AIFlow Solver by adding

Code: Select all

Solver % Matrix % BulkValues => Solver % Matrix % Values
Solver % Matrix % BulkRHS => Solver % Matrix % RHS
directly after the end of the bulk assembly step. It removes the segfault error, but the computed external forces do not look convincing. I've also tried to add these two lines of code after the Neumann boundary conditions assembly, between the CALL DefaultFinishAssembly() and CALL DefaultDirichletBCs(), but the results are not better.

Would anyone have an idea on how to properly fix this segfault error ? I have attached a small test case to the post.

Thanks a lot,
Kévin
Attachments
TestFile_Forum.zip
(627.51 KiB) Downloaded 334 times
Last edited by kfourteau on 08 Mar 2021, 17:49, edited 1 time in total.
fgillet
Posts: 46
Joined: 30 Sep 2010, 16:58

Re: AIFlow - Segmentation Fault with Calculate Loads

Post by fgillet »

Hi Kevin,
following some discussions on the elmerice slack, in the channel beginner-course-nov2020; I have updated the codes so that they call all the required Elemer default routines to compute the residual.
This is now fixed in the elmerice branch;
https://github.com/ElmerCSC/elmerfem/co ... 1e7dbc3e7f

Updateing your code should fix your problem.

cheers
Favien
fgillet
Posts: 46
Joined: 30 Sep 2010, 16:58

Re: AIFlow - Segmentation Fault with Calculate Loads

Post by fgillet »

Also, the bulkValues contains the stiffness matrix before applying the Dirichlet conditions; while the Values is the stiffness matrix after applying Dirichlet; so that computing the residual tells you what you have to add to your system to comply with your Dirichlet conditions.
kfourteau
Posts: 15
Joined: 25 Jun 2020, 16:45
Antispam: Yes

Re: AIFlow - Segmentation Fault with Calculate Loads

Post by kfourteau »

Hi Fabien,

Perfect ! I've downloaded and compiled the last elmerice branch of Elmer's github and it works now.
I'll read the code to understand why my fix did not work.

Thanks a lot,
Kévin
Post Reply