cfs-energy / cfspopcon

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

Volume integration considerations for profile shape #96

Closed pabloprf closed 5 days ago

pabloprf commented 2 months ago

I'm leaving this comment here so that this doesn't get forgotten:

It recently came to my attention that the so-called "PRFfunctional" forms have remained untouched for several years. These functional forms were built by me in 2020-2021 and implemented by the developers in the MARS code. Subsequent upgrades and transitions to CFSpopcon, with potential improvements to other aspects of the physics, have kept PRFfunctionals as they original were.

PRFfunctionals construct a fixed core-a/LT with a pedestal at the edge. The edge is always at x=0.95 and the linear transition to a/LT=0 on axis starts at x_a. x_a is determined by the constraint on the temperature peaking, nu_T. In other words, providing as input the temperature peaking nu_T, the core gradient aLT and the volume average <T>, the code finds what is the x_a to fulfill these requirements. Then, the same x_a is used for the density (trying to "mimic" the effect of sawtooth), for which the core gradient a/Ln is found automatically by the routine to fulfill x_a, nu_n and <n>.

The speed requirements of POPCONs forced us back then to hard-code "look up tables" to find x_a and aLn and perform the integrations offline (using, e.g., Mathematica), providing only the required coefficients in the POCPON code. Consequently, these look up tables and coefficients were obtained by using the approximations in the original MARS code, e.g. cylindrical volume integration approximation.

I don't know if integrations, radial coordinates and so on have improved from the MARS era, but someone should check that PRFfunctionals still work fine. One should check that the PRFfunctional profiles have the volume averages and peakings that are given as inputs.

@AudreySaltzman @tbody-cfs

AudreySaltzman commented 2 months ago

I tested whether with a given input a volume average electron temperature and a volume average electron density the PRF functions generate integrating the profile over the volume then returns the same average values. They match to better than 0.5%. Therefore, we no longer think this is a concern.

Test code here:

from cfspopcon.formulas.geometry.volume_integral import integrate_profile_over_volume
from cfspopcon.formulas.plasma_profiles.plasma_profiles import calc_1D_plasma_profiles
from cfspopcon.unit_handling import ureg
from cfspopcon.named_options import ProfileForm

average_electron_temp = 10 * ureg.keV 
average_electron_density = 20 * ureg.n19

rho, electron_density_profiles, fuel_ion_density_profiles, electron_temp_profiles, ion_temp_profiles = \
    calc_1D_plasma_profiles(density_profile_form = ProfileForm.prf,
                            temp_profile_form = ProfileForm.prf,
                            average_electron_density = average_electron_density,
                            average_electron_temp = average_electron_temp, 
                            average_ion_temp = average_electron_temp, 
                            electron_density_peaking = 1.6, 
                            ion_density_peaking = 1.6,
                            temperature_peaking = 2.5, 
                            dilution = 1.0, 
                            normlized_inverse_temp_scale_length = 2.5)

print(integrate_profile_over_volume(array_per_m3 = electron_density_profiles, rho = rho, plasma_volume = 1.0 * ureg.m**3))

print(integrate_profile_over_volume(array_per_m3 = electron_temp_profiles / (ureg.keV * ureg.m**3) , rho = rho, plasma_volume = 1.0 * ureg.m**3))

Outputs here:

<xarray.DataArray 'prf' ()> Size: 8B
<Quantity(1.9950426060521806e+20, 'dimensionless')>
<xarray.DataArray 'prf' ()> Size: 8B
<Quantity(9.981796400424884, 'dimensionless')>
pabloprf commented 2 months ago

Thank you for the check @AudreySaltzman. I think this is because (and correct me if I'm wrong) that cfspopcon still assumes cylindrical approximation for the zone volumes when it does the integration. Not sure of whether to close this issue or keep it open for, when future enhancements are made, we remember to revisit the PRFfunctionals. I'll let it up to the devs.

github-actions[bot] commented 1 week ago

This issue has not seen any activity in the past 60 days. It is now marked as stale and will be closed in 7 days if no further activity is registered.