00001 /* 00002 * ******** fete: From ENDF To ENDL ********* 00003 * 00004 * Copyright (c) 2006, The Regents of the University of California. 00005 * All rights reserved. 00006 * 00007 * Produced at the Lawrence Livermore National Laboratory. 00008 * Written by David A. Brown, Gerry Hedstrom, Tony Hill 00009 * 00010 * This file is part of fete v1.0 (UCRL-CODE-218718) 00011 * 00012 * Please read the COPYING file for "Our Notice and GNU General 00013 * Public License" in the root of this software distribution. 00014 * 00015 * This program is free software; you can redistribute it and/or modify 00016 * it under the terms of the GNU General Public License (as published by 00017 * the Free Software Foundation) version 2, dated June 1991. 00018 * 00019 * This program is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms 00022 * and conditions of the GNU General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU General Public License along 00025 * with this program; if not, write to the Free Software Foundation, Inc., 00026 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00027 * 00028 * $Revision: 1838 $ 00029 * $Date: 2006-04-11 16:20:40 -0700 (Tue, 11 Apr 2006) $ 00030 * $Author: hedstrom $ 00031 * $Id: mf6classes.hpp 1838 2006-04-11 23:20:40Z hedstrom $ 00032 * 00033 * ******** fete: From ENDF To ENDL ********* 00034 */ 00035 00036 // header for the classes used in translating the MF=6 files 00037 00038 #ifndef MF6CLASSES 00039 #define MF6CLASSES 00040 00041 #include <cmath> 00042 00043 #include "list_3d.hpp" 00044 #include "mappings.hpp" 00045 #include "nuclei.hpp" 00046 #include "ENDF_file.hpp" 00047 #include "math_util.hpp" // for the Param class 00048 #include "multiplicity.hpp" 00049 00050 // ----------- class mf6_one_d ----------------- 00051 //! This class is for the 1-dimensional lists of (energy, probability density) used for double-differential data. 00052 class mf6_one_d : public distrib_base 00053 { 00054 public: 00055 // constructor 00056 mf6_one_d(); 00057 00058 // destructor 00059 ~mf6_one_d() {} 00060 00061 // to map between center-of-mass and laboratory coordinates 00062 mappings *map_; 00063 00064 inline void copy_map( mappings *Map ) 00065 { 00066 map_ = Map; 00067 } 00068 00069 // for a given mu make Num+1 new links for secondary 00070 // energies min_E <= E <= max_E 00071 //! Generates new links in outgoing particle energy for a given angle cosine 00072 void one_E_row( double min_E, double max_E ); 00073 00074 }; 00075 00076 // ----------- class one_d_phase ----------------- 00077 //! One (E', probability) list for the N-body phase-space distribution 00078 class one_d_phase : public mf6_one_d 00079 { 00080 public: 00081 double Ei_max; 00082 double exponent; 00083 00084 //! The phase-space probability distribution 00085 double f( double E ); 00086 }; 00087 00088 // ----------- class two_d_phase ----------------- 00089 //! Class for one incident energy for the N-body phase-space distribution 00090 class two_d_phase : public three_d_link< one_d_phase > 00091 { 00092 public: 00093 double Ei_max_; 00094 double exponent_; 00095 00096 // ********* implement virtual functions ******************* 00097 //! Append a new one_d_phase and set its parameters 00098 two_d_phase::iterator new_one_d( two_d_phase::iterator where ); 00099 // ********** end of virtual functions ********************* 00100 }; 00101 00102 // ----------- class phase_space ----------------- 00103 //! Class for the N-body phase-space distribution 00104 class phase_space : public three_d_list< two_d_phase > 00105 { 00106 private: 00107 double mass_ratio; // (total_mass - particle_mass)/total_mass 00108 double Q; // energy of the reaction 00109 double exponent__; // 1.5*n - 4 00110 00111 //! Handles one incident neutron energy 00112 void one_E_in( double e_in ); 00113 00114 //! Finds the transition from forward to omnidirectional emission 00115 double find_E_trans( ); 00116 00117 public: 00118 //! Constructor identifies the participating particles in the reaction 00119 phase_space( int projectile, int target, int ZAP ); 00120 ~phase_space() {} 00121 00122 //! Reads the data and expands it into a list 00123 void expand_data( mf6_file& inFile, multiplicity& multiple ); 00124 00125 //! Expand data for a single incident neutron energy 00126 void expand_E_in( phase_space::iterator e_in_link ); 00127 00128 }; 00129 00130 // ----------- class two_d_ENDL_table ----------------- 00131 //! Class for one incident energy for the LAW=7 double differential table 00132 class two_d_ENDL_table : public three_d_link< one_d_table > 00133 { 00134 public: 00135 00136 // ********* implement virtual functions ******************* 00137 //! Append a new one_d_ENDL_tablep 00138 two_d_ENDL_table::iterator 00139 new_one_d( two_d_ENDL_table::iterator where ); 00140 // ********** end of virtual functions ********************* 00141 }; 00142 00143 // ----------- class ENDL_table ----------------- 00144 //! Class for the LAW=7 double differential table 00145 class ENDL_table : public three_d_list< two_d_ENDL_table > 00146 { 00147 private: 00148 //! There is no ENDL_table probability function 00149 inline double get_f(Pair& E_mu) 00150 { 00151 return 0.0; 00152 } 00153 00154 public: 00155 //! Default constructor 00156 ENDL_table( ); 00157 //! Default destructor 00158 ~ENDL_table( ) {} 00159 00160 //! Reads all the data 00161 void read_data( mf6_file& inFile, int ZAP, 00162 multiplicity& multiple ); 00163 00164 //! Reads the data for one incident energy 00165 void one_E_in( mf6_file& inFile ); 00166 00167 }; 00168 00169 // ----------- class Legendre_item ----------------- 00170 //! Class holding Legendre coefficients for the mf6, LAW=1, LANG=1 Legendre expansions 00171 class Legendre_item 00172 { 00173 public: 00174 //! Default constructor 00175 Legendre_item( ); 00176 00177 //! Default destructor 00178 ~Legendre_item( ) {} 00179 00180 //! Energy of the outgoing particle 00181 double E_out; 00182 00183 //! The Legendre coefficients 00184 Param coefs; 00185 00186 //! Reads a set of data 00187 //! Sets *E_out_done = true if the outgoing energy is too big 00188 void read_coefs( int i_start, string& linebuff, int order, 00189 mf6_file& inFile, bool *E_out_done ); 00190 00191 //! Copies the Legendre coefficients 00192 void copy_coef( Legendre_item& copy_from ); 00193 00194 //! Interpolates the coefficients between next_link and the previous one 00195 void interpolate( Legendre_item& prev_item, 00196 Legendre_item& next_item ); 00197 }; 00198 00199 // ----------- class Legendre_list ----------------- 00200 //! Class holding an array of Legendre coefficients for the mf6, LAW=1, LANG=1 Legendre expansions 00201 class Legendre_list : public list< Legendre_item > 00202 { 00203 private: 00204 // insert zero links from E0 to the head 00205 void pad_head( double E0 ); 00206 00207 // append zero links up to E0 00208 void pad_tail( double E0 ); 00209 00210 public: 00211 //! Energy of the incident particle 00212 double E_in; 00213 00214 //! The Legendre order 00215 int order; 00216 00217 // type of interpolation between this list and the previous one 00218 int interp_type; 00219 00220 // for the unit_base transformation 00221 double least_E; 00222 double most_E; 00223 00224 //! Default destructor 00225 inline ~Legendre_list( ) {} 00226 00227 //! Reads the data 00228 //! Sets *done = true if the incident energy is too big 00229 void read_data( int LEP, mf6_file& inFile, bool *done ); 00230 00231 //! We have only gamma lines---no continuum 00232 void only_lines( one_d_table& gamma_lines ); 00233 00234 //! We have gamma lines and continuum 00235 void add_lines( one_d_table& gamma_lines ); 00236 00237 //! Gets the norm with respect to E_out. 00238 double get_norm( ); 00239 00240 //! Removes jump discontinuities 00241 void widen_jumps( ); 00242 00243 //! Utility code used by widen_jumps 00244 void widen_cluster( Legendre_list::iterator cluster_start, 00245 Legendre_list::iterator cluster_end, int cluster_size, double jump_width ); 00246 00247 //! Sets the norm with respect to E_out to 1. 00248 void renorm( ); 00249 00250 //! Expands the interpolation with respect to energy of the outgoing particle 00251 void expand_interp( int LEP ); 00252 00253 // make sure that there are links for each energy in E_out_list 00254 void fill_with( list< double >& E_out_list ); 00255 00256 //! deletes entries with E_out > max_E_out 00257 void chop_E_out( double max_E_out ); 00258 00259 //! Transforms to unit base 0 <= E' <= 1 00260 void unit_base( ); 00261 00262 //! Undoes the unit-base transformation 00263 void rescale( ); 00264 00265 //! operator*=, used in interpolation 00266 Legendre_list& operator*=( double alpha ); 00267 00268 //! operator+=, used in interpolation 00269 Legendre_list& operator+=( Legendre_list& to_add ); 00270 00271 //! Copies the Legendre coefficients 00272 void copy( Legendre_list& to_add ); 00273 00274 // print for debugging 00275 void print( ); 00276 }; 00277 00278 // ----------- class mf6_Legendre_raw ----------------- 00279 //! Class holding all of the mf6 Legendre data in ENDF format 00280 class mf6_Legendre_raw : public list<Legendre_list> 00281 { 00282 public: 00283 // The interpolation information 00284 vector<int> NBT; 00285 vector<int> INT; 00286 00287 //! Default destructor 00288 inline ~mf6_Legendre_raw( ) {} 00289 00290 //! Reads the data 00291 void read_data( int NR, int num_E_in, int LEP, mf6_file& inFile ); 00292 00293 //! Gets the maximum Legendre order 00294 int get_max_order( ); 00295 00296 //! Normalizes all of the lists 00297 void renorm( ); 00298 00299 //! Removes jump discontinuities 00300 void widen_jumps( ); 00301 00302 //! Expands the interpolation for the ENDF lists 00303 void expand_interp( ); 00304 00305 //! deletes entries with E_in > max_E_in 00306 void chop_E_in( double max_E_in ); 00307 00308 //! Inserts a new interpolated link 00309 void interpolate( double E_in, 00310 mf6_Legendre_raw::iterator prev_ptr, 00311 mf6_Legendre_raw::iterator next_ptr ); 00312 00313 //! deletes entries with E_out > max_E_out 00314 void chop_E_out( double max_E_out ); 00315 00316 //! For debugging 00317 void print( ); 00318 }; 00319 00320 // ----------- class mf6_one_order ----------------- 00321 //! Class for one the Legendre order for mf6, LAW=1, LANG=1 00322 class mf6_one_order : public two_d_table 00323 { 00324 public: 00325 //! Checks whether all coefficients are zero at this order 00326 bool null_coefs( ); 00327 }; 00328 00329 // ----------- class mf6_Legendre ----------------- 00330 //! Class for the mf6, LAW=1, LANG=1 Legendre expansions 00331 class mf6_Legendre 00332 { 00333 private: 00334 // the multiplicity (used mostly for gammas) 00335 multiplicity multiple; 00336 00337 // a class for all of the ENDF/B-VI data 00338 mf6_Legendre_raw ENDF_data; 00339 00340 // an stl::vector to hold the data in ENDL order 00341 vector<mf6_one_order> ENDL_data; 00342 00343 int order; // Legendre order 00344 00345 public: 00346 //! Default constructor 00347 mf6_Legendre( ) {} 00348 00349 //! Default destructor 00350 ~mf6_Legendre( ) {} 00351 00352 //! Handles all the data 00353 void master( mf6_file& inFile, int LEP, int NR, int NE, bool res_copy ); 00354 00355 //! Converts to ENDL format 00356 void reformat( ); 00357 00358 //! Reduces the order if high-order Legendre coefficients are all zero 00359 void reduce_order( ); 00360 00361 //! Prints the ENDL file 00362 void write_endl( ); 00363 }; 00364 00365 00366 #endif