Skip to content

Slab force update#215

Open
The9Cat wants to merge 20 commits intodevelfrom
slabUpdate
Open

Slab force update#215
The9Cat wants to merge 20 commits intodevelfrom
slabUpdate

Conversation

@The9Cat
Copy link
Copy Markdown
Member

@The9Cat The9Cat commented Apr 5, 2026

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.

@The9Cat The9Cat added the enhancement New feature or request label Apr 5, 2026
@The9Cat The9Cat requested a review from Copilot April 5, 2026 19:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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

The9Cat and 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
Member Author

The9Cat commented Apr 5, 2026

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

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 5, 2026

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

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants