Skip to content
Open
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
6 changes: 6 additions & 0 deletions bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5625,6 +5625,12 @@ Give the user the ability to input LTR high-latitude electric potential.
Default: FALSE
</entry>

<entry id="ionos_epotential_mage" type="logical" category="waccmx"
group="ionosphere_nl" valid_values="">
For 2-way coupling WACCM-X with MAGE magnetosphere

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is MAGE a welknown acronym, or should the namelist description give a little more information?

Default: FALSE
</entry>

<entry id="ltr_files" type="char*256(20)" input_pathname="abs" category="waccmx"
group="ionosphere_nl" valid_values="" >
List of full pathnames of LTR electic potential inputs for both hemispheres.
Expand Down
18 changes: 15 additions & 3 deletions src/ionosphere/waccmx/dpie_coupling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module dpie_coupling
use perf_mod, only: t_startf, t_stopf
use amie_module, only: getamie
use ltr_module, only: getltr
use mage_module, only: mage_advance
use edyn_solve, only: phihm
use edyn_params, only: dtr, rtd
use aurora_params, only: prescribed_period ! turns on overwrite of energy fields in aurora phys
Expand Down Expand Up @@ -119,7 +120,7 @@ subroutine d_pie_init( edyn_active_in, oplus_xport_in, oplus_nsplit_in, crit_col
end subroutine d_pie_init

!-----------------------------------------------------------------------
subroutine d_pie_epotent( highlat_potential_model, crit_out, cols, cole, efx_phys, kev_phys, amie_in, ltr_in )
subroutine d_pie_epotent( highlat_potential_model, crit_out, cols, cole, efx_phys, kev_phys, amie_in, ltr_in, mage_in )
use edyn_solve, only: pfrac ! NH fraction of potential (nmlonp1,nmlat0)
use time_manager, only: get_curr_date
use heelis, only: heelis_model
Expand All @@ -142,6 +143,7 @@ subroutine d_pie_epotent( highlat_potential_model, crit_out, cols, cole, efx_phy
integer, optional, intent(in) :: cols, cole
logical, optional,intent(in) :: amie_in
logical, optional,intent(in) :: ltr_in
logical, optional,intent(in) :: mage_in

! Prescribed energy flux
real(r8), optional, intent(out) :: efx_phys(:)
Expand All @@ -151,7 +153,7 @@ subroutine d_pie_epotent( highlat_potential_model, crit_out, cols, cole, efx_phy
!
! local vars
!
logical :: amie_inputs, ltr_inputs
logical :: amie_inputs, ltr_inputs, mage_inputs

real(r8) :: secs ! time of day in seconds
integer :: iyear,imo,iday,tod ! tod is time-of-day in seconds
Expand Down Expand Up @@ -202,10 +204,12 @@ subroutine d_pie_epotent( highlat_potential_model, crit_out, cols, cole, efx_phy

amie_inputs=.false.
ltr_inputs=.false.
mage_inputs=.false.
if (present(amie_in)) amie_inputs=amie_in
if (present(ltr_in)) ltr_inputs= ltr_in
if (present(ltr_in)) mage_inputs= mage_in

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this be if (present(mage_in))?


prescribed_inputs: if (amie_inputs .or. ltr_inputs) then
prescribed_inputs: if (amie_inputs .or. ltr_inputs .or. mage_inputs) then

if (.not. (present(kev_phys).and.present(efx_phys)) ) then
call endrun('d_pie_epotent: kev_phys and efx_phys must be present')
Expand All @@ -224,6 +228,14 @@ subroutine d_pie_epotent( highlat_potential_model, crit_out, cols, cole, efx_phy
write(iulog,"('After Calling getamie >>> iamie = ', i2)") iamie
end if
prescribed_period = iamie == 1
else if (mage_inputs) then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This logic indicates that only one of amie_inputs or mage_inputs is used. Should there be a check during namelist setting to exit with an error if both are set to true?

if (masterproc) then
write(iulog,*) 'Calling mage_advance >>> '
end if

call mage_advance( iyear, imo, iday, tod, &
prescr_phihm, prescr_efxm, prescr_kevm )
prescribed_period = .TRUE.
else
if (masterproc) then
write(iulog,*) 'Calling getltr >>> '
Expand Down
18 changes: 16 additions & 2 deletions src/ionosphere/waccmx/edynamo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ module edynamo
real(r8), allocatable, dimension(:,:) :: &
zigm11, & ! sigma11*cos(theta0)
zigmc, & ! sigmac
zigm1, & ! for Hall conductance diagnostic
zigm1, & ! for Hall conductance diagnostic (folded)
azigm1, & ! for Hall conductance diagnostic (not folded)
zigm2, & ! sigma2
azigm2, & ! for Ped conductance diagnostic (not folded)
zigm22, & ! sigma22/cos(theta0)
rim1,rim2, & ! see description in comment below
rhs, & ! right-hand side of PDE
Expand Down Expand Up @@ -105,7 +107,7 @@ module edynamo
logical, public :: debug_hist = .false.

public :: alloc_edyn, ed1, ed2, ed1_glb, ed2_glb
public :: zigm11, zigmc, zigm2, zigm22, rim1, rim2
public :: zigm11, zigmc, zigm2, zigm22, rim1, rim2, azigm1, azigm2
public :: dynamo

contains
Expand Down Expand Up @@ -368,9 +370,15 @@ subroutine alloc_edyn
allocate(zigm1(mlon00:mlon11,mlat00:mlat11) ,stat=istat)
if (istat /= 0) call endrun('alloc_edyn: zigm1')
zigm1 = finit
allocate(azigm1(mlon00:mlon11,mlat00:mlat11) ,stat=istat)
if (istat /= 0) call endrun('alloc_edyn: azigm1')
azigm1 = finit
allocate(zigm2(mlon00:mlon11,mlat00:mlat11) ,stat=istat)
if (istat /= 0) call endrun('alloc_edyn: zigm2')
zigm2 = finit
allocate(azigm2(mlon00:mlon11,mlat00:mlat11) ,stat=istat)
if (istat /= 0) call endrun('alloc_edyn: azigm2')
azigm2 = finit
allocate(zigm22(mlon00:mlon11,mlat00:mlat11),stat=istat)
if (istat /= 0) call endrun('alloc_edyn: zigm22')
zigm22 = finit
Expand Down Expand Up @@ -528,7 +536,9 @@ subroutine fieldline_integrals( ped_mag, hal_mag, adotv1_mag, adotv2_mag, &
zigm11 = finit
zigm22 = finit
zigm1 = finit
azigm1 = finit
zigm2 = finit
azigm2 = finit
zigmc = finit
rim1 = finit
rim2 = finit
Expand Down Expand Up @@ -929,6 +939,10 @@ subroutine complete_integrals
fmsub(:,:,6) = rim2 (mlon0:mlon1,mlat0:mlat1)
fmsub(:,:,7) = zigm1 (mlon0:mlon1,mlat0:mlat1)

! Store zigm1 for coupling before folding hemispheres
azigm1(mlon0:mlon1,mlat0:mlat1) = zigm1(mlon0:mlon1,mlat0:mlat1)
azigm2(mlon0:mlon1,mlat0:mlat1) = zigm2(mlon0:mlon1,mlat0:mlat1)

call mp_mag_foldhem(fmsub,mlon0,mlon1,mlat0,mlat1,nf2d)
call mp_mag_periodic_f2d(fmsub,mlon0,mlon1,mlat0,mlat1,nf2d)

Expand Down
Loading
Loading