Skip to content

Incorporates relative humidity to atmospheric conditions - #2834

Merged
SiboVG merged 19 commits into
openrocket:unstablefrom
gdilbaz:incorporate-relative-humidity
Jan 2, 2026
Merged

SiboVG merged 19 commits into
openrocket:unstablefrom
gdilbaz:incorporate-relative-humidity

Conversation

@gdilbaz

@gdilbaz gdilbaz commented Jul 6, 2025

Copy link
Copy Markdown
Contributor

This PR adresses #2713 incorporating the relative humudity to gas constant calculations. Also adding option to specify it simulation options.

image

When modeling the behaviour of RH as the altitude increased i opted to model it linearly decreasing by 6% per kilometer. I did this due to the lack of literature tackling the problem. The literature I've found was inconsistent but mentioned rates between 4-8%. Because the program doesn't currently take humidity to consideration and the relatively small effect it'd have I think this model is fine four our purposes. Any help is really appreciated in this part.

Method:
Clausius-Clapeyron equation was used to determine the saturation vapor pressure
image

Then due definition :
Relative Humidity
image
Mixing ratio (Epsilon being the ratio of molar masses)
image
Specific Humidity
image

Subtituting e into the mixing ratio we get:
image

We also know
image

Finally after some algebra:
image

@JoePfeiffer

Copy link
Copy Markdown
Contributor

Could you point at some of the sources you used to derive the humidity variation with altitude?

@gdilbaz

gdilbaz commented Jul 9, 2025 •

Copy link
Copy Markdown
Contributor Author

Yeah absolutely.
link1
link2

I've derived the 6% from these and another analysis from japanese meteorologists which I will post here as soon as i find the pdf.

pdf
Please note that I'd love to implement a theoretical implementation of RH. I've tried to implement the methods in the pdf but the simulation results blew up and were highly unrealistic.

Any help in literature would help tremendously.

/**
* Calculate the relative humidity at any altitude.
* Assumes relative humidity drops at a rate of 0,06/km
* Assumes there is no more humidity after 16,5 km

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where does this come from, can you please add a source in the docstring?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added the papers I used but when i was searching for the modeling of RH I couldn't find it's modelling wrt altitude. I am hoping someone more knowledgeable about the subject can give a more concrete and correct model.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, if it's not based on anything, we should simple return humidity1 and add a TODO to make it dependent on the altitude. There's no point in inventing numbers 🙂.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@gdilbaz if you have time, could you clarify this? Once that's done, we can do a full code review and merge it.

assertTrue(options.isISAAtmosphere());
assertEquals(288.15, options.getLaunchTemperature(), EPSILON);
assertEquals(101325, options.getLaunchPressure(), EPSILON);
//assertEquals(0, options.getLaunchHumidity(), EPSILON);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this not work? Why is it commented out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Don't exactly remember but seems to be working fine. Probably just a temporary fix until the I came around to tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You only test cases with relative humidity equal to 0. Can you please also add test cases that test different humidity levels, and that test the different calculations, e.g. vapor pressure....

@SiboVG

SiboVG commented Jul 21, 2025

Copy link
Copy Markdown
Member

Great work @gdilbaz, thanks! I've added some comments. I still need to test it thoroughly though. We are currently in the process of releasing the 24.12 release. Once that's done, we can look into merging your PR.

@SiboVG

SiboVG commented Aug 6, 2025

Copy link
Copy Markdown
Member

@gdilbaz did you find time to take a look at my remarks?

@gdilbaz

gdilbaz commented Aug 7, 2025

Copy link
Copy Markdown
Contributor Author

@gdilbaz did you find time to take a look at my remarks?
Unfortunately I couldn’t. I’ve been working in a different city for a while now. I am returning home later today will look into this ASAP.

@SiboVG

SiboVG commented Aug 7, 2025

Copy link
Copy Markdown
Member

@gdilbaz did you find time to take a look at my remarks?
Unfortunately I couldn’t. I’ve been working in a different city for a while now. I am returning home later today will look into this ASAP.

No pressure! Just making sure you got the message.

gdilbaz and others added 6 commits August 15, 2025 10:15
removed "import java.security.PublicKey;"
removed"import info.openrocket.core.rocketcomponent.*;"
Will return R if humidity is 0
/**
* Calculate the relative humidity at any altitude.
* Assumes relative humidity drops at a rate of 0,06/km
* Assumes there is no more humidity after 16,5 km

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@gdilbaz if you have time, could you clarify this? Once that's done, we can do a full code review and merge it.

@gdilbaz

gdilbaz commented Jan 1, 2026

Copy link
Copy Markdown
Contributor Author

Hello,
Sorry for the, very, late reply. I've been quite busy and couldn't really managed to come back to this issue until recently. After some literature review, I've found a paper by David Romps. In this paper, he tackles on the RH distribution wrt altitude. But his work only cover's the tropics(20 degree S - 20 degree N). Outside the regions some of the assumptions starts breaking down.

I'm willing to implement his paper since I couldn't find any other papers that are this useful. But it'll be locked into the region I've mentioned which may lead us to exclude simulating it outside the region concerning me with the usefulnes of the implementation. I'd appreciate any guidance and further literature to review. Thanks!

Here is the link to the paper: https://journals.ametsoc.org/view/journals/clim/27/19/jcli-d-14-00255.1.pdf

@SiboVG

SiboVG commented Jan 1, 2026

Copy link
Copy Markdown
Member

Hello, Sorry for the, very, late reply. I've been quite busy and couldn't really managed to come back to this issue until recently. After some literature review, I've found a paper by David Romps. In this paper, he tackles on the RH distribution wrt altitude. But his work only cover's the tropics(20 degree S - 20 degree N). Outside the regions some of the assumptions starts breaking down.

I'm willing to implement his paper since I couldn't find any other papers that are this useful. But it'll be locked into the region I've mentioned which may lead us to exclude simulating it outside the region concerning me with the usefulnes of the implementation. I'd appreciate any guidance and further literature to review. Thanks!

Here is the link to the paper: https://journals.ametsoc.org/view/journals/clim/27/19/jcli-d-14-00255.1.pdf

Thanks for the reply! The paper you linked could be a start, but it's not very generic. I would be inclined to just use a constant RH throughout the flight. So, you can replace the content of calculateHumidity with return humidity1; and a comment TODO: implement changing humidity based on altitude. We can fill this in later, or leave it as is. From the paper, in the first 10-15 km, the RH doesn't change much, so it also wouldn't change much during flight.

@SiboVG

SiboVG commented Jan 2, 2026 •

Copy link
Copy Markdown
Member

Thanks a lot for your contribution @gdilbaz, we appreciate it!

@SiboVG
SiboVG merged commit 4e95d1a into openrocket:unstable Jan 2, 2026
@gdilbaz
gdilbaz deleted the incorporate-relative-humidity branch January 3, 2026 07:49
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.

3 participants