Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide Stepsize as float or int #936

Merged
merged 5 commits into from
Jan 14, 2025
Merged

Conversation

jhdark
Copy link
Collaborator

@jhdark jhdark commented Jan 13, 2025

Proposed changes

Fix for #846

With this change users can define the dt simply by an int or float such as:

import festim as F

my_model = F.Simulation()

my_model.mesh = F.MeshFromVertices([1, 2, 3, 4])

my_model.materials = F.Material(id=1, D_0=1, E_D=0)
my_model.T = 300
my_model.settings = F.Settings(
    absolute_tolerance=1e-10,
    relative_tolerance=1e-10,
    transient=True,
    final_time=10,
)

my_model.dt = 1    # <------- provide stepsize as int or float


my_model.initialise()
my_model.run()

Types of changes

What types of changes does your code introduce to FESTIM?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactoring
  • Documentation Update (if none of the other choices apply)
  • New tests

Checklist

  • Black formatted
  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@jhdark jhdark added the enhancement New feature or request label Jan 13, 2025
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.26%. Comparing base (8d6857b) to head (59c2eb4).
Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #936      +/-   ##
==========================================
- Coverage   99.27%   99.26%   -0.02%     
==========================================
  Files          60       60              
  Lines        2753     2713      -40     
==========================================
- Hits         2733     2693      -40     
  Misses         20       20              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RemDelaporteMathurin RemDelaporteMathurin linked an issue Jan 14, 2025 that may be closed by this pull request
docs/source/userguide/stepsize.rst Outdated Show resolved Hide resolved
test/unit/test_stepsize.py Show resolved Hide resolved
test/unit/test_stepsize.py Outdated Show resolved Hide resolved
Co-authored-by: Rémi Delaporte-Mathurin <[email protected]>
@RemDelaporteMathurin
Copy link
Collaborator

@jhdark can you format the code and then feel free to merge

@jhdark jhdark merged commit af3b3c3 into festim-dev:main Jan 14, 2025
5 of 6 checks passed
@jhdark jhdark deleted the stepsize_float branch January 14, 2025 17:57
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.

QoL: provide stepsize as float
2 participants