Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/DiffEq/Beta/MixNumberFractionBetaCoeffPolicy.cpp
4 : : \copyright 2012-2015 J. Bakosi,
5 : : 2016-2018 Los Alamos National Security, LLC.,
6 : : 2019-2021 Triad National Security, LLC.
7 : : All rights reserved. See the LICENSE file for details.
8 : : \brief Mass-fraction beta SDE coefficients policies
9 : : \details This file defines coefficients policy classes for the mass-fraction
10 : : beta SDE, defined in DiffEq/Beta/MixNumberFractionBeta.h. For
11 : : general requirements on mixture number-fraction beta SDE
12 : : coefficients policy classes see the header file.
13 : : */
14 : : // *****************************************************************************
15 : :
16 : : #include "MixNumberFractionBetaCoeffPolicy.hpp"
17 : :
18 [ - - ]: 0 : walker::MixNumFracBetaCoeffDecay::MixNumFracBetaCoeffDecay(
19 : : ncomp_t ncomp,
20 : : const std::vector< kw::sde_bprime::info::expect::type >& bprime_,
21 : : const std::vector< kw::sde_S::info::expect::type >& S_,
22 : : const std::vector< kw::sde_kappaprime::info::expect::type >& kprime_,
23 : : const std::vector< kw::sde_rho2::info::expect::type >& rho2_,
24 : : const std::vector< kw::sde_rcomma::info::expect::type >& rcomma_,
25 : : std::vector< kw::sde_bprime::info::expect::type >& bprime,
26 : : std::vector< kw::sde_S::info::expect::type >& S,
27 : : std::vector< kw::sde_kappaprime::info::expect::type >& kprime,
28 : : std::vector< kw::sde_rho2::info::expect::type >& rho2,
29 : : std::vector< kw::sde_rcomma::info::expect::type >& rcomma,
30 : : std::vector< kw::sde_b::info::expect::type >& b,
31 : : std::vector< kw::sde_kappa::info::expect::type >& k )
32 : : // *****************************************************************************
33 : : // Constructor: initialize coefficients
34 : : //! \param[in] ncomp Number of scalar components in this SDE system
35 : : //! \param[in] bprime_ Vector used to initialize coefficient vector bprime
36 : : //! \param[in] S_ Vector used to initialize coefficient vector S
37 : : //! \param[in] kprime_ Vector used to initialize coefficient vector kprime
38 : : //! \param[in] rho2_ Vector used to initialize coefficient vector rho2
39 : : //! \param[in] rcomma_ Vector used to initialize coefficient vector rcomma
40 : : //! \param[in,out] bprime Coefficient vector to be initialized
41 : : //! \param[in,out] S Coefficient vector to be initialized
42 : : //! \param[in,out] kprime Coefficient vector to be initialized
43 : : //! \param[in,out] rho2 Coefficient vector to be initialized
44 : : //! \param[in,out] rcomma Coefficient vector to be initialized
45 : : //! \param[in,out] b Coefficient vector to be initialized
46 : : //! \param[in,out] k Coefficient vector to be initialized
47 : : // *****************************************************************************
48 : : {
49 [ - - ][ - - ]: 0 : ErrChk( bprime_.size() == ncomp,
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
50 : : "Wrong number of mix number-fraction beta SDE parameters 'b''");
51 [ - - ][ - - ]: 0 : ErrChk( S_.size() == ncomp,
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
52 : : "Wrong number of mix number-fraction beta SDE parameters 'S'");
53 [ - - ][ - - ]: 0 : ErrChk( kprime_.size() == ncomp,
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
54 : : "Wrong number of mix number-fraction beta SDE parameters 'kappa''");
55 [ - - ][ - - ]: 0 : ErrChk( rho2_.size() == ncomp,
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
56 : : "Wrong number of mix number-fraction beta SDE parameters 'rho2'");
57 [ - - ][ - - ]: 0 : ErrChk( rcomma_.size() == ncomp,
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
58 : : "Wrong number of mix number-fraction beta SDE parameters 'rcomma'");
59 : :
60 : 0 : bprime = bprime_;
61 : 0 : S = S_;
62 : 0 : kprime = kprime_;
63 : 0 : rho2 = rho2_;
64 : 0 : rcomma = rcomma_;
65 : :
66 : 0 : b.resize( bprime.size() );
67 : 0 : k.resize( kprime.size() );
68 : 0 : }
69 : :
70 : : void
71 : 0 : walker::MixNumFracBetaCoeffDecay::update(
72 : : char depvar,
73 : : ncomp_t ncomp,
74 : : const std::map< tk::ctr::Product, tk::real >& moments,
75 : : const std::vector< kw::sde_bprime::info::expect::type >& bprime,
76 : : const std::vector< kw::sde_kappaprime::info::expect::type >& kprime,
77 : : std::vector< kw::sde_b::info::expect::type >& b,
78 : : std::vector< kw::sde_kappa::info::expect::type >& k ) const
79 : : // *****************************************************************************
80 : : // Update coefficients
81 : : //! \details This where the mix number-fraction beta SDE is made consistent
82 : : //! with the no-mix and fully mixed limits by specifying the SDE
83 : : //! coefficients, b and kappa as functions of b' and kappa'.
84 : : // *****************************************************************************
85 : : {
86 [ - - ]: 0 : for (ncomp_t c=0; c<ncomp; ++c) {
87 [ - - ]: 0 : tk::real m = tk::ctr::lookup( tk::ctr::mean(depvar,c), moments );
88 [ - - ]: 0 : tk::real v = tk::ctr::lookup( tk::ctr::variance(depvar,c), moments );
89 : :
90 [ - - ][ - - ]: 0 : if (m<1.0e-8 || m>1.0-1.0e-8) m = 0.5;
91 [ - - ][ - - ]: 0 : if (v<1.0e-8 || v>1.0-1.0e-8) v = 0.5;
92 : :
93 : 0 : b[c] = bprime[c] * (1.0 - v / m / ( 1.0 - m ));
94 : 0 : k[c] = kprime[c] * v;
95 : : }
96 : 0 : }
97 : :
|