Adds an spherical basis that is an exact deprojection of an exponential surface density#199
Adds an spherical basis that is an exact deprojection of an exponential surface density#199
Conversation
…l disk as an option to EmpCylSL
There was a problem hiding this comment.
Pull request overview
Adds a new spherical “exponential deprojection” density model (based on the Abel inversion / modified Bessel (K_0)) and wires it into the cylindrical EOF basis generation as the new default option, with an additional configurable scale-length bias factor and a small test driver.
Changes:
- Introduces
ExpDeprojprofile implementation (density + tabulated enclosed-mass) and exposes it as a selectableEmpCylSLmodel (ExpSphere). - Switches the default spherical model for
EmpCylSLEOF generation to the new deprojected exponential-sphere option and updates cache validation to include the model label. - Adds a
biasconfiguration parameter to rescale the effective disk scale length used for basis construction; adds atestEDexecutable.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
utils/Test/testED.cc |
Adds a small executable to numerically re-project the deprojected density and compare against an exponential surface density. |
utils/Test/CMakeLists.txt |
Builds the new testED utility. |
src/Cylinder.cc |
Adds bias config support and applies it to the scale length passed into the cylindrical basis constructor. |
src/Cylinder.H |
Documents and stores the new bias parameter. |
include/ExpDeproj.H |
Declares the new ExpDeproj profile helper. |
include/EmpCylSL.H |
Adds ExpSphere to EmpModel and stores a precomputed ExpDeproj instance. |
exputil/ExpDeproj.cc |
Implements ExpDeproj density and tabulated/interpolated enclosed mass. |
exputil/EmpCylSL.cc |
Makes ExpSphere the default model, routes densR/massR to ExpDeproj, adds debug output, and tightens HDF5 cache validation via model. |
exputil/CMakeLists.txt |
Compiles ExpDeproj.cc into exputil. |
expui/BiorthBasis.cc |
Adds bias, changes default mtype, and expands mtype parsing to include the new model. |
expui/BiorthBasis.H |
Stores the new bias parameter in the cylindrical basis configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Revert incorrect naming changes - ExpSphere is the correct model name
Add input validation for bias parameter in cylindrical basis
- Revert EmpCylSL::mtype default to Exponential - Add user info message suggesting using ExpSphere instead - Add mtype key to Cylindrical - Add new ExpSphere types to IC utilities - Add a list of allowed mtypes for Doxygen documenation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
utils/ICs/check_coefs.cc:497
- The error message in check_coefs.cc still lists the outdated options and is missing ExpSphere and Power from the list. The updated list should match what's shown in check_coefs2.cc line 500: "Exponential, ExpSphere, Gaussian, Plummer, Power".
if (myid==0) std::cout << "No EmpCylSL EmpModel named <"
<< mtype << ">, valid types are: "
<< "Exponential, Gaussian, Plummer" << std::endl;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Fix thread-unsafe lazy initialization in ExpDeproj::mass()
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Add `@param ppower` Doxygen documentation to Cylinder.H
Fix incomplete valid mtype list in check_coefs.cc error message
Summary
Adds an spherical basis that is an exact deprojection of an exponential surface density. Specifically, using the Abel inversion, the exponential surface density
$$\qquad\Sigma(R)=\Sigma_0 e^{-R/a}$$ $R>0$ deprojects to
$$\qquad\rho(r)=\frac{\Sigma_0}{\pi a} K_0\left(\frac{r}{a}\right).$$
for
Implementation
The exact deprojected spherical basis is the default in this branch and has the ascii tag
ExpDeproj. The previous default wasExponential. The cumulative mass needed bySLGridSphis analytic but only in terms of modified Bessel and Struve functions. The latter is not available in the stdlib. The cumulative mass is computed using brute-force quadrature instead.Note
I would recommend renaming
ExpDeprojtoExponentialand delete the older, original implementation. I've left both for testing.