Hi,
This is my second Elmer model so please excuse any naivety. I was running into a segmentation fault when trying to compute the velocity (using 'Nonlinear Calculate Velocity = Logical True' in my solver section) of the dependent variable of a transient heat equation. The primary issue is in MainUtils.f90 where the velocity variable is only added for the steady state case:
IF( ListGetLogical( Solver % Values,'Calculate Velocity',Found) THEN
where, I believe, it should also add the variable in the transient case:
IF( ListGetLogical( Solver % Values,'Calculate Velocity',Found) &
.OR. ListGetLogical( Solver % Values, 'Nonlinear Calculate Velocity', Found) ) THEN
or however you want to code it. The segmentation fault was occurring in SolverUtils.f90 on the call:
VeloVar => VariableGet( Solver % Mesh % Variables, str )
because 'heat velocity' (or whatever you name the variable) was never created AND because the variable linked list appears to end tragically. While this is easily solved using the above fix, I hope that someone can take a look at how some of these linked lists are being terminated so perhaps we can stop the program a bit more graciously -- tracking down seg faults is time consuming for me since I am admittedly an amateur fortran programmer. In any case, hope this is all helpful.
Kevin
Nonlinear calculate velocity
Re: Nonlinear calculate velocity
Hi Kevin,
thanks for the report, we'll have a look.
As for the linked lists, the VariableGet() should just return Null(), if the variable is not
found. Just the check for this , i.e. something like
is missing.
Regards, Juha
thanks for the report, we'll have a look.
As for the linked lists, the VariableGet() should just return Null(), if the variable is not
found. Just the check for this , i.e. something like
Code: Select all
IF(.NOT.ASSOCIATED(VeloVar)) CALL Fatal('Velocity variable not found')
Regards, Juha
Re: Nonlinear calculate velocity
Juha,
I agree that is should return Null() but it doesn't. It seg faults before the return. I can work on narrowing it down if you can help me figure out the fix. I suspect that the problem is in the creation of the list and not actually in VariableGet() and I'm not familiar with the code base.
Thanks,
Kevin
I agree that is should return Null() but it doesn't. It seg faults before the return. I can work on narrowing it down if you can help me figure out the fix. I suspect that the problem is in the creation of the list and not actually in VariableGet() and I'm not familiar with the code base.
Thanks,
Kevin
Re: Nonlinear calculate velocity
Hi,
i don't see any troubles after either creating the "VeloVar" variable, when the
"Nonlinear Calculate Velocity" flag is given, or checking that the "VeloVar" is
actually present before accessing it, or both. Running "valgrind ElmerSolver"
(a memory access checking program) doesn't reveal anything either.
If you have an example case that still behaves badly, could you please share
it?
Regards,Juha
i don't see any troubles after either creating the "VeloVar" variable, when the
"Nonlinear Calculate Velocity" flag is given, or checking that the "VeloVar" is
actually present before accessing it, or both. Running "valgrind ElmerSolver"
(a memory access checking program) doesn't reveal anything either.
If you have an example case that still behaves badly, could you please share
it?
Regards,Juha