rice-solar-physics / deprecated_EBTEL

Deprecated EBTEL code
0 stars 1 forks source link

Give example of how output data is formatted #1

Closed wtbarnes closed 8 years ago

wtbarnes commented 8 years ago

@anjmarsh I've moved your comment here because I think it 's an issue that should be addressed in the README/install instructions for this repo:

Hi Will,

I see you posted examples of how to open and plot the EBTEL results using Python. I don't know Python at all; would you be willing to write a similar set of instructions for IDL users? This would probably be useful for more people than I ; )

thanks, Andrew

wtbarnes commented 8 years ago

The results are just printed as a .txt file, with each column corresponding to a different parameter (e.g. time, temperature, density) and each row corresponding to the time step. I think this should be pretty straightforward just to load into IDL as a matrix? So for example if you just grab the first column (time) and the second column (temperature), you've got your temperature profile. Similarly, the third column is the density.

What would be more helpful is for me to just provide some details about how the output is formatted in the README. In the meantime, if you don't mind reading a bit of the C code, this line tells the order in which the parameters are printed.

anjmarsh commented 8 years ago

Hi Will,

I just downloaded this code and am trying to run it. Unfortunately, it doesn't seem to work in Python or on the command line:

ew.run_ebtel('/home/andrew/EBTEL_C/bin/', '/home/andrew/EBTEL_C/config/', config_file='my_custom_config.xml') Traceback (most recent call last): File "", line 1, in File "ebtel_wrapper.py", line 146, in run_ebtel output = subprocess.check_output([exec_directory+'ebtel',config_directory+kwargs['config_file']]) AttributeError: 'module' object has no attribute 'check_output' exit() [andrew@plasma bin]$ ./ebtel /home/andrew/EBTEL_C/config/my_custom_config.xml Segmentation fault (core dumped)

Any idea what is going wrong here? I just installed matplotlib and scipy, and I have the latest version of libxml2 installed. The build seems to work okay, I have attached a text file with the command line output.

cheers, Andrew

On Wed, Aug 24, 2016 at 10:15 PM, Will Barnes notifications@github.com wrote:

The results are just printed as a .txt file, with each column corresponding to a different parameter (e.g. time, temperature, density) and each row corresponding to the time step. I think this should be pretty straightforward just to load into IDL as a matrix? So for example if you just grab the first column (time) and the second column (temperature), you've got your temperature profile. Similarly, the third column is the density.

What would be more helpful is for me to just provide some details about how the output is formatted in the README. In the meantime, if you don't mind reading a bit of the C code, this line https://github.com/rice-solar-physics/EBTEL_C/blob/master/src/ebtel_functions_util.c#L392 tells the order in which the parameters are printed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rice-solar-physics/EBTEL_C/issues/1#issuecomment-242282978, or mute the thread https://github.com/notifications/unsubscribe-auth/ALtyTadGZbJ0RHLt5UfT99HICn_kN0_Iks5qjSTogaJpZM4JssAO .

[andrew@plasma build]$ ./build Default values for LFLAGS Default values for IFLAGS gcc -c -Wall -g -std=c99 -I /usr/include/libxml2 ebtel_functions_loop.c gcc -c -Wall -g -std=c99 -I /usr/include/libxml2 ebtel_functions_param.c gcc -c -Wall -g -std=c99 -I /usr/include/libxml2 ebtel_functions_util.c gcc -c -Wall -g -std=c99 -I /usr/include/libxml2 ebtel_functions_solvers.c gcc -c -Wall -g -std=c99 -I /usr/include/libxml2 ebtel_functions_heating.c gcc -c -Wall -g -std=c99 -I /usr/include/libxml2 ebtel_main.c gcc -Wall -g -std=c99 ebtel_functions_loop.o ebtel_functions_param.o ebtel_functions_util.o ebtel_functions_solvers.o ebtel_functions_heating.o ebtel_main.o -o ../bin/ebtel -lxml2 -lz -lm

wtbarnes commented 8 years ago

The first issue you raise I think is due to the version of Python you're using. According to this SO answer, the check_ouput method that I use was introduced Python 2.7 so if you're using anything <2.7, that's likely the problem.

Your second issue is a bigger problem. Unfortunately segmentation fault could really mean anything. Could you copy and paste your my_custom_config.xml file here? Perhaps it is just a small formatting issue. I can try to reproduce the error on my end.

Sorry you're having trouble running the code...as I'm sure you've noticed, the configuration of the runs is a bit of a mess. I'm working on a major refactor that will make the configuration process much easier and the code itself much nicer to look at.

anjmarsh commented 8 years ago

Good to know the first problem is easy to fix, I'll try to update Python.

Here is the config file: <?xml version="1.0" ?>

