Removed decay data, now with pyne! #762

Merged
merged 10 commits into from Mar 5, 2014

Conversation

Projects
None yet
3 participants
@scopatz
Member

scopatz commented Mar 5, 2014

This PR replaces the decayInfo.dat file with nuclear data coming from pyne. A custom cyclus_nuc_data.h5 has been created and uploaded to our webspace. The install process will automatically download and install this file. This data file may be generated by the following command:

scopatz@ares ~/pyne staging $ nuc_data_make -o cyclus_nuc_data.h5 
    -m atomic_mass,scattering_lengths,decay,simple_xs,materials,eaf,wimsd_fpy,nds_fpy

This PR also exposed what I would consider some fundamental problems with how the current methodology works. These will be addressed in separate issues as the purpose here is only to integrate with pyne data. As much as I wanted to throw my machine out of the 4th floor window of ERB during this process, the unite tests now pass :).

@scopatz scopatz added this to the v0.5 milestone Mar 5, 2014

@@ -167,6 +167,9 @@ int main(int argc, char* argv[]) {
std::string path = Env::PathBase(argv[0]);
Env::SetCyclusRelPath(path);
+ // tell pyne about the path to nuc data
+ pyne::NUC_DATA_PATH = Env::GetBuildPath() + "/share/cyclus_nuc_data.h5";

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member

should likely use a boost file system path for os robustness

@gidden

gidden Mar 5, 2014

Member

should likely use a boost file system path for os robustness

This comment has been minimized.

@scopatz

scopatz Mar 5, 2014

Member

There is a lot of this kind of code in cyclus right now. Maybe we could make an issue and tackle it later.

@scopatz

scopatz Mar 5, 2014

Member

There is a lot of this kind of code in cyclus right now. Maybe we could make an issue and tackle it later.

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member

I see thats the case with finding mass.sqlite as well. Would you like to make the issue? We could also make an issue about using pyne nuclide masses as well and get rid of mass.sqlite.

@gidden

gidden Mar 5, 2014

Member

I see thats the case with finding mass.sqlite as well. Would you like to make the issue? We could also make an issue about using pyne nuclide masses as well and get rid of mass.sqlite.

This comment has been minimized.

@scopatz

scopatz Mar 5, 2014

Member

I see thats the case with finding mass.sqlite as well. Would you like to make the issue?

I'd rather if you did. Thanks!

We could also make an issue about using pyne nuclide masses as well and get rid of mass.sqlite.

I am going to do this tomorrow :)

@scopatz

scopatz Mar 5, 2014

Member

I see thats the case with finding mass.sqlite as well. Would you like to make the issue?

I'd rather if you did. Thanks!

We could also make an issue about using pyne nuclide masses as well and get rid of mass.sqlite.

I am going to do this tomorrow :)

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member

done

@gidden

gidden Mar 5, 2014

Member

done

+else()
+ message("-- Downloading http://regtests.fuelcycle.org/cyclus_nuc_data.h5 to "
+ "'${CMAKE_CURRENT_SOURCE_DIR}/cyclus_nuc_data.h5'...")
+ file(DOWNLOAD "http://regtests.fuelcycle.org/cyclus_nuc_data.h5"

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member

TIL. Neat!

@gidden

gidden Mar 5, 2014

Member

TIL. Neat!

src/composition.cc
+
+ if (atom_.size() == 0)
+ // FIXME this is only here for testing
+ return (Composition::Ptr) new Composition(tot_decay, decay_line_);

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member

This comment has been minimized.

@rwcarlsen

rwcarlsen Mar 5, 2014

Member

Also - need curlies on multi-line if. Also - the casting syntax is strange and non-obvious. You should use the constructor syntax - which is what is really going on:

return Composition::Ptr(new Composition(tot_decay, decay_line_));
@rwcarlsen

rwcarlsen Mar 5, 2014

Member

Also - need curlies on multi-line if. Also - the casting syntax is strange and non-obvious. You should use the constructor syntax - which is what is really going on:

return Composition::Ptr(new Composition(tot_decay, decay_line_));

This comment has been minimized.

@rwcarlsen

rwcarlsen Mar 5, 2014

Member

@scopatz I just noticed a bug here - could you throw in this line at the top of the NewDecay function:

  atom(); // force evaluation of atom-composition if not calculated already
@rwcarlsen

rwcarlsen Mar 5, 2014

Member

@scopatz I just noticed a bug here - could you throw in this line at the top of the NewDecay function:

  atom(); // force evaluation of atom-composition if not calculated already

This comment has been minimized.

@scopatz

scopatz Mar 5, 2014

Member

Done.

On Tue, Mar 4, 2014 at 10:54 PM, Robert Carlsen notifications@github.comwrote:

In src/composition.cc:

@@ -105,11 +105,13 @@ void Composition::Record(Context* ctx) {

Composition::Ptr Composition::NewDecay(int delta) {
int tot_decay = prev_decay_ + delta;

  • double months_per_year = 12;
  • double years = double(delta) / months_per_year;
  • if (atom_.size() == 0)
  • // FIXME this is only here for testing
  • return (Composition::Ptr) new Composition(tot_decay, decay_line_);

@scopatz https://github.com/scopatz I just noticed a bug here - could
you throw in this line at the top of the NewDecay function:

atom(); // force evaluation of atom-composition if not calculated already

Reply to this email directly or view it on GitHubhttps://github.com/cyclus/cyclus/pull/762/files#r10287754
.

@scopatz

scopatz Mar 5, 2014

Member

Done.

On Tue, Mar 4, 2014 at 10:54 PM, Robert Carlsen notifications@github.comwrote:

In src/composition.cc:

@@ -105,11 +105,13 @@ void Composition::Record(Context* ctx) {

Composition::Ptr Composition::NewDecay(int delta) {
int tot_decay = prev_decay_ + delta;

  • double months_per_year = 12;
  • double years = double(delta) / months_per_year;
  • if (atom_.size() == 0)
  • // FIXME this is only here for testing
  • return (Composition::Ptr) new Composition(tot_decay, decay_line_);

@scopatz https://github.com/scopatz I just noticed a bug here - could
you throw in this line at the top of the NewDecay function:

atom(); // force evaluation of atom-composition if not calculated already

Reply to this email directly or view it on GitHubhttps://github.com/cyclus/cyclus/pull/762/files#r10287754
.

+ int i;
+ int col;
+ int daughter;
+ std::set<int> daughters;

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member

I believe in a PyNE PR, someone suggested either from_nuc/to_nuc, parent/child, or mother/daughter, in that preference order =)

@gidden

gidden Mar 5, 2014

Member

I believe in a PyNE PR, someone suggested either from_nuc/to_nuc, parent/child, or mother/daughter, in that preference order =)

This comment has been minimized.

@scopatz

scopatz Mar 5, 2014

Member

I feel it safe to call this legacy code that matches the names around it :)

@scopatz

scopatz Mar 5, 2014

Member

I feel it safe to call this legacy code that matches the names around it :)

src/decayer.cc
@@ -162,7 +110,7 @@ void Decayer::GetResult(CompMap& comp) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Decayer::BuildDecayMatrix() {
- double decayConst = 0; // decay constant, in inverse years
+ double decayConst = 0; // decay constant, in inverse secs

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member
src/decayer.cc
@@ -173,6 +121,9 @@ void Decayer::BuildDecayMatrix() {
while (parent_iter != parent_.end()) {
jcol = parent_iter->second.first; // determines column index
decayConst = parent_iter->second.second;
+ // Gross heuristic for mostly stable nuclides 2903040000 sec / 100 years
+ if ((long double) exp(-2903040000 * decayConst) == 0.0)

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member

c++ style casts

@gidden

gidden Mar 5, 2014

Member

c++ style casts

@@ -128,7 +127,8 @@ void Material::Decay(int curr_time) {
CompMap::const_iterator it;
for (it = c.end(); it != c.begin(); --it) {
int nuc = it->first;
- double lambda_months = Decayer::DecayConstant(nuc) / 12;
+ // 2419200 == secs / month
+ double lambda_months = pyne::decay_const(nuc) * 2419200;

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member

shouldn't [months] = [secs] / [secs / month]?

@gidden

gidden Mar 5, 2014

Member

shouldn't [months] = [secs] / [secs / month]?

This comment has been minimized.

@gidden

gidden Mar 5, 2014

Member

errr, [months] = 1 / ([secs / month] * [1 / secs])

@gidden

gidden Mar 5, 2014

Member

errr, [months] = 1 / ([secs / month] * [1 / secs])

This comment has been minimized.

@scopatz

scopatz Mar 5, 2014

Member

lambda: [1/months] = [1/sec] * [sec/month]

@scopatz

scopatz Mar 5, 2014

Member

lambda: [1/months] = [1/sec] * [sec/month]

@gidden

This comment has been minimized.

Show comment
Hide comment
@gidden

gidden Mar 5, 2014

Member

we definitely need decayer unit tests..

Member

gidden commented Mar 5, 2014

we definitely need decayer unit tests..

@rwcarlsen

This comment has been minimized.

Show comment
Hide comment
@rwcarlsen

rwcarlsen Mar 5, 2014

Member

+1 for tests. I also would like to award anthony a code destroyer medal. Code is the enemy.

@gidden - who is in your new profile pic?

Member

rwcarlsen commented Mar 5, 2014

+1 for tests. I also would like to award anthony a code destroyer medal. Code is the enemy.

@gidden - who is in your new profile pic?

@gidden

This comment has been minimized.

Show comment
Hide comment
@gidden

gidden Mar 5, 2014

Member

On Tue, Mar 4, 2014 at 10:46 PM, Robert Carlsen notifications@github.comwrote:

+1 for tests. I also would like to award anthony a code destroyer medal.
Code is the enemy.

@gidden https://github.com/gidden - who is in your new profile pic?

A friend of mine named Nic. This was on a glacier lake tour at the bottom
of South America.

Reply to this email directly or view it on GitHubhttps://github.com/cyclus/cyclus/pull/762#issuecomment-36709809
.

Matthew Gidden
Ph.D. Candidate, Nuclear Engineering
The University of Wisconsin -- Madison
Ph. 225.892.3192

Member

gidden commented Mar 5, 2014

On Tue, Mar 4, 2014 at 10:46 PM, Robert Carlsen notifications@github.comwrote:

+1 for tests. I also would like to award anthony a code destroyer medal.
Code is the enemy.

@gidden https://github.com/gidden - who is in your new profile pic?

A friend of mine named Nic. This was on a glacier lake tour at the bottom
of South America.

Reply to this email directly or view it on GitHubhttps://github.com/cyclus/cyclus/pull/762#issuecomment-36709809
.

Matthew Gidden
Ph.D. Candidate, Nuclear Engineering
The University of Wisconsin -- Madison
Ph. 225.892.3192

@scopatz

This comment has been minimized.

Show comment
Hide comment
@scopatz

scopatz Mar 5, 2014

Member

+1 for tests.

I completely agree, but I think that is a separate issue.

I also would like to award anthony a code destroyer medal. Code is the enemy.

Thanks! Hopefully I'll get rid of even more tomorrow.

I think this is ready for another look.

Member

scopatz commented Mar 5, 2014

+1 for tests.

I completely agree, but I think that is a separate issue.

I also would like to award anthony a code destroyer medal. Code is the enemy.

Thanks! Hopefully I'll get rid of even more tomorrow.

I think this is ready for another look.

src/composition.cc
+
+ // FIXME this is only here for testing
+ if (atom_.size() == 0)
+ return static_cast<Composition::Ptr>(new Composition(tot_decay, decay_line_));

This comment has been minimized.

@rwcarlsen

rwcarlsen Mar 5, 2014

Member

This should be:

return Composition::Ptr(new Composition(tot_decay, decay_line_));

Composition::Ptr is a smart pointer - so we want to call its constructor. A static cast is wrong.

@rwcarlsen

rwcarlsen Mar 5, 2014

Member

This should be:

return Composition::Ptr(new Composition(tot_decay, decay_line_));

Composition::Ptr is a smart pointer - so we want to call its constructor. A static cast is wrong.

@scopatz

This comment has been minimized.

Show comment
Hide comment
@scopatz

scopatz Mar 5, 2014

Member

ping.

Member

scopatz commented Mar 5, 2014

ping.

@gidden

This comment has been minimized.

Show comment
Hide comment
@gidden

gidden Mar 5, 2014

Member

Looks good. Thanks, @scopatz!

Member

gidden commented Mar 5, 2014

Looks good. Thanks, @scopatz!

gidden added a commit that referenced this pull request Mar 5, 2014

Merge pull request #762 from scopatz/rm-decay
Removed decay data, now with pyne!

@gidden gidden merged commit 825f02b into cyclus:develop Mar 5, 2014

1 check passed

default build and test completed successfully
Details

@scopatz scopatz deleted the scopatz:rm-decay branch Mar 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment