Skip to content

Add dimensionless initialisation mode to FokkerPlanck#12

Open
pineapple-bois wants to merge 1 commit intojohnaparker:mainfrom
pineapple-bois:feature/dimensionless-pr
Open

Add dimensionless initialisation mode to FokkerPlanck#12
pineapple-bois wants to merge 1 commit intojohnaparker:mainfrom
pineapple-bois:feature/dimensionless-pr

Conversation

@pineapple-bois
Copy link
Copy Markdown

This PR adds a mode argument to the FokkerPlanck constructor so that the solver can be instantiated using either physical or dimensionless parameters.

The new argument is:

  • mode="physical" (default): preserves the existing API based on temperature and drag
  • mode="dimensionless": allows scaled problems to be specified directly using diffusion, without temperature or drag

Because the default remains mode="physical", existing code should continue to work unchanged.

Motivation

The current API is a good fit for SI-style physical problems, but I also wanted to work directly with dimensionless variables. The aim here was to add that option without changing the existing physical path or touching the core solver logic.

What this changes

In physical mode, the constructor:

  • requires temperature
  • requires drag
  • rejects diffusion
  • computes beta, mobility, and diffusion as before

In dimensionless mode, the constructor:

  • rejects temperature
  • rejects drag
  • accepts optional diffusion, defaulting to 1.0
  • sets beta = 1
  • uses unit mobility and user-supplied scaled diffusion

So this only affects initialisation; the solver itself behaves as before.

Checks

To make sure this did not break the existing API, I:

  • ran the full test suite
  • added tests for physical-mode equivalence and dimensionless initialisation
  • ran the existing examples successfully on the PR branch

The added tests cover:

  • physical mode validation
  • rejection of mixed physical and dimensionless arguments
  • default and explicit dimensionless diffusion
  • equivalence between the default constructor path and explicit mode="physical"
  • dimensionless free-diffusion rates in the no-force/no-potential case
  • finite rates for a simple quadratic dimensionless potential

Scope

I kept this PR fairly narrow. It is just about constructor semantics and basic dimensionless initialisation.

I have not tried to tackle the wider question of how forces, potentials, or model-specific reduced variables should be documented in a general dimensionless setting. I think that belongs in separate work.

Thanks for open-sourcing fplanck. I have found it really useful in my own stochastic processes work, and this change came directly from using it for reduced and dimensionless formulations.

Ian

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant