Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
2aa97bc
Initial additions to write MESH_DOMAIN_EXTENTS
alhom May 29, 2024
f230e34
First implementations
alhom May 30, 2024
8dcd949
Extending the prototype
alhom Jun 11, 2024
9deae75
Initial commit for linking vlsvreaders together.. so that e.g. vg_j c…
alhom Mar 10, 2025
e14e6a7
Forays towards HDF5 storage (for read-write support without implement…
alhom Mar 14, 2025
4d30a0f
Merge branch 'mpi_domain_extensts' into linked-readers
alhom Mar 14, 2025
077b6c2
Added documentation strings to magnetopause scripts and fixed plottin…
jreimi Jun 5, 2025
b95d2c0
Add checks for starting point input, change ragged arrays to lists, a…
jreimi Jun 5, 2025
de4f3f8
Change the streamline tracing to use analysator's fieldtracer instead…
jreimi Jun 6, 2025
6ca082e
2d and 3d magnetopause scripts: Add function find_magnetopause() that…
jreimi Jun 10, 2025
79abb14
Moved magnetopause functions to analysator/pyCalculations
jreimi Jun 12, 2025
a200580
Add magnetopause functions and surface function to calculations.py
jreimi Jun 12, 2025
99e37c9
Change surface triangles so that the normals have the same direction.
jreimi Jun 12, 2025
35cf3fb
Changed function names for clarity, added possible keyword argumets f…
jreimi Jun 12, 2025
6225f0d
Added example files for using magnetopause functions and plotting the…
jreimi Jun 13, 2025
58e84bf
Added yt dependency for the 2d script
alhom Jun 16, 2025
7303815
function and file name changes and removal of unnecessary surface mak…
jreimi Jul 14, 2025
40842f0
Changed magnetopause stuff names in the sphinx directory to (hopefull…
jreimi Jul 15, 2025
1a3502f
Added fix for toctree
jreimi Jul 15, 2025
6eb059b
Function name changes, removed unused import
jreimi Jun 16, 2025
6a69fac
Fix to surface making and an attempt to make the subsolar area nicer
jreimi Jun 26, 2025
4340cc9
More possible fixes to surface making, function name changes also to …
jreimi Jul 15, 2025
dc08ad2
Removed streamline magnetopause from scripts in sphinx
jreimi Jul 15, 2025
da57da3
Move streamline magnetopause script usage examples to scripts
jreimi Jul 17, 2025
1fc418f
Updated sphinx
jreimi Jul 17, 2025
f6bff74
Added blank lines
jreimi Jul 17, 2025
35965fe
fixes for sphinx
jreimi Jul 17, 2025
a5a68b5
more fixes for sphinx
jreimi Jul 17, 2025
71594a6
Remove debug output
alhom Aug 19, 2025
fa4039c
Merge branch 'master' into linked-readers
alhom Aug 19, 2025
52015d8
vlsvReader.read_interpolated_variable test_variable to use the first …
alhom Aug 20, 2025
3c360bc
Merge pull request #334 from alhom/dev
alhom Aug 20, 2025
a70e0e4
Fix undeclared var
alhom Aug 20, 2025
cab54a9
Fix docstrings
alhom Aug 20, 2025
12c3820
Fix docstrings properly after fixing the thing that caused a wrong wa…
alhom Aug 20, 2025
dbba6eb
Add vlsvcache.py, start moving cache functionalities there
alhom Aug 20, 2025
131894f
Moving cache stuff to vlsvcache
alhom Aug 20, 2025
ed8e6ea
Better SW magnetopause and region classification draft
jreimi Aug 20, 2025
01836c3
Documentation drafts and regions script
jreimi Aug 20, 2025
abcdbd4
fix to dayside slicing
jreimi Aug 21, 2025
3252d5a
Field values are passed to stopping condition function instead of uni…
jreimi Aug 22, 2025
7eeb1bd
Magnetopause script additional notes
jreimi Aug 25, 2025
3effe84
attempted citation fixes
jreimi Aug 25, 2025
88099fb
Magnetopause search file
jreimi Aug 26, 2025
0283802
regions format changes draft
jreimi Aug 26, 2025
6f9a9fc
non-fix to surface making and added outline to how to get beta* + con…
jreimi Aug 26, 2025
46fe573
1) Add caching of neihgbor stencils (yes, it's via Pickle, it's ugly)
alhom Jul 9, 2025
47809fb
Moving cache stuff to vlsvcache
alhom Aug 20, 2025
bd3e207
Partial fileindex reading update
alhom Aug 21, 2025
4255e69
Rtree working and has some mildly tested thresholds for when to use t…
alhom Aug 25, 2025
7ed31f4
Housekeeping functions (clear, build some caches), revert neighbor st…
alhom Aug 26, 2025
cc9fa74
Dependency cleaning
alhom Aug 26, 2025
4df5e36
Separate SpatialIndex get/set
alhom Aug 26, 2025
f3e6ad1
Guard against missing numWritingRanks, adjusted spatialindex getter
alhom Aug 26, 2025
17dccb8
removed extra vtp save that shouldn't be there yet
jreimi Aug 26, 2025
23b4db1
Better optional arguments for regions
jreimi Aug 27, 2025
eb43f48
removed main function and moved usage example to docstring
jreimi Aug 27, 2025
afee9e9
Sphinx updates: bowshock and scripts toctree
jreimi Aug 27, 2025
db3be40
removed bowshock after moving contents to regions doc before
jreimi Aug 27, 2025
fcd718c
sphinx documentation fixes
jreimi Aug 27, 2025
09a4d54
something wrong eith te beta* stop condition here
jreimi Aug 28, 2025
1dc40fa
added automodules for regions and magnetopause documentations, some r…
jreimi Aug 28, 2025
e8f2754
Added documentation strings to magnetopause scripts and fixed plottin…
jreimi Jun 5, 2025
fed2153
Add checks for starting point input, change ragged arrays to lists, a…
jreimi Jun 5, 2025
2da0e0e
Change the streamline tracing to use analysator's fieldtracer instead…
jreimi Jun 6, 2025
cf3f82d
2d and 3d magnetopause scripts: Add function find_magnetopause() that…
jreimi Jun 10, 2025
efbf1c0
Moved magnetopause functions to analysator/pyCalculations
jreimi Jun 12, 2025
83826df
Add magnetopause functions and surface function to calculations.py
jreimi Jun 12, 2025
c67f732
Change surface triangles so that the normals have the same direction.
jreimi Jun 12, 2025
10c0f41
Changed function names for clarity, added possible keyword argumets f…
jreimi Jun 12, 2025
59a6c21
Added example files for using magnetopause functions and plotting the…
jreimi Jun 13, 2025
6a80256
Added yt dependency for the 2d script
alhom Jun 16, 2025
8f51471
function and file name changes and removal of unnecessary surface mak…
jreimi Jul 14, 2025
cddf3af
Changed magnetopause stuff names in the sphinx directory to (hopefull…
jreimi Jul 15, 2025
b253e11
Added fix for toctree
jreimi Jul 15, 2025
6daa976
Function name changes, removed unused import
jreimi Jun 16, 2025
61b4fb2
Fix to surface making and an attempt to make the subsolar area nicer
jreimi Jun 26, 2025
2d65f54
More possible fixes to surface making, function name changes also to …
jreimi Jul 15, 2025
42a425e
Removed streamline magnetopause from scripts in sphinx
jreimi Jul 15, 2025
b0a2b24
Move streamline magnetopause script usage examples to scripts
jreimi Jul 17, 2025
0a602c6
Updated sphinx
jreimi Jul 17, 2025
b35f7fb
Added blank lines
jreimi Jul 17, 2025
9217675
fixes for sphinx
jreimi Jul 17, 2025
21a73d8
more fixes for sphinx
jreimi Jul 17, 2025
d2dda2e
Better SW magnetopause and region classification draft
jreimi Aug 20, 2025
cca6229
Documentation drafts and regions script
jreimi Aug 20, 2025
682199d
fix to dayside slicing
jreimi Aug 21, 2025
37910d3
Field values are passed to stopping condition function instead of uni…
jreimi Aug 22, 2025
8bb1aff
Magnetopause script additional notes
jreimi Aug 25, 2025
d5af3ca
attempted citation fixes
jreimi Aug 25, 2025
f6322ed
Magnetopause search file
jreimi Aug 26, 2025
0bf0cd1
regions format changes draft
jreimi Aug 26, 2025
338daaa
non-fix to surface making and added outline to how to get beta* + con…
jreimi Aug 26, 2025
9ac7574
removed extra vtp save that shouldn't be there yet
jreimi Aug 26, 2025
91e8d83
Better optional arguments for regions
jreimi Aug 27, 2025
59e1dca
removed main function and moved usage example to docstring
jreimi Aug 27, 2025
381c256
Sphinx updates: bowshock and scripts toctree
jreimi Aug 27, 2025
c6559d9
removed bowshock after moving contents to regions doc before
jreimi Aug 27, 2025
0b659c4
sphinx documentation fixes
jreimi Aug 27, 2025
099de07
something wrong eith te beta* stop condition here
jreimi Aug 28, 2025
b3675d1
added automodules for regions and magnetopause documentations, some r…
jreimi Aug 28, 2025
c710e48
dev rebase
jreimi Aug 28, 2025
88a5076
added mention of beta* stop condition to docstring
jreimi Aug 28, 2025
49e45be
docstring fixes
jreimi Aug 28, 2025
80fb347
small sphinx changes
jreimi Aug 28, 2025
5f3c556
added option to pass down keyword args to streamline and shue functions
jreimi Aug 28, 2025
fa0ee4e
small changes to regions.py docstrings
jreimi Aug 29, 2025
3c1f750
magetopause.py: removed main function, added usage examples to docstring
jreimi Aug 29, 2025
685c2ac
less print during regions
jreimi Aug 29, 2025
1d54dcb
fixed some typos
jreimi Aug 29, 2025
453c932
added main functions to magnetopause and regions scripts
jreimi Aug 29, 2025
74e6d7f
logging instead of prints
jreimi Aug 29, 2025
207bf52
added mention of dayside cells to CPS doc
jreimi Aug 29, 2025
a9356b3
small additions to magnetopause docs
jreimi Aug 29, 2025
f7104eb
added comment about cusps catching extra cells on dayside to sphinx doc
jreimi Aug 29, 2025
cc3ca72
documentation updates
jreimi Aug 29, 2025
68ac9f7
added note about lobes
jreimi Aug 29, 2025
7007381
removed redundant streamline magnetopause plot example file
jreimi Aug 29, 2025
3995c02
also removed plotting example from sphinx
jreimi Aug 29, 2025
cc79359
added something about field lines to documentation
jreimi Aug 29, 2025
e90b519
Update requirements.txt
alhom Sep 1, 2025
3f7093d
Merge pull request #337 from alhom/cache_files
alhom Sep 1, 2025
d73be8b
Merge branch 'dev' into region_classification
alhom Sep 1, 2025
cf9e9cb
Update pyproject.toml
alhom Sep 1, 2025
331f4cb
Merge pull request #338 from jreimi/region_classification
alhom Sep 1, 2025
e4be4fb
Guards for setting up cache files, cache setup script
alhom Sep 1, 2025
847ca2f
Missing newline
alhom Sep 1, 2025
c6c0e44
Merge pull request #344 from alhom/cache_files
alhom Sep 1, 2025
b7ebaff
Merge branch 'master' into dev
alhom Sep 9, 2025
194f8e1
Merge pull request #347 from alhom/dev
alhom Sep 9, 2025
1a932cf
Merge pull request #350 from fmihpc/master
alhom Sep 18, 2025
d7b8801
Merge branch 'master' into dev
alhom Jan 14, 2026
0213d18
Refactor vtk dependency in pyproject.toml
alhom Jan 15, 2026
2c96697
Try with carrington-constrained sbatch...
alhom Jan 18, 2026
95910d2
Update optional dependencies in pyproject.toml
alhom Jan 18, 2026
414a44b
Update SLURM constraint for testpackage workflow
alhom Jan 18, 2026
e314024
Merge branch 'master' into dev
lassejsc Jan 20, 2026
9ec0efa
Fixed the folder path
lassejsc Jan 30, 2026
e5738ed
Merge pull request #419 from lassejsc/path_fix_cache
alhom Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions Documentation/sphinx/magnetopause.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
Magnetopause: how to find
=========================

Note: The analysator methods here are prototypes and should be adapted and modified as needed.

Magnetopause

Plasma beta, beta*
------------------


Modified plasma beta

.. math:: \beta * = \dfrac{P_{th}P_{dyn}}{B^2/2\mu_0}

[Xu_et_al_2016]_, [Brenner_et_al_2021]_


The beta* gets values below 1 inside the magnetosphere near magnetopause and can be used to create a magnetopause surface.

Caveats: magnetotail current sheet has beta* :math:`>` 1

**in analysator:**

see :func:`magnetopause.magnetopause` "method" keyword options "beta_star", "beta_star_with_connectivity"

datareducer: beta_star, vg_beta_star

.. [Xu_et_al_2016] Xu, S., M. W. Liemohn, C. Dong, D. L. Mitchell, S. W. Bougher, and Y. Ma (2016), Pressure and ion composition boundaries at Mars, J. Geophys. Res. Space Physics, 121, 6417–6429, doi:10.1002/2016JA022644.
.. [Brenner_et_al_2021] Brenner A, Pulkkinen TI, Al Shidi Q and Toth G (2021) Stormtime Energetics: Energy Transport Across the Magnetopause in a Global MHD Simulation. Front. Astron. Space Sci. 8:756732. doi: 10.3389/fspas.2021.756732



Field line connectivity
-----------------------

Bulkfiles from newer Vlasiator runs include connection (whether magnetic field lines are closed-closed, closed-open, open/closed or open-open) and coordinates for field line start and end points that can be used in finding the mangetopause location.


Solar wind flow
---------------

Method used in e.g. [Palmroth_et_al_2003]_

Streamlines of velocity field that are traced from outside the bow shock curve around the magnetopause.

Caveats: sometimes some streamlines can curve into the magnetotail or dayside magnetoshpere


**In analysator:**

see
:func:`calculations.find_magnetopause_sw_streamline_2d`
:func:`calculations.find_magnetopause_sw_streamline_3d`

Streamlines are traced from outside the bow shock towards Earth. A subsolar point for the magnetopause is chosen to be where streamlines get closest to Earth in x-axis [y/z~0].

From subsolar point towards Earth, space is divided radially by spherical coordiante (theta from x-axis) angles theta and phi, and magnetopause is located by looking at streamline point distances from origo and marked to be at middle of the sector

From the Earth towards negative x the space is divided into yz-planes and streamlines are interpolated to certain x-points.
Each yz-plane is then divided into 2d sectors and magnetopause is marked to be in the middle of the sector with the radius of the n:th closest streamline to the x-axis.


For subsolar point, radial dayside, and -x planes the closest streamline point can be changed to be n:th closest by setting keyword *ignore*, in which case *ignore* closest streamline points are not taken into account.


2d:
Note: no radial dayside, uses yt-package instead of analysator's fieldtracer

3d:
After the magnetopause points are chosen, they are made into a surface by setting connnection lines between vertices (magnetopause points) to make surface triangles.
This surface is then made into a vtkPolyData and returned as vtkDataSetSurfaceFilter that can be written into e.g. .vtp file.



.. [Palmroth_et_al_2003] Palmroth, M., T. I. Pulkkinen, P. Janhunen, and C.-C. Wu (2003), Stormtime energy transfer in global MHD simulation, J. Geophys. Res., 108, 1048, doi:10.1029/2002JA009446, A1.




Shue et al. (1997)
------------------

The Shue et al. (1997) [Shue_et_al_1997]_ magnetopause model:

.. math::

r_0 &= (11.4 + 0.013 B_z)(D_p)^{-\frac{1}{6.6}}, for B_z \geq 0 \\
&= (11.4 + 0.14 B_z)(D_p)^{-\frac{1}{6.6}}, for B_z \leq 0

.. math::

\alpha = (0.58-0.010B_z)(1+0.010 D_p)


where :math:`D_p` is the dynamic pressure of the solar wind and :math:`B_z` the magnetic field z-component magnitude.
:math:`r_0` is the magnetopause standoff distance and :math:`\alpha` is the level of tail flaring.


The magnetopause radius as a function of angle :math:`\theta` is

.. math::
r = r_0 (\frac{2}{1+\cos \theta})^\alpha

**In analysator:**

see :doc:`../shue`


.. [Shue_et_al_1997] Shue, J.-H., Chao, J. K., Fu, H. C., Russell, C. T., Song, P., Khurana, K. K., and Singer, H. J. (1997). A new functional form to study the solar wind control of the magnetopause size and shape. Journal of Geophysical Research: Space Physics, 102(A5):9497–9511. eprint: https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/97JA00196.





**In analysator:**
------------------

:mod:`magnetopause` in scripts for 3d runs
Constructs the magnetopause surface with vtk's vtkDelaunay3d triangulation with optional alpha to make the surface non-convex.
Uses regions.py functions.

Important: SDF of non-convex surface might not always work as expected inside the magnetosphere if e.g. the lobes are hollow.

options (magnetopause() method keyword) and some notes:

* solar wind flow ("streamlines")
* uses *magnetopause_sw_streamline_3d.py* from pyCalculations
* if streamlines make a turn so that the velocity points sunwards (to pos. x), the streamline is ignored from that point onwards
* streamlines that enter an area where beta* is below 0.4 are also stopped
* this can affect the far magnetotail as streamlines may turn inwards into lobes at some point and may result in magnetopause not forming
due to not enough streamline points where magnetopause is supposed to be
* very dependent on how solar wind streamlines behave
* streamline seeds and other options can greatly affect the resulting magnetopause

* beta* ("beta_star")
* beta* treshold might need tweaking as sometimes there are small low beta* areas in the magnetosheath that get taken in distorting the magnetopause shape at nose
* convex hull (Delaunay_alpha=None) usually makes a nice rough magnetopause but goes over any inward dips (like polar cusps)
* alpha shape (Delaunay_alpha= e.g. 1*R_E) does a better job at cusps and delicate shapes like vortices but might fail at SDF inside the magnetosphere
* Delaynay3d has an easier time if the treshold is something like [0.4, 0.5] and not [0.0, 0.5], but this can affect the alpha shape if alpha is used

* beta* with magnetic field line connectivity ("beta_star_with_connectivity")
* includes closed-closed magnetic field line areas if available, otherwise like "beta_star"
* can help with nose shape as beta* can be set lower to exclude magnetosheath low beta* areas while still getting the full dayside from field lines

* Shue et al. 1997 ("shue")
* uses *shue.py* from scripts
* a rough theoretical magnetopause using Shue et al. 1997 method based on B_z, solar wind density, and solar wind velocity

* user-defined parameter tresholds ("dict")
* creates a magnetopause (or other area) using the Delaunay3d triangulation of some area where user-defined tresholds given as dictionary
* dictionary key is data name in datafile and value is treshold used, if dictionary has multiple conditions, they all need to be fulfilled
* dictionary example: {"vg_rho": [None, 1e5]} makes a magnetopause using cells where density is less than 1e5


.. automodule:: magnetopause
:members:
5 changes: 0 additions & 5 deletions Documentation/sphinx/magnetopause2d.rst

This file was deleted.

5 changes: 0 additions & 5 deletions Documentation/sphinx/magnetopause3d.rst

This file was deleted.

Loading
Loading