-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nondimensionalization of Geothermal Gradient #125
Comments
Can you add a full MWE (minimal working example)? Screenshots are only partially helpful. |
and these are the results from this:
|
ok, I see. Here a more compact version of the same: julia> using GeoParams
julia> CharDim = GEO_units(length=40km, viscosity=1e20Pa*s);
julia> GeoTherm = GeoUnit(30K/1km)
GeoUnit{dimensional, K km⁻¹·⁰},
30.0
julia> GeoTherm_nd = nondimensionalize(GeoTherm, CharDim)
GeoUnit{nondimensional, K km⁻¹·⁰},
0.942544083572242
julia> GeoTherm_dim = dimensionalize(GeoTherm_nd, CharDim)
julia> @assert GeoTherm_dim == GeoTherm. # all is fine
julia> length = GeoUnit(1km)
julia> length_nd = nondimensionalize(length, CharDim)
GeoUnit{nondimensional, km},
0.025
julia> T = length*GeoTherm. # correct answer
GeoUnit{dimensional, K},
30.0
julia> T_nd = length_nd*GeoTherm_nd. # incorrect units are stored (should be {nondimensional, K})
GeoUnit{nondimensional, },
0.02356360208930605 So there is a problem when we multiply two non-dimensional |
As far as I can tell from here, units are thrown away. |
yup, that's no good. |
This may work? function foo(x::GeoUnit{T1,U1}, y::GeoUnit{T2,U2}) where {T1,T2,U1,U2}
return GeoUnit(*(UnitValue(x), UnitValue(y)) * (x.unit*y.unit))
end In [21]: foo(length_nd, GeoTherm_nd)
GeoUnit{dimensional, K},
0.02356360208930605 |
yes that should do it; now it needs to be generalized for all operations. Addition/subtraction can only be done if they have the same time; multiplication/division should work for different units as well |
I missed it, but it returns |
yes missed that too; should be |
I've ran into a nondimesionalization problem during testing of my code.
I want to calculate the geothermal gradient on a grid that has a topography. This means that the 0.0km mark should start at topography. After doing so, I wanted to add the gradient in non dimensional numbers.
However the non dimensional numbers do not work correctly when dimensionalized again. See screenshot.
Is there a way to add a non dimensional term for K/km or C/km?
The text was updated successfully, but these errors were encountered: