Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when one tries to run with "all simple ions" #138

Closed
jhmatthews opened this issue Feb 5, 2015 · 0 comments
Closed

Segfault when one tries to run with "all simple ions" #138

jhmatthews opened this issue Feb 5, 2015 · 0 comments
Labels
bug Bugs in the code medium

Comments

@jhmatthews
Copy link
Collaborator

I believe the way the code should work when you turn on macro-atom line transfer mode but don't give the required atomic data (i.e. use say standard77) is that the code should detect no macro-atom levels and treat all line transitions using the "simple-ion" approach.

At the moment, one gets a segfault when this happens because the macromain structure is not allocated when nlevels_macro is zero. It's fine for the estimators not to be allocated, but the general structure still needs to be. A couple of problems here:

first, the variable geo.nmacro is always initialised to 0. When we call calloc_macro it doesn't allocate memory if the following condition is entered:

  if (nlevels_macro == 0 && geo.nmacro == 0)
    {

      Log
    ("calloc_macro: Allocated no space for macro since nlevels_macro==0 and geo.nmacro==0\n");
      return (0);
    }

Second, there is also a line in resonate.c which sets mplasma to NULL if (geo.nmacro > 0) - this is what actually causes the current segfault, I believe, but if you remove this you get a segfault caused by the first problem.

I think the easiest solution is that we always set geo.nmacro to NPLASMA if geo.rt_mode = 2 - i.e. we want to use the macro-atom machinery for line transfer but treat everything as simple ions.

Longer term, we could probably tidy up the variables which define all this stuff to make it simpler and more obvious what is happening.

@jhmatthews jhmatthews added medium bug Bugs in the code labels Feb 5, 2015
@jhmatthews jhmatthews added this to the Next AGN paper milestone Feb 5, 2015
jhmatthews added a commit to jhmatthews/sirocco that referenced this issue Feb 5, 2015
…ure if geo_rt_mode is 2 even for simple ions only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs in the code medium
Projects
None yet
Development

No branches or pull requests

1 participant