From 9d3e8ef4532213f527d3f59e4b541f623e1cdcc3 Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Sun, 7 Jul 2024 21:10:39 -0400 Subject: [PATCH 01/10] docker file to run on local desktop --- Dockerfile.camp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Dockerfile.camp b/Dockerfile.camp index 99180a908..3d1714e48 100644 --- a/Dockerfile.camp +++ b/Dockerfile.camp @@ -33,11 +33,10 @@ RUN curl -LO https://github.com/jacobwilliams/json-fortran/archive/6.1.0.tar.gz && make install \ && cd ~ -RUN curl -LO https://github.com/open-atmos/camp/archive/refs/tags/v1.0.0-gamma.tar.gz \ - && tar -zxvf v1.0.0-gamma.tar.gz +COPY ../camp_ /camp_ # Install a modified version of CVODE -RUN cd camp-1.0.0-gamma \ +RUN cd camp_ \ && tar -zxvf cvode-3.4-alpha.tar.gz \ && cd cvode-3.4-alpha \ && mkdir build \ @@ -54,7 +53,7 @@ ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64:/usr/loc ENV PATH="${PATH}:/usr/local/jsonfortran-gnu-6.1.0/lib" # Build CAMP -RUN cd camp-1.0.0-gamma \ +RUN cd camp_ \ && mkdir build \ && cd build \ && export JSON_FORTRAN_HOME="/usr/local/jsonfortran-gnu-6.1.0" \ @@ -68,11 +67,11 @@ RUN cd camp-1.0.0-gamma \ && cd ~ # NOTE: Modify .dockerignore to whitelist files/directories to copy. -COPY . /partmc/ +COPY partmc_ /partmc/ RUN mkdir /build \ && cd /build \ - && export CAMP_HOME="/camp-1.0.0-gamma/build/" \ + && export CAMP_HOME="/camp_/build/" \ && cmake -D CMAKE_BUILD_TYPE=release \ -D CMAKE_C_FLAGS_DEBUG="-g" \ -D CMAKE_Fortran_FLAGS_DEBUG="-g" \ From cde137968a99cadf88334ed6bb356cc0ca02190d Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Mon, 8 Jul 2024 10:48:40 -0400 Subject: [PATCH 02/10] modifying json files to include layers --- test/camp/aerosol_representation.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/camp/aerosol_representation.json b/test/camp/aerosol_representation.json index 15eba0f7a..0e80f1c45 100644 --- a/test/camp/aerosol_representation.json +++ b/test/camp/aerosol_representation.json @@ -1,9 +1,18 @@ { "camp-data" : [ { - "name" : "PartMC single particle", + "name" : "PartMC single-particle with layers", "type" : "AERO_REP_SINGLE_PARTICLE", "maximum computational particles" : 1050 + "layers": [ + { + "name": "one layer", + "phases": [ + "organic_matter" + ], + "covers": "none" + } + ] } ] } From 635ecd6feedef966854a15b5a66c9aa495a433f7 Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Fri, 12 Jul 2024 20:21:49 -0400 Subject: [PATCH 03/10] test pass with layers --- test/camp/aero_init_comp.dat | 2 +- test/camp/aerosol_representation.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/camp/aero_init_comp.dat b/test/camp/aero_init_comp.dat index 551f60b3e..60d1961ac 100644 --- a/test/camp/aero_init_comp.dat +++ b/test/camp/aero_init_comp.dat @@ -1,2 +1,2 @@ # mass fractions -organic_matter.POA 1.0 +one_layer.organic_matter.POA 1.0 diff --git a/test/camp/aerosol_representation.json b/test/camp/aerosol_representation.json index 0e80f1c45..0f4ae3121 100644 --- a/test/camp/aerosol_representation.json +++ b/test/camp/aerosol_representation.json @@ -1,12 +1,12 @@ { "camp-data" : [ { - "name" : "PartMC single-particle with layers", + "name" : "PartMC single particle", "type" : "AERO_REP_SINGLE_PARTICLE", - "maximum computational particles" : 1050 + "maximum computational particles" : 1050, "layers": [ { - "name": "one layer", + "name": "one_layer", "phases": [ "organic_matter" ], From f5d2f9fefedea7453fb187b44d0fcea3ecb0c8e1 Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Mon, 22 Jul 2024 21:40:37 -0400 Subject: [PATCH 04/10] running scenarios/6_camp with layers --- scenarios/6_camp/aero_init_comp.dat | 2 +- scenarios/6_camp/aerosol_representation.json | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scenarios/6_camp/aero_init_comp.dat b/scenarios/6_camp/aero_init_comp.dat index 551f60b3e..60d1961ac 100644 --- a/scenarios/6_camp/aero_init_comp.dat +++ b/scenarios/6_camp/aero_init_comp.dat @@ -1,2 +1,2 @@ # mass fractions -organic_matter.POA 1.0 +one_layer.organic_matter.POA 1.0 diff --git a/scenarios/6_camp/aerosol_representation.json b/scenarios/6_camp/aerosol_representation.json index 1b7030974..f37edead5 100644 --- a/scenarios/6_camp/aerosol_representation.json +++ b/scenarios/6_camp/aerosol_representation.json @@ -3,7 +3,16 @@ { "name" : "PartMC single particle", "type" : "AERO_REP_SINGLE_PARTICLE", - "maximum computational particles" : 10500 + "maximum computational particles" : 10500, + "layers": [ + { + "name": "one_layer", + "phases": [ + "organic_matter" + ], + "covers": "none" + } + ] } ] } From 5ca4aafe72abd9d244335eee2e8bbc05ff5c1c62 Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Thu, 1 Aug 2024 15:43:00 -0400 Subject: [PATCH 05/10] corrected Docker file;= --- Dockerfile.camp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.camp b/Dockerfile.camp index 3d1714e48..f7d0acf15 100644 --- a/Dockerfile.camp +++ b/Dockerfile.camp @@ -10,6 +10,7 @@ RUN dnf -y update \ sundials-devel \ lapack-devel \ openblas-devel \ + git \ gsl-devel \ cmake \ && dnf clean all @@ -33,7 +34,8 @@ RUN curl -LO https://github.com/jacobwilliams/json-fortran/archive/6.1.0.tar.gz && make install \ && cd ~ -COPY ../camp_ /camp_ +#RUN git clone https://github.com/open-atmos/camp.git +COPY ../camp_ /camp_ # Install a modified version of CVODE RUN cd camp_ \ From a0f929d7f7a2618d0704e1057cccc45a52f8384b Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Mon, 5 Aug 2024 15:26:22 -0400 Subject: [PATCH 06/10] dockerfile changes --- Dockerfile.camp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile.camp b/Dockerfile.camp index f7d0acf15..5cf7c48ef 100644 --- a/Dockerfile.camp +++ b/Dockerfile.camp @@ -34,11 +34,11 @@ RUN curl -LO https://github.com/jacobwilliams/json-fortran/archive/6.1.0.tar.gz && make install \ && cd ~ -#RUN git clone https://github.com/open-atmos/camp.git -COPY ../camp_ /camp_ +RUN git clone https://github.com/open-atmos/camp.git +#COPY ../camp_ /camp_ # Install a modified version of CVODE -RUN cd camp_ \ +RUN cd camp \ && tar -zxvf cvode-3.4-alpha.tar.gz \ && cd cvode-3.4-alpha \ && mkdir build \ @@ -55,7 +55,7 @@ ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64:/usr/loc ENV PATH="${PATH}:/usr/local/jsonfortran-gnu-6.1.0/lib" # Build CAMP -RUN cd camp_ \ +RUN cd camp \ && mkdir build \ && cd build \ && export JSON_FORTRAN_HOME="/usr/local/jsonfortran-gnu-6.1.0" \ @@ -73,7 +73,7 @@ COPY partmc_ /partmc/ RUN mkdir /build \ && cd /build \ - && export CAMP_HOME="/camp_/build/" \ + && export CAMP_HOME="/camp/build/" \ && cmake -D CMAKE_BUILD_TYPE=release \ -D CMAKE_C_FLAGS_DEBUG="-g" \ -D CMAKE_Fortran_FLAGS_DEBUG="-g" \ From 084b10482044d7a3988a1fa6537623d506162da2 Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Mon, 5 Aug 2024 15:26:53 -0400 Subject: [PATCH 07/10] dockerfile update --- Dockerfile.camp | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile.camp b/Dockerfile.camp index 5cf7c48ef..6f27b81aa 100644 --- a/Dockerfile.camp +++ b/Dockerfile.camp @@ -35,7 +35,6 @@ RUN curl -LO https://github.com/jacobwilliams/json-fortran/archive/6.1.0.tar.gz && cd ~ RUN git clone https://github.com/open-atmos/camp.git -#COPY ../camp_ /camp_ # Install a modified version of CVODE RUN cd camp \ From 8dabc2593292ded92a3711df1195f3fcd6fa428b Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Fri, 16 Aug 2024 16:50:01 -0400 Subject: [PATCH 08/10] layer concentrations are now correct --- scenarios/6_camp/aerosol_representation.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scenarios/6_camp/aerosol_representation.json b/scenarios/6_camp/aerosol_representation.json index f37edead5..bda1aad5d 100644 --- a/scenarios/6_camp/aerosol_representation.json +++ b/scenarios/6_camp/aerosol_representation.json @@ -8,7 +8,11 @@ { "name": "one_layer", "phases": [ - "organic_matter" + "dust", + "sea_salt", + "organic_matter", + "black_carbon", + "other_PM" ], "covers": "none" } From 4b330e607f1570e5820f859d8722c062e4fdc110 Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Sun, 18 Aug 2024 13:18:32 -0400 Subject: [PATCH 09/10] aero rep json file for testing --- test/camp/aerosol_representation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/camp/aerosol_representation.json b/test/camp/aerosol_representation.json index 0f4ae3121..f0bb25374 100644 --- a/test/camp/aerosol_representation.json +++ b/test/camp/aerosol_representation.json @@ -8,7 +8,7 @@ { "name": "one_layer", "phases": [ - "organic_matter" + "organic_matter" ], "covers": "none" } From ea50e4b9d2a4dd5f443b9ff4e82ce0ac70598d77 Mon Sep 17 00:00:00 2001 From: jtgasparik Date: Sat, 8 Feb 2025 20:11:27 -0500 Subject: [PATCH 10/10] running with three layers --- Dockerfile.camp | 26 ++++++++++++-------- scenarios/6_camp/aero_init_comp.dat | 4 ++- scenarios/6_camp/aerosol_representation.json | 24 +++++++++++++++++- scenarios/6_camp/camp.spec | 2 +- scenarios/6_camp/plot_aero_species.py | 12 ++++----- scenarios/6_camp/plot_gas_species.py | 8 +++--- src/camp_interface.F90 | 1 + 7 files changed, 54 insertions(+), 23 deletions(-) diff --git a/Dockerfile.camp b/Dockerfile.camp index 6f27b81aa..4906a00d4 100644 --- a/Dockerfile.camp +++ b/Dockerfile.camp @@ -10,7 +10,8 @@ RUN dnf -y update \ sundials-devel \ lapack-devel \ openblas-devel \ - git \ + git \ + valgrind \ gsl-devel \ cmake \ && dnf clean all @@ -34,10 +35,14 @@ RUN curl -LO https://github.com/jacobwilliams/json-fortran/archive/6.1.0.tar.gz && make install \ && cd ~ -RUN git clone https://github.com/open-atmos/camp.git +#RUN git clone https://github.com/open-atmos/camp.git +RUN git clone https://github.com/jtgasparik/camp_.git \ + && cd camp_ \ + && git checkout SIMPOL_multiple_layers \ + && cd ~ # Install a modified version of CVODE -RUN cd camp \ +RUN cd camp_ \ && tar -zxvf cvode-3.4-alpha.tar.gz \ && cd cvode-3.4-alpha \ && mkdir build \ @@ -50,17 +55,18 @@ RUN cd camp \ && make install \ && cd ~ -ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64:/usr/local/jsonfortran-gnu-6.1.0/lib" +ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/usr/local/lib:/usr/local/lib64:/usr/local/jsonfortran-gnu-6.1.0/lib" +#ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64:/usr/local/jsonfortran-gnu-6.1.0/lib" ENV PATH="${PATH}:/usr/local/jsonfortran-gnu-6.1.0/lib" # Build CAMP -RUN cd camp \ +RUN cd camp_ \ && mkdir build \ && cd build \ && export JSON_FORTRAN_HOME="/usr/local/jsonfortran-gnu-6.1.0" \ - && cmake -D CMAKE_BUILD_TYPE=release \ - -D CMAKE_C_FLAGS_DEBUG="-pg" \ - -D CMAKE_Fortran_FLAGS_DEBUG="-pg" \ + && cmake -D CMAKE_BUILD_TYPE=debug \ + #-D CMAKE_C_FLAGS_DEBUG="-pg" \ + #-D CMAKE_Fortran_FLAGS_DEBUG="-pg" \ -D CMAKE_MODULE_LINKER_FLAGS="-pg" \ -D ENABLE_GSL:BOOL=TRUE \ .. \ @@ -72,8 +78,8 @@ COPY partmc_ /partmc/ RUN mkdir /build \ && cd /build \ - && export CAMP_HOME="/camp/build/" \ - && cmake -D CMAKE_BUILD_TYPE=release \ + && export CAMP_HOME="/camp_/build/" \ + && cmake -D CMAKE_BUILD_TYPE=debug \ -D CMAKE_C_FLAGS_DEBUG="-g" \ -D CMAKE_Fortran_FLAGS_DEBUG="-g" \ -D CMAKE_C_FLAGS_RELEASE="-O2 -g -Werror -Wall -Wextra" \ diff --git a/scenarios/6_camp/aero_init_comp.dat b/scenarios/6_camp/aero_init_comp.dat index 60d1961ac..8d8a0e847 100644 --- a/scenarios/6_camp/aero_init_comp.dat +++ b/scenarios/6_camp/aero_init_comp.dat @@ -1,2 +1,4 @@ # mass fractions -one_layer.organic_matter.POA 1.0 +one_layer.organic_matter.POA 0.4 +two_layer.organic_matter.POA 0.3 +three_layer.organic_matter.POA 0.3 diff --git a/scenarios/6_camp/aerosol_representation.json b/scenarios/6_camp/aerosol_representation.json index bda1aad5d..dee879f96 100644 --- a/scenarios/6_camp/aerosol_representation.json +++ b/scenarios/6_camp/aerosol_representation.json @@ -3,7 +3,7 @@ { "name" : "PartMC single particle", "type" : "AERO_REP_SINGLE_PARTICLE", - "maximum computational particles" : 10500, + "maximum computational particles" : 120, "layers": [ { "name": "one_layer", @@ -14,6 +14,28 @@ "black_carbon", "other_PM" ], + "covers": "two_layer" + }, + { + "name": "two_layer", + "phases": [ + "dust", + "sea_salt", + "organic_matter", + "black_carbon", + "other_PM" + ], + "covers": "three_layer" + }, + { + "name": "three_layer", + "phases": [ + "dust", + "sea_salt", + "organic_matter", + "black_carbon", + "other_PM" + ], "covers": "none" } ] diff --git a/scenarios/6_camp/camp.spec b/scenarios/6_camp/camp.spec index d66f3599a..e878aa87e 100644 --- a/scenarios/6_camp/camp.spec +++ b/scenarios/6_camp/camp.spec @@ -1,7 +1,7 @@ run_type particle # particle-resolved run output_prefix out/camp # prefix of output files n_repeat 1 # number of Monte Carlo repeats -n_part 10000 # total number of particles +n_part 100 # total number of particles restart no # whether to restart from saved state (yes/no) do_select_weighting no # whether to select weighting explicitly (yes/no) diff --git a/scenarios/6_camp/plot_aero_species.py b/scenarios/6_camp/plot_aero_species.py index 71e5a9ae6..49e44f3f0 100644 --- a/scenarios/6_camp/plot_aero_species.py +++ b/scenarios/6_camp/plot_aero_species.py @@ -69,7 +69,7 @@ def major_formatter(x, pos): return f'{1e9*x:.1f}' pos = [0,0] -mass_conc, mass_std = get_mass_conc(file, n_times,'organic_matter.ISOP-P1_aero', +mass_conc, mass_std = get_mass_conc(file, n_times,'one_layer.organic_matter.ISOP-P1_aero', n_repeats=n_runs) axes[pos[0]][pos[1]].plot(times[partmc_ind_to_plot], mass_conc[partmc_ind_to_plot], color=colors[0], ls='', marker='%s'%(part_symbol), label="ISOP_P1_aero", @@ -79,12 +79,12 @@ def major_formatter(x, pos): axes[pos[0]][pos[1]].grid(True,linestyle='--') axes[pos[0]][pos[1]].set_xlim([0,24*60]) axes[pos[0]][pos[1]].xaxis.set_major_locator(ticker.FixedLocator([0,360,720,1080,1440])) -axes[pos[0]][pos[1]].xaxis.set_major_formatter(time_formatter) +#axes[pos[0]][pos[1]].xaxis.set_major_formatter(time_formatter) axes[pos[0]][pos[1]].set_ylim([0,3e-9]) -axes[pos[0]][pos[1]].yaxis.set_major_formatter(major_formatter) +#axes[pos[0]][pos[1]].yaxis.set_major_formatter(major_formatter) axes[pos[0]][pos[1]].set_ylabel(r'Mass concentration ($\mu \rm g \, m^{-3}$)') pos = [1,0] -mass_conc, mass_std = get_mass_conc(file, n_times,'organic_matter.ISOP-P2_aero', +mass_conc, mass_std = get_mass_conc(file, n_times,'one_layer.organic_matter.ISOP-P2_aero', n_repeats=n_runs) axes[pos[0]][pos[1]].plot(times[partmc_ind_to_plot], mass_conc[partmc_ind_to_plot], color=colors[0], ls='', marker='%s'%(part_symbol), label="ISOP-P2_aero", @@ -94,10 +94,10 @@ def major_formatter(x, pos): axes[pos[0]][pos[1]].set_xlabel('Simulation time (h)') axes[pos[0]][pos[1]].set_xlim([0,24*60]) axes[pos[0]][pos[1]].xaxis.set_major_locator(ticker.FixedLocator([0,360,720,1080,1440])) -axes[pos[0]][pos[1]].xaxis.set_major_formatter(time_formatter) +#axes[pos[0]][pos[1]].xaxis.set_major_formatter(time_formatter) axes[pos[0]][pos[1]].set_ylabel(r'Mass concentration ($\mu \rm g \, m^{-3}$)') axes[pos[0]][pos[1]].set_ylim([0,3e-10]) -axes[pos[0]][pos[1]].yaxis.set_major_formatter(major_formatter) +#axes[pos[0]][pos[1]].yaxis.set_major_formatter(major_formatter) out_filename = 'out/timeseries_aero.pdf' print("Writing %s" % out_filename) fig.savefig(out_filename) diff --git a/scenarios/6_camp/plot_gas_species.py b/scenarios/6_camp/plot_gas_species.py index 2c78a4995..70ce9475a 100644 --- a/scenarios/6_camp/plot_gas_species.py +++ b/scenarios/6_camp/plot_gas_species.py @@ -74,12 +74,12 @@ def time_formatter(x, pos): axes[pos[0]][pos[1]].grid(True,linestyle='--') axes[pos[0]][pos[1]].set_xlim([0,24*60]) axes[pos[0]][pos[1]].xaxis.set_major_locator(ticker.FixedLocator([0,360,720,1080,1440])) -axes[pos[0]][pos[1]].xaxis.set_major_formatter(time_formatter) +#axes[pos[0]][pos[1]].xaxis.set_major_formatter(time_formatter) axes[pos[0]][pos[1]].set_ylabel("Mixing ratio (ppm)") axes[pos[0]][pos[1]].set_ylim([0,.14]) positions = [0,.02,.04,.06,.08,.10,.12,.14] axes[pos[0]][pos[1]].yaxis.set_major_locator(ticker.FixedLocator(positions)) -axes[pos[0]][pos[1]].yaxis.set_major_formatter(major_formatter) +#axes[pos[0]][pos[1]].yaxis.set_major_formatter(major_formatter) pos = [1,0] var = 'ISOP' @@ -102,10 +102,10 @@ def time_formatter(x, pos): axes[pos[0]][pos[1]].grid(True,linestyle='--') axes[pos[0]][pos[1]].set_xlim([0,24*60]) axes[pos[0]][pos[1]].xaxis.set_major_locator(ticker.FixedLocator([0,360,720,1080,1440])) -axes[pos[0]][pos[1]].xaxis.set_major_formatter(time_formatter) +#axes[pos[0]][pos[1]].xaxis.set_major_formatter(time_formatter) axes[pos[0]][pos[1]].set_ylabel("Mixing ratio (ppm)") axes[pos[0]][pos[1]].set_ylim([0,ymax[0]]) -axes[pos[0]][pos[1]].yaxis.set_major_formatter(major_formatter) +#axes[pos[0]][pos[1]].yaxis.set_major_formatter(major_formatter) out_filename = 'out/camp_gases.pdf' print("Writing %s" % out_filename) fig.savefig(out_filename) diff --git a/src/camp_interface.F90 b/src/camp_interface.F90 index 20cb07ad4..6aa2aa682 100644 --- a/src/camp_interface.F90 +++ b/src/camp_interface.F90 @@ -93,6 +93,7 @@ subroutine pmc_camp_interface_solve(camp_core, camp_state, & ! Update the PartMC gas-phase state call gas_state_get_camp_conc(gas_state, camp_state) + !call camp_core%print() end subroutine pmc_camp_interface_solve