diff --git a/Dockerfile.camp b/Dockerfile.camp index 99180a908..4906a00d4 100644 --- a/Dockerfile.camp +++ b/Dockerfile.camp @@ -10,6 +10,8 @@ RUN dnf -y update \ sundials-devel \ lapack-devel \ openblas-devel \ + git \ + valgrind \ gsl-devel \ cmake \ && dnf clean all @@ -33,11 +35,14 @@ 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 +#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-1.0.0-gamma \ +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-1.0.0-gamma \ && 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-1.0.0-gamma \ +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 \ .. \ @@ -68,12 +74,12 @@ 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/" \ - && 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 551f60b3e..8d8a0e847 100644 --- a/scenarios/6_camp/aero_init_comp.dat +++ b/scenarios/6_camp/aero_init_comp.dat @@ -1,2 +1,4 @@ # mass fractions -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 1b7030974..dee879f96 100644 --- a/scenarios/6_camp/aerosol_representation.json +++ b/scenarios/6_camp/aerosol_representation.json @@ -3,7 +3,42 @@ { "name" : "PartMC single particle", "type" : "AERO_REP_SINGLE_PARTICLE", - "maximum computational particles" : 10500 + "maximum computational particles" : 120, + "layers": [ + { + "name": "one_layer", + "phases": [ + "dust", + "sea_salt", + "organic_matter", + "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 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 15eba0f7a..f0bb25374 100644 --- a/test/camp/aerosol_representation.json +++ b/test/camp/aerosol_representation.json @@ -3,7 +3,16 @@ { "name" : "PartMC single particle", "type" : "AERO_REP_SINGLE_PARTICLE", - "maximum computational particles" : 1050 + "maximum computational particles" : 1050, + "layers": [ + { + "name": "one_layer", + "phases": [ + "organic_matter" + ], + "covers": "none" + } + ] } ] }