Skip to content

Commit

Permalink
Merge branch 'develop' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eamousing committed Nov 13, 2024
2 parents b17a331 + f5302b4 commit 574b2fe
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 60 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ add_library(uemeplib ${SOURCES})
include(test/CMakeLists.txt)

# Build and link main executable
add_executable(uemep src/uEMEP_control_v2.f90)
add_executable(uemep src/uEMEP_main.f90)
target_link_libraries(uemep PRIVATE uemeplib ${NC_LIB})

29 changes: 6 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# uEMEP
Air quality dispersion model for high resolution downscaling of EMEP MSC-W

Comments, questions to [email protected]

This github repository contains the fortran code for compiling the uEMEP model.

## This version
Version 6.0
This Github repository contains the source code for the uEMEP model.

## Installation

Expand All @@ -31,22 +26,10 @@ Tests are currently built by default when building uEMEP.

To run the tests, simply run `make test` or `ctest` in the build directory after running `make`.

## Implementation
The command line structure for uEMEP is as follows:
uEMEPvX.exe config_file_1 config_file_2 … config_file_10 yyyymmddHH

where X is the current version.
The file names config_file_n are up to 10 configuration files that can be read that specify the model calculation.

Each new configuration file will overwrite the previous values of the parameters specified in the new configuration file.

Parameters that are not specified will be unchanged.

The date string, required, ‘yyyymmddHH’ refers to the date string of the EMEP file to be read, specified in the configuration files.

uEMEP uses the time stamps provided by EMEP to specify the calculation times.

uEMEP requires EMEP output files, one of which contains the local fraction data, for implementation.

## Running

For help on running uEMEP, run the following from the `build` directory:

```bash
./uemep --help
```
58 changes: 30 additions & 28 deletions src/save_data/uEMEP_save_netcdf_file.f90
Original file line number Diff line number Diff line change
Expand Up @@ -891,34 +891,36 @@ subroutine uEMEP_save_netcdf_control
end if

