CYCLUS
Loading...
Searching...
No Matches
enrichment.cc
Go to the documentation of this file.
1#include "enrichment.h"
2
3#include <cmath>
4#include <sstream>
5
6#include "error.h"
7#include "cyc_limits.h"
8#include "logger.h"
9#include "mat_query.h"
10
11namespace cyclus {
12namespace toolkit {
13
14// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15Assays::Assays(double feed, double product, double tails)
16 : feed_(feed), product_(product), tails_(tails) {}
17
18// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19double Assays::Feed() const {
20 return feed_;
21}
22
23// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24double Assays::Product() const {
25 return product_;
26}
27
28// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29double Assays::Tails() const {
30 return tails_;
31}
32
33// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
35 return UraniumAssayAtom(rsrc);
36}
37
38// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
40 double value;
41 MatQuery mq(rsrc);
42 double u235 = mq.atom_frac(922350000);
43 double u238 = mq.atom_frac(922380000);
44
45 LOG(LEV_DEBUG1, "CEnr") << "Comparing u235 atom fraction : " << u235
46 << " with u238 atom fraction: " << u238;
47
48 if (u235 + u238 > 0) {
49 value = u235 / (u235 + u238);
50 } else {
51 value = 0;
52 }
53 return value;
54}
55
56// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
58 double value;
59 MatQuery mq(rsrc);
60 double u235 = mq.mass_frac(922350000);
61 double u238 = mq.mass_frac(922380000);
62
63 LOG(LEV_DEBUG1, "CEnr") << "Comparing u235 mass fraction : " << u235
64 << " with u238 mass fraction: " << u238;
65
66 if (u235 + u238 > 0) {
67 value = u235 / (u235 + u238);
68 } else {
69 value = 0;
70 }
71 return value;
72}
73
74// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
76 MatQuery mq(rsrc);
77 return mq.mass(922350000) + mq.mass(922380000);
78}
79
80// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
81double FeedQty(double product_qty, const Assays& assays) {
82 double factor =
83 (assays.Product() - assays.Tails()) / (assays.Feed() - assays.Tails());
84 return product_qty * factor;
85}
86
87// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
88double TailsQty(double product_qty, const Assays& assays) {
89 double factor =
90 (assays.Product() - assays.Feed()) / (assays.Feed() - assays.Tails());
91 return product_qty * factor;
92}
93
94// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
95double ValueFunc(double frac) {
96 if (frac < 0) {
97 std::stringstream msg;
98 msg << "The provided fraction (" << frac
99 << ") is lower than the acceptable range.";
100 throw ValueError(msg.str());
101 }
102
103 if (frac >= 1) {
104 std::stringstream msg;
105 msg << "The provided fraction (" << frac
106 << ") is higher than the acceptable range.";
107 throw ValueError(msg.str());
108 }
109
110 return (1 - 2 * frac) * std::log(1 / frac - 1);
111}
112
113// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
114double SwuRequired(double product_qty, const Assays& assays) {
115 double feed = FeedQty(product_qty, assays);
116 double tails = TailsQty(product_qty, assays);
117 double swu = product_qty * ValueFunc(assays.Product()) +
118 tails * ValueFunc(assays.Tails()) -
119 feed * ValueFunc(assays.Feed());
120 return swu;
121}
122
123} // namespace toolkit
124} // namespace cyclus
boost::shared_ptr< Material > Ptr
Definition material.h:75
For values that are too big, too small, etc.
Definition error.h:37
A simple container class for enrichment assays.
Definition enrichment.h:12
double Tails() const
Definition enrichment.cc:29
double Feed() const
Definition enrichment.cc:19
double Product() const
Definition enrichment.cc:24
Assays(double feed, double product, double tails)
Constructor.
Definition enrichment.cc:15
A class that provides convenience methods for querying a material's properties.
Definition mat_query.h:13
double atom_frac(Nuc nuc)
returns the atom/mole fraction of nuclide nuc in the material.
Definition mat_query.cc:38
double mass_frac(Nuc nuc)
Returns the mass fraction of nuclide nuc in the material.
Definition mat_query.cc:23
double mass(Nuc nuc)
Returns the mass in kg of nuclide nuc in the material.
Definition mat_query.cc:15
Top-level enrichment functionality.
Code providing rudimentary logging capability for the Cyclus core.
#define LOG(level, prefix)
allows easy logging via the streaming operator similar to std::cout; this is the primary way to use t...
Definition logger.h:34
double UraniumAssayMass(Material::Ptr rsrc)
Definition enrichment.cc:57
double UraniumQty(Material::Ptr rsrc)
inline double UraniumAssay(Material::Ptr mat) { return UraniumAssay(mat.get()); }
Definition enrichment.cc:75
double FeedQty(double product_qty, const Assays &assays)
inline double UraniumQty(Material::Ptr mat) { return UraniumQty(mat.get()); }
Definition enrichment.cc:81
double SwuRequired(double product_qty, const Assays &assays)
double ValueFunc(double frac)
Definition enrichment.cc:95
double UraniumAssayAtom(Material::Ptr rsrc)
Definition enrichment.cc:39
double UraniumAssay(Material::Ptr rsrc)
Definition enrichment.cc:34
double TailsQty(double product_qty, const Assays &assays)
Definition enrichment.cc:88
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Definition agent.cc:14
@ LEV_DEBUG1
debugging information - least verbose
Definition logger.h:70