Skip to content

Slab force update - #215

Open
The9Cat wants to merge 128 commits into
develfrom
slabUpdate
Open

Slab force update#215
The9Cat wants to merge 128 commits into
develfrom
slabUpdate

Conversation

@The9Cat

Copy link
Copy Markdown
Member

Updates for consistency with the current conventions

  1. Density for isothermal slab is now proportional to sech(z/2h)^2 rather than sech(z/h)^2
  2. SlablSL now implements the self_consistent flag for enabling a frozen potential
  3. Added a version # to the slab cache along with a user warning about this change

One general development support feature

Added compile -time parsing of the EXP version string into major, minor, patch for internal version control logic. E.g.

#include <iostream>
#include "libvars.H"
using namespace __EXP__;
int main()
{
std::cout << "Major=" << exp_build.major << '\n';
std::cout << "Minor=" << exp_build.minor << '\n';
std::cout << "Patch=" << exp_build.patch << '\n';
return 0;
}

This will make future version-dependent toggles easier to implement. We have a usage example in both SLGridSlab and in utils/Test.

@The9CatThe9Cat added the enhancement New feature or request label Apr 5, 2026
@The9Cat
The9Cat requested a review from CopilotApril 5, 2026 19:38

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_consistent configuration 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
FileDescription
utils/Test/version_test.ccAdds a small example program that prints VERSION and parsed major/minor/patch.
utils/Test/CMakeLists.txtBuilds the new vtest utility.
utils/ICs/bonnerebert.ccRemoves the local VERSION macro and the -V version flag handling.
src/SlabSL.HDocuments self_consistent and adds storage for frozen coefficients.
src/SlabSL.ccAdds YAML parsing for self_consistent and uses frozen coefficients during force evaluation.
src/cudaSlabSL.cuUses frozen coefficients when copying coefficients to the GPU if self_consistent=false.
include/SLGridMP2.HAdds cache versioning for slab cache and improves internal grouping/comments.
include/libvars.HExposes exp_build as a compile-time parsed {major,minor,patch} version triple.
include/EXPversion.HIntroduces a constexpr version-string parser.
exputil/SLGridMP2.ccUpdates isothermal slab profile functions and adds slab cache version checks/write.
exputil/libvars.ccEnsures config header is included in libvars translation unit.
expui/BiorthBasis.ccAllows 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/--version option was removed from getopt_long parsing, but long_options still defines a version entry and usage() still advertises -V. This makes the CLI help incorrect and --version will likely behave unexpectedly (depending on getopt_long behavior). Either restore handling for -V/--version or remove it consistently from long_options and 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.

Comment threadsrc/SlabSL.cc Outdated
Comment threadsrc/SlabSL.H Outdated
Comment threadsrc/SlabSL.H Outdated
Comment threadexputil/SLGridMP2.cc Outdated
Comment threadexputil/SLGridMP2.cc Outdated
Comment threadinclude/EXPversion.H Outdated
Comment threadutils/Test/version_test.cc
The9Catand others added 7 commits April 5, 2026 16:33
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>
@The9Cat

Copy link
Copy Markdown
MemberAuthor

@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 VERSION string into a structure of three ints (major, minor, patch) that may be used to gate various features rather than reverting to some sort of on-the-fly parse of the VERSION for each case or using CPP macros (yuck). The structure, named EXPversion, is a global library variable compiled into exputil. E.g. this PR uses the EXPversion instance to alert the user to the scale height convention change for the the isothermal disk. Your comments on this bit will be helpful I think.

CopilotAI commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

@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 ...

The version_test.cc file now consistently uses "integer triplet" in both the file comment and the runtime output (commit b7ed7eb). The other resolved review comments were already addressed in earlier commits on this branch.

@The9Cat

Copy link
Copy Markdown
MemberAuthor

@michael-petersen Not a lot has changed here recently. I did another Copilot pass (which found a few minor pyEXP binding issues and minor transitive header issues) for good measure. It seems a complete and solid as the rest of the stuff at this point. My recommendation is a merge to devel and consider any future updates as a separate feature or bug fix branches.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@The9Cat@michael-petersen