Page 1 of 1

[SOLVED] AIFlow - Segmentation Fault with Calculate Loads

Posted: 08 Mar 2021, 11:17
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

Re: AIFlow - Segmentation Fault with Calculate Loads

Posted: 08 Mar 2021, 14:55
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

Re: AIFlow - Segmentation Fault with Calculate Loads

Posted: 08 Mar 2021, 14:58
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.

Re: AIFlow - Segmentation Fault with Calculate Loads

Posted: 08 Mar 2021, 17:48
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