! Save EMEP allsources
! NB: For now, this is always saved
write(unit_logfile,'(a)')'--------------------------'
write(unit_logfile,'(a)')'Saving EMEP allsources'
write(unit_logfile,'(a)')'--------------------------'
do i_pollutant=1,n_emep_pollutant_loop
!EMEP does not have all pollutants so only save to n_emep_pollutant_loop
!Only save the allsource value here 'EMEP_allsources'
variable_type='float'
i_file=emep_subgrid_file_index(allsource_index)
var_name_temp=trim(var_name_nc(conc_nc_index,pollutant_loop_index(i_pollutant),allsource_index))//'_'//trim(filename_grid(i_file))
unit_str='ug/m3'
if (save_netcdf_file_flag) then
write(unit_logfile,'(a,f12.3)')'Writing netcdf variable: '//trim(var_name_temp),sum(subgrid(:,:,:,emep_subgrid_index,allsource_index,i_pollutant))/size(subgrid,1)/size(subgrid,2)/size(subgrid,3)
call uEMEP_save_netcdf_file(unit_logfile,temp_name,subgrid_dim(x_dim_index),subgrid_dim(y_dim_index),subgrid_dim(t_dim_index) &
,subgrid(:,:,:,emep_subgrid_index,allsource_index,i_pollutant),x_subgrid,y_subgrid,lon_subgrid,lat_subgrid,var_name_temp &
,unit_str,title_str,create_file,valid_min,variable_type,scale_factor)
endif
if (save_netcdf_receptor_flag.and.n_valid_receptor.ne.0) then
write(unit_logfile,'(a,f12.3)')'Writing netcdf receptor variable: '//trim(var_name_temp),sum(subgrid(:,:,:,emep_subgrid_index,allsource_index,i_pollutant))/size(subgrid,1)/size(subgrid,2)/size(subgrid,3)
call uEMEP_save_netcdf_receptor_file(unit_logfile,temp_name_rec,subgrid_dim(x_dim_index),subgrid_dim(y_dim_index),subgrid_dim(t_dim_index) &
,subgrid(:,:,:,emep_subgrid_index,allsource_index,i_pollutant),x_subgrid,y_subgrid,lon_subgrid,lat_subgrid,var_name_temp &
,unit_str,title_str_rec,create_file_rec,valid_min &
,x_receptor(valid_receptor_index(1:n_valid_receptor)),y_receptor(valid_receptor_index(1:n_valid_receptor)) &
,lon_receptor(valid_receptor_index(1:n_valid_receptor)),lat_receptor(valid_receptor_index(1:n_valid_receptor)) &
,z_rec(allsource_index,1) &
,name_receptor(valid_receptor_index(1:n_valid_receptor),1),n_valid_receptor,variable_type,scale_factor)
endif
end do
! Save only if pure EMEP contributions are saved
if (save_emep_source_contributions .or. save_emep_additional_source_contributions) then
write(unit_logfile,'(a)')'--------------------------'
write(unit_logfile,'(a)')'Saving EMEP allsources'
write(unit_logfile,'(a)')'--------------------------'
do i_pollutant=1,n_emep_pollutant_loop
!EMEP does not have all pollutants so only save to n_emep_pollutant_loop
!Only save the allsource value here 'EMEP_allsources'
variable_type='float'
i_file=emep_subgrid_file_index(allsource_index)
var_name_temp=trim(var_name_nc(conc_nc_index,pollutant_loop_index(i_pollutant),allsource_index))//'_'//trim(filename_grid(i_file))
unit_str='ug/m3'
if (save_netcdf_file_flag) then
write(unit_logfile,'(a,f12.3)')'Writing netcdf variable: '//trim(var_name_temp),sum(subgrid(:,:,:,emep_subgrid_index,allsource_index,i_pollutant))/size(subgrid,1)/size(subgrid,2)/size(subgrid,3)
call uEMEP_save_netcdf_file(unit_logfile,temp_name,subgrid_dim(x_dim_index),subgrid_dim(y_dim_index),subgrid_dim(t_dim_index) &
,subgrid(:,:,:,emep_subgrid_index,allsource_index,i_pollutant),x_subgrid,y_subgrid,lon_subgrid,lat_subgrid,var_name_temp &
,unit_str,title_str,create_file,valid_min,variable_type,scale_factor)
endif
if (save_netcdf_receptor_flag.and.n_valid_receptor.ne.0) then
write(unit_logfile,'(a,f12.3)')'Writing netcdf receptor variable: '//trim(var_name_temp),sum(subgrid(:,:,:,emep_subgrid_index,allsource_index,i_pollutant))/size(subgrid,1)/size(subgrid,2)/size(subgrid,3)
call uEMEP_save_netcdf_receptor_file(unit_logfile,temp_name_rec,subgrid_dim(x_dim_index),subgrid_dim(y_dim_index),subgrid_dim(t_dim_index) &
,subgrid(:,:,:,emep_subgrid_index,allsource_index,i_pollutant),x_subgrid,y_subgrid,lon_subgrid,lat_subgrid,var_name_temp &
,unit_str,title_str_rec,create_file_rec,valid_min &
,x_receptor(valid_receptor_index(1:n_valid_receptor)),y_receptor(valid_receptor_index(1:n_valid_receptor)) &
,lon_receptor(valid_receptor_index(1:n_valid_receptor)),lat_receptor(valid_receptor_index(1:n_valid_receptor)) &
,z_rec(allsource_index,1) &
,name_receptor(valid_receptor_index(1:n_valid_receptor),1),n_valid_receptor,variable_type,scale_factor)
endif
end do
end if

!Save the EMEP data interpolated to the subgrid. These are based on the gridded concentrations
! Loop over 5 different verions
Expand Down
15 changes: 7 additions & 8 deletions src/uEMEP_control_v2.f90 → src/uEMEP_main.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
program uEMEP_v6
program uEMEP
!! ****************************************************************************
!! uEMEP control v2
!! uEMEP
!!
!! Bruce rolstad Denby ([email protected])
!! MET Norway
Expand Down Expand Up @@ -73,20 +73,19 @@ program uEMEP_v6
integer :: source_index
real :: start_time_cpu, end_time_cpu
logical :: have_read_emep = .false.
character(len=64) :: logfile_name = "logfile.txt", program_name

! Start timer
call cpu_Time(start_time_cpu)

! Set model version
model_version_str='7.0.2'

! Check command line arguments and handle special cases that have to be printed to stdout
call check_command_line()

! Set model version
model_version_str='uEMEP_v6.3'

write(*,*) ''
write(*,*) '------------------------------------------------------------------------'
write(*,*) 'Starting program '//trim(model_version_str)
write(*,*) 'Starting program uEMEP v'//trim(model_version_str)
write(*,*) '------------------------------------------------------------------------'

! Read the command line, assigning the configuration file names and the substitution date_str
Expand Down Expand Up @@ -508,5 +507,5 @@ program uEMEP_v6
write(*,'(a,i5,a,i2)') ' CPU time taken (MM:SS): ', floor((end_time_cpu - start_time_cpu)/60.0),':', floor(mod(end_time_cpu - start_time_cpu, 60.0))
write(*,*) '------------------------------------------------------------------------'

end program uEMEP_v6
end program uEMEP

0 comments on commit 574b2fe

Please sign in to comment.