diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e19c3efcab5c80a82c473c8a56c22efd12253d8a..30570213afb7dcfc318f9e65944416b1f82cd367 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ stages: - build - test - compare - # - container + - container default: image: @@ -189,6 +189,36 @@ documentation: - cd ./documentation && mkdocs build -c --verbose - sshpass -p "$WOLKE_PASSWORD" rsync -autv --delete -e "ssh -o StrictHostKeyChecking=no" /tmp/cr-site/* "$WOLKE_USER@wolke.img.univie.ac.at:/var/www/flexpart/docs" -# base: -# stage: container -# image: \ No newline at end of file +base: + stage: container + image: quay.io/podman/stable + when: manual + script: + - podman build -t "harbor.wolke.img.univie.ac.at/flexpart/rockylinux9:latest" -f ./tests/Dockerfile + - podman push "harbor.wolke.img.univie.ac.at/flexpart/rockylinux9:latest" + +post: + stage: container + image: quay.io/podman/stable + when: manual + script: + - podman build -t "harbor.wolke.img.univie.ac.at/flexpart/postprocessing:py39" -f ./tests/Dockerfile.python + - podman push "harbor.wolke.img.univie.ac.at/flexpart/postprocessing:py39" + +flexpart: + stage: container + image: quay.io/podman/stable + when: manual + script: + - podman build -t "harbor.wolke.img.univie.ac.at/flexpart/flexpartv11-${CI_COMMIT_REF_NAME}:${CI_COMMIT_SHA:0:8}" --build-arg COMMIT=${CI_COMMIT_SHA:0:8} -f ./containers/Dockerfile ../ + - podman push "harbor.wolke.img.univie.ac.at/flexpart/flexpartv11-${CI_COMMIT_REF_NAME}:${CI_COMMIT_SHA:0:8}" + +flexpartv10: + stage: container + image: quay.io/podman/stable + when: manual + script: + - podman build -t "harbor.wolke.img.univie.ac.at/flexpart/flexpartv10.4:latest" -f ./containers/Dockerfile.v10.4 ../ + - podman push "harbor.wolke.img.univie.ac.at/flexpart/flexpartv10.4:latest" + +# add a build for apptainer ? \ No newline at end of file diff --git a/AVAILABLE b/AVAILABLE index 17640db9723700f0ab006629ff15ac0fe752f0ab..d237605c916b106b4c7dd9c670680efebeb1647b 100644 --- a/AVAILABLE +++ b/AVAILABLE @@ -1,27 +1,5 @@ XXXXXX EMPTY LINES XXXXXXXXX XXXXXX EMPTY LINES XXXXXXXX YYYYMMDD HHMMSS name of the file(up to 80 characters) -20120101 000000 EA12010100 ON DISK -20120101 010000 EA12010101 ON DISK -20120101 020000 EA12010102 ON DISK -20120101 030000 EA12010103 ON DISK -20120101 040000 EA12010104 ON DISK -20120101 050000 EA12010105 ON DISK -20120101 060000 EA12010106 ON DISK -20120101 070000 EA12010107 ON DISK -20120101 080000 EA12010108 ON DISK -20120101 090000 EA12010109 ON DISK -20120101 100000 EA12010110 ON DISK -20120101 110000 EA12010111 ON DISK -20120101 120000 EA12010112 ON DISK -20120101 130000 EA12010113 ON DISK -20120101 140000 EA12010114 ON DISK -20120101 150000 EA12010115 ON DISK -20120101 160000 EA12010116 ON DISK -20120101 170000 EA12010117 ON DISK -20120101 180000 EA12010118 ON DISK -20120101 190000 EA12010119 ON DISK -20120101 200000 EA12010120 ON DISK -20120101 210000 EA12010121 ON DISK -20120101 220000 EA12010122 ON DISK -20120101 230000 EA12010123 ON DISK +20090101 000000 EC2009010100 ON DISK +20090101 060000 EC2009010106 ON DISK diff --git a/Dockerfile_flexpart b/Dockerfile_flexpart deleted file mode 100644 index b21156010cdb6a06faa2557fcb59f0c27afcfa87..0000000000000000000000000000000000000000 --- a/Dockerfile_flexpart +++ /dev/null @@ -1,37 +0,0 @@ -# -# Dockerfile for CI and Flexpart container images -# Options: -# - COMMIT = ... (use git log --pretty=format:'%h %D (%s %at)' -n 1) -# with this option Flexpart is build inside the container -# Build Examples: -# - podman build -t harbor.wolke.img.univie.ac.at/flexpart/flexpartv11:$(git rev-parse --abbrev-ref HEAD) -f Dockerfile_flexpart --build-arg COMMIT="$(git log --pretty=format:'%h %D %ad' -n 1)" -# -# -# Build image with Flexpart inside -# -#FROM harbor.wolke.img.univie.ac.at/flexpart/almalinux8:latest -FROM harbor.wolke.img.univie.ac.at/flexpart/rockylinux9:latest -ARG COMMIT=0 -ENV COMMIT=$COMMIT -COPY ./src /src -COPY ./tests/default_options /options - -# since the new data set is larger, we download the data for the container -RUN wget -P /inputs "https://webdata.wolke.img.univie.ac.at/flexpart/*" -# COPY ./tests/default_winds /inputs - -COPY ./entrypoint.sh /entrypoint.sh -WORKDIR /src -# -# compile using a standardized -# need to fix march to x86_64_v3 , remove mtune -# here generic means core_avx2 -RUN make -f makefile_gfortran eta=no arch=generic \ - && make -f makefile_gfortran arch=generic \ - && mkdir -p /output \ - && echo -e "/options/\n/output/\n/inputs/\n/inputs/AVAILABLE" > /pathnames -# In the Dockerfile, the ENTRYPOINT command defines the executable, -# while CMD sets the default parameter. -# so here our entrypoint run script and default FLEXPART_ETA or FLEXPART -ENTRYPOINT ["/entrypoint.sh"] -CMD ["FLEXPART_ETA"] diff --git a/Dockerfile_jasper b/Dockerfile_jasper deleted file mode 100644 index 46396ba4d6007076b547ad57add0fd50ea92bcb8..0000000000000000000000000000000000000000 --- a/Dockerfile_jasper +++ /dev/null @@ -1,30 +0,0 @@ -# -# Dockerfile for CI and Flexpart container images -# Build Examples: -# - podman build -t harbor.wolke.img.univie.ac.at/flexpart/almalinux8:jasper -f Dockerfile -# -FROM almalinux:8-minimal -# -# Build development image (with/without jasper) -# jasper was used in FP 10.4 (eccodes, emoslib) -# -RUN microdnf install -y epel-release && \ - microdnf install -y --enablerepo=powertools make netcdf-fortran-devel.x86_64 netcdf.x86_64 cmake tar gcc-c++ perl jasper-libs.x86_64 && \ - microdnf clean all -y - -# -# Download ECCODES Version -# note 2.30.0 has an issue!!! -# -RUN curl https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.31.0-Source.tar.gz | tar xz -RUN mkdir build && \ - cd build && \ - cmake -DENABLE_ECCODES_OMP_THREADS=ON ../eccodes-*/ && \ - make -j8 && \ - make install -# -# set environment variables -# -ENV FC=gfortran -ENV LIBRARY_PATH=/usr/lib64:/usr/local/lib64 -ENV CPATH=/usr/include:/usr/local/include:/usr/lib64/gfortran/modules diff --git a/README.md b/README.md index 6c26f5d235c9e4a81c750c018ca6cff69e591062..a50b282f2c0aba1e41cf64259fcafe7a2fc55aa5 100644 --- a/README.md +++ b/README.md @@ -12,409 +12,23 @@ Other references: * This repository contains versions of the Lagrangian model FLEXPART * Development versions -* Issues on the FLEXPART model +* Issues on the FLEXPART model, [tickets](./-/issues)/[mail](mailto:flexpart-support.img-wien@univie.ac.at) * Feature requests for future versions ## Getting started with Flexpart -The model is written in Fortran. It needs to be compiled for the architecture that runs it. - - -### 1.Configuration - - The Makefiles e.g. `src/makefile_gfortran` can use environmental variables: - - `CPATH` for include directories - - `LIBRARY_PATH` for libraries - - This is commonly used on HPC systems. e.g. JET and VSC. These paths will be added via `rpath` so statically linked. - Otherwise edit the makefile with the paths to libraries and include files. - -**Required Dependencies:** - - * [ecCodes](https://confluence.ecmwf.int/display/ECC) from ECMWF (Jasper is not a requirement). - * [NetCDF](https://www.unidata.ucar.edu/software/netcdf/) (optional) from UCAR - * Fortran Compiler with [Fortran 2008](https://fortranwiki.org/fortran/show/Fortran+2008+status) standard, e.g. GCC compiler `8+` or INTEL `19+` or INTEL-ONEAPI - * make utils - -### 2.Compilation - -Clone the git repository or download one of the [releases](https://gitlab.phaidra.org/flexpart/flexpart/-/releases) - -```bash -# clone the repository to your directory or download one of our releases -git clone https://gitlab.phaidra.org/flexpart/flexpart.git -# change to the SRC directory -cd flexpart/src -# Remember to configure your libraries in the makefile or environmental variables -# use for example the GCC makefile -make -f makefile_gfortran -# this will create the FLEXPART executable -file ./FLEXPART -# Check its dependencies: -ldd ./FLEXPART -``` -Now you are almost ready to run. - -### 3.Deployment instructions - - FLEXPART is a standalone executable - The necessary ECMWF wind fields can be obtained testing flex_ecmwf - The AVAILABLE file works with the default ERA 5 retrieved winds - In the winds are available in flex_ecmwf/work it should suffice to execute - `./src/FLEXPART` in the main directory - -### Container version - -since version 11, FLEXPART is also available as a container. There is a Dockerfile and some instructions on how to build the container from scratch or you can download the container from our [registry](https://harbor.wolke.img.univie.ac.at) using for example podman/docker or singularity/apptainer: - -Specifications: -- compiled using `march=core-avx2`, compatible with CPUs above AVX2 (since Haswell or Zen) -- ecCodes - - -```sh -# registry download, replace podman to docker or vice versa -podman pull harbor.wolke.img.univie.ac.at/flexpart/flexpartv11:master -# using singularity/apptainer for running FLEXPART -# there might be some warnings about EPERM (can be ignored) -apptainer pull flexpart.sif docker://harbor.wolke.img.univie.ac.at/flexpart/flexpartv11:master -``` - -running it using podman/docker or singularity/apptainer: - -```sh -# simple run the container with default settings -podman run harbor.wolke.img.univie.ac.at/flexpart/flexpartv11:master -# running the container requires a writable output directory -# mounting the local directory to /output inside the container -apptainer run -B .:/output flexpart.sif -``` - - - -<details> -<summary>podman/docker flexpart run log</summary> -<pre><code class="shell"> -Welcome, running FLEXPART -Using defaults (/pathnames) -/options/ -/output/ -/inputs/ -/inputs/AVAILABLE -Mount volumes to change inputs -Git: c5bdd94 HEAD -> master, origin/master, origin/HEAD Tue Nov 21 16:15:27 2023 +0100 -EXECUTING FLEXPART -trying to execute: /src/FLEXPART_ETA -Executing: /src/FLEXPART_ETA - Welcome to FLEXPART Version 11 - Git: undefined - FLEXPART is free software released under the GNU General Public License. - FLEXPART is running with ETA coordinates. - ---------------- - INFORMATION: SUBGRIDSCALE TERRAIN EFFECT IS - NOT PARAMETERIZED DURING THIS SIMULATION. - ---------------- - - *********** WARNING ********************************** - * FLEXPART running in parallel mode * - * Number of uncertainty classes in * - * set to number of threads: 1 * - * All other computations are done with 8 threads. * - ******************************************************* - - FLEXPART WARNING: TIME DIFFERENCE BETWEEN TWO - WIND FIELDS IS BIG. THIS MAY CAUSE A DEGRADATION - OF SIMULATION QUALITY. - ECMWF metdata detected - NXSHIFT is set to 0 - grid dim: 181 91 92 92 91 92 - Vertical levels in ECMWF data: 92 92 - - Mother domain: - Longitude range: -178.00000 to 182.00000 Grid distance: 2.00000 - Latitude range : -90.00000 to 90.00000 Grid distance: 2.00000 - - Number of receptors: 2 - Releasepoints : 1 - reading SPECIES 24 - Particle shape SPHERE for particle 24 - - SPECIES: 24 AIRTRACER (GAS) - Wet removal for gases is turned: OFF - Dry deposition for gases is turned: OFF - Below-cloud scavenging: OFF - In-cloud scavenging: OFF - Particles released (numpartmax): 10000 - Total mass released: 1.0000000E+00 - Allocating fields for global output (x,y): 85 65 - Concentrations are calculated using kernel - WARNING: turbulence switched off. - Simulated 0.0 hours ( 0 s), 0 particles - Time: 0 seconds. Total spawned: 0 alive: 0 terminated: 0 - Allocating 10000 particles 0 0 0 - Finished allocation - Time: 900 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 1800 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 2700 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 3600 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - 3600 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 - Time: 4500 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 5400 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 6300 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 7200 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - 7200 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 - Time: 8100 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 9000 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 9900 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 10800 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - 10800 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 - Read wind fields: 0.609375000 seconds - Timemanager: 1.17187500 seconds,first timestep: 1.09375000 seconds - Write particle files: 4.68750000E-02 seconds - Total running time: 1.81250000 seconds - tps,io,tot: 1.95312500E-02 0.131249994 1.81250000 - CONGRATULATIONS: YOU HAVE SUCCESSFULLY COMPLETED A FLEXPART MODEL RUN! -FINISHED -</code></pre> -</details> - - -<details> -<summary>singularity/apptainer flexpart run log</summary> -<pre> -<code class="language-shell"> -INFO: gocryptfs not found, will not be able to use gocryptfs -Welcome, running FLEXPART -Using defaults (/pathnames) -/options/ -/output/ -/inputs/ -/inputs/AVAILABLE -Mount volumes to change inputs -Git: c5bdd94 HEAD -> master, origin/master, origin/HEAD Tue Nov 21 16:15:27 2023 +0100 -EXECUTING FLEXPART -trying to execute: /src/FLEXPART_ETA -Executing: /src/FLEXPART_ETA - Welcome to FLEXPART Version 11 - Git: undefined - FLEXPART is free software released under the GNU General Public License. - FLEXPART is running with ETA coordinates. - ---------------- - INFORMATION: SUBGRIDSCALE TERRAIN EFFECT IS - NOT PARAMETERIZED DURING THIS SIMULATION. - ---------------- - - *********** WARNING ********************************** - * FLEXPART running in parallel mode * - * Number of uncertainty classes in * - * set to number of threads: 1 * - * All other computations are done with 8 threads. * - ******************************************************* - - FLEXPART WARNING: TIME DIFFERENCE BETWEEN TWO - WIND FIELDS IS BIG. THIS MAY CAUSE A DEGRADATION - OF SIMULATION QUALITY. - ECMWF metdata detected - NXSHIFT is set to 0 - grid dim: 181 91 92 92 91 92 - Vertical levels in ECMWF data: 92 92 - - Mother domain: - Longitude range: -178.00000 to 182.00000 Grid distance: 2.00000 - Latitude range : -90.00000 to 90.00000 Grid distance: 2.00000 - - Number of receptors: 2 - Releasepoints : 1 - reading SPECIES 24 - Particle shape SPHERE for particle 24 - - SPECIES: 24 AIRTRACER (GAS) - Wet removal for gases is turned: OFF - Dry deposition for gases is turned: OFF - Below-cloud scavenging: OFF - In-cloud scavenging: OFF - Particles released (numpartmax): 10000 - Total mass released: 1.0000000E+00 - Allocating fields for global output (x,y): 85 65 - Concentrations are calculated using kernel - WARNING: turbulence switched off. - Simulated 0.0 hours ( 0 s), 0 particles - Time: 0 seconds. Total spawned: 0 alive: 0 terminated: 0 - Allocating 10000 particles 0 0 0 - Finished allocation - Time: 900 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 1800 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 2700 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 3600 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - 3600 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 - Time: 4500 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 5400 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 6300 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 7200 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - 7200 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 - Time: 8100 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 9000 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 9900 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - Time: 10800 seconds. Total spawned: 10000 alive: 10000 terminated: 0 - 10800 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 - Read wind fields: 0.703125000 seconds - Timemanager: 1.25000000 seconds,first timestep: 1.15625000 seconds - Write particle files: 1.56250000E-02 seconds - Total running time: 2.00000000 seconds - tps,io,tot: 2.34375000E-02 0.143749997 2.00000000 - CONGRATULATIONS: YOU HAVE SUCCESSFULLY COMPLETED A FLEXPART MODEL RUN! -FINISHED -</code></pre> -</details> - -<details> -<summary>ncdump of default run output</summary> -<pre><code class="language-shell"> -# check the output -ncdump -h grid_conc_20090101000000.nc -netcdf grid_conc_20090101000000 { -dimensions: - time = UNLIMITED ; // (3 currently) - longitude = 85 ; - latitude = 65 ; - height = 4 ; - numspec = 1 ; - pointspec = 1 ; - nageclass = 1 ; - nchar = 45 ; - ncharrec = 16 ; - numpoint = 1 ; - receptor = UNLIMITED ; // (2 currently) -variables: - int time(time) ; - time:units = "seconds since 2009-01-01 00:00" ; - time:calendar = "proleptic_gregorian" ; - float longitude(longitude) ; - longitude:long_name = "longitude in degree east" ; - longitude:axis = "Lon" ; - longitude:units = "degrees_east" ; - longitude:standard_name = "grid_longitude" ; - longitude:description = "grid cell centers" ; - float latitude(latitude) ; - latitude:long_name = "latitude in degree north" ; - latitude:axis = "Lat" ; - latitude:units = "degrees_north" ; - latitude:standard_name = "grid_latitude" ; - latitude:description = "grid cell centers" ; - float height(height) ; - height:units = "meters" ; - height:positive = "up" ; - height:standard_name = "height" ; - height:long_name = "height above ground" ; - char RELCOM(numpoint, nchar) ; - RELCOM:long_name = "release point name" ; - float RELLNG1(numpoint) ; - RELLNG1:units = "degrees_east" ; - RELLNG1:long_name = "release longitude lower left corner" ; - float RELLNG2(numpoint) ; - RELLNG2:units = "degrees_east" ; - RELLNG2:long_name = "release longitude upper right corner" ; - float RELLAT1(numpoint) ; - RELLAT1:units = "degrees_north" ; - RELLAT1:long_name = "release latitude lower left corner" ; - float RELLAT2(numpoint) ; - RELLAT2:units = "degrees_north" ; - RELLAT2:long_name = "release latitude upper right corner" ; - float RELZZ1(numpoint) ; - RELZZ1:units = "meters" ; - RELZZ1:long_name = "release height bottom" ; - float RELZZ2(numpoint) ; - RELZZ2:units = "meters" ; - RELZZ2:long_name = "release height top" ; - int RELKINDZ(numpoint) ; - RELKINDZ:long_name = "release kind" ; - int RELSTART(numpoint) ; - RELSTART:units = "seconds" ; - RELSTART:long_name = "release start relative to simulation start" ; - int RELEND(numpoint) ; - RELEND:units = "seconds" ; - RELEND:long_name = "release end relative to simulation start" ; - int RELPART(numpoint) ; - RELPART:long_name = "number of release particles" ; - float RELXMASS(numspec, numpoint) ; - RELXMASS:long_name = "total release particle mass" ; - int LAGE(nageclass) ; - LAGE:units = "seconds" ; - LAGE:long_name = "age class" ; - int ORO(latitude, longitude) ; - ORO:standard_name = "surface altitude" ; - ORO:long_name = "outgrid surface altitude" ; - ORO:units = "m" ; - char receptor(receptor, ncharrec) ; - receptor:long_name = "receptor name" ; - float spec001_mr(nageclass, pointspec, time, height, latitude, longitude) ; - spec001_mr:units = "ng m-3" ; - spec001_mr:long_name = "AIRTRACER" ; - spec001_mr:decay = -0.07001485f ; - spec001_mr:weightmolar = 29.f ; - spec001_mr:ohcconst = -9.e-10f ; - spec001_mr:ohdconst = -9.9f ; - spec001_mr:vsetaver = 0.f ; - float receptor_conc001(receptor, time) ; - receptor_conc001:units = "ng m-3" ; - receptor_conc001:_FillValue = -1.f ; - receptor_conc001:positive = "up" ; - receptor_conc001:standard_name = "receptor_conc" ; - receptor_conc001:long_name = "receptor_concentration" ; - -// global attributes: - :Conventions = "CF-1.6" ; - :title = "FLEXPART model output" ; - :git = "undefined" ; - :source = "Version 11 model output" ; - :history = "2023-11-21 16:22 +0100 created by mblaschek on NB513" ; - :references = "Stohl et al., Atmos. Chem. Phys., 2005, doi:10.5194/acp-5-2461-200" ; - :outlon0 = -25.f ; - :outlat0 = 10.f ; - :dxout = 1.f ; - :dyout = 1.f ; - :ldirect = 1 ; - :ibdate = "20090101" ; - :ibtime = "000000" ; - :iedate = "20090101" ; - :ietime = "030000" ; - :loutstep = 3600 ; - :loutaver = 3600 ; - :loutsample = 900 ; - :loutrestart = -1 ; - :lsynctime = 900 ; - :ctl = -0.2f ; - :ifine = 1 ; - :iout = 1 ; - :ipout = 0 ; - :lsubgrid = 0 ; - :lconvection = 0 ; - :lagespectra = 0 ; - :ipin = 0 ; - :ioutputforeachrelease = 0 ; - :iflux = 0 ; - :mdomainfill = 0 ; - :ind_source = 1 ; - :ind_receptor = 1 ; - :mquasilag = 0 ; - :nested_output = 0 ; - :sfc_only = 0 ; - :linit_cond = 0 ; -} -</code> -</pre> -</details> +The model is written in Fortran. It needs to be compiled for the architecture that runs it. Please have a look at the instructions on building FLEXPART available [here](./documentation/docs/building.md) or [online](https://flexpart.img.univie.ac.at/docs). There is also a containerized version of FLEXPART available. ### Contribution guidelines * The version contributed should compile on a reference version of the system and compiler. - - `FLEXPART 10.4` used as reference gfortran 5.4 on Ubuntu 16.04 - - `FLEXPART 11` uses as reference gfortran 8.5.0 on AlmaLinux 8/RockyLinux 8 or gfortran 11.4.1 on RockyLinux 9 + - `FLEXPART 10.4` used as a reference gfortran 5.4 on Ubuntu 16.04 + - `FLEXPART 11` uses as a reference gfortran 8.5.0 on AlmaLinux 8/RockyLinux 8 or gfortran 11.4.1 on RockyLinux 9 * Code contribution including new features and bug fixes should be complemented with appropriate tests An essential test consists of a set of input files and directories that allow FLEXPART to run. A test can be accompanied by output files for verification * Code review * report issues via mail to [support](mailto:flexpart-support.img-wien@univie.ac.at) -* become an active developer and request a user account. \ No newline at end of file +* become an active developer and request a user account on gitlab. \ No newline at end of file diff --git a/containers/Dockerfile b/containers/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0d9a164f53370a47555732d4becc90164c43653b --- /dev/null +++ b/containers/Dockerfile @@ -0,0 +1,48 @@ +FROM rockylinux:9-minimal +RUN microdnf install -y epel-release && \ + microdnf install -y --enablerepo=crb make netcdf-fortran-devel.x86_64 netcdf.x86_64 eccodes eccodes-devel cmake tar gcc-c++ perl git wget && \ + microdnf clean all -y && \ + rm -rf /var/cache/yum +# +# Download ECCODES Version +# note 2.30.0 has an issue!!! +# ENV ECCODES=2.31.0 +# RUN curl https://confluence.ecmwf.int/download/attachments/45757960/eccodes-${ECCODES}-Source.tar.gz | tar xz +# RUN mkdir build && \ +# cd build && \ +# cmake -DENABLE_ECCODES_OMP_THREADS=ON ../eccodes-*/ && \ +# make -j8 && \ +# make install +# +# set environment variables +# +ENV FC=gfortran +ENV LIBRARY_PATH=/usr/lib64:/usr/local/lib64 +ENV CPATH=/usr/include:/usr/local/include:/usr/lib64/gfortran/modules +# cmd Arguments for COMMIT ID/tag +ARG COMMIT=0 +ENV COMMIT=$COMMIT +COPY ./src /src +# since the new data set is larger, we download the data for the container +# EC 2009 01 01 00 - 06 +RUN wget -r -np -nd -A 'EC*' -P /inputs "https://webdata.wolke.img.univie.ac.at/flexpart/" +WORKDIR /src +# +# compile using a standardized +# need to fix march to x86_64_v3 , remove mtune +# here generic means core_avx2 +RUN make -f makefile_gfortran eta=no arch=generic \ + && make -f makefile_gfortran arch=generic \ + && mkdir -p /output \ + && echo -e "/options/\n/output/\n/inputs/\n/inputs/AVAILABLE" > /pathnames + +COPY ./AVAILABLE /inputs/AVAILABLE +# Entrypoint script (user tips) +COPY ./containers/entrypoint.sh /entrypoint.sh +COPY ./tests/default_options /options +# In the Dockerfile, the ENTRYPOINT command defines the executable, +# while CMD sets the default parameter. +# so here our entrypoint run script and default FLEXPART_ETA or FLEXPART +ENTRYPOINT ["/entrypoint.sh"] +# Could be FLEXPART_ETA pathnames_custom +CMD ["FLEXPART_ETA"] diff --git a/containers/Dockerfile.v10.4 b/containers/Dockerfile.v10.4 new file mode 100644 index 0000000000000000000000000000000000000000..b9eb95aa8e345da1a6883914198326bfe5ed631c --- /dev/null +++ b/containers/Dockerfile.v10.4 @@ -0,0 +1,59 @@ +# +# Dockerfile for CI and Flexpart container images +# Build Examples: +# - podman build -t harbor.wolke.img.univie.ac.at/flexpart/almalinux8:jasper -f Dockerfile +# +FROM almalinux:8-minimal +# +# Build development image (with/without jasper) +# jasper was used in FP 10.4 (eccodes, emoslib) +# +RUN microdnf install -y epel-release && \ + microdnf install -y --enablerepo=powertools make netcdf-fortran-devel.x86_64 netcdf.x86_64 cmake tar gcc-c++ perl jasper-libs.x86_64 && \ + microdnf clean all -y + +# +# Download ECCODES Version +# note 2.30.0 has an issue!!! +# +RUN curl https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.31.0-Source.tar.gz | tar xz +RUN mkdir build && \ + cd build && \ + cmake -DENABLE_ECCODES_OMP_THREADS=ON ../eccodes-*/ && \ + make -j8 && \ + make install +# +# set environment variables +# +ENV FC=gfortran +ENV LIBRARY_PATH=/usr/lib64:/usr/local/lib64 +ENV CPATH=/usr/include:/usr/local/include:/usr/lib64/gfortran/modules + +WORKDIR / +# clone just that version for FLEXPART v10.4 + small fixes +RUN git clone --branch v10.4.1 --single-branch https://gitlab.phaidra.org/flexpart/flexpart.git \ + && cp -r flexpart/src /src + +ENV COMMIT=v10.4 +COPY ./tests/default_options /options + +# since the new data set is larger, we download the data for the container +RUN wget -r --no-parent -A 'EC*' -P /inputs "https://webdata.wolke.img.univie.ac.at/flexpart/" +COPY ./AVAILABLE /inputs/ +# Entrypoint script (user tips) +COPY ./entrypoint.sh /entrypoint.sh +WORKDIR /src +# +# compile using a subset of microarch +# need to fix march to x86_64_v3 , remove mtune +# here generic means core_avx2 +RUN make -f makefile_gfortran eta=no arch=generic \ + && make -f makefile_gfortran arch=generic \ + && mkdir -p /output \ + && echo -e "/options/\n/output/\n/inputs/\n/inputs/AVAILABLE" > /pathnames +# In the Dockerfile, the ENTRYPOINT command defines the executable, +# while CMD sets the default parameter. +# so here our entrypoint run script and default FLEXPART_ETA or FLEXPART +ENTRYPOINT ["/entrypoint.sh"] +# Could be FLEXPART_ETA pathnames_custom +CMD ["FLEXPART"] diff --git a/containers/Singularity b/containers/Singularity new file mode 100644 index 0000000000000000000000000000000000000000..2fa369908bbb2de1c384adcde5c011a877b87d02 --- /dev/null +++ b/containers/Singularity @@ -0,0 +1,70 @@ +Bootstrap: docker +From: rockylinux:9-minimal +Stage: spython-base + +%files +../src /src +../AVAILABLE /inputs/AVAILABLE +./entrypoint.sh /entrypoint.sh +../tests/default_options /options + +%post +microdnf install -y epel-release && \ +microdnf install -y --enablerepo=crb make netcdf-fortran-devel.x86_64 netcdf.x86_64 eccodes eccodes-devel cmake tar gcc-c++ perl git wget && \ +microdnf clean all -y && \ +rm -rf /var/cache/yum +# +# Download ECCODES Version +# note 2.30.0 has an issue!!! +# ENV ECCODES=2.31.0 +# RUN curl https://confluence.ecmwf.int/download/attachments/45757960/eccodes-${ECCODES}-Source.tar.gz | tar xz +# RUN mkdir build && \ +# cd build && \ +# cmake -DENABLE_ECCODES_OMP_THREADS=ON ../eccodes-*/ && \ +# make -j8 && \ +# make install +# +# set environment variables +# +FC=gfortran +LIBRARY_PATH=/usr/lib64:/usr/local/lib64 +CPATH=/usr/include:/usr/local/include:/usr/lib64/gfortran/modules +# cmd Arguments for COMMIT ID/tag +COMMIT=0 +COMMIT=$COMMIT +# since the new data set is larger, we download the data for the container +# EC 2009 01 01 00 - 06 +wget -r -np -nd -A 'EC*' -P /inputs "https://webdata.wolke.img.univie.ac.at/flexpart/" +mkdir -p /src +cd /src +export FC=gfortran +export LIBRARY_PATH=/usr/lib64:/usr/local/lib64 +export CPATH=/usr/include:/usr/local/include:/usr/lib64/gfortran/modules +# +# compile using a standardized +# need to fix march to x86_64_v3 , remove mtune +# here generic means core_avx2 +make -f makefile_gfortran eta=no arch=generic \ +&& make -f makefile_gfortran arch=generic \ +&& mkdir -p /output \ +&& echo -e "/options/\n/output/\n/inputs/\n/inputs/AVAILABLE" > /pathnames + +# Entrypoint script (user tips) +# In the Dockerfile, the ENTRYPOINT command defines the executable, +# while CMD sets the default parameter. +# so here our entrypoint run script and default FLEXPART_ETA or FLEXPART +# Could be FLEXPART_ETA pathnames_custom +%environment +export FC=gfortran +export LIBRARY_PATH=/usr/lib64:/usr/local/lib64 +export CPATH=/usr/include:/usr/local/include:/usr/lib64/gfortran/modules +export COMMIT=$COMMIT + +# add a check if output is writeable? +%runscript +cd /src +exec /entrypoint.sh FLEXPART_ETA "$@" + +%startscript +cd /src +exec /entrypoint.sh FLEXPART_ETA "$@" diff --git a/containers/build.sh b/containers/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..39aeeeb948faa3b5baf5428235e08a5876cdf0ad --- /dev/null +++ b/containers/build.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# By MB +# Build a FLEXPART container +CPATH=$(dirname $0) +# +# using podman to build containers +# +BRANCH=$(git rev-parse --abbrev-ref HEAD) +COMMIT=$(git log --pretty=format:'%h' -n 1) +echo "Building flexpart v11 branch: $BRANCH : $COMMIT" +read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n' + +cd $CPATH + +if [ "$1" != "apptainer" ]; then + # build with subdirectory as root + podman build -f Dockerfile -t flexpartv11-${BRANCH}:${COMMIT} --build-arg COMMIT=$COMMIT ../ + # registry + # podman build -t harbor.wolke.img.univie.ac.at/flexpart/flexpartv11-${BRANCH}:$COMMIT --build-arg COMMIT=$COMMIT .. +else + apptainer build flexpartv11-${BRANCH}-${COMMIT}.sif Singularity +fi \ No newline at end of file diff --git a/containers/entrypoint.sh b/containers/entrypoint.sh new file mode 100755 index 0000000000000000000000000000000000000000..5bd2387c8c622971aee4aec40f1520739f0ca06c --- /dev/null +++ b/containers/entrypoint.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# By MB +# run FLEXPART, but provide a bit of information + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' +report() { + if [ $? -eq 0 ]; then + printf "%-68s[$GREEN%10s$NC]\n" "$@" "OK" + return 0 + else + printf "%-68s[$RED%10s$NC]\n" "$@" "FAILED" + return 1 + fi +} + +echo "Welcome, running FLEXPART " +test -e /pathnames +report "Using defaults (/pathnames)" +cat /pathnames +echo "Mount volumes to change inputs" +echo "Git: $COMMIT" +echo "EXECUTING FLEXPART" +if [ $# -eq 1 ]; then + test -e /src/"$1" + report "Executing: /src/$1" + if [ $? -eq 0 ]; then + /src/"$1" /pathnames + else + test -e "$1" + report "Executing: $1" + if [ $? -eq 0 ]; then + exec "$1" + fi + fi + +elif [ $# -eq 2 ]; then + test -e /src/"$1" + report "Executing: /src/$1 $2" + if [ $? -eq 0 ]; then + /src/"$1" "$2" + fi +else + test -e /src/FLEXPART_ETA + report "Executing: /src/FLEXPART_ETA" + /src/FLEXPART_ETA /pathnames +fi +echo "FINISHED" diff --git a/create_tarball.sh b/create_tarball.sh deleted file mode 100755 index eebe81a3df49d89cab657cab955d7e5a453d5a81..0000000000000000000000000000000000000000 --- a/create_tarball.sh +++ /dev/null @@ -1,242 +0,0 @@ -#!/bin/bash -# Ignacio Pisso, May 2017 -# Changes 2018-2019 - -echo CREATE A NEW FLEXPART DISTRIBUTION - -# get current commit hash -githash=$(git rev-parse --short --verify HEAD) -echo githash $githash -#define version number with hash -version=10.4_$githash -echo version $version - -# define tarball name -targetdir=../flexpart_distribution/ -echo targetdir $targetdir - -# name distribution version -distribution_name=flexpart_v$version - -# name distribution temporary dir -tarball_tmp=${targetdir}flexpart_v$version -echo tarball_tmp $tarball_tmp - -# name distribution tarball file -#tarball=${targetdir}flexpart_v$version.tar -tarball=${tarball_tmp}.tar -echo tarball $tarball - -# if needed clean old package -if [ -d $tarball_tmp ]; then - echo - echo clean old tarball - hora=$(date +"%Y-%m-%d_%H%M%S") - tarball_tmp_bk=$tarball_tmp$tarball_tmp_$hora - echo tarball_tmp=$tarball_tmp exists: move to tarball_tmp_bk=$tarball_tmp_bk #and exit - mkdir $tarball_tmp_bk - mv $tarball_tmp $tarball_tmp_bk/ - mv $tarball $tarball_tmp_bk/ - #exit - echo old files moved to tarball_tmp_bk=$tarball_tmp_bk - echo -fi - -# start packing -## needs in addition to the git repo ANCILLARY git repos -# VERIFY THESE RESOURCES EXIST BEFORE PACKING DISTRIBUTION -#1 OH file OH_variables.bin || OH_variables=../flexin/OH_FIELDS/OH_variables.bin -#2 flex_extract || flex_extract=../flex_extract_v7.0.4/ -#3 flex_read_fortran from ../flex_read_matlab/export_basic TODO: add functions to ../flex_read_matlab/export/ -# flex_read_matlab_src=../flex_read_matlab/export_basic -#4 tests/examples ../flex_tests_examples/examples/* - - - - -# mkdir container -echo --------------------------------------------------------- -echo ')' create basis dir $tarball_tmp -mkdir $tarball_tmp -echo --------------------------------------------------------- - -echo - -# patnames -echo --------------------------------------------------------- -echo ')' copy pathnames -cp pathnames $tarball_tmp/pathnames -echo --------------------------------------------------------- - -echo - -# fortran source files -echo --------------------------------------------------------- -echo ')' copy src/ -mkdir $tarball_tmp/src -cp src/*.f90 $tarball_tmp/src -cp -r src/gributils $tarball_tmp/src -cp src/makefile $tarball_tmp/src -echo --------------------------------------------------------- - -cp LICENSE $tarball_tmp/LICENSE_GPLv3 -cp src/flexpart_license.txt $tarball_tmp/src - -echo - -# options dir -echo --------------------------------------------------------- -echo ')' copy options/ -echo --------------------------------------------------------- -mkdir $tarball_tmp/options -user_input_files="AGECLASSES COMMAND IGBP_int1.dat OUTGRID OUTGRID_NEST RECEPTORS RELEASES surfdata.t surfdepo.t" -for i in $user_input_files -do - echo $i - cp -r options/$i $tarball_tmp/options -done -mkdir $tarball_tmp/options/SPECIES -cp options/SPECIES/SPECIES* $tarball_tmp/options/SPECIES/ -cp options/SPECIES/specoverview.f90 $tarball_tmp/options/SPECIES/ -echo copy options/SPECIES/ to $tarball_tmp/options/SPECIES/ -echo --------------------------------------------------------- - -echo - -# OH file -echo --------------------------------------------------------- -echo ')' copy OH_variables.bin to flexin -mkdir $tarball_tmp/flexin -OH_variables=../flexin/OH_FIELDS/OH_variables.bin -cp $OH_variables $tarball_tmp/flexin/ -echo --------------------------------------------------------- - -echo - -# AVAILABLE -echo --------------------------------------------------------- -echo ')' copy AVAILABLE -cp AVAILABLE $tarball_tmp/AVAILABLE -echo --------------------------------------------------------- - -echo - -# output -echo --------------------------------------------------------- -echo ')' create output/ # mkdir $tarball_tmp/output -mkdir $tarball_tmp/output -echo --------------------------------------------------------- -echo output reference? -echo --------------------------------------------------------- - -echo - -# preprocess -echo --------------------------------------------------------- -echo ')' preprocess/ -mkdir $tarball_tmp/preprocess -echo -----------------flex_extract------------------- -mkdir $tarball_tmp/preprocess/flex_extract -flex_extract=../flex_extract_v7.0.4/ -echo include flex_extract v7.0.4 b7c1c04a204c91e53759ef590504bf52dfaece64 -echo from $flex_extract [use git modules?] IP 3/2018 -cp $flex_extract/README.md $tarball_tmp/preprocess/flex_extract -cp -r $flex_extract/docs $tarball_tmp/preprocess/flex_extract -cp -r $flex_extract/grib_templates $tarball_tmp/preprocess/flex_extract -cp -r $flex_extract/python $tarball_tmp/preprocess/flex_extract -cp -r $flex_extract/src $tarball_tmp/preprocess/flex_extract -echo flex_extract copied -echo --------------------------------------------------------- -echo AVAILABLE generation scripts? -echo --------------------------------------------------------- - -echo - -# postprocess -echo --------------------------------------------------------- -echo ')' postprocess/ - -postprocess=postprocess -mkdir $tarball_tmp/$postprocess -echo -----------------flex_read_fortran------------------- -flex_read_fortran_src=$postprocess/flex_read_fortran/ -mkdir $tarball_tmp/$postprocess/flex_read_fortran -cp $postprocess/flex_read_fortran/*.f $tarball_tmp/$postprocess/flex_read_fortran -cp $postprocess/flex_read_fortran/*.f90 $tarball_tmp/$postprocess/flex_read_fortran -cp $postprocess/flex_read_fortran/makefile $tarball_tmp/$postprocess/flex_read_fortran -echo flex_read_fortran copied from $flex_read_fortran_src - -echo -----------------flex_read_matlab------------------- -flex_read_matlab_src=../flex_read_matlab/export_basic -mkdir $tarball_tmp/$postprocess/flex_read_matlab -cp -r $flex_read_matlab_src/* $tarball_tmp/$postprocess/flex_read_matlab -echo flex_read_fortran from $flex_read_matlab_src # NOT copied -echo --------------------------------------------------------- - -echo - -echo --------------------------------------------------------- -echo ')' tests/ -#echo '13) tests' -mkdir $tarball_tmp/tests -echo ----------------- examples ------------------- - -mkdir $tarball_tmp/tests/examples -cp -r ../flex_tests_examples/examples/* $tarball_tmp/tests/examples/ - -echo ----------------- examples_reference ------------------- -cp -r ./tests/examples_reference $tarball_tmp/tests/ - -echo -----------------read examples------------------- - -mkdir $tarball_tmp/tests/read_examples - -cp tests/read_examples/declare_examples $tarball_tmp/tests/read_examples/ -cp tests/read_examples/display_examples.sh $tarball_tmp/tests/read_examples/ -cp tests/read_examples/examples_output.txt $tarball_tmp/tests/read_examples/ -cp tests/read_examples/read_examples.sh $tarball_tmp/tests/read_examples/ -cp tests/read_examples/read_grids.sh $tarball_tmp/tests/read_examples/ -cp tests/read_examples/read_parts.sh $tarball_tmp/tests/read_examples/ -cp tests/read_examples/set_examples_all $tarball_tmp/tests/read_examples/ -cp tests/read_examples/set_examples_3.sh $tarball_tmp/tests/read_examples/ -cp tests/read_examples/read_headers.sh $tarball_tmp/tests/read_examples/ -cp tests/read_examples/read_examples_output.txt $tarball_tmp/tests/ #read_examples/ - -echo ------------compare examples------------------- -mkdir $tarball_tmp/tests/compare_examples - - -cp tests/compare_examples/*.sh $tarball_tmp/tests/compare_examples -cp tests/compare_examples/compare_grids_output.txt $tarball_tmp/tests/ #compare_examples - -echo - -echo --------------------------------------------------------- -echo create tarball - -cd $targetdir -tar cf $distribution_name.tar $distribution_name - -pwd - -echo tarball $tarball complete -echo exported untarred files in $tarball_tmp - -echo verify: -echo cp -r preprocess/flex_extract/work $tarball_tmp/preprocess/flex_extract/ -echo cd $tarball_tmp/src -echo $HOME/repos/flexpart/src/make_in_laptop.sh -echo cd .. ';' ./src/FLEXPART -echo cd postprocess/flex_read_fortran -echo make test -echo e.g.: max: 0.115784094 mean: 4.70877676E-05 -echo cd ../../tests/examples ';' make run -echo cd ../read_examples -echo ./read_examples.sh -echo ./read_examples.sh '>' ../read_examples_output.txt -echo cd ../compare_examples -echo ./compare_grids.sh -echo ./compare_grids.sh '>' ../compare_grids_output.txt - -echo e.g. tar --append --file=$tarball_tmp/ ../compare_grids_output.txt ../read_examples_output.txt - diff --git a/documentation/docs/containers.md b/documentation/docs/containers.md new file mode 100644 index 0000000000000000000000000000000000000000..e15288a8e1f368ebec61e1ac3720a81f76ea8eab --- /dev/null +++ b/documentation/docs/containers.md @@ -0,0 +1,399 @@ +# Containers + +There are two most commonly used container formats available: + +1. Docker/Podman +2. Singularity/Apptainer + +with FLEXPART and recipes can be found in containers folder. + +Since version 11, FLEXPART is also available as a container. There is a Dockerfile and some instructions on how to build the container from scratch using for example podman/docker or singularity/apptainer: + +Specifications: +- compiled using `march=core-avx2`, compatible with CPUs above AVX2 (since Haswell or Zen) +- ecCodes + + +```sh +# build container using podman (adjust for docker) +$ ./containers/build.sh + +Building flexpart v11 branch: master : 2464aef +Press any key to continue or Ctrl+C to exit... +STEP 1/16: FROM rockylinux:9-minimal +... +STEP 16/16: CMD ["FLEXPART_ETA"] +--> Using cache 200844128a6919007417f3fa905221c8dbdea4bb285895ef80e89d3df80274b6 +COMMIT flexpartv11-master:2464aef +--> 200844128a69 +Successfully tagged localhost/flexpartv11-master:2464aef +200844128a6919007417f3fa905221c8dbdea4bb285895ef80e89d3df80274b6 +# finished + +# using singularity/apptainer for running FLEXPART +# there might be some warnings about EPERM (can be ignored) +$ ./containers/build.sh apptainer + +Building flexpart v11 branch: master : 2464aef +Press any key to continue or Ctrl+C to exit... +INFO: Starting build... +INFO: Adding environment to container +INFO: Adding startscript +INFO: Adding runscript +INFO: Creating SIF file... +INFO: Build complete: flexpartv11-master-2464aef.sif +# finished +``` + +running it using podman/docker or singularity/apptainer: + +```sh +# simple run the container with default settings +podman run localhost/flexpartv11-master:2464aef +# running the container requires a writable output directory +# mounting the local directory to /output inside the container +apptainer run -B .:/output flexpartv11-master-2464aef.sif +``` + + + +<details> +<summary>podman/docker flexpart run log</summary> +<pre><code class="shell"> +Welcome, running FLEXPART +Using defaults (/pathnames) +/options/ +/output/ +/inputs/ +/inputs/AVAILABLE +Mount volumes to change inputs +Git: c5bdd94 HEAD -> master, origin/master, origin/HEAD Tue Nov 21 16:15:27 2023 +0100 +EXECUTING FLEXPART +trying to execute: /src/FLEXPART_ETA +Executing: /src/FLEXPART_ETA + Welcome to FLEXPART Version 11 + Git: undefined + FLEXPART is free software released under the GNU General Public License. + FLEXPART is running with ETA coordinates. + ---------------- + INFORMATION: SUBGRIDSCALE TERRAIN EFFECT IS + NOT PARAMETERIZED DURING THIS SIMULATION. + ---------------- + + *********** WARNING ********************************** + * FLEXPART running in parallel mode * + * Number of uncertainty classes in * + * set to number of threads: 1 * + * All other computations are done with 8 threads. * + ******************************************************* + + FLEXPART WARNING: TIME DIFFERENCE BETWEEN TWO + WIND FIELDS IS BIG. THIS MAY CAUSE A DEGRADATION + OF SIMULATION QUALITY. + ECMWF metdata detected + NXSHIFT is set to 0 + grid dim: 181 91 92 92 91 92 + Vertical levels in ECMWF data: 92 92 + + Mother domain: + Longitude range: -178.00000 to 182.00000 Grid distance: 2.00000 + Latitude range : -90.00000 to 90.00000 Grid distance: 2.00000 + + Number of receptors: 2 + Releasepoints : 1 + reading SPECIES 24 + Particle shape SPHERE for particle 24 + + SPECIES: 24 AIRTRACER (GAS) + Wet removal for gases is turned: OFF + Dry deposition for gases is turned: OFF + Below-cloud scavenging: OFF + In-cloud scavenging: OFF + Particles released (numpartmax): 10000 + Total mass released: 1.0000000E+00 + Allocating fields for global output (x,y): 85 65 + Concentrations are calculated using kernel + WARNING: turbulence switched off. + Simulated 0.0 hours ( 0 s), 0 particles + Time: 0 seconds. Total spawned: 0 alive: 0 terminated: 0 + Allocating 10000 particles 0 0 0 + Finished allocation + Time: 900 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 1800 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 2700 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 3600 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + 3600 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 + Time: 4500 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 5400 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 6300 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 7200 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + 7200 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 + Time: 8100 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 9000 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 9900 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 10800 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + 10800 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 + Read wind fields: 0.609375000 seconds + Timemanager: 1.17187500 seconds,first timestep: 1.09375000 seconds + Write particle files: 4.68750000E-02 seconds + Total running time: 1.81250000 seconds + tps,io,tot: 1.95312500E-02 0.131249994 1.81250000 + CONGRATULATIONS: YOU HAVE SUCCESSFULLY COMPLETED A FLEXPART MODEL RUN! +FINISHED +</code></pre> +</details> + + +<details> +<summary>singularity/apptainer flexpart run log</summary> +<pre> +<code class="language-shell"> +INFO: gocryptfs not found, will not be able to use gocryptfs +Welcome, running FLEXPART +Using defaults (/pathnames) +/options/ +/output/ +/inputs/ +/inputs/AVAILABLE +Mount volumes to change inputs +Git: c5bdd94 HEAD -> master, origin/master, origin/HEAD Tue Nov 21 16:15:27 2023 +0100 +EXECUTING FLEXPART +trying to execute: /src/FLEXPART_ETA +Executing: /src/FLEXPART_ETA + Welcome to FLEXPART Version 11 + Git: undefined + FLEXPART is free software released under the GNU General Public License. + FLEXPART is running with ETA coordinates. + ---------------- + INFORMATION: SUBGRIDSCALE TERRAIN EFFECT IS + NOT PARAMETERIZED DURING THIS SIMULATION. + ---------------- + + *********** WARNING ********************************** + * FLEXPART running in parallel mode * + * Number of uncertainty classes in * + * set to number of threads: 1 * + * All other computations are done with 8 threads. * + ******************************************************* + + FLEXPART WARNING: TIME DIFFERENCE BETWEEN TWO + WIND FIELDS IS BIG. THIS MAY CAUSE A DEGRADATION + OF SIMULATION QUALITY. + ECMWF metdata detected + NXSHIFT is set to 0 + grid dim: 181 91 92 92 91 92 + Vertical levels in ECMWF data: 92 92 + + Mother domain: + Longitude range: -178.00000 to 182.00000 Grid distance: 2.00000 + Latitude range : -90.00000 to 90.00000 Grid distance: 2.00000 + + Number of receptors: 2 + Releasepoints : 1 + reading SPECIES 24 + Particle shape SPHERE for particle 24 + + SPECIES: 24 AIRTRACER (GAS) + Wet removal for gases is turned: OFF + Dry deposition for gases is turned: OFF + Below-cloud scavenging: OFF + In-cloud scavenging: OFF + Particles released (numpartmax): 10000 + Total mass released: 1.0000000E+00 + Allocating fields for global output (x,y): 85 65 + Concentrations are calculated using kernel + WARNING: turbulence switched off. + Simulated 0.0 hours ( 0 s), 0 particles + Time: 0 seconds. Total spawned: 0 alive: 0 terminated: 0 + Allocating 10000 particles 0 0 0 + Finished allocation + Time: 900 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 1800 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 2700 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 3600 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + 3600 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 + Time: 4500 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 5400 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 6300 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 7200 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + 7200 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 + Time: 8100 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 9000 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 9900 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + Time: 10800 seconds. Total spawned: 10000 alive: 10000 terminated: 0 + 10800 Seconds simulated: 10000 Particles: Uncertainty: 0.000 0.000 0.000 + Read wind fields: 0.703125000 seconds + Timemanager: 1.25000000 seconds,first timestep: 1.15625000 seconds + Write particle files: 1.56250000E-02 seconds + Total running time: 2.00000000 seconds + tps,io,tot: 2.34375000E-02 0.143749997 2.00000000 + CONGRATULATIONS: YOU HAVE SUCCESSFULLY COMPLETED A FLEXPART MODEL RUN! +FINISHED +</code></pre> +</details> + +<details> +<summary>ncdump of default run output</summary> +<pre><code class="language-shell"> +# check the output +ncdump -h grid_conc_20090101000000.nc +netcdf grid_conc_20090101000000 { +dimensions: + time = UNLIMITED ; // (3 currently) + longitude = 85 ; + latitude = 65 ; + height = 4 ; + numspec = 1 ; + pointspec = 1 ; + nageclass = 1 ; + nchar = 45 ; + ncharrec = 16 ; + numpoint = 1 ; + receptor = UNLIMITED ; // (2 currently) +variables: + int time(time) ; + time:units = "seconds since 2009-01-01 00:00" ; + time:calendar = "proleptic_gregorian" ; + float longitude(longitude) ; + longitude:long_name = "longitude in degree east" ; + longitude:axis = "Lon" ; + longitude:units = "degrees_east" ; + longitude:standard_name = "grid_longitude" ; + longitude:description = "grid cell centers" ; + float latitude(latitude) ; + latitude:long_name = "latitude in degree north" ; + latitude:axis = "Lat" ; + latitude:units = "degrees_north" ; + latitude:standard_name = "grid_latitude" ; + latitude:description = "grid cell centers" ; + float height(height) ; + height:units = "meters" ; + height:positive = "up" ; + height:standard_name = "height" ; + height:long_name = "height above ground" ; + char RELCOM(numpoint, nchar) ; + RELCOM:long_name = "release point name" ; + float RELLNG1(numpoint) ; + RELLNG1:units = "degrees_east" ; + RELLNG1:long_name = "release longitude lower left corner" ; + float RELLNG2(numpoint) ; + RELLNG2:units = "degrees_east" ; + RELLNG2:long_name = "release longitude upper right corner" ; + float RELLAT1(numpoint) ; + RELLAT1:units = "degrees_north" ; + RELLAT1:long_name = "release latitude lower left corner" ; + float RELLAT2(numpoint) ; + RELLAT2:units = "degrees_north" ; + RELLAT2:long_name = "release latitude upper right corner" ; + float RELZZ1(numpoint) ; + RELZZ1:units = "meters" ; + RELZZ1:long_name = "release height bottom" ; + float RELZZ2(numpoint) ; + RELZZ2:units = "meters" ; + RELZZ2:long_name = "release height top" ; + int RELKINDZ(numpoint) ; + RELKINDZ:long_name = "release kind" ; + int RELSTART(numpoint) ; + RELSTART:units = "seconds" ; + RELSTART:long_name = "release start relative to simulation start" ; + int RELEND(numpoint) ; + RELEND:units = "seconds" ; + RELEND:long_name = "release end relative to simulation start" ; + int RELPART(numpoint) ; + RELPART:long_name = "number of release particles" ; + float RELXMASS(numspec, numpoint) ; + RELXMASS:long_name = "total release particle mass" ; + int LAGE(nageclass) ; + LAGE:units = "seconds" ; + LAGE:long_name = "age class" ; + int ORO(latitude, longitude) ; + ORO:standard_name = "surface altitude" ; + ORO:long_name = "outgrid surface altitude" ; + ORO:units = "m" ; + char receptor(receptor, ncharrec) ; + receptor:long_name = "receptor name" ; + float spec001_mr(nageclass, pointspec, time, height, latitude, longitude) ; + spec001_mr:units = "ng m-3" ; + spec001_mr:long_name = "AIRTRACER" ; + spec001_mr:decay = -0.07001485f ; + spec001_mr:weightmolar = 29.f ; + spec001_mr:ohcconst = -9.e-10f ; + spec001_mr:ohdconst = -9.9f ; + spec001_mr:vsetaver = 0.f ; + float receptor_conc001(receptor, time) ; + receptor_conc001:units = "ng m-3" ; + receptor_conc001:_FillValue = -1.f ; + receptor_conc001:positive = "up" ; + receptor_conc001:standard_name = "receptor_conc" ; + receptor_conc001:long_name = "receptor_concentration" ; + +// global attributes: + :Conventions = "CF-1.6" ; + :title = "FLEXPART model output" ; + :git = "undefined" ; + :source = "Version 11 model output" ; + :history = "2023-11-21 16:22 +0100 created by mblaschek on NB513" ; + :references = "Stohl et al., Atmos. Chem. Phys., 2005, doi:10.5194/acp-5-2461-200" ; + :outlon0 = -25.f ; + :outlat0 = 10.f ; + :dxout = 1.f ; + :dyout = 1.f ; + :ldirect = 1 ; + :ibdate = "20090101" ; + :ibtime = "000000" ; + :iedate = "20090101" ; + :ietime = "030000" ; + :loutstep = 3600 ; + :loutaver = 3600 ; + :loutsample = 900 ; + :loutrestart = -1 ; + :lsynctime = 900 ; + :ctl = -0.2f ; + :ifine = 1 ; + :iout = 1 ; + :ipout = 0 ; + :lsubgrid = 0 ; + :lconvection = 0 ; + :lagespectra = 0 ; + :ipin = 0 ; + :ioutputforeachrelease = 0 ; + :iflux = 0 ; + :mdomainfill = 0 ; + :ind_source = 1 ; + :ind_receptor = 1 ; + :mquasilag = 0 ; + :nested_output = 0 ; + :sfc_only = 0 ; + :linit_cond = 0 ; +} +</code> +</pre> +</details> + +Interactive shells can be launched into containers, to have a look at configurations and to better understand what might go wrong. Podman/Docker allows to alter files inside of the container and save these changes. Singularity/Apptainer containers are not writeable, but acts like a normal executable with access to host files. + + +```sh +# using podman +$ podman run -it localhost/flexpartv11-master:2464aef /bin/bash +Welcome, running FLEXPART +Using defaults (/pathnames) [ OK] +/options/ +/output/ +/inputs/ +/inputs/AVAILABLE +Mount volumes to change inputs +Git: 2464aef +EXECUTING FLEXPART +Executing: /src//bin/bash [ FAILED] +Executing: /bin/bash [ OK] +bash-5.1# +# now you are inside the container +bash-5.1# pwd +/src +# important directories are /input, /output, /src, /options + +# +# using singularity/apptainer +$ apptainer run +``` \ No newline at end of file diff --git a/documentation/mkdocs.yml b/documentation/mkdocs.yml index 9cddeee8112c79a762643c00a6defddf2b4b5e05..e0e0f01772ce74dc5c15494726147c2eb40053f6 100644 --- a/documentation/mkdocs.yml +++ b/documentation/mkdocs.yml @@ -38,5 +38,6 @@ nav: - 'transport.md' - 'evolution.md' - 'examples.md' + - 'containers.md' - 'troubleshooting.md' diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100755 index 5fb5f2902975e561208044db36913791b4b62f1f..0000000000000000000000000000000000000000 --- a/entrypoint.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# By MB -# run FLEXPART, but provide a bit of information -echo "Welcome, running FLEXPART " -echo "Using defaults (/pathnames)" -cat /pathnames -echo "Mount volumes to change inputs" -echo "Git: $COMMIT" -echo "EXECUTING FLEXPART" -if [ $# -eq 1 ]; then - echo "trying to execute: /src/$1" - if [ -e /src/"$1" ]; then - echo "Executing: /src/$1" - /src/"$1" /pathnames - else - echo "Falling back to default, executing: /src/FLEXPART_ETA" - /src/FLEXPART_ETA /pathnames - fi -else - echo "Executing: /src/FLEXPART_ETA" - /src/FLEXPART_ETA /pathnames -fi -echo "FINISHED" diff --git a/pathnames b/pathnames index 6571a6256ae107e4817e6adb3f13b2650640cef6..2f9a3548c3054ce02f88b5480ffc4c6fb9f9aa8c 100644 --- a/pathnames +++ b/pathnames @@ -1,4 +1,4 @@ ./options/ ./output/ -./preprocess/flex_extract/work/ +./inputs ./AVAILABLE diff --git a/pathnames_ECMWF_OPER b/pathnames_ECMWF_OPER deleted file mode 100644 index c464acb3c5e8761746d0a540cfa52a93d0a096a0..0000000000000000000000000000000000000000 --- a/pathnames_ECMWF_OPER +++ /dev/null @@ -1,6 +0,0 @@ -./options/ -./output/ -/ -/xnilu_wrk/flex_wrk/WIND_FIELDS/AVAILABLE_ECMWF_OPER_fields_global -============================================ - diff --git a/Dockerfile b/tests/Dockerfile similarity index 56% rename from Dockerfile rename to tests/Dockerfile index 9aea002457f59bab4759a78b4b2dc8572c45e347..5fea829dd09526b1fdee6763565e06d984355a3b 100644 --- a/Dockerfile +++ b/tests/Dockerfile @@ -1,27 +1,13 @@ -# -# Dockerfile for CI and Flexpart container images -# Build Examples: -# - podman build -t harbor.wolke.img.univie.ac.at/flexpart/almalinux8 -f Dockerfile -# - podman build -t harbor.wolke.img.univie.ac.at/flexpart/rockylinux9 -f Dockerfile -# -# FROM rockylinux:8-minimal FROM rockylinux:9-minimal -# -# Build development image (with/without jasper) -# jasper was used in FP 10.4 (eccodes, emoslib) -# -# 8: --enablerepo=powertools -# since 9, there is 2.31 eccodes in epel RUN microdnf install -y epel-release && \ - microdnf install -y --enablerepo=crb make netcdf-fortran-devel.x86_64 netcdf.x86_64 eccodes eccodes-devel cmake tar gcc-c++ perl git && \ + microdnf install -y --enablerepo=crb make netcdf-fortran-devel.x86_64 netcdf.x86_64 eccodes eccodes-devel cmake tar gcc-c++ perl git wget && \ microdnf clean all -y && \ rm -rf /var/cache/yum - # # Download ECCODES Version # note 2.30.0 has an issue!!! -# -# RUN curl https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.31.0-Source.tar.gz | tar xz +# ENV ECCODES=2.31.0 +# RUN curl https://confluence.ecmwf.int/download/attachments/45757960/eccodes-${ECCODES}-Source.tar.gz | tar xz # RUN mkdir build && \ # cd build && \ # cmake -DENABLE_ECCODES_OMP_THREADS=ON ../eccodes-*/ && \ @@ -32,4 +18,4 @@ RUN microdnf install -y epel-release && \ # ENV FC=gfortran ENV LIBRARY_PATH=/usr/lib64:/usr/local/lib64 -ENV CPATH=/usr/include:/usr/local/include:/usr/lib64/gfortran/modules +ENV CPATH=/usr/include:/usr/local/include:/usr/lib64/gfortran/modules \ No newline at end of file