Conversation
…ency with the recent Cylinder update
There was a problem hiding this comment.
Pull request overview
This PR updates the slab force/basis implementation to match current conventions (isothermal slab profile normalization, cache versioning, and a self_consistent “frozen potential” mode) and adds compile-time parsing of the EXP version string for internal version-dependent logic.
Changes:
- Switch isothermal slab model normalization to use a
sech^2(z/2H)form and warn users when running older EXP versions. - Add a
self_consistentconfiguration flag to SlabSL to support freezing the potential coefficients. - Add compile-time EXP version parsing (
EXPversion.H,exp_build) and a small test utility; add slab cache version attribute.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/Test/version_test.cc | Adds a small example program that prints VERSION and parsed major/minor/patch. |
| utils/Test/CMakeLists.txt | Builds the new vtest utility. |
| utils/ICs/bonnerebert.cc | Removes the local VERSION macro and the -V version flag handling. |
| src/SlabSL.H | Documents self_consistent and adds storage for frozen coefficients. |
| src/SlabSL.cc | Adds YAML parsing for self_consistent and uses frozen coefficients during force evaluation. |
| src/cudaSlabSL.cu | Uses frozen coefficients when copying coefficients to the GPU if self_consistent=false. |
| include/SLGridMP2.H | Adds cache versioning for slab cache and improves internal grouping/comments. |
| include/libvars.H | Exposes exp_build as a compile-time parsed {major,minor,patch} version triple. |
| include/EXPversion.H | Introduces a constexpr version-string parser. |
| exputil/SLGridMP2.cc | Updates isothermal slab profile functions and adds slab cache version checks/write. |
| exputil/libvars.cc | Ensures config header is included in libvars translation unit. |
| expui/BiorthBasis.cc | Allows self_consistent as a recognized YAML key for the slab basis config. |
Comments suppressed due to low confidence (1)
utils/ICs/bonnerebert.cc:404
- The
-V/--versionoption was removed fromgetopt_longparsing, butlong_optionsstill defines aversionentry andusage()still advertises-V. This makes the CLI help incorrect and--versionwill likely behave unexpectedly (depending ongetopt_longbehavior). Either restore handling for-V/--versionor remove it consistently fromlong_optionsand the usage text.
"R:" /* runit */
"N:" /* number */
"S:" /* seed */
"h", /* help */
long_options, (int *) 0)) != EOF)
{
switch (c)
{
case 'o': /* --output */
oname = string(optarg);
break;
case 'd': /* --xstep */
h = atof(optarg);
break;
case 'r': /* --ratio */
Rratio = atof(optarg);
break;
case 'R': /* --runit */
R = atof(optarg);
break;
case 'M': /* --munit */
Munit = atof(optarg);
break;
case 'm': /* --mass */
M = atof(optarg);
break;
case 'T': /* --temp */
T = atof(optarg);
break;
case 'N': /* --number */
N = atoi(optarg);
break;
case 'S': /* --seed */
S = atoi(optarg);
break;
case 'h':
usage (0);
default:
usage (-1);
}
💡 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: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@michael-petersen I am probably the only one that uses the slab stuff and these changes implement some of the standard features from the other force classes. So no need for you to spend time on most of this. It's all tested and seems to work. However, note that this PR adds a compile-time function that parses the CMake-generated |
Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/a9b4ee92-2327-4580-968b-23dded26f6e2 Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
The |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 14 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @details **YAML configuration** | ||
|
|
||
| @param nmaxx is the maximum order of the expansion in x (default 6) | ||
|
|
||
| @param nmaxy is the maximum order of the expansion in y (default 6) | ||
|
|
||
| @param nmaxz is the maximum order of the expansion in z (default 6) | ||
|
|
||
| @param nminx is the minimum order of the expansion in x (default 0) | ||
|
|
||
| @param nminy is the minimum order of the expansion in y (default 0) | ||
|
|
||
| @param hslab is the scale height of the slab (default 0.2) | ||
|
|
||
| @param zmax is the maximum z for the slab (default 10.0) | ||
|
|
||
| @param ngrid is the number of grid points in z for the | ||
| Sturm-Liouville solver (default 1000) | ||
|
|
||
| @param cmap is the coordinate mapping for the SL solver (must be one of "tanh", "sech", or "linear", default "linear") | ||
|
|
||
| @param type is the type of slab to solve for (default | ||
| "isothermal", must be "isothermal", "parabolic", or "constant") | ||
|
|
||
| @param self_consistent set to true allows the particles to evolve | ||
| under the time-dependent basis expansion. For a basis fixed in time to | ||
| the initial time: set to false. | ||
|
|
||
| @param cachename is the name of the basis cache file. This is a | ||
| required parameter. | ||
| */ |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Added nint and samplesz to the YAML configuration docstring in commit 7b4f5d7, including the constraint that samplesz must be greater than 0 when nint>0.
| std::vector<Eigen::MatrixXd> orthoMat; | ||
| switch (Type) { | ||
| case Trig: | ||
| std::cout << "No internal orthogonality check for OneDTrig" | ||
| << std::endl; | ||
| break; | ||
| case SL: | ||
| { | ||
| int knots; | ||
| std::cout << "Number of knots? "; | ||
| std::cin >> knots; | ||
| auto orthoMat = orthoSL->orthoCheck(knots); | ||
| std::cout << "Orthogonality check for SLGridSlab" << std::endl; |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Removed the unused outer std::vector<Eigen::MatrixXd> orthoMat; declaration in commit 5dbe30a. The inner auto orthoMat = orthoSL->orthoCheck(knots) in the SL block is the only declaration now.
| @@ -82,6 +103,7 @@ SlabSL::SlabSL(Component* c0, const YAML::Node& conf) : PotAccel(c0, conf) | |||
| } | |||
| } | |||
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Changed if (true) to if (false) in commit 0cc1bc5, matching the deep-debug pattern from Cylinder.cc. The comment now reads "Set to 'true' only for deep debugging; 'false' for production."
| // Coordinate map | ||
| std::map<std::string, int> CoordMap = | ||
| { | ||
| {"tanh" , 0}, | ||
| {"sech" , 1}, | ||
| {"linear", 2} | ||
| }; | ||
|
|
||
| int Cmap = CoordMap[cmap]; | ||
|
|
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Replaced CoordMap[cmap] with CoordMap.find(cmap) in commit 0cc1bc5. An invalid cmap value now throws a std::runtime_error with a message listing the valid options.
| while ((c = getopt_long (argc, argv, | ||
| "o:" /* output */ | ||
| "d:" /* xstep */ | ||
| "r:" /* ratio */ | ||
| "M:" /* munit */ | ||
| "m:" /* mass */ | ||
| "T:" /* temp */ | ||
| "R:" /* runit */ | ||
| "N:" /* number */ | ||
| "S:" /* seed */ | ||
| "h" /* help */ | ||
| "V", /* version */ | ||
| "h", /* help */ | ||
| long_options, (int *) 0)) != EOF) |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Restored -V/--version handling in commit 0cc1bc5: added 'V' to the getopt_long option string and a case 'V': that prints program_name + VERSION (from libvars.H) and exits cleanly.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/61daa681-8beb-4cbd-877f-f58ff1d18b1a Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/61aca825-1c82-4e34-af64-6de5d2314370 Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
… option Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/437a8908-e2a0-48c1-9224-8263a765ef4e Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
|
@copilot The slab force is implemented in |
Here are the three differences I found that could lead to significantly different results: 1. Texture lookup: missing (kx, ky) swap when The textures are initialized for the upper-triangular set if (iix >= iiy) grid->get_pot(zpot, zz, iix, iiy);
else grid->get_pot(zpot, zz, iiy, iix);The CUDA kernels omit this swap. For every int kx = max(abs(ii), abs(jj));
int ky = min(abs(ii), abs(jj));
int offset = 1 + (kx*(kx+1)/2 + ky)*slabNumZ;2. Opposite sign convention for the potential term at z < 0 —
if (pos[2]<0 && 2*(n/2)!=n) sign = -1; // odd n
if (pos[2]<0 && 2*(n/2)==n) sign = -1; // even nThat sign is correct for the z-force int signV = 1, signF = 1;
if (pos[2]<0 && 2*(n/2)!=n) signV = -1; // potential: flip odd modes
if (pos[2]<0 && 2*(n/2)==n) signF = -1; // z-force: flip even modesand apply 3. Missing CPU ( double adb = cC->Adiabatic();
double mm = -4.0*M_PI * cC->Mass(i) * adb;CUDA ( cuFP_t mm = - p.mass * 2.0*slabDfac; // = -4π * mass, no Adiabatic()For standard runs Minor additional discrepancies (bookkeeping/subsampling only):
|
…tures changes proposed by Copilot
…efficient creation in pyEXP
Updates for consistency with the current conventions
SlablSLnow implements theself_consistentflag for enabling a frozen potentialOne general development support feature
Added compile -time parsing of the EXP version string into major, minor, patch for internal version control logic. E.g.
This will make future version-dependent toggles easier to implement. We have a usage example in both
SLGridSlaband inutils/Test.