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),
17 product_(product),
18 tails_(tails) {}
19
20// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21double Assays::Feed() const {
22 return feed_;
23}
24
25// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
26double Assays::Product() const {
27 return product_;
28}
29
30// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
31double Assays::Tails() const {
32 return tails_;
33}
34
35// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39
40// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
42 double value;
44 double u235 = mq.atom_frac(922350000);
45 double u238 = mq.atom_frac(922380000);
46
47 LOG(LEV_DEBUG1, "CEnr") << "Comparing u235 atom fraction : "
48 << u235 << " with u238 atom fraction: "
49 << u238;
50
51 if (u235 + u238 > 0) {
52 value = u235 / (u235 + u238);
53 } else {
54 value = 0;
55 }
56 return value;
57}
58
59// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
61 double value;
63 double u235 = mq.mass_frac(922350000);
64 double u238 = mq.mass_frac(922380000);
65
66 LOG(LEV_DEBUG1, "CEnr") << "Comparing u235 mass fraction : "
67 << u235 << " with u238 mass fraction: "
68 << u238;
69
70 if (u235 + u238 > 0) {
71 value = u235 / (u235 + u238);
72 } else {
73 value = 0;
74 }
75 return value;
76}
77
78// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
81 return mq.mass(922350000) + mq.mass(922380000);
82}
83
84// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
85double FeedQty(double product_qty, const Assays& assays) {
86 double factor =
87 (assays.Product() - assays.Tails())
88 /
89 (assays.Feed() - assays.Tails());
90 return product_qty * factor;
91}
92
93// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
94double TailsQty(double product_qty, const Assays& assays) {
95 double factor =
96 (assays.Product() - assays.Feed())
97 /
98 (assays.Feed() - assays.Tails());
99 return product_qty * factor;
100}
101
102// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
103double ValueFunc(double frac) {
104 if (frac < 0) {
105 std::stringstream msg;
106 msg << "The provided fraction (" << frac
107 << ") is lower than the acceptable range.";
108 throw ValueError(msg.str());
109 }
110
111 if (frac >= 1) {
112 std::stringstream msg;
113 msg << "The provided fraction (" << frac
114 << ") is higher than the acceptable range.";
115 throw ValueError(msg.str());
116 }
117
118 return (1 - 2 * frac) * std::log(1 / frac - 1);
119}
120
121// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
122double SwuRequired(double product_qty, const Assays& assays) {
123 double feed = FeedQty(product_qty, assays);
124 double tails = TailsQty(product_qty, assays);
125 double swu =
126 product_qty * ValueFunc(assays.Product()) +
127 tails * ValueFunc(assays.Tails()) -
128 feed * ValueFunc(assays.Feed());
129 return swu;
130}
131
132} // namespace toolkit
133} // namespace cyclus
boost::shared_ptr< Material > Ptr
Definition material.h:75
For values that are too big, too small, etc.
Definition error.h:41
A simple container class for enrichment assays.
Definition enrichment.h:12
double Tails() const
Definition enrichment.cc:31
double Feed() const
Definition enrichment.cc:21
double Product() const
Definition enrichment.cc:26
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:12
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:35
double UraniumAssayMass(Material::Ptr rsrc)
Definition enrichment.cc:60
double UraniumQty(Material::Ptr rsrc)
inline double UraniumAssay(Material::Ptr mat) { return UraniumAssay(mat.get()); }
Definition enrichment.cc:79
double FeedQty(double product_qty, const Assays &assays)
inline double UraniumQty(Material::Ptr mat) { return UraniumQty(mat.get()); }
Definition enrichment.cc:85
double SwuRequired(double product_qty, const Assays &assays)
double ValueFunc(double frac)
double UraniumAssayAtom(Material::Ptr rsrc)
Definition enrichment.cc:41
double UraniumAssay(Material::Ptr rsrc)
Definition enrichment.cc:36
double TailsQty(double product_qty, const Assays &assays)
Definition enrichment.cc:94
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:58
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters