Skip to content

Bugfix: Fix the Vortex Initialisation#74

Merged
sdeastham merged 8 commits intoMIT-LAE:mainfrom
Calebsakhtar:bugfix/vortex-met-init
Aug 6, 2025
Merged

Bugfix: Fix the Vortex Initialisation#74
sdeastham merged 8 commits intoMIT-LAE:mainfrom
Calebsakhtar:bugfix/vortex-met-init

Conversation

@Calebsakhtar
Copy link
Copy Markdown
Contributor

@Calebsakhtar Calebsakhtar commented Aug 6, 2025

Summary

BUG: Some constructors used data from the input.yaml instead of the actual meteorology.

Following a recent update, specifying the meteorology through the input.yaml file is not allowed. However, I identified a bug where some of the EPM (the Vortex and Aircraft classes) were initialized with data from the input.yaml file. I identified this oversight and reported it to @sdeastham.

This pull request consists of a slight refactor of the initialization of the EPM to fix this oversight. The most important changes include updating the Aircraft class to use a new constructor that takes a Meteorology object. The required values of temperature and humidity are now taken from the meteorology file instead of the input.yaml. This should help make the meteorology file the only source of truth.

Refactoring Details

  • Updated the Aircraft class constructor to require a Meteorology object and Input objecs. An older constructor that was only used in the tests was removed. (Code.v05-00/include/Core/Aircraft.hpp, Code.v05-00/src/Core/Aircraft.cpp) [1] [2] [3] [4]
  • Modified the construction of the Aircraft object in LAGRIDPlumeModel to use the modified constructor, passing in the Meteorology object. (Code.v05-00/src/Core/LAGRIDPlumeModel.cpp) [1] [2]
  • Commented out legacy unit tests for Aircraft that relied on the old constructor interface. These tests are no longer compatible with the refactored Aircraft class. (Code.v05-00/tests/test_aircraft.cpp)

Results

(Two sets of simulations A, and B. The only thing that changes is the temp and RH in the input.yaml A = 217 K, 125% RHw; B = 180 K, 105% RHw. The real temperature and relative humidity with respect to water vapor in the meteorology is 223.15 K and 76.4 % RHw across A and B)

Table 1: EPM outputs for two simulations before and after the bugfix.

Parameter Pre-bugfix (A) Post-bugfix (A) Pre-bugfix (B) Post-bugfix (B)
Vortex Sinking Survival Fraction 0.808848 0.806338 0.823748 0.806338
Initial Contrail Width (m) 27.0893 26.4901 31.7477 26.4901
Initial Contrail Depth (m) 161.284 164.932 137.619 164.932
Initial Num Particles 8.05351e+12 8.02843e+12 8.20256e+12 8.02843e+12
Initial Ice Mass (kg) 1.46656e-05 1.46199e-05 1.4937e-05 1.46199e-05

Table 2: Integral quantities for simulation family B

Quantity (simulation B only) Pre-bugfix Value Post-bugfix Value % Difference
Lifetime Integral of N (# / m) 2.39e+13 2.38e+13 0.67%
Lifetime Integral of Total Extinction (m) 10288 10301 0.13%
Lifetime Integral of Ice Mass (kg of ice/m) 57.8 57.3 0.81%
comparison

Figure 1: Evolution of integral quantities for simulation family B.

Discussion

  • Bug appears to be fixed since post-bugfix runs seem to have same EPM outputs regardless of input.yaml values (Table 1).
  • Bug was minor as it only affected some bits of the early contrail (Table 2, Figure 1).

@Calebsakhtar Calebsakhtar marked this pull request as ready for review August 6, 2025 19:17
@Calebsakhtar
Copy link
Copy Markdown
Contributor Author

@sdeastham The PR is now ready for review! Thanks for the help!

@sdeastham
Copy link
Copy Markdown
Collaborator

IceVol_Comparison_2D Mass_Comparison_1D

Code compiles and runs without issue, and the effect on the PR test case is minimal (<0.4% difference in time-integrated mass). Edits look reasonable. Good to go.

@sdeastham sdeastham merged commit f2e5268 into MIT-LAE:main Aug 6, 2025
@Calebsakhtar Calebsakhtar deleted the bugfix/vortex-met-init branch August 7, 2025 09:41
AlphaBetaGammaChi pushed a commit to AlphaBetaGammaChi/HAPCEMM-Chem that referenced this pull request Apr 11, 2026
* Ensure vortex uses met temp, rhw, and pressure

* Remove an unused Aircraft constructor

* Fix the Aircraft constructor declaration

* Add the meteorology header to the aircraft head

* Disable the aircraft test

* Add debug print statements to the Aircraft constructor

* Initialise the EI after the aircraft

* Fix the vortex initialisation in Aircraft
AlphaBetaGammaChi pushed a commit to AlphaBetaGammaChi/HAPCEMM-Chem that referenced this pull request Apr 11, 2026
* Ensure vortex uses met temp, rhw, and pressure

* Remove an unused Aircraft constructor

* Fix the Aircraft constructor declaration

* Add the meteorology header to the aircraft head

* Disable the aircraft test

* Add debug print statements to the Aircraft constructor

* Initialise the EI after the aircraft

* Fix the vortex initialisation in Aircraft
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