cfs-energy / cfspopcon

POPCONs (Plasma OPerating CONtours)
https://cfspopcon.readthedocs.io/en/latest/
MIT License
22 stars 14 forks source link

Add distinction between line-averaged and volume-averaged density #30

Open nelsonand opened 5 months ago

nelsonand commented 5 months ago

A pull request to organize solutions to https://github.com/cfs-energy-internal/internal-cfspopcon/issues/237 and https://github.com/cfs-energy-internal/internal-cfspopcon/issues/238. Most of this development was done by Columbia undergrads @aarooshgr and @ThomasWangAPAM

nelsonand commented 5 months ago

Summary of changes

Two average densities now exist:

Ion and electron densities are now handled separately when needed.

These changes were propagated through the code as specified in #238:

Full list follows:

Calc_average_total_pressure

Calc_beta_general

Run_calc_beta, calc_beta_toroidal, calc_beta_poloidal

Two_point_model_fixed_fpow

Physics_glossary

use_LOC_tau_e_below_threshold

Figures_of_merit

Power_balance_from_tau, Run_calc_power_balance_from_tau_e

Operational_limits

Heat exhaust

Plasma_profiles

Peaked_profiles

Two_point_model_fixed_tet

Two_point_model_fixed_qpart

Extrinsic_core_radiator

Zeff_and_dilution_from_impurities Run_calc_zeff_and_dilution_from_impurities Calc_impurity_charge_state Summed_impurity_density

Average_ion_density

nelsonand commented 5 months ago

@hassec @djbattagl Should be ready for a review.

This addresses all of https://github.com/cfs-energy-internal/internal-cfspopcon/issues/238, except for updating the symbol as indicated in that issue (I wasn't sure if we want that or not).

https://github.com/cfs-energy-internal/internal-cfspopcon/issues/238 does have a few things as "not sure" - we didn't change these in the end.

djbattagl commented 5 months ago

@tbody-cfs Do you have any quick guidance on whether to use volume averaged density or line-averaged density in these modules: run_calc_heat_exhaust, Run_two_point_model_fixed_tet, Two_point_model_fixed_qpart, Extrinsic_core_radiator ?

djbattagl commented 5 months ago

@nelsonand The code looks good to me. Could you provide an example where line_averaged_density_frac = 1 and compare to the results from an older version (should be the same).

And then show how the results change with the fraction not equal to one.

tbody-cfs commented 5 months ago

@tbody-cfs Do you have any quick guidance on whether to use volume averaged density or line-averaged density in these modules: run_calc_heat_exhaust, Run_two_point_model_fixed_tet, Two_point_model_fixed_qpart, Extrinsic_core_radiator ?

I'd use volume-averaged for these. It really only depends on your choice of nesep_over_nebar = 0.3.

hassec commented 5 months ago

Oh and since we are changing arguments of functions (thus technically breaking our API) can you change version = "4.0.0" to version = "5.0.0.dev" in pyproject.toml ?

nelsonand commented 5 months ago

@hassec I'm having trouble getting radas to install on this branch (and the main cfspopcon branch) Are the installation instructions up to date after the latest updates?

Specifically, when I do 'poetry run radas -d ./radas_dir'

I get the following error:

``` (base) oaknelson@Oaks-MBP-2 aaroosh-fork % poetry run radas -d ./radas_dir ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor mass ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** unspecified CX donor element ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** ****************************** xxdata_11 warning ****************************** no class name given in file ****************************** program continues ****************************** At line 355 of file radas_dir/readers/adf11/xxdata_11/xxdata_11.for (unit = 10, file = 'radas_dir/data_files/nitrogen_line_emission_from_excitation.dat') Fortran runtime error: End of file ```


hassec commented 5 months ago

@nelsonand the way to install/use radas did indeed change but should be updated and working on main. That's a change that came in via the merge of #40.

This branch seems to have quite a few conflicts (probably due to the merge of #40). So the best bet is likely a rebase of this branch, fixing the conflicts, and then trying again. That said there is also #41 which might get merged soon. I think you and @tbody-cfs already chatted about that PR, right? So it might make sense to wait for #41 and only rebase after that merge to avoid having to rebase and resolve conflicts twice.

nelsonand commented 4 months ago

Yeah - good call. I guess we'll wait for https://github.com/cfs-energy/cfspopcon/pull/41 to go in first! Thanks.

nelsonand commented 4 months ago

Hi @ThomasWangAPAM , can you rebase this onto https://github.com/cfs-energy/cfspopcon/pull/41 in prep for the merge?

ThomasWangAPAM commented 4 months ago

Hi @ThomasWangAPAM , can you rebase this onto #41 in prep for the merge?

Rebase done!

ThomasWangAPAM commented 4 months ago

@nelsonand The code looks good to me. Could you provide an example where line_averaged_density_frac = 1 and compare to the results from an older version (should be the same).

And then show how the results change with the fraction not equal to one.

POPCON generated by the current cfspopcon/main branch: image

POPCON generated by new codes with line_averaged_density_frac = 1: image

POPCON generated by new codes with line_averaged_density_frac = 1.5: image

hassec commented 1 month ago

@nelsonand @ThomasWangAPAM what is the status of this PR. Is there a plan to rebase and finalize this?

tbody-cfs commented 1 month ago

@hassec I can do the rebase after #80 goes in, since this was already rebased once