-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBdot.hpp
More file actions
63 lines (49 loc) · 1.64 KB
/
Bdot.hpp
File metadata and controls
63 lines (49 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: (BSD-3-Clause)
*
* Copyright (c) 2025- Lawrence Livermore National Security LLC
* All rights reserved
*
* See top level LICENSE files for details.
* ------------------------------------------------------------------------------------------------------------
*/
#pragma once
#include "common/macros.hpp"
namespace hpcReact
{
template< typename REAL_TYPE,
typename INDEX_TYPE,
typename IONIC_STRENGTH_TYPE >
class Bdot
{
public:
using RealType = REAL_TYPE;
using IndexType = INDEX_TYPE;
struct Params : public IONIC_STRENGTH_TYPE::PARAMS
{
};
template< typename ARRAY_1D_TO_CONST,
typename ARRAY_1D >
static inline HPCREACT_HOST_DEVICE
void
calculateActivities( IONIC_STRENGTH_TYPE::PARAMS const & params,
ARRAY_1D_TO_CONST const & speciesConcentrations,
ARRAY_1D & activities )
{
RealType const ionicStrength = IONIC_STRENGTH_TYPE::calculate( params, speciesConcentrations );
RealType const sqrtI = sqrt(ionicStrength);
RealType const A_gamma = 2;
RealType const B_gamma = 1.6;
auto const & speciesCharge = params.m_speciesCharge;
auto const & a = params.m_ionSizeParameter;
auto const & b = params.m_bdotParameter;
constexpr IndexType numSpecies = params.numSpecies();
for( IndexType i=0; i<numSpecies; ++i )
{
RealType const gamma_coeff = -A_gamma * sqrtI / ( 1 + a[i] * B_gamma * sqrtI );
activities[i] = gamma_coeff * speciesCharge[i] * speciesCharge[i] + b[i] * ionicStrength;
}
}
};
} // namespace hpcReact