<loop_length>75.0</loop_length>
/home/andrew/EBTEL_C/data/my_ebtel_output_file
<usage_option>dem</usage_option>

On Wed, Sep 14, 2016 at 11:11 PM, Will Barnes notifications@github.com wrote:

The first issue you raise I think is due to the version of Python you're using. According to this SO answer http://stackoverflow.com/questions/26894024/subprocess-check-output-module-object-has-out-attribute-check-output, the check_ouput method that I use was introduced Python 2.7 so if you're using anything <2.7, that's likely the problem.

Your second issue is a bigger problem. Unfortunately segmentation fault could really mean anything. Could you copy and paste your my_custom_config.xml file here? Perhaps it is just a small formatting issue. I can try to reproduce the error on my end.

Sorry you're having trouble running the code...as I'm sure you've noticed, the configuration of the runs is a bit of a mess. I'm working on a major refactor that will make the configuration process much easier and the code itself much nicer to look at.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rice-solar-physics/EBTEL_C/issues/1#issuecomment-247244038, or mute the thread https://github.com/notifications/unsubscribe-auth/ALtyTfHVSbEPY4Xn-J7hvr_1MspSyJulks5qqOGOgaJpZM4JssAO .

wtbarnes commented 8 years ago

Ah ok. I think my instructions about the configuration aren't so clear. You actually need to include all of the configuration options in each input file. The segmentation fault is happening because it can't find the needed inputs. I believe the sample one in the repo is out of date. Again, this will be changing soon. But below is a sample config file that should work...

<?xml version="1.0" ?>
<input>
    <!-- general input parameters -->
        <total_time>5000</total_time>
        <tau>1.0</tau>
        <loop_length>40</loop_length>
        <usage_option>dem</usage_option> <!-- dem (recommended), no_dem, nt_ebeam, or rad_ratio -->
        <rad_option>rk</rad_option> <!-- rtv or rk-->
        <dem_option>new</dem_option> <!-- new or old -->
        <heat_flux_option>classical</heat_flux_option> <!-- limited or classical -->
        <solver>rk4</solver> <!-- euler, rk4, or rka4 -->
        <ic_mode>st_eq</ic_mode> <!-- st_eq, force, or scaling -->
        <output_file>/home/andrew/EBTEL_C/data/my_ebtel_output_file</output_file>
        <print_plasma_params>True</print_plasma_params> <!-- choose whether to print main plasma parameters -->
        <rka_error>1.e-6</rka_error>
        <index_dem>451</index_dem>
        <T0>7.36e+5</T0>
        <n0>1.927e+8</n0>
        <sat_limit>0.1666667</sat_limit> <!-- Typical EBTEL value is 1/6 -->
    <!-- heating parameters -->
        <heating_shape>triangle</heating_shape> <!-- triangle, square, or gaussian -->
        <num_events>2</num_events>
        <t_start>10.0</t_start>
        <t_pulse_half>50</t_pulse_half>
        <h_nano>0.01</h_nano>
        <h_back>3.5e-5</h_back>
        <mean_t_start>5000</mean_t_start>
        <std_t_start>2000</std_t_start>
        <alpha>-2</alpha>
        <amp0>0.001</amp0>
        <amp1>0.01</amp1>
        <t_start_switch>file</t_start_switch> <!-- uniform, normal, or file -->
        <amp_switch>file</amp_switch> <!-- uniform, power_law, or file -->
        <t_end_switch>file</t_end_switch> <!-- uniform or file -->
        <r3_cond_0>6.0</r3_cond_0>
                <r3_grav_correction>True</r3_grav_correction>
        <r3_rad_0>0.6</r3_rad_0>
        <r3_loss_correction>True</r3_loss_correction>
        <sample_rate>1</sample_rate>
        <heat_species>electron</heat_species>
    <!-- heating input files (only need these if using the 'file' option for the above switches)-->
        <start_time_array>
            <start_time_array0>0.0</start_time_array0>
            <start_time_array1>2500.0</start_time_array1>
            <!--<start_time_array2>1000.0</start_time_array2>-->
        </start_time_array>
        <amp_array>
            <amp_array0>0.5</amp_array0>
            <amp_array1>0.25</amp_array1>
            <!--<amp_array2>0.05</amp_array2>-->
        </amp_array>
        <end_time_array>
            <end_time_array0>200.0</end_time_array0>
            <end_time_array1>2600.0</end_time_array1>
            <!--<end_time_array2>1100.0</end_time_array2>-->
        </end_time_array>
</input>
anjmarsh commented 8 years ago

Thank you, that file worked just fine.

One other point I wanted to mention is that the user needs to be sure the output directory (in your example, /path/to/EBTEL_C/data) exists before trying to write to it. This may good to clarify in the instructions, since I assumed the /data directory already existed or would be created during the run process.

On Thu, Sep 15, 2016 at 3:51 PM, Will Barnes notifications@github.com wrote:

Ah ok. I think my instructions about the configuration aren't so clear. You actually need to include all of the configuration options in each input file. The segmentation fault is happening because it can't find the needed inputs. I believe the sample one in the repo is out of date. Again, this will be changing soon. But below is a sample config file that should work...

<?xml version="1.0" ?>

<!-- general input parameters -->
    <total_time>5000</total_time>
    <tau>1.0</tau>
    <loop_length>40</loop_length>
    <usage_option>dem</usage_option> <!-- dem (recommended), no_dem, nt_ebeam, or rad_ratio -->
    <rad_option>rk</rad_option> <!-- rtv or rk-->
    <dem_option>new</dem_option> <!-- new or old -->
    <heat_flux_option>classical</heat_flux_option> <!-- limited or classical -->
    <solver>rk4</solver> <!-- euler, rk4, or rka4 -->
    <ic_mode>st_eq</ic_mode> <!-- st_eq, force, or scaling -->
    <output_file>/home/andrew/EBTEL_C/data/my_ebtel_output_file</output_file>
    <print_plasma_params>True</print_plasma_params> <!-- choose whether to print main plasma parameters -->
    <rka_error>1.e-6</rka_error>
    <index_dem>451</index_dem>
    <T0>7.36e+5</T0>
    <n0>1.927e+8</n0>
    <sat_limit>0.1666667</sat_limit> <!-- Typical EBTEL value is 1/6 -->
<!-- heating parameters -->
    <heating_shape>triangle</heating_shape> <!-- triangle, square, or gaussian -->
    <num_events>2</num_events>
    <t_start>10.0</t_start>
    <t_pulse_half>50</t_pulse_half>
    <h_nano>0.01</h_nano>
    <h_back>3.5e-5</h_back>
    <mean_t_start>5000</mean_t_start>
    <std_t_start>2000</std_t_start>
    <alpha>-2</alpha>
    <amp0>0.001</amp0>
    <amp1>0.01</amp1>
    <t_start_switch>file</t_start_switch> <!-- uniform, normal, or file -->
    <amp_switch>file</amp_switch> <!-- uniform, power_law, or file -->
    <t_end_switch>file</t_end_switch> <!-- uniform or file -->
    <r3_cond_0>6.0</r3_cond_0>
            <r3_grav_correction>True</r3_grav_correction>
    <r3_rad_0>0.6</r3_rad_0>
    <r3_loss_correction>True</r3_loss_correction>
    <sample_rate>1</sample_rate>
    <heat_species>electron</heat_species>
<!-- heating input files (only need these if using the 'file' option for the above switches)-->
    <start_time_array>
        <start_time_array0>0.0</start_time_array0>
        <start_time_array1>2500.0</start_time_array1>
        <!--<start_time_array2>1000.0</start_time_array2>-->
    </start_time_array>
    <amp_array>
        <amp_array0>0.5</amp_array0>
        <amp_array1>0.25</amp_array1>
        <!--<amp_array2>0.05</amp_array2>-->
    </amp_array>
    <end_time_array>
        <end_time_array0>200.0</end_time_array0>
        <end_time_array1>2600.0</end_time_array1>
        <!--<end_time_array2>1100.0</end_time_array2>-->
    </end_time_array>

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rice-solar-physics/EBTEL_C/issues/1#issuecomment-247477019, or mute the thread https://github.com/notifications/unsubscribe-auth/ALtyTbffJG9c9V8VxUWv5diR_7ssxFZnks5qqcv_gaJpZM4JssAO .

wtbarnes commented 8 years ago

Ah yes that's a good point. Another note I forgot to mention: if you instead put default in the output_file field of the configuration file, it should create a data/ directory (if it doesn't already exist) and then output your results to a filename labeled using the convention: ebteldatL{loop_length}_{usage_option}_{heating_shape}_{solver}.txt.

wtbarnes commented 8 years ago

Just as a note, I'll be deprecating this repository soon (i.e. the code will still be available, but unsupported) and publishing an improved version, ebtel++ that includes all of the modifications discussed in this paper. The code will also be much tidier and there will be extended documentation for parsing output and configuring runs. This should be mostly finished by the end of the weekend.

wtbarnes commented 8 years ago

I've now deprecated this piece of code in favor of ebtelPlusPlus which implements the two-fluid EBTEL equations (though the single-fluid option can be used as well). You can find the new documentation here, including how to setup an input file and how to parse the output. The configuration is largely the same as the old EBTEL-C code (via an XML file), but simplified and easier to use.

Feel free to open an issue on that repo if you run into any trouble.