Skip to content

Commit

Permalink
Merge pull request #134 from magnusuMET/feature/deposition
Browse files Browse the repository at this point in the history
Improved deposition parametrisation
  • Loading branch information
magnusuMET authored Feb 13, 2025
2 parents 4dbb416 + 7d9b887 commit 5419cee
Show file tree
Hide file tree
Showing 24 changed files with 2,222 additions and 245 deletions.
24 changes: 3 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,36 +82,18 @@ Snappy.egg-info
/src/naccident/snap_batch_copy.f90
/src/naccident/snap_batch_copy.F90

/src/nbomb/*.inc
/src/nbomb/*.mod
/src/nbomb/bsnap_nbomb
/src/nbomb/create_bomb_input
/src/nbomb/snap_batch_copy.f90
/src/nbomb/snap_batch_copy.F90

/src/test/testDateCalc
/src/test/test_array_utils
/src/test/find_parameters_fi_test
/src/test/snap_batch_copy.F90

/src/traj/*.inc
/src/traj/*.mod
/src/traj/bsnap_traj
/src/traj/create_traj_input
/src/traj/snap_batch_copy.f90
/src/traj/snap_batch_copy.F90

/src/volcano/*.mod
/src/volcano/*.inc
/src/volcano/snapargos.inc
/src/volcano/bsnap_volcano
/src/volcano/snap_batch_copy.f90
/src/volcano/snap_batch_copy.F90

src/test/snap_testdata


docs/html
docs/latex

bsnap_*

utils/SnapPy/Snappy.egg-info
src/test/snap_testdata
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM ubuntu:22.04 AS builder

ENV SNAP_FIMEX_VERSION=1.9

RUN apt-get update -y && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:met-norway/fimex && \
apt-get update -y && \
apt-get install -y libnetcdff-dev gfortran libfimex-$SNAP_FIMEX_VERSION-dev make && \
apt-get remove -y software-properties-common && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*

WORKDIR /snap
ARG VERSION="latest"
ADD src .
RUN ln --symbolic --force gcc_pkgconfig.mk current.mk
ENV SNAP_USE_OMP=1
RUN make clean && make

FROM ubuntu:22.04

ENV SNAP_FIMEX_VERSION=1.9

RUN apt-get update -y && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:met-norway/fimex && \
apt-get update -y && \
apt-get install -y libnetcdff7 libfimex-$SNAP_FIMEX_VERSION-0 tini && \
apt-get remove -y software-properties-common && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*

WORKDIR /snap
COPY --from=builder /snap/naccident/bsnap_naccident /snap/bsnap

ENTRYPOINT ["/usr/bin/env", "TINI_VERBOSITY=0", "/usr/bin/tini", "-g", "--", "/snap/bsnap"]
38 changes: 36 additions & 2 deletions src/common/allocateFields.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ module allocateFieldsML
depdry, depwet, accprec, avgprec, avghbl, precip, &
pmsl1, pmsl2, field1, field2, field3, field4, field3d1, xm, ym, &
garea, field_hr1, field_hr2, field_hr3, hbl_hr, &
precip3d, cw3d, &
max_column_scratch, max_column_concentration, &
aircraft_doserate, aircraft_doserate_scratch, t1_abs, t2_abs, &
aircraft_doserate_threshold_height, &
total_activity_released, total_activity_lost_domain, total_activity_lost_other
aircraft_doserate_threshold_height, vd_dep, &
xflux, yflux, hflux, t2m, z0, leaf_area_index, &
roa, ustar, monin_l, raero, vs, rs, &
total_activity_released, total_activity_lost_domain, total_activity_lost_other, &
wscav, cloud_cover
USE snapfilML, only: idata, fdata
USE snapgrdML, only: ahalf, bhalf, vhalf, alevel, blevel, vlevel, imodlevel, &
compute_column_max_conc, compute_aircraft_doserate, aircraft_doserate_threshold
Expand All @@ -44,6 +48,7 @@ subroutine allocateFields
USE snapdimML, only: nx, ny, nk, output_resolution_factor, ldata, maxsiz
USE snapparML, only: ncomp, nocomp, iparnum
USE releaseML, only: mplume, iplume, plume_release, mpart
USE snapmetML, only: met_params

logical, save :: FirstCall = .TRUE.
integer :: AllocateStatus
Expand Down Expand Up @@ -147,6 +152,14 @@ subroutine allocateFields

ALLOCATE ( precip(nx,ny), STAT = AllocateStatus)
IF (AllocateStatus /= 0) ERROR STOP errmsg
if (met_params%use_3d_precip) then
ALLOCATE(precip3d(nx,ny,nk), cw3d(nx,ny,nk), STAT=AllocateStatus)
if (AllocateStatus /= 0) ERROR STOP errmsg
ALLOCATE(wscav(nx,ny,nk,ncomp),STAT=AllocateStatus)
if (AllocateStatus /= 0) ERROR STOP errmsg
wscav(:,:,:,:) = 0.0
allocate(cloud_cover(nx,ny,nk))
endif

! the calculation-fields
ALLOCATE ( avghbl(nx,ny), STAT = AllocateStatus)
Expand Down Expand Up @@ -223,6 +236,18 @@ subroutine allocateFields
total_activity_lost_domain(:) = 0.0
total_activity_lost_other(:) = 0.0

! Dry deposition fields
block
use drydepml, only: requires_extra_fields_to_be_read
if (requires_extra_fields_to_be_read()) then
allocate(vd_dep(nx,ny,ncomp), STAT=AllocateStatus)
if (AllocateStatus /= 0) ERROR STOP errmsg
allocate(xflux, yflux, hflux, t2m, z0, leaf_area_index, mold=ps2)
allocate(roa(nx, ny))
allocate(ustar, monin_l, raero, vs, rs, mold=roa)
endif
end block

end subroutine allocateFields


Expand Down Expand Up @@ -276,6 +301,10 @@ subroutine deAllocateFields
DEALLOCATE ( pmsl2)

DEALLOCATE ( precip)
if (allocated(precip3d)) deallocate(precip3d)
if (allocated(cw3d)) deallocate(cw3d)
if (allocated(wscav)) deallocate(wscav)
if (allocated(cloud_cover)) deallocate(cloud_cover)

DEALLOCATE ( avghbl )
DEALLOCATE ( avgprec )
Expand Down Expand Up @@ -316,6 +345,11 @@ subroutine deAllocateFields
DEALLOCATE ( plume_release )

DEALLOCATE( total_activity_released, total_activity_lost_domain, total_activity_lost_other )
if (allocated(vd_dep)) then
deallocate(vd_dep)
deallocate(xflux, yflux, hflux, t2m, z0, leaf_area_index)
deallocate(roa, ustar, monin_l, raero, vs, rs)
endif

end subroutine deAllocateFields
end module allocateFieldsML
Loading

0 comments on commit 5419cee

Please sign in to comment.