Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Code.v05-00/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ option(DEBUG "Enable debug mode" OFF)
SET(RINGS 0)
SET(OMP 1)
option(BUILD_TEST ON)
option(ENABLE_PROFILING "Enable perf-friendly build (-g -O2)" OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
include(CheckCXXCompilerFlag)
Expand All @@ -35,6 +36,10 @@ elseif (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
#-Michael
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -fno-trapping-math -funsafe-math-optimizations")
endif()
if(ENABLE_PROFILING)
message(STATUS "Profiling enabled: adding debug symbols and frame pointers")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -fno-omit-frame-pointer")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

execute_process(COMMAND git rev-parse --short HEAD
Expand Down Expand Up @@ -132,4 +137,4 @@ add_subdirectory(tests)

if (DEBUG)
message(STATUS "DEBUG mode is enabled")
endif()
endif()
19 changes: 18 additions & 1 deletion Code.v05-00/include/AIM/Aerosol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ class AIM::Aerosol

/* Moments */
//NOTE: This gives the moment in [- / cm3]. You need to multiply by factors to get it in [ / m] or something.
//NOTE: now returning binMoment without the log bin ratio, as the only instance calling this function already calculates it
inline double binMoment(int iBin, int n = 0) const {
return (log(bin_Edges[iBin + 1]) - log(bin_Edges[iBin])) * pow(bin_Centers[iBin], n) * pdf[iBin];
if (n == 0){
return pdf[iBin]; // if n = 0, it can skip the pow() calculation
}

return pow(bin_Centers[iBin], n) * pdf[iBin];
}
//NOTE: This gives the moment in [- / cm3]. You need to multiply by factors to get it in [ / m] or something.
template <UInt N> //Template allows us to evaulate the power at compile time to decrease runtime
double Moment() const;
double Moment( UInt n = 0 ) const;
double Radius( ) const;
double EffRadius( ) const;
Expand All @@ -79,6 +86,7 @@ class AIM::Aerosol
inline const Vector_1D& getBinVCenters() const { return bin_VCenters; };
inline const Vector_1D& getBinEdges() const { return bin_Edges; };
inline const Vector_1D& getBinSizes() const { return bin_Sizes; };
inline const Vector_1D& getLogBinEdges() const { return log_Bin_Edges; };
inline UInt getNBin() const { return nBin; };
inline const Vector_1D& getPDF() const { return pdf; };

Expand All @@ -88,6 +96,7 @@ class AIM::Aerosol
Vector_1D bin_VCenters;
Vector_1D bin_Edges;
Vector_1D bin_Sizes;
Vector_1D log_Bin_Edges;
UInt nBin;
Vector_1D pdf; // represents dN [-/cm3] / d(ln r)
};
Expand Down Expand Up @@ -124,8 +133,14 @@ class AIM::Grid_Aerosol
inline void updateNy(int ny_new) { Ny = ny_new; };

/* Moments */
template <UInt N> //Templates allow us to evaulate the power at compile time to decrease runtime
Vector_2D Moment() const;
Vector_2D Moment( UInt n ) const;
template <UInt N>
double Moment( const Vector_1D& PDF ) const;
double Moment( UInt n, const Vector_1D& PDF ) const;
template <UInt N>
double Moment( UInt iNx, UInt jNy ) const;
double Moment( UInt n, UInt iNx, UInt jNy ) const;

/* Extra utils */
Expand Down Expand Up @@ -177,6 +192,7 @@ class AIM::Grid_Aerosol
inline const Vector_3D& getBinVCenters() const { return bin_VCenters; };
inline const Vector_1D& getBinEdges() const { return bin_Edges; };
inline const Vector_1D& getBinSizes() const { return bin_Sizes; };
inline const Vector_1D& getLogBinEdges() const { return log_Bin_Edges; };
inline UInt getNBin() const { return nBin; };
inline const Vector_3D& getPDF() const { return pdf; };
inline Vector_3D& getPDF() { return pdf; };
Expand All @@ -189,6 +205,7 @@ class AIM::Grid_Aerosol
Vector_1D bin_Edges;
Vector_1D bin_VEdges;
Vector_1D bin_Sizes;
Vector_1D log_Bin_Edges;
UInt nBin;
unsigned int Nx, Ny;
Vector_3D pdf; //Everything with the pdf is implicitly in [ / cm3]
Expand Down
10 changes: 6 additions & 4 deletions Code.v05-00/include/Util/MetFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ namespace met
Atmospheric Chemistry and Physics
https://doi.org/10.5194/acp-22-10919-2022
*/

double rhi_abs = rhi * 0.01;

double rhi_abs = rhi / 100.0;
double rhi_abs_a = rhi_abs / a;

double rhi_corr = (rhi_abs / a) <= 1
? rhi_abs / a
: std::min(std::pow(rhi_abs / a, b), 1.65);
double rhi_corr = (rhi_abs_a) <= 1
? rhi_abs_a
: std::min(std::pow(rhi_abs_a, b), 1.65);
return rhi_corr * 100.0;
}
struct newXCoordsPair {
Expand Down
Loading