|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'm trying to write a function to calculate air density based on the
following article:
http://en.wikipedia.org/wiki/Barometric_formula#Density_equations
My question is, is the "exp" function in the article the same as the
"exp" function in POV-Ray? If not, what's the best way of going about
writing these functions in SDL? My calculus is very rusty, but the
description given here seems simple enough to implement:
http://en.wikipedia.org/wiki/Exponential_function#Continued_fractions_for_ex
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> I'm trying to write a function to calculate air density based on the
> following article:
>
> http://en.wikipedia.org/wiki/Barometric_formula#Density_equations
>
> My question is, is the "exp" function in the article the same as the
> "exp" function in POV-Ray?
Yes.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
scott wrote:
> Yes.
Thanks! The functions use multi-valued constants that will be tricky to
implement. Also, there are no functions for values beyond 71km. Is that
because the air so so thin that it's not worth calculating?
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD <mik### [at] gmailcom> wrote:
> Thanks! The functions use multi-valued constants that will be tricky to
> implement. Also, there are no functions for values beyond 71km. Is that
> because the air so so thin that it's not worth calculating?
The atmosphere is made up of different layers, each with their own typical
temperature gradient. Just because the last reference point is at 71km, that
doesn't mean the formulae are not valid beyond that point. It just means that
most of the interesting features are below.
If you just want a good approximation,
exp(-1.4237e-4 * h)
is a good approximation on a log scale, where h is in meters. That tends to
overpredict where the density is large, so
exp(-1.2e-4 * h)
is a much better approximation for low altitudes. Of course it overpredicts
high altitudes where the densities are tiny anyway. These are just based on
least squares and eyeballing, respectively. Which one to choose just depends
what you need it for. If you're looking to model it with media or something,
I'd just split the difference. It'd be in the ballpark anyway. If you really
need it to be accurate, then work on implementing the formula on Wikipedia.
- Ricky
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
triple_r wrote:
> If you just want a good approximation,
>
> exp(-1.4237e-4 * h)
>
> is a good approximation on a log scale, where h is in meters. That tends to
> overpredict where the density is large, so
>
> exp(-1.2e-4 * h)
>
> is a much better approximation for low altitudes. Of course it overpredicts
> high altitudes where the densities are tiny anyway. These are just based on
> least squares and eyeballing, respectively. Which one to choose just depends
> what you need it for. If you're looking to model it with media or something,
> I'd just split the difference. It'd be in the ballpark anyway. If you really
> need it to be accurate, then work on implementing the formula on Wikipedia.
>
> - Ricky
I'm applying the media to the difference of two very large spheres.
Currently, the inner sphere (the Earth's radius) is set to "6375000 *
Meters", where Meters is equal to 4. I'm not sure how big to make the
outer sphere.
Could you please rewrite your density function to take this into
account? I've created a few patterns that begin and end at X distances
away from the center. I managed to get them to work if they are linear,
but act strange when the functions are non-linear.
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD <mik### [at] gmailcom> wrote:
> I'm applying the media to the difference of two very large spheres.
> Currently, the inner sphere (the Earth's radius) is set to "6375000 *
> Meters", where Meters is equal to 4. I'm not sure how big to make the
> outer sphere.
Just make it go up to 50 or 100km. The density at 100km is about 6e-4 percent
the density at the surface. You'd have to try *very* hard to make this appear
as a discontinuity.
> Could you please rewrite your density function to take this into
> account?
exp(-1.2e-4*(h/Meters-6375000))
Does that sound right? Just be aware of precision issues if you're going to
model the earth in meters.
- Ricky
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
triple_r wrote:
> Just make it go up to 50 or 100km. The density at 100km is about 6e-4 percent
> the density at the surface. You'd have to try *very* hard to make this appear
> as a discontinuity.
>
>> Could you please rewrite your density function to take this into
>> account?
>
> exp(-1.2e-4*(h/Meters-6375000))
>
> Does that sound right? Just be aware of precision issues if you're going to
> model the earth in meters.
>
> - Ricky
Here's my first attempt. I can't see a whole lot in the image. Could you
suggest some better settings for the scattering media?
-Mike
//BEGIN
#local Meters = 4;
#local InnerRadius = EarthRadius;
#local OuterRadius = EarthRadius + 100000 * Meters;
#local BoundRadius = sin(acos(EarthRadius/OuterRadius)) * OuterRadius;
#local DiffrRadius = OuterRadius - InnerRadius;
#local ScaleAmount = 32; // arbitrary number
#local HazePigment = pigment
{
function {exp(-1.2e-4 * (f_r(x,y,z) - EarthRadius)/Meters)}
color_map
{
[0 rgb 0]
[1 rgb 1]
}
}
difference
{
sphere {0, OuterRadius}
sphere {0, InnerRadius}
bounded_by {cylinder {<0,EarthRadius,0,>, <0,OuterRadius,0,>, BoundRadius}}
hollow
material
{
texture {pigment {rgbt 1}}
interior
{
media
{
scattering {1, 0.5 * 1/ScaleAmount/1000}
method 3
intervals 1
// samples 30, 100
samples 10, 40
density
{
pigment_pattern {HazePigment}
density_map {[1/4 rgb 0][3/4 rgb 1]}
}
}
}
scale ScaleAmount
}
translate -y * EarthRadius
}
//END
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD wrote:
> Here's my first attempt. I can't see a whole lot in the image. Could you
> suggest some better settings for the scattering media?
>
> -Mike
Nevermind. I am going to crap this and follow the TerraPOV tutorial instead.
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |