chalmersplasmatheory/DREAM

Throw error when no initial temperature prescribed

Opened this issue · 1 comments

At the moment, a default uniform cold electron temperature of $T_{\rm cold}=-1,\mathrm{eV}$ is used if no initial temperature profile is specified. This will (of course) crash the simulation with an anonymous error message. It should be very straightforward to instead throw an exception if the initial temperature is not prescribed and provide a more user-friendly error message.

Proposed solution: Change the following code in src/Settings/Equations/T_cold.cpp

    real_t *Tcold_init = LoadDataR(MODULENAME, fluidGrid->GetRadialGrid(), s, "init");
    eqsys->SetInitialValue(id_T_cold, Tcold_init);
    delete [] Tcold_init;

to something along the lines of

    real_t *Tcold_init = LoadDataR(MODULENAME, fluidGrid->GetRadialGrid(), s, "init");
    if (Tcold_init == nullptr)
        throw SettingsException("VERY INFORMATIVE ERROR MESSAGE");
    eqsys->SetInitialValue(id_T_cold, Tcold_init);
    delete [] Tcold_init;