-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add TUV-x height grid updates #134
base: development
Are you sure you want to change the base?
Changes from 19 commits
4c269e4
e1fd505
beb5126
afbe013
778a65a
fc1e9c5
6ea9c50
9642bfa
e0d6f83
7851097
3a71dc3
99d6dea
e4119ea
0ec84f1
2261760
45ef3b6
aafd074
4660749
fe44583
e8c6b61
a29d7c0
452f068
e3ec7b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,4 @@ | ||||||||||||||
module micm_util | ||||||||||||||
module musica_ccpp_micm_util | ||||||||||||||
implicit none | ||||||||||||||
|
||||||||||||||
private | ||||||||||||||
|
@@ -8,93 +8,67 @@ module micm_util | |||||||||||||
contains | ||||||||||||||
|
||||||||||||||
subroutine reshape_into_micm_arr(temperature, pressure, dry_air_density, constituents, & | ||||||||||||||
rate_params, m_temperature, m_pressure, m_dry_air_density, m_constituents, m_rate_params) | ||||||||||||||
m_temperature, m_pressure, m_dry_air_density, m_constituents) | ||||||||||||||
use iso_c_binding, only: c_double | ||||||||||||||
use ccpp_kinds, only: kind_phys | ||||||||||||||
|
||||||||||||||
real(kind_phys), target, intent(in) :: temperature(:,:) ! K | ||||||||||||||
real(kind_phys), target, intent(in) :: pressure(:,:) ! Pa | ||||||||||||||
real(kind_phys), target, intent(in) :: dry_air_density(:,:) ! kg m-3 | ||||||||||||||
real(kind_phys), target, intent(in) :: constituents(:,:,:) ! kg kg-1 | ||||||||||||||
real(kind_phys), target, intent(in) :: rate_params(:,:,:) | ||||||||||||||
real(c_double), target, intent(out) :: m_temperature(:) ! K | ||||||||||||||
real(c_double), target, intent(out) :: m_pressure(:) ! Pa | ||||||||||||||
real(c_double), target, intent(out) :: m_dry_air_density(:) ! kg m-3 | ||||||||||||||
real(c_double), target, intent(out) :: m_constituents(:) ! kg kg-1 | ||||||||||||||
real(c_double), target, intent(out) :: m_rate_params(:) | ||||||||||||||
|
||||||||||||||
! local variables | ||||||||||||||
integer :: num_columns, num_layers | ||||||||||||||
integer :: num_constituents, num_rate_params | ||||||||||||||
integer :: i_column, i_layer, i_elem, i_constituents, i_rate_params | ||||||||||||||
integer :: num_constituents | ||||||||||||||
integer :: i_column, i_layer, i_elem, i_constituents | ||||||||||||||
|
||||||||||||||
num_columns = size(constituents, dim=1) | ||||||||||||||
num_layers = size(constituents, dim=2) | ||||||||||||||
num_constituents = size(constituents, dim=3) | ||||||||||||||
num_rate_params = size(rate_params, dim=3) | ||||||||||||||
|
||||||||||||||
! Reshape into 1-D arry in species-column first order | ||||||||||||||
! refers to: state.variables_[i_cell][i_species] = concentrations[i_species_elem++] | ||||||||||||||
i_elem = 1 | ||||||||||||||
i_constituents = 1 | ||||||||||||||
i_rate_params = 1 | ||||||||||||||
do i_layer = 1, num_layers | ||||||||||||||
do i_column = 1, num_columns | ||||||||||||||
m_temperature(i_elem) = real(temperature(i_column, i_layer), c_double) | ||||||||||||||
m_pressure(i_elem) = real(pressure(i_column, i_layer), c_double) | ||||||||||||||
m_dry_air_density(i_elem) = real(dry_air_density(i_column, i_layer), c_double) | ||||||||||||||
m_constituents(i_constituents : i_constituents + num_constituents - 1) & | ||||||||||||||
= real(constituents(i_column, i_layer, :), c_double) | ||||||||||||||
m_rate_params(i_rate_params : i_rate_params + num_rate_params - 1) & | ||||||||||||||
= real(rate_params(i_column, i_layer, :), c_double) | ||||||||||||||
i_elem = i_elem + 1 | ||||||||||||||
i_constituents = i_constituents + num_constituents | ||||||||||||||
i_rate_params = i_rate_params + num_rate_params | ||||||||||||||
end do | ||||||||||||||
end do | ||||||||||||||
|
||||||||||||||
end subroutine reshape_into_micm_arr | ||||||||||||||
|
||||||||||||||
subroutine reshape_into_ccpp_arr(temperature, pressure, dry_air_density, constituents, & | ||||||||||||||
rate_params, m_temperature, m_pressure, m_dry_air_density, m_constituents, m_rate_params) | ||||||||||||||
subroutine reshape_into_ccpp_arr(constituents, m_constituents) | ||||||||||||||
use iso_c_binding, only: c_double | ||||||||||||||
use ccpp_kinds, only: kind_phys | ||||||||||||||
real(kind_phys), intent(out) :: temperature(:,:) ! K | ||||||||||||||
real(kind_phys), intent(out) :: pressure(:,:) ! Pa | ||||||||||||||
real(kind_phys), intent(out) :: dry_air_density(:,:) ! kg m-3 | ||||||||||||||
real(kind_phys), intent(out) :: constituents(:,:,:) ! kg kg-1 | ||||||||||||||
real(kind_phys), intent(out) :: rate_params(:,:,:) | ||||||||||||||
real(c_double), intent(in) :: m_temperature(:) ! K | ||||||||||||||
real(c_double), intent(in) :: m_pressure(:) ! Pa | ||||||||||||||
real(c_double), intent(in) :: m_dry_air_density(:) ! kg m-3 | ||||||||||||||
real(c_double), intent(in) :: m_constituents(:) ! kg kg-1 | ||||||||||||||
real(c_double), intent(in) :: m_rate_params(:) | ||||||||||||||
|
||||||||||||||
! local variables | ||||||||||||||
integer :: num_columns, num_layers | ||||||||||||||
integer :: num_constituents, num_rate_params | ||||||||||||||
integer :: i_column, i_layer, i_elem, i_constituents, i_rate_params | ||||||||||||||
integer :: num_constituents | ||||||||||||||
integer :: i_column, i_layer, i_constituents | ||||||||||||||
|
||||||||||||||
num_columns = size(constituents, dim=1) | ||||||||||||||
num_layers = size(constituents, dim=2) | ||||||||||||||
num_constituents = size(constituents, dim=3) | ||||||||||||||
Comment on lines
63
to
65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Should it be this instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I found this possibly confusing. The function !> Reshape array (1D -> 3D) and convert type (c_double -> kind_phys)
subroutine reshape_into_ccpp_arr(micm_constituents, constituents) |
||||||||||||||
num_rate_params = size(rate_params, dim=3) | ||||||||||||||
|
||||||||||||||
i_elem = 1 | ||||||||||||||
i_constituents = 1 | ||||||||||||||
i_rate_params = 1 | ||||||||||||||
do i_layer = 1, num_layers | ||||||||||||||
do i_column = 1, num_columns | ||||||||||||||
temperature(i_column, i_layer) = real(m_temperature(i_elem), kind_phys) | ||||||||||||||
pressure(i_column, i_layer) = real(m_pressure(i_elem), kind_phys) | ||||||||||||||
dry_air_density(i_column, i_layer) = real(m_dry_air_density(i_elem), kind_phys) | ||||||||||||||
constituents(i_column, i_layer, :) & | ||||||||||||||
= real(m_constituents(i_constituents : i_constituents + num_constituents - 1), kind_phys) | ||||||||||||||
rate_params(i_column, i_layer, :) & | ||||||||||||||
= real(m_rate_params(i_rate_params : i_rate_params + num_rate_params - 1), kind_phys) | ||||||||||||||
i_elem = i_elem + 1 | ||||||||||||||
i_constituents = i_constituents + num_constituents | ||||||||||||||
i_rate_params = i_rate_params + num_rate_params | ||||||||||||||
end do | ||||||||||||||
end do | ||||||||||||||
|
||||||||||||||
|
@@ -156,4 +130,4 @@ subroutine convert_to_mass_mixing_ratio(dry_air_density, molar_mass_arr, constit | |||||||||||||
|
||||||||||||||
end subroutine convert_to_mass_mixing_ratio | ||||||||||||||
|
||||||||||||||
end module micm_util | ||||||||||||||
end module musica_ccpp_micm_util |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we still do this when the
intent
ofconstituents
isout
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe the
intent
can beinout
to get the dimension?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
intent(inout)
should definitely work here, and is probably the safest bet.