Skip to content

Commit ee66f3e

Browse files
committed
refactor
1 parent 6c6838e commit ee66f3e

19 files changed

+1180
-608
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ set( hpcReact_headers
55
reactions/bulkGeneric/EquilibriumReactions.hpp
66
reactions/bulkGeneric/EquilibriumReactionsAggregatePrimaryConcentration_impl.hpp
77
reactions/bulkGeneric/EquilibriumReactionsReactionExtents_impl.hpp
8+
reactions/geochemistry/GeochemicalSystems.hpp
89
reactions/bulkGeneric/KineticReactions.hpp
910
reactions/bulkGeneric/KineticReactions_impl.hpp
1011
reactions/bulkGeneric/MixedEquilibriumKineticReactions.hpp
1112
reactions/bulkGeneric/MixedEquilibriumKineticReactions_impl.hpp
1213
reactions/bulkGeneric/Parameters.hpp
1314
reactions/bulkGeneric/ParametersPredefined.hpp
1415
reactions/bulkGeneric/SpeciesUtilities.hpp
16+
reactions/bulkGeneric/unitTestUtilities/kineticReactionsTest_utilities.hpp
17+
reactions/massActions/MassActions.hpp
1518
)
1619

1720
set( hpcReact_sources)
@@ -60,6 +63,8 @@ message(STATUS "HPCReact/src CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DI
6063
# EXCLUDES "blt/*" )
6164

6265
add_subdirectory( reactions/bulkGeneric/unitTests )
66+
add_subdirectory( reactions/geochemistry/unitTests )
67+
add_subdirectory( reactions/massActions/unitTests )
6368
add_subdirectory( common/unitTests )
6469
add_subdirectory( docs )
6570

src/common/printers.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <stdio.h>
4+
#include "CArrayWrapper.hpp"
45

56
template< typename T, int N >
67
void print( T const (&a)[N], char const * name, int const numDigits )

src/reactions/bulkGeneric/EquilibriumReactionsAggregatePrimaryConcentration_impl.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "EquilibriumReactions.hpp"
33
#endif
44

5-
#include "SpeciesUtilities.hpp"
5+
#include "reactions/massActions/MassActions.hpp"
66

77
namespace hpcReact
88
{
@@ -35,10 +35,10 @@ EquilibriumReactions< REAL_TYPE,
3535

3636
RealType aggregatePrimaryConcentrations[numPrimarySpecies] = {0.0};
3737
ARRAY_2D dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations = {{{0.0}}};
38-
calculateAggregatePrimaryConcentrationsWrtLogC< REAL_TYPE, INT_TYPE, INDEX_TYPE >( params,
39-
logPrimarySpeciesConcentration,
40-
aggregatePrimaryConcentrations,
41-
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations );
38+
massActions::calculateAggregatePrimaryConcentrationsWrtLogC< REAL_TYPE, INT_TYPE, INDEX_TYPE >( params,
39+
logPrimarySpeciesConcentration,
40+
aggregatePrimaryConcentrations,
41+
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations );
4242

4343

4444
for( IndexType i=0; i<numPrimarySpecies; ++i )

src/reactions/bulkGeneric/KineticReactions_impl.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,10 @@ KineticReactions< REAL_TYPE,
273273
reactionRatesDerivatives( r, i ) = 0.0;
274274
}
275275
}
276-
} // end of if constexpr ( CALCULATE_DERIVATIVES )
276+
} // end of if constexpr ( CALCULATE_DERIVATIVES )
277+
} // end of else
277278
reactionRates[r] = - rateConstant * surfaceArea[r] * ( 1 - quotient / equilibriumConstant );
278-
} // end of if constexpr ( LOGE_CONCENTRATION )
279+
}
279280
}
280281

281282
// function to the reaction rate. Includes impact of temperature, concentration, surface area, volume fraction and porosity

src/reactions/bulkGeneric/MixedEquilibriumKineticReactions_impl.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "common/constants.hpp"
44
#include "common/CArrayWrapper.hpp"
5-
#include "SpeciesUtilities.hpp"
5+
#include "reactions/massActions/MassActions.hpp"
66

77

88
/** @file MixedEquilibriumKineticReactions_impl.hpp
@@ -45,13 +45,13 @@ MixedEquilibriumKineticReactions< REAL_TYPE,
4545
{
4646

4747
// 1. Compute new aggregate species from primary species
48-
calculateAggregatePrimaryConcentrationsWrtLogC< REAL_TYPE,
49-
INT_TYPE,
50-
INDEX_TYPE >( params.equilibriumReactionsParameters(),
51-
logPrimarySpeciesConcentrations,
52-
logSecondarySpeciesConcentrations,
53-
aggregatePrimarySpeciesConcentrations,
54-
dAggregatePrimarySpeciesConcentrations_dLogPrimarySpeciesConcentrations );
48+
massActions::calculateAggregatePrimaryConcentrationsWrtLogC< REAL_TYPE,
49+
INT_TYPE,
50+
INDEX_TYPE >( params.equilibriumReactionsParameters(),
51+
logPrimarySpeciesConcentrations,
52+
logSecondarySpeciesConcentrations,
53+
aggregatePrimarySpeciesConcentrations,
54+
dAggregatePrimarySpeciesConcentrations_dLogPrimarySpeciesConcentrations );
5555

5656
if constexpr( PARAMS_DATA::numKineticReactions() > 0 )
5757
{

src/reactions/bulkGeneric/Parameters.hpp

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ template< typename REAL_TYPE,
2020
typename INT_TYPE,
2121
typename INDEX_TYPE,
2222
int NUM_SPECIES,
23-
int NUM_REACTIONS >
23+
int NUM_REACTIONS,
24+
int NUM_SURFACE_REACTIONS = 0 >
2425
struct EquilibriumReactionsParameters
2526
{
2627
using RealType = REAL_TYPE;
@@ -31,9 +32,14 @@ struct EquilibriumReactionsParameters
3132

3233
static constexpr IndexType numReactions() { return NUM_REACTIONS; }
3334

35+
static constexpr IndexType numSurfaceReactions() { return NUM_SURFACE_REACTIONS; }
36+
37+
static constexpr IndexType numAqueousReactions() { return numReactions() - numSurfaceReactions(); }
38+
3439
static constexpr IndexType numPrimarySpecies() { return numSpecies() - numReactions(); }
3540

3641
static constexpr IndexType numSecondarySpecies() { return numSpecies() - numPrimarySpecies(); }
42+
3743

3844
constexpr
3945
EquilibriumReactionsParameters( CArrayWrapper< RealType, NUM_REACTIONS, NUM_SPECIES > const & stoichiometricMatrix,
@@ -50,30 +56,6 @@ struct EquilibriumReactionsParameters
5056
CArrayWrapper< RealType, NUM_REACTIONS > m_equilibriumConstant;
5157
};
5258

53-
template< typename REAL_TYPE,
54-
typename INT_TYPE,
55-
typename INDEX_TYPE,
56-
int NUM_SPECIES,
57-
int NUM_REACTIONS >
58-
struct SurfaceReactionsParameters : public EquilibriumReactionsParameters< REAL_TYPE,
59-
INT_TYPE,
60-
INDEX_TYPE,
61-
NUM_SPECIES,
62-
NUM_REACTIONS >
63-
{
64-
using Base = EquilibriumReactionsParameters< REAL_TYPE, INT_TYPE, INDEX_TYPE, NUM_SPECIES, NUM_REACTIONS >;
65-
using RealType = Base::RealType;
66-
using IntType = Base::IntType;
67-
using IndexType = Base::IndexType
68-
69-
constexpr SurfaceReactionsParameters( CArrayWrapper< RealType, NUM_REACTIONS, NUM_SPECIES > const & stoichiometricMatrix,
70-
CArrayWrapper< RealType, NUM_REACTIONS > equilibriumConstant ) :
71-
Base( stoichiometricMatrix, equilibriumConstant )
72-
{}
73-
};
74-
75-
76-
7759
template< typename REAL_TYPE,
7860
typename INT_TYPE,
7961
typename INDEX_TYPE,

0 commit comments

Comments
 (0)