Skip to content

Bugs/electrodynamics and logfiles - #100

Merged
aaronjridley merged 17 commits into
developfrom
bugs/electrodynamics_and_logfiles
Jun 18, 2026
Merged

aaronjridley merged 17 commits into
developfrom
bugs/electrodynamics_and_logfiles

Conversation

@abukowski21

Copy link
Copy Markdown
Collaborator

[BUG/FEAT] A lot of changes to Electrodynamics...

  • Some of the dynamo changes are experimental. will be documented more thoroughly as they're validated
  • Several indexing, sign, etc. bugs fixed in calc_electrodynamics.f90
  • Increase precision in logfile
  • Move Dipole default spec. to ModPlanet & fix bug with MLT & APEX=F

Atheer Alhothali and others added 17 commits June 2, 2026 20:03
    Horizontal Momentum Components: Allocated 4D arrays (HorizAdvection, HorizPressureGrad, HorizCoriolis, Centrifugal) to store the East and North acceleration terms.

    Vertical Momentum Components: Allocated 3D and 4D arrays (VertAdvection, VertCoriolis, VertCentrifugal, EffectiveGravity) to store per-species advection and bulk vertical acceleration terms.

    advance_horizontal.f90
    Horizontal Momentum Components: Initialized and assigned the East and North advection and pressure gradient terms by splitting the existing velocity update calculation into separate components without changing the physics.

    Vertical Momentum Components: Initialized and assigned the species vertical advection.

    advance_vertical.f90
    Vertical Momentum Components: Assigned the vertical Coriolis, centrifugal, and effective gravity terms by splitting the existing terms into separate arrays.

    output_common.f90
    Output Configuration: Increased nValidTypes to 27, added 3DMOH and 3DMOV in the valid types array, and added their respective case statements to define the number of variables to write (nvars_to_write).

    Horizontal Momentum Output (3DMOH): Added explicit header definitions for the East and North momentum variables and implemented the output_3dmoh subroutine to write the horizontal data.

    Vertical Momentum Output (3DMOV): Added explicit header definitions for the per-species vertical momentum variables and bulk upward components, and implemented the output_3dmov subroutine to write the vertical data.
- some +/- & */(divide) flips
- One index swap
- one (potentially) out-of-bounds error
- Missing **2's
- "chamical" -> "chemical"
- Don't convert MLT to radians in 2dmel outputs
Replaces  DipAngle approximation in SigmaR with the complete richmond  tensor, correctly handling magnetic declination.

The old version was only valid for bE=0
If anyone reading this, JFC. This was a tough one!

basically:
1. GITM was only putting MLT on the mag grid with APEX=T
2. if apex=F, mlt was nonsense
3. easy fix. Just have it calculate MLT whenever we're on earth, right? wrong!
4. SWMF sets #MAGNETICFIELD, gitm sets #DIPOLE. ok fine whatever. we just have to read it from the swmf or UAM, right? WRONG!
4.5. GITM's default dipole was set in modInputs & not able to be parsed / manipulated by the swmf. need to move to modPlanet
5. thought that was it? think again. To calculate MLT with the apex routine we need the subsolar pt abd the pole's Lon & CoLat, not tilt/offset.
6. Calculate magnetic pole Lon & coLat in init_b0 when apex=F :-)

----

what changed:

- Default dipole is now **actually** tilted. Not offset.
- All planets set their own dipole (earth =/= other-planets == 0)
- We calculate things the same with & without apex
- gitm interfaces better with the swmf

All this to change one stupid fucking line in calc_electrodynamics.f90
it's field-line-integrated, not altitude integrated!
and uh update solutions therein or whatever
- does not change outputs when not included
- Will be documented more soon, but:
- allow lat boundary to move
- Toggle mirroring (after solve)
- Toggle BC's
- Toggle eq-avg subtacting
@aaronjridley
aaronjridley merged commit 82a447d into develop Jun 18, 2026
3 checks passed
@aaronjridley
aaronjridley deleted the bugs/electrodynamics_and_logfiles branch June 18, 2026 19:33
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.

2 participants