Skip to content
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 ccpp_compliant ozphys_2015.f #160

Merged
merged 8 commits into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion physics/ozinterp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,4 @@ SUBROUTINE ozinterpol(me,npts,IDATE,FHOUR,jindx1,jindx2,ozplout,ddy)
RETURN
END

end module ozinterp
end module ozinterp
78 changes: 43 additions & 35 deletions physics/ozphys.f
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,60 @@ end subroutine ozphys_finalize
!! Research Laboratory through CHEM2D chemistry model
!! (McCormack et al. (2006) \cite mccormack_et_al_2006).
!! \section arg_table_ozphys_run Argument Table
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |----------------|---------------------------------------------------|---------------------------------------------------|---------|------|-----------|-----------|--------|----------|
!! | ix | horizontal_dimension | horizontal dimension | count | 0 | integer | | in | F |
!! | im | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F |
!! | levs | vertical_dimension | number of vertical layers | count | 0 | integer | | in | F |
!! | ko3 | vertical_dimension_of_ozone_forcing_data | number of vertical layers in ozone forcing data | count | 0 | integer | | in | F |
!! | dt | time_step_for_physics | physics time step | s | 0 | real | kind_phys | in | F |
!! | oz | ozone_concentration_updated_by_physics | ozone concentration updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | tin | air_temperature_updated_by_physics | updated air temperature | K | 2 | real | kind_phys | in | F |
!! | po3 | natural_log_of_ozone_forcing_data_pressure_levels | natural log of ozone forcing data pressure levels | log(Pa) | 1 | real | kind_phys | in | F |
!! | prsl | air_pressure | mid-layer pressure | Pa | 2 | real | kind_phys | in | F |
!! | prdout | ozone_forcing | ozone forcing data | various | 3 | real | kind_phys | in | F |
!! | oz_coeff | number_of_coefficients_in_ozone_forcing_data | number of coefficients in ozone forcing data | index | 0 | integer | | in | F |
!! | delp | air_pressure_difference_between_midlayers | difference between mid-layer pressures | Pa | 2 | real | kind_phys | in | F |
!! | ldiag3d | flag_diagnostics_3D | flag for calculating 3-D diagnostic fields | flag | 0 | logical | | in | F |
!! | ozp | change_in_ozone_concentration | change in ozone concentration | kg kg-1 | 3 | real | kind_phys | inout | F |
!! | me | mpi_rank | rank of the current MPI task | index | 0 | integer | | in | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |----------------|---------------------------------------------------------------------------|----------------------------------------------------------------------------|---------|------|-----------|-----------|--------|----------|
!! | ix | horizontal_dimension | horizontal dimension | count | 0 | integer | | in | F |
!! | im | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F |
!! | levs | vertical_dimension | number of vertical layers | count | 0 | integer | | in | F |
!! | ko3 | vertical_dimension_of_ozone_forcing_data | number of vertical layers in ozone forcing data | count | 0 | integer | | in | F |
!! | dt | time_step_for_physics | physics time step | s | 0 | real | kind_phys | in | F |
!! | oz | ozone_concentration_updated_by_physics | ozone concentration updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | tin | air_temperature_updated_by_physics | updated air temperature | K | 2 | real | kind_phys | in | F |
!! | po3 | natural_log_of_ozone_forcing_data_pressure_levels | natural log of ozone forcing data pressure levels | log(Pa) | 1 | real | kind_phys | in | F |
!! | prsl | air_pressure | mid-layer pressure | Pa | 2 | real | kind_phys | in | F |
!! | prdout | ozone_forcing | ozone forcing coefficients | various | 3 | real | kind_phys | in | F |
!! | oz_coeff | number_of_coefficients_in_ozone_forcing_data | number of coefficients in ozone forcing data | index | 0 | integer | | in | F |
!! | delp | air_pressure_difference_between_midlayers | difference between mid-layer pressures | Pa | 2 | real | kind_phys | in | F |
!! | ldiag3d | flag_diagnostics_3D | flag for calculating 3-D diagnostic fields | flag | 0 | logical | | in | F |
!! | ozp1 | cumulative_change_in_ozone_concentration_due_to_production_and_loss_rate | cumulative change in ozone concentration due to production and loss rate | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | ozp2 | cumulative_change_in_ozone_concentration_due_to_ozone_mixing_ratio | cumulative change in ozone concentration due to ozone mixing ratio | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | ozp3 | cumulative_change_in_ozone_concentration_due_to_temperature | cumulative change in ozone concentration due to temperature | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | ozp4 | cumulative_change_in_ozone_concentration_due_to_overhead_ozone_column | cumulative change in ozone concentration due to overhead ozone column | kg kg-1 | 2 | real | kind_phys | inout | F |
!! | con_g | gravitational_acceleration | gravitational acceleration | m s-2 | 0 | real | kind_phys | in | F |
!! | me | mpi_rank | rank of the current MPI task | index | 0 | integer | | in | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
!> \section genal_ozphys GFS ozphys_run General Algorithm
!! @{
subroutine ozphys_run ( &
& ix, im, levs, ko3, dt, oz, tin, po3, &
& prsl, prdout, oz_coeff, delp, ldiag3d, &
& ozp, me, errmsg, errflg)
& ozp1, ozp2, ozp3, ozp4, con_g, me, errmsg, errflg)
!
! this code assumes that both prsl and po3 are from bottom to top
! as are all other variables
!
use machine , only : kind_phys
use physcons, only : grav => con_g
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for fixing this, Man!

implicit none
!
! Interface variables
integer, intent(in) :: im, ix, levs, ko3, oz_coeff, me
real(kind=kind_phys), intent(inout) :: &
& oz(ix,levs), ozp(ix,levs,oz_coeff)
& oz(ix,levs), &
& ozp1(ix,levs), ozp2(ix,levs), ozp3(ix,levs), &
& ozp4(ix,levs)
real(kind=kind_phys), intent(in) :: &
& dt, po3(ko3), prdout(ix,ko3,oz_coeff), &
& prsl(ix,levs), tin(ix,levs), delp(ix,levs)
& prsl(ix,levs), tin(ix,levs), delp(ix,levs), &
& con_g
real :: gravi
logical, intent(in) :: ldiag3d

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
!
! Local variables
real, parameter :: gravi=1.0/grav
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could have just removed the ", parameter" statement and used

real :: gravi =1.0/grav

but that's not worth requesting an additional change. Leave it like it is.

integer k,kmax,kmin,l,i,j
logical flg(im)
real(kind=kind_phys) pmax, pmin, tem, temp
Expand All @@ -88,13 +95,14 @@ subroutine ozphys_run ( &
!
! save input oz in ozi
ozi = oz
gravi=1.0/con_g
!
!> - Calculate vertical integrated column ozone values.
if (oz_coeff > 2) then
colo3(:,levs+1) = 0.0
do l=levs,1,-1
do i=1,im
colo3(i,l) = colo3(i,l+1) + ozi(i,l) * delp(i,l) * gravi
colo3(i,l) = colo3(i,l+1) + ozi(i,l) * delp(i,l) * gravi
enddo
enddo
endif
Expand Down Expand Up @@ -156,16 +164,16 @@ subroutine ozphys_run ( &
!
if (ldiag3d) then ! ozone change diagnostics
do i=1,im
ozp(i,l,1) = ozp(i,l,1) + prod(i,1)*dt
ozp(i,l,2) = ozp(i,l,2) + (oz(i,l) - ozib(i))
ozp1(i,l) = ozp1(i,l) + prod(i,1)*dt
ozp2(i,l) = ozp2(i,l) + (oz(i,l) - ozib(i))
enddo
endif
endif
!> - Calculate the 4 terms of prognostic ozone change during time \a dt:
!! - ozp(:,:,1) - Ozone production at model layers
!! - ozp(:,:,2) - Ozone tendency at model layers
!! - ozp(:,:,3) - Ozone production from temperature term at model layers
!! - ozp(:,:,4) - Ozone production from column ozone term at model layers
!! - ozp1(:,:) - Ozone production from production/loss ratio
!! - ozp2(:,:) - Ozone production from ozone mixing ratio
!! - ozp3(:,:) - Ozone production from temperature term at model layers
!! - ozp4(:,:) - Ozone production from column ozone term at model layers
if (oz_coeff == 4) then
do i=1,im
ozib(i) = ozi(i,l) ! no filling
Expand All @@ -177,10 +185,10 @@ subroutine ozphys_run ( &
enddo
if (ldiag3d) then ! ozone change diagnostics
do i=1,im
ozp(i,l,1) = ozp(i,l,1) + prod(i,1)*dt
ozp(i,l,2) = ozp(i,l,2) + (oz(i,l) - ozib(i))
ozp(i,l,3) = ozp(i,l,3) + prod(i,3)*tin(i,l)*dt
ozp(i,l,4) = ozp(i,l,4) + prod(i,4)*colo3(i,l+1)*dt
ozp1(i,l) = ozp1(i,l) + prod(i,1)*dt
ozp2(i,l) = ozp2(i,l) + (oz(i,l) - ozib(i))
ozp3(i,l) = ozp3(i,l) + prod(i,3)*tin(i,l)*dt
ozp4(i,l) = ozp4(i,l) + prod(i,4)*colo3(i,l+1)*dt
enddo
endif
endif
Expand Down
Loading