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

Add VerticalFieldConstraint and function to estimate plasma equilibrium field #3076

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

CoronelBuendia
Copy link
Contributor

Linked Issues

Closes #{ID}

Description

Interface Changes

Checklist

I confirm that I have completed the following checks:

  • Tests run locally and pass pytest tests --reactor
  • Code quality checks run locally and pass pre-commit run --from-ref develop --to-ref HEAD
  • Documentation built locally and checked sphinx-build -W documentation/source documentation/build

@CoronelBuendia CoronelBuendia added equilibria Tasks relating to the equilibria module optimisation Tasks relating to optimisation labels Mar 5, 2024
@CoronelBuendia CoronelBuendia requested review from a team as code owners March 5, 2024 09:01
Copy link

sonarcloud bot commented Mar 5, 2024

Quality Gate Passed Quality Gate passed

Issues
4 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
18.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

codecov bot commented Mar 5, 2024

Codecov Report

Attention: Patch coverage is 73.33333% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 79.79%. Comparing base (60832c1) to head (994e333).

Files Patch % Lines
bluemira/equilibria/optimisation/constraints.py 80.00% 2 Missing ⚠️
bluemira/plasma_physics/rules_of_thumb.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3076      +/-   ##
===========================================
+ Coverage    79.74%   79.79%   +0.04%     
===========================================
  Files          227      227              
  Lines        25451    25465      +14     
===========================================
+ Hits         20297    20320      +23     
+ Misses        5154     5145       -9     

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

Copy link
Contributor

github-actions bot commented Mar 5, 2024

⚠️ Warning Report

Found 0 new warnings, 0 fixed warnings. 🎉

All warnings (15)

On collect

  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.equilibria.opt_constraints' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.utilities.opt_problems' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/pkg_resources/__init__.py:2846: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('sphinxcontrib'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/pkg_resources/__init__.py:2846: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('mpl_toolkits'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.utilities.opt_tools' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.utilities.optimiser' is deprecated and will be removed in version 2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.equilibria.opt_problems' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.equilibria.opt_constraint_funcs' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.geometry.optimisation._optimisation_old' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.equilibria.opt_objectives' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.

On runtest

  • /home/runner/work/bluemira/bluemira/bluemira/base/reactor.py:677: DeprecationWarning: Using kwarg 'dim' is no longer supported. Simply pass in the dimensions you would like to show, e.g. show_cad('xz')
  • /home/runner/work/bluemira/bluemira/eudemo/eudemo/tf_coils/tf_coils.py:338: DeprecationWarning: Argument 'separatrix' is deprecated, argument 'ripple_wire' is used instead.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/h5py/__init__.py:36: UserWarning: h5py is running against HDF5 1.14.3 when it was built against 1.14.2, this may cause problems
  • /home/runner/work/bluemira/bluemira/tests/builders/test_tf_coils.py:46: DeprecationWarning: RippleConstrainedLengthGOP API has changed, please specify how you want to constrain TF ripple by using one of the available RipplePointSelector classes. Defaulting to an EquispacedSelector with n_rip_points=3 for now.

is almost certainly irrelevant at the end of breakdown.
"""
k_term = 1.0 if kappa_95 is None else np.sqrt(2.0 / (1.0 + kappa_95**2))
return -MU_0_4PI * I_p / R_0 * (beta_p_th + 0.5 * l_i - 1.5 + np.log(8 * A * k_term))
Copy link
Contributor

@je-cook je-cook Mar 15, 2024

Choose a reason for hiding this comment

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

Could we have a couple line test for this to an expected result?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, could you add a test to test_rules_of_thumb?

Copy link
Contributor

@geograham geograham left a comment

Choose a reason for hiding this comment

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

This might be a papercut change rather than something to address in this merge but I think that it would be good to have a bit more info in the top docstring for rules_of_thumb.

Otherwise just the minor comments.

Thermal poloidal beta
l_i:
Normalised internal inductance
kappa:
Copy link
Contributor

Choose a reason for hiding this comment

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

kappa_95

is almost certainly irrelevant at the end of breakdown.
"""
k_term = 1.0 if kappa_95 is None else np.sqrt(2.0 / (1.0 + kappa_95**2))
return -MU_0_4PI * I_p / R_0 * (beta_p_th + 0.5 * l_i - 1.5 + np.log(8 * A * k_term))
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, could you add a test to test_rules_of_thumb?

@je-cook je-cook force-pushed the develop branch 5 times, most recently from 5a50acb to 7574352 Compare May 15, 2024 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
equilibria Tasks relating to the equilibria module optimisation Tasks relating to optimisation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants