Skip to content

Commit

Permalink
map vert component of ion vels to oplus and phys grids
Browse files Browse the repository at this point in the history
	modified:   src/ionosphere/waccmx/edyn3D_driver.F90
	modified:   src/ionosphere/waccmx/edyn3D_fline_fields.F90
	modified:   src/ionosphere/waccmx/edyn3D_params.F90
	modified:   src/ionosphere/waccmx/ionosphere_interface.F90
  • Loading branch information
fvitt committed Sep 27, 2024
1 parent ea3ca3e commit a53d633
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/ionosphere/waccmx/edyn3D_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ subroutine edyn3D_driver_reg(mpicom, npes)

end subroutine edyn3D_driver_reg

subroutine edyn3D_driver_timestep( nphyscol, nphyslev, physalt, tn, sigPed, sigHal, un, vn, tn_out, tn_out2, ui_out, vi_out )
subroutine edyn3D_driver_timestep( nphyscol, nphyslev, physalt, tn, sigPed, sigHal, un, vn, tn_out, tn_out2, ui_out, vi_out, wi_out )

use edyn3d_mpi, only: mlon0_p,mlon1_p
use cam_history, only: outfld
use edyn3D_fieldline, only: fline_p, fline_s1, fline_s2
use edyn3D_fline_fields, only: Tn_p, height_s1, height_s2, IonV_s1, IonU_s1 !, IonW_s1
use edyn3D_fline_fields, only: Tn_p, height_s1, height_s2, IonV_s1, IonU_s1, IonW_s1
use edyn3D_fline_fields, only: sigma_ped_s1,sigma_hal_s1,sigma_ped_s2,sigma_hal_s2,un_s1,vn_s1,un_s2,vn_s2
use edyn_mpi, only: lon0,lon1,lat0,lat1,lev0,lev1
use regridder, only: regrid_phys2geo_3d, regrid_geo2phys_3d
Expand All @@ -167,6 +167,7 @@ subroutine edyn3D_driver_timestep( nphyscol, nphyslev, physalt, tn, sigPed, sigH
real(r8), intent(out) :: tn_out2(nphyslev,nphyscol)
real(r8), intent(out) :: ui_out(nphyslev,nphyscol)
real(r8), intent(out) :: vi_out(nphyslev,nphyscol)
real(r8), intent(out) :: wi_out(nphyslev,nphyscol)

real(r8) :: geogaltp(mlon0_p:mlon1_p, nptsp_total)
real(r8) :: geoglatp(mlon0_p:mlon1_p, nptsp_total)
Expand Down Expand Up @@ -458,7 +459,7 @@ subroutine edyn3D_driver_timestep( nphyscol, nphyslev, physalt, tn, sigPed, sigH

IonU_s1%flines(i,j,isn)%fld(k) = ui_s1(i,ncnt2)
IonV_s1%flines(i,j,isn)%fld(k) = vi_s1(i,ncnt2)
! IonW_s1%flines(i,j,isn)%fld(k) = vi_s1(i,ncnt2)
IonW_s1%flines(i,j,isn)%fld(k) = vi_s1(i,ncnt2)

end do

Expand All @@ -469,15 +470,16 @@ subroutine edyn3D_driver_timestep( nphyscol, nphyslev, physalt, tn, sigPed, sigH

call output_fline_field(IonU_s1)
call output_fline_field(IonV_s1)
! call output_fline_field(IonW_s1)
call output_fline_field(IonW_s1)

call edyn3D_regridder_mag2oplus( opalt, IonU_s1, IonU_oplus )
call edyn3D_regridder_mag2oplus( opalt, IonV_s1, IonV_oplus )
! call edyn3D_regridder_mag2oplus( opalt, IonW_s1, IonW_oplus )
call edyn3D_regridder_mag2oplus( opalt, IonW_s1, IonW_oplus )

do j = lat0,lat1
call outfld( 'IonU_opg', IonU_oplus(lon0:lon1,j,lev0:lev1), lon1-lon0+1, j )
call outfld( 'IonV_opg', IonV_oplus(lon0:lon1,j,lev0:lev1), lon1-lon0+1, j )
! call outfld( 'IonW_opg', IonW_oplus(lon0:lon1,j,lev0:lev1), lon1-lon0+1, j )
call outfld( 'IonW_opg', IonW_oplus(lon0:lon1,j,lev0:lev1), lon1-lon0+1, j )
end do

do i = mlon0_p,mlon1_p
Expand Down Expand Up @@ -542,7 +544,7 @@ subroutine edyn3D_driver_timestep( nphyscol, nphyslev, physalt, tn, sigPed, sigH

call edyn3D_regridder_mag2phys(IonU_s1, physalt, nphyscol,nphyslev, ui_out)
call edyn3D_regridder_mag2phys(IonV_s1, physalt, nphyscol,nphyslev, vi_out)
! call edyn3D_regridder_mag2phys(IonW_s1, physalt, nphyscol,nphyslev, wi_out)
call edyn3D_regridder_mag2phys(IonW_s1, physalt, nphyscol,nphyslev, wi_out)

call t_stopf('edyn3D_driver_timestep.7')

Expand Down
16 changes: 16 additions & 0 deletions src/ionosphere/waccmx/edyn3D_fline_fields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module edyn3D_fline_fields

type(magfield_t) :: IonU_s1
type(magfield_t) :: IonV_s1
type(magfield_t) :: IonW_s1

contains

Expand Down Expand Up @@ -161,6 +162,17 @@ subroutine edyn3D_fline_fields_alloc()
IonV_s1%esmf_fld_src => magField_s1_src
allocate(IonV_s1%flines(mlon0_p:mlon1_p,nmlat_h,2))

IonW_s1%name = 'IonW_s1'
IonW_s1%mlon0 = mlon0_p
IonW_s1%mlon1 = mlon1_p
IonW_s1%nmlat_h = nmlat_h
IonW_s1%nptstot = nptsp_total
IonW_s1%rhandle_mag2phys => rh_s1mag2phys
IonW_s1%rhandle_phys2mag => rh_phys2mag_s1
IonW_s1%esmf_fld_des => magField_s1_des
IonW_s1%esmf_fld_src => magField_s1_src
allocate(IonW_s1%flines(mlon0_p:mlon1_p,nmlat_h,2))

do h = 1,2
do j = 1,nmlat_h
do i = mlon0_p,mlon1_p
Expand Down Expand Up @@ -193,6 +205,10 @@ subroutine edyn3D_fline_fields_alloc()
allocate(IonV_s1%flines(i,j,h)%fld(fline_s1(i,j,h)%npts))
IonV_s1%flines(i,j,h)%fld = nan

IonW_s1%flines(i,j,h)%npts = fline_s1(i,j,h)%npts
allocate(IonW_s1%flines(i,j,h)%fld(fline_s1(i,j,h)%npts))
IonW_s1%flines(i,j,h)%fld = nan

end do
end do
end do
Expand Down
9 changes: 8 additions & 1 deletion src/ionosphere/waccmx/ionosphere_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ subroutine ionosphere_init()

call addfld('IonU_phys', (/ 'lev' /), 'I', 'm/s','Zonal Ion Drift Velocity on phys grid' )
call addfld('IonV_phys', (/ 'lev' /), 'I', 'm/s','Meridional Ion Drift Velocity on phys grid' )
call addfld('IonW_phys', (/ 'lev' /), 'I', 'm/s','Vertial Ion Drift Velocity on phys grid' )

end subroutine ionosphere_init

Expand Down Expand Up @@ -574,13 +575,15 @@ subroutine ionosphere_run2(phys_state, pbuf2d)
real(r8), pointer :: tn_in(:,:)
real(r8), pointer :: ui_out(:,:)
real(r8), pointer :: vi_out(:,:)
real(r8), pointer :: wi_out(:,:)
real(r8), pointer :: tn_out(:,:)
real(r8), pointer :: tn_out2(:,:)
real(r8) :: phys_out(pcols,pver)
real(r8) :: phys_out2(pcols,pver)

real(r8) :: phys_ui_out(pcols,pver)
real(r8) :: phys_vi_out(pcols,pver)
real(r8) :: phys_wi_out(pcols,pver)

! test 3D field line mag grid infrastructure --

Expand Down Expand Up @@ -1027,6 +1030,7 @@ subroutine ionosphere_run2(phys_state, pbuf2d)

allocate(ui_out(pver,nphyscols), stat=astat)
allocate(vi_out(pver,nphyscols), stat=astat)
allocate(wi_out(pver,nphyscols), stat=astat)

j = 0
do lchnk = begchunk, endchunk
Expand All @@ -1045,7 +1049,8 @@ subroutine ionosphere_run2(phys_state, pbuf2d)
end do
end do

call edyn3D_driver_timestep( nphyscols, pver, physalt, tn_in, sigma_ped_blck, sigma_hall_blck, u_blck, v_blck, tn_out, tn_out2, ui_out, vi_out )
call edyn3D_driver_timestep( nphyscols, pver, physalt, tn_in, sigma_ped_blck, sigma_hall_blck, u_blck, v_blck, &
tn_out, tn_out2, ui_out, vi_out, wi_out )

j = 0
do lchnk = begchunk, endchunk
Expand All @@ -1060,12 +1065,14 @@ subroutine ionosphere_run2(phys_state, pbuf2d)

phys_ui_out(i,k) = ui_out(k,j)
phys_vi_out(i,k) = vi_out(k,j)
phys_wi_out(i,k) = wi_out(k,j)
end do
end do
call outfld( 'TnPhysOut', phys_out, pcols, lchnk )
call outfld( 'Tn_phys2', phys_out2, pcols, lchnk )
call outfld( 'IonU_phys', phys_ui_out, pcols, lchnk )
call outfld( 'IonV_phys', phys_vi_out, pcols, lchnk )
call outfld( 'IonW_phys', phys_wi_out, pcols, lchnk )
end do

deallocate(physalt)
Expand Down

0 comments on commit a53d633

Please sign in to comment.