idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.62k stars 1.01k forks source link

SegFault (and potential for better error message) when using DebugResidualAux #27633

Open lewisgross1296 opened 2 weeks ago

lewisgross1296 commented 2 weeks ago

Bug Description

I attempted to use DebugResidualAux (albeit incorrectly) and it led to a Seg Fault, but there was no useful error message to indicate why. Here's what I got:

/var/spool/pbs/mom_priv/jobs/1222491.sawtoothpbs.SC: line 24: 50363 Segmentation fault      (core dumped) ${CARDINAL_DIR}/cardinal-opt -i ${JOB_DIR}/solid.i --n-threads=6 > small_inf.txt

I think there's a chance here to print something to help future users.

The cause of the Seg Fault is that the Variable I attempted to use DebugResidualAux on was a FIRST LAGRANGE, but the AuxVariable I made to store the debug residual was CONSTANT MONOMIAL. When I changed my AuxVariable to match the same type as my variable, the simulation ran.

Maybe related to #7800 but this is still open and has different syntax that caused it? Could also add more info the the docs to prevent users from doing this.

Steps to Reproduce

[Variables]
  [T]
  []
[]

[AuxVariables]
  [temp_residuals]
    family = MONOMIAL
    order = CONSTANT
  []
[]

[AuxKernels]
  [debug_aux]
    type = DebugResidualAux
    debug_variable = T
    variable = temp_residuals
  []
[]
...
add kernels, executioner, etc. here
...

Impact

I was able to get it fixed quickly thanks to @joshuahansel, but I fear others would have to recompile in debug mode and do some digging to get to the bottom on their own.

[Optional] Diagnostics

No response