Skip to content

Commit

Permalink
Emission <-> AGS interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco de Bruine committed Jun 8, 2021
1 parent c05eee0 commit 0424c3c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/modemisdata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ module modemisdata
emisnames = (/ (' ', iname=1, 100) /) ! list with scalar names,
! each name must(!) be 6 characters long for now

! Interaction with AGs ------------------------------------------------
integer :: svco2ags = -1 ! Scalar field number for AGs to emit CO2
integer, allocatable :: co2fields(:) ! Array defnining co2 fields for AGs

! ---------------------------------------------------------------------!
! Main variables !
! ---------------------------------------------------------------------!
Expand Down
21 changes: 18 additions & 3 deletions src/modemission.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ subroutine initemission
integer :: ierr

! --- Read & broadcast namelist EMISSION -----------------------------------
namelist/NAMEMISSION/ l_emission, kemis, svskip, emisnames
namelist/NAMEMISSION/ l_emission, kemis, svskip, emisnames

if (myid == 0) then

Expand All @@ -56,9 +56,23 @@ subroutine initemission

call mpi_bcast(l_emission, 1, mpi_logical, 0, comm3d, ierr)
call mpi_bcast(kemis, 1, mpi_integer, 0, comm3d, ierr)
call mpi_bcast(svskip, 1, mpi_integer, 0, comm3d, ierr)
call mpi_bcast(svskip, 1, mpi_integer, 0, comm3d, ierr)
call mpi_bcast(emisnames(1:100), 100, mpi_character, 0, comm3d, ierr)

! -- Interaction with AGs ----------------------------------------------------

allocate(co2fields(nsv-svskip))

svco2ags = findloc(emisnames(1:nsv-svskip), value = "co2ags", dim = 1)
co2fields = index(emisnames(1:nsv-svskip), "co2")

if (myid == 0) then
write(6,*) 'modemission: co2fields (scalar fields with CO2 0=no, 1=yes)'
write(6,*) co2fields
write(6,*) 'modemission: svco2ags (scalar field number for AGS emissions)'
write(6,*) svco2ags
endif

! --- Local pre-calculations and settings
if (.not. (l_emission)) return

Expand Down Expand Up @@ -101,7 +115,7 @@ subroutine reademission(iyear, imonth, iday, ihour, emisfield)

use mpi, only : MPI_INFO_NULL
use netcdf
use modmpi, only : myid, myidx, myidy, comm3d
use modmpi, only : myid, myidx, myidy
use modglobal, only : i1, j1, i2, j2, imax, jmax, nsv
use moddatetime, only : datex

Expand Down Expand Up @@ -225,6 +239,7 @@ subroutine exitemission
if (.not. (l_emission)) return

deallocate(emisfield)
deallocate(co2fields)

end subroutine exitemission

Expand Down

0 comments on commit 0424c3c

Please sign in to comment.