00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include "mf5classes.hpp"
00039 #include "global_params.hpp"
00040
00041 extern ENDLClass ENDL;
00042 extern GlobalParameterClass Global;
00043
00044
00045
00046 void mf5_table::read_data( mf5_file& inFile, int NR, int NP )
00047
00048
00049
00050 {
00051 duplicate_Ein = false;
00052
00053 if( ENDL.S == 7 )
00054 {
00055
00056 }
00057 else
00058 {
00059
00060 inFile.get_regions( NR, _weight.NBT, _weight.INT );
00061
00062 _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00063 _weight.expand_interp( ENDL.Max_E_in );
00064 }
00065
00066 int iZERO, NE;
00067 double ZERO;
00068
00069 inFile.read_line2( &ZERO, &iZERO, &NR, &NE );
00070
00071
00072 inFile.get_regions(NR, NBT, INT);
00073
00074 for (int iNE=0; iNE < NE; iNE++ )
00075 {
00076 one_E_in(inFile);
00077 }
00078
00079 set_interp();
00080 if((NR > 1) || (INT[0] != 2))
00081 {
00082 table_interp( );
00083
00084 thinit( );
00085 }
00086 }
00087
00088
00089 void mf5_table::one_E_in(mf5_file& inFile)
00090
00091 {
00092 double ZERO;
00093 int iZERO;
00094
00095 string linebuff;
00096 string strbuff;
00097
00098 double E_1;
00099 int NR;
00100 int NP;
00101
00102 getline( inFile, linebuff );
00103 read_ddiiii(&linebuff, &ZERO,
00104 &E_1,
00105 &iZERO,
00106 &iZERO,
00107 &NR ,
00108 &NP);
00109
00110 if( NP < 1 )
00111 {
00112 SevereError("mf5_table::one_E_in",
00113 pastenum("Negative number of data points ",NP)+"in mf5_table class.");
00114 }
00115
00116
00117
00118 one_d_table new_link;
00119
00120
00121 insert(end(), new_link);
00122 two_d_iterator this_link = end();
00123 --this_link;
00124
00125
00126 this_link->E_in() = E_1 * ENDL.eV2MeV;
00127
00128
00129 inFile.get_regions(NR, this_link->NBT, this_link->INT);
00130
00131
00132 double prev_x = -1.0;
00133 for( int iNP=0; iNP < NP; iNP++ )
00134 {
00135 int iP=iNP % 3;
00136 if ( iP == 0 )
00137 {
00138 getline( inFile, linebuff);
00139 }
00140 strbuff = linebuff.substr(iP*22, 22);
00141 double X,Y;
00142 read_dd(&strbuff, &X, &Y );
00143 if ( X==-999. || Y==-999. )
00144 {
00145 SevereError("mf5_table::one_E_in","read_PAIR fucked up!");
00146 }
00147 else
00148 {
00149 X *= ENDL.eV2MeV;
00150 Y /= ENDL.eV2MeV;
00151 if( X < prev_x ){
00152 SevereError( "mf5_table::one_E_in",
00153 pastenum( "energy out of order: ", X ) );
00154 }
00155 else if( X == prev_x ){
00156 duplicate_Ein = true;
00157 Warning( "mf5_table::one_E_in",
00158 pastenum( "duplicate outgoing energy: ", prev_x ) );
00159 }
00160 dd_link XYdata( X, Y );
00161 this_link->insert(this_link->end(), XYdata);
00162 prev_x = X;
00163 }
00164 }
00165
00166 this_link->expand_interp( ENDL.Max_E_out );
00167 if (this_link->needs_widening()) this_link->widen_jumps( 0.0 );
00168 this_link->renorm( );
00169 if( ENDL.S != 7 )
00170 {
00171 this_link->weight = _weight.evaluate( this_link->E_in() );
00172 }
00173 }
00174
00175 void mf5_table::table_interp( )
00176
00177
00178 {
00179 if(INT[0] == -7)
00180 {
00181 SevereError("mf5_table::table_interp","table_interp called twice");
00182 }
00183
00184
00185 for( mf5_table::iterator this_link = begin();
00186 this_link != end(); ++this_link )
00187 {
00188 this_link->get_bins();
00189 }
00190
00191 thicken();
00192
00193
00194 INT[0] = -7;
00195 }
00196
00197
00198
00199 two_d_evap::two_d_evap()
00200
00201 {
00202 UU = -10.0;
00203 Max_energy = ENDL.Max_E_in;
00204 }
00205
00206 two_d_evap::two_d_evap(double U)
00207
00208 {
00209 UU = U*ENDL.eV2MeV;
00210 Max_energy = ENDL.Max_E_in;
00211 }
00212
00213 two_d_evap::~two_d_evap()
00214
00215 {
00216 }
00217
00218 void two_d_evap::make_list()
00219
00220 {
00221 const double EPS = Global.Value( "mf5_tol" );
00222
00223 dd_list::iterator theta_ptr = _theta.begin();
00224 bool pass_maxE = false;
00225
00226
00227 if (theta_ptr->x > Max_energy)
00228 {
00229 ENDL.write_file = false;
00230 }
00231 else
00232 {
00233
00234 for( ; ( (theta_ptr!= _theta.end()) && !pass_maxE );
00235 ++theta_ptr)
00236 {
00237
00238 if(theta_ptr->x > Max_energy)
00239 {
00240 pass_maxE = true;
00241 }
00242
00243 insert(end(), theta_ptr->x, theta_ptr->y);
00244
00245
00246 if(theta_ptr->x > (1 - EPS)*Max_energy)
00247 {
00248 break;
00249 }
00250 }
00251
00252 set_interp();
00253
00254
00255 if( pass_maxE )
00256 {
00257 chop_highE( Max_energy );
00258 }
00259
00260 thicken();
00261
00262
00263 renorm();
00264 }
00265 }
00266
00267 void two_d_evap::read_data(mf5_file& inFile, int NR, int NP)
00268
00269
00270 {
00271 duplicate_Ein = false;
00272
00273 string linebuff;
00274 string strbuff;
00275 dd_link XYdata;
00276
00277
00278 inFile.get_regions(NR, _weight.NBT, _weight.INT);
00279
00280 _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00281 _weight.expand_interp( ENDL.Max_E_in );
00282
00283
00284 double zero;
00285 int izero;
00286 int nr, np;
00287 inFile.read_line2(&zero, &izero, &nr, &np);
00288
00289
00290 inFile.get_regions(nr, NBT, INT);
00291
00292
00293 double prev_x = -1.0;
00294 for( int iNP=0; iNP < np; iNP++ )
00295 {
00296 int iP=iNP % 3;
00297 if ( iP == 0 )
00298 {
00299 getline( inFile, linebuff);
00300 }
00301 strbuff = linebuff.substr(iP*22, 22);
00302 read_dd(&strbuff, &XYdata.x, &XYdata.y );
00303
00304 XYdata.x *= ENDL.eV2MeV;
00305 XYdata.y *= ENDL.eV2MeV;
00306 if( XYdata.x < prev_x ){
00307 SevereError( "two_d_evap::read_data",
00308 pastenum( "energy out of order: ", XYdata.x ) );
00309 }
00310 else if( XYdata.x == prev_x ){
00311 duplicate_Ein = true;
00312 Warning( "two_d_evap::read_data",
00313 pastenum( "duplicate energy: ", prev_x ) );
00314 }
00315 _theta.insert(_theta.end(), XYdata);
00316 prev_x = XYdata.x;
00317 }
00318 }
00319
00320 void two_d_evap::insert(two_d_iterator where, double e_in, double Theta)
00321
00322 {
00323 one_d_evap new_link;
00324
00325
00326 two_d_list<one_d_evap>::insert(where, new_link);
00327
00328
00329 two_d_iterator this_link = where;
00330 --this_link;
00331 this_link->weight = _weight.evaluate( e_in );
00332 this_link->initiate(e_in, Theta, UU);
00333 }
00334
00335
00336 two_d_Maxwell::two_d_Maxwell()
00337
00338 {
00339 UU = -10.0;
00340 Max_energy = ENDL.Max_E_in;
00341 }
00342
00343 two_d_Maxwell::two_d_Maxwell(double U)
00344
00345 {
00346 UU = U*ENDL.eV2MeV;
00347 Max_energy = ENDL.Max_E_in;
00348 }
00349
00350 two_d_Maxwell::~two_d_Maxwell()
00351
00352 {
00353 }
00354
00355 void two_d_Maxwell::make_list()
00356
00357 {
00358 const double EPS = Global.Value( "mf5_tol" );
00359
00360 dd_list::iterator theta_ptr = _theta.begin();
00361 bool pass_maxE = false;
00362
00363
00364 if (theta_ptr->x > Max_energy)
00365 {
00366 ENDL.write_file = false;
00367 }
00368 else
00369 {
00370
00371 for( ; ( (theta_ptr!= _theta.end()) && !pass_maxE );
00372 ++theta_ptr)
00373 {
00374
00375 if(theta_ptr->x > Max_energy)
00376 {
00377 pass_maxE = true;
00378 }
00379
00380 insert(end(), theta_ptr->x, theta_ptr->y);
00381
00382
00383 if(theta_ptr->x > (1 - EPS)*Max_energy)
00384 {
00385 break;
00386 }
00387 }
00388
00389 set_interp();
00390
00391
00392 if( pass_maxE )
00393 {
00394 chop_highE( Max_energy );
00395 }
00396
00397 thicken();
00398
00399
00400 renorm();
00401 }
00402 }
00403
00404 void two_d_Maxwell::read_data(mf5_file& inFile, int NR, int NP)
00405
00406
00407 {
00408 duplicate_Ein = false;
00409
00410 string linebuff;
00411 string strbuff;
00412 dd_link XYdata;
00413
00414
00415 inFile.get_regions(NR, _weight.NBT, _weight.INT);
00416
00417 _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00418 _weight.expand_interp( ENDL.Max_E_in );
00419
00420
00421 double zero;
00422 int izero;
00423 int nr, np;
00424 inFile.read_line2(&zero, &izero, &nr, &np);
00425 double prev_x = -1.0;
00426
00427 inFile.get_regions(nr, NBT, INT);
00428
00429
00430 for( int iNP=0; iNP < np; iNP++ )
00431 {
00432 int iP=iNP % 3;
00433 if ( iP == 0 )
00434 {
00435 getline( inFile, linebuff);
00436 }
00437 strbuff = linebuff.substr(iP*22, 22);
00438 read_dd(&strbuff, &XYdata.x, &XYdata.y );
00439
00440 XYdata.x *= ENDL.eV2MeV;
00441 XYdata.y *= ENDL.eV2MeV;
00442 if( XYdata.x < prev_x ){
00443 SevereError( "two_d_Maxwell::read_data",
00444 pastenum( "energy out of order: ", XYdata.x ) );
00445 }
00446 else if( XYdata.x == prev_x ){
00447 duplicate_Ein = true;
00448 Warning( "two_d_Maxwell::read_data",
00449 pastenum( "duplicate energy: ", prev_x ) );
00450 }
00451 _theta.insert(_theta.end(), XYdata);
00452 prev_x = XYdata.x;
00453 }
00454 }
00455
00456 void two_d_Maxwell::insert(two_d_iterator where, double e_in, double Theta)
00457
00458 {
00459 one_d_Maxwell new_link;
00460
00461
00462 two_d_list<one_d_Maxwell>::insert(where, new_link);
00463
00464
00465 two_d_iterator this_link = where;
00466 --this_link;
00467 this_link->initiate(e_in, Theta, UU);
00468 this_link->weight = _weight.evaluate( this_link->E_in() );
00469 }
00470
00471
00472 two_d_Watt::two_d_Watt()
00473
00474 {
00475 UU = -10.0;
00476 Max_energy = ENDL.Max_E_in;
00477 }
00478
00479 two_d_Watt::two_d_Watt(double U)
00480
00481 {
00482 UU = U*ENDL.eV2MeV;
00483 Max_energy = ENDL.Max_E_in;
00484 }
00485
00486 two_d_Watt::~two_d_Watt()
00487
00488 {
00489 }
00490
00491 void two_d_Watt::make_list()
00492
00493 {
00494 const double EPS = Global.Value( "mf5_tol" );
00495
00496 dd_list::iterator a_ptr = Watt_a.begin();
00497 dd_list::iterator b_ptr = Watt_b.begin();
00498 bool pass_maxE = false;
00499
00500
00501 if (a_ptr->x > Max_energy)
00502 {
00503 ENDL.write_file = false;
00504 }
00505 else
00506 {
00507
00508 for( ; ( (a_ptr != Watt_a.end()) && !pass_maxE ); ++a_ptr )
00509 {
00510
00511 if(a_ptr->x > Max_energy)
00512 {
00513 pass_maxE = true;
00514 }
00515
00516 insert( end(), a_ptr->x, a_ptr->y );
00517
00518
00519 if(a_ptr->x > (1 - EPS)*Max_energy)
00520 {
00521 break;
00522 }
00523 }
00524
00525 set_interp();
00526
00527
00528 set_b();
00529
00530
00531 if( pass_maxE )
00532 {
00533 chop_highE( Max_energy );
00534 }
00535
00536 thicken();
00537
00538
00539 renorm();
00540 }
00541 }
00542
00543 void two_d_Watt::read_data(mf5_file& inFile, int NR, int NP)
00544
00545
00546 {
00547 duplicate_Ein = false;
00548
00549 string linebuff;
00550 string strbuff;
00551 dd_link XYdata;
00552
00553
00554 inFile.get_regions(NR, _weight.NBT, _weight.INT);
00555
00556
00557 _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00558 _weight.expand_interp( ENDL.Max_E_in );
00559
00560
00561 double zero;
00562 int izero;
00563 int nr, np;
00564 inFile.read_line2(&zero, &izero, &nr, &np);
00565
00566
00567 inFile.get_regions(nr, NBT, INT);
00568
00569
00570 double prev_x = -1.0;
00571 for( int iNP=0; iNP < np; iNP++ )
00572 {
00573 int iP=iNP % 3;
00574 if ( iP == 0 )
00575 {
00576 getline( inFile, linebuff);
00577 }
00578 strbuff = linebuff.substr(iP*22, 22);
00579 read_dd(&strbuff, &XYdata.x, &XYdata.y );
00580
00581 XYdata.x *= ENDL.eV2MeV;
00582 XYdata.y *= ENDL.eV2MeV;
00583 if( XYdata.x < prev_x ){
00584 SevereError( "two_d_Watt::read_data",
00585 pastenum( "energy out of order: ", XYdata.x ) );
00586 }
00587 else if( XYdata.x == prev_x ){
00588 duplicate_Ein = true;
00589 Warning( "two_d_Watt::read_data",
00590 pastenum( "duplicate energy: ", prev_x ) );
00591 }
00592 Watt_a.insert(Watt_a.end(), XYdata);
00593 prev_x = XYdata.x;
00594 }
00595
00596
00597 inFile.read_line2(&zero, &izero, &nr, &np);
00598
00599
00600 inFile.get_regions(nr, Watt_b.NBT, Watt_b.INT);
00601
00602
00603 for( int iNP=0; iNP < np; iNP++ )
00604 {
00605 int iP=iNP % 3;
00606 if ( iP == 0 )
00607 {
00608 getline( inFile, linebuff);
00609 }
00610 strbuff = linebuff.substr(iP*22, 22);
00611 read_dd(&strbuff, &XYdata.x, &XYdata.y );
00612
00613 XYdata.x *= ENDL.eV2MeV;
00614 XYdata.y /= ENDL.eV2MeV;
00615 Watt_b.insert(Watt_b.end(), XYdata);
00616 }
00617
00618 fill_in_lists(Watt_a, Watt_b);
00619 }
00620
00621 void two_d_Watt::insert( two_d_iterator where, double e_in, double a )
00622
00623 {
00624 one_d_Watt new_link;
00625
00626
00627 two_d_list<one_d_Watt>::insert(where, new_link);
00628
00629
00630 two_d_iterator this_link = where;
00631 --this_link;
00632 this_link->set_EUa( e_in, UU, a );
00633 this_link->weight = _weight.evaluate( this_link->E_in() );
00634 }
00635
00636 void two_d_Watt::set_b( )
00637
00638 {
00639 const double EPS = Global.Value( "mf5_tol" );
00640 dd_list::iterator a_ptr = Watt_a.begin();
00641 dd_list::iterator b_ptr = Watt_b.begin();
00642
00643 double E_a = a_ptr->x;
00644 double E_b = b_ptr->x;
00645 if( abs( E_a - E_b ) > EPS*E_a )
00646 {
00647 SevereError("two_d_Watt::set_b",
00648 "Watt a and b lists should start at the same energies.");
00649 }
00650
00651 int n_NBT = 0;
00652
00653 two_d_Watt::iterator list_ptr = begin();
00654 list_ptr->same_b( b_ptr->y, Watt_b.INT[ n_NBT ] );
00655
00656
00657 ++a_ptr;
00658 ++b_ptr;
00659 E_a = a_ptr->x;
00660 E_b = b_ptr->x;
00661 int b_count = 1;
00662
00663
00664 for( ++list_ptr; list_ptr != end(); )
00665 {
00666
00667 if( abs( E_a - E_b ) < EPS*E_a )
00668 {
00669 list_ptr->same_b( b_ptr->y, Watt_b.INT[ n_NBT ] );
00670
00671
00672 ++a_ptr;
00673 ++b_ptr;
00674 E_a = a_ptr->x;
00675 E_b = b_ptr->x;
00676 ++list_ptr;
00677 ++b_count;
00678 if( b_count >= Watt_b.NBT[ n_NBT ] )
00679 {
00680 ++n_NBT;
00681 }
00682 }
00683 else if( E_b < E_a )
00684 {
00685
00686 one_d_Watt new_link;
00687
00688
00689 two_d_list<one_d_Watt>::insert(list_ptr, new_link);
00690 two_d_iterator this_link = list_ptr;
00691 --this_link;
00692
00693
00694 dd_list::iterator prev_a = a_ptr;
00695 --prev_a;
00696 double a_value = Watt_a.interp( E_b, *prev_a, *a_ptr,
00697 list_ptr->interp_type );
00698 this_link->weight = _weight.evaluate( this_link->E_in() );
00699 this_link->intermediate_b( E_b, UU, a_value,
00700 list_ptr->interp_type, b_ptr->y, Watt_b.INT[ n_NBT ] );
00701
00702
00703 ++b_ptr;
00704 E_b = b_ptr->x;
00705 ++b_count;
00706 if( b_count >= Watt_b.NBT[ n_NBT ] )
00707 {
00708 ++n_NBT;
00709 }
00710 }
00711 else
00712 {
00713
00714 dd_list::iterator prev_b = b_ptr;
00715 --prev_b;
00716 double b_value = Watt_b.interp( E_a, *prev_b, *b_ptr,
00717 Watt_b.INT[ n_NBT ] );
00718 list_ptr->same_b( b_value, Watt_b.INT[ n_NBT ] );
00719
00720
00721 ++a_ptr;
00722 E_a = a_ptr->x;
00723 ++list_ptr;
00724 }
00725 }
00726 }
00727
00728
00729 two_d_Madland::two_d_Madland()
00730
00731 {
00732 EFL_ = -10.0;
00733 EFH_ = -10.0;
00734 Max_energy = ENDL.Max_E_in;
00735 }
00736
00737 two_d_Madland::~two_d_Madland()
00738
00739 {
00740 }
00741
00742 void two_d_Madland::make_list()
00743
00744 {
00745 const double EPS = Global.Value( "mf5_tol" );
00746
00747 dd_list::iterator TM_ptr = Madland_TM.begin();
00748 bool pass_maxE = false;
00749
00750
00751 if (TM_ptr->x > Max_energy)
00752 {
00753 ENDL.write_file = false;
00754 }
00755 else
00756 {
00757
00758 for( ; ( (TM_ptr != Madland_TM.end()) && !pass_maxE );
00759 ++TM_ptr)
00760 {
00761
00762 if(TM_ptr->x > Max_energy)
00763 {
00764 pass_maxE = true;
00765 }
00766
00767 insert(end(), TM_ptr->x, TM_ptr->y);
00768
00769
00770 if(TM_ptr->x > (1 - EPS)*Max_energy)
00771 {
00772 break;
00773 }
00774 }
00775 }
00776
00777 set_interp();
00778
00779
00780 if( pass_maxE )
00781 {
00782 chop_highE( Max_energy );
00783 }
00784
00785 thicken();
00786 }
00787
00788 void two_d_Madland::read_data(mf5_file& inFile, int NR, int NP)
00789
00790
00791 {
00792 duplicate_Ein = false;
00793
00794 string linebuff;
00795 string strbuff;
00796 dd_link XYdata;
00797
00798
00799 inFile.get_regions(NR, _weight.NBT, _weight.INT);
00800
00801
00802 _weight.read_data( inFile, NP, ENDL.eV2MeV, 1.0 );
00803 _weight.expand_interp( ENDL.Max_E_in );
00804
00805
00806 int nr, ne;
00807 double EFL, EFH;
00808 inFile.read_Madland( &EFL, &EFH, &nr, &ne);
00809 set_EF( EFL, EFH );
00810
00811
00812 inFile.get_regions(nr, NBT, INT);
00813
00814
00815 double prev_x = -1.0;
00816 for( int iNE=0; iNE < ne; iNE++ )
00817 {
00818 int iP=iNE % 3;
00819 if ( iP == 0 )
00820 {
00821 getline( inFile, linebuff);
00822 }
00823 strbuff = linebuff.substr(iP*22, 22);
00824 read_dd(&strbuff, &XYdata.x, &XYdata.y );
00825
00826 XYdata.x *= ENDL.eV2MeV;
00827 XYdata.y *= ENDL.eV2MeV;
00828 if( XYdata.x < prev_x ){
00829 SevereError( "two_d_Madland::read_data",
00830 pastenum( "energy out of order: ", XYdata.x ) );
00831 }
00832 else if( XYdata.x == prev_x ){
00833 duplicate_Ein = true;
00834 Warning( "two_d_Madland::read_data",
00835 pastenum( "duplicate energy: ", prev_x ) );
00836 }
00837 Madland_TM.insert(Madland_TM.end(), XYdata);
00838 prev_x = XYdata.x;
00839 }
00840 }
00841
00842 void two_d_Madland::insert(two_d_iterator where, double e_in, double TM)
00843
00844 {
00845 one_d_Madland new_link;
00846
00847
00848 two_d_list<one_d_Madland>::insert(where, new_link);
00849
00850
00851 two_d_iterator this_link = where;
00852 --this_link;
00853 this_link->initiate( e_in, EFL_, EFH_, TM );
00854 this_link->weight = _weight.evaluate( this_link->E_in() );
00855 }
00856
00857
00858 add_them_up:: add_them_up( int NK )
00859 {
00860 NK_ = NK;
00861
00862
00863 table_vec = new mf5_table[ NK ];
00864 evap_vec = new two_d_evap[ NK ];
00865 Maxwell_vec = new two_d_Maxwell[ NK ];
00866 Watt_vec = new two_d_Watt[ NK ];
00867 Madland_vec = new two_d_Madland[ NK ];
00868
00869 num_table = 0;
00870 num_evap = 0;
00871 num_Maxwell = 0;
00872 num_Watt = 0;
00873 num_Madland = 0;
00874
00875
00876 debug_ = false;
00877 }
00878
00879 add_them_up::~add_them_up( )
00880 {
00881 if( num_table > 0 )
00882 {
00883 delete [] table_vec;
00884 }
00885 if( num_evap > 0 )
00886 {
00887 delete [] evap_vec;
00888 }
00889 if( num_Maxwell > 0 )
00890 {
00891 delete [] Maxwell_vec;
00892 }
00893 if( num_Watt > 0 )
00894 {
00895 delete [] Watt_vec;
00896 }
00897 if( num_Madland > 0 )
00898 {
00899 delete [] Madland_vec;
00900 }
00901 }
00902
00903
00904 void add_them_up::manager( mf5_file& inFile )
00905 {
00906
00907 for( int j = 0; j < NK_; ++j )
00908 {
00909 one_model( inFile );
00910 }
00911
00912
00913 common_Ein( );
00914
00915
00916 wt_add( );
00917
00918
00919 check_total_wt( );
00920
00921
00922 widen_jumps( );
00923
00924
00925 renorm( );
00926 if (ENDL.write_file)
00927 {
00928 write_endl( 4 );
00929 }
00930 }
00931
00932 void add_them_up::one_model( mf5_file& inFile )
00933
00934 {
00935 double U;
00936 int LF, NR, NP;
00937
00938
00939 inFile.read_line2(&U, &LF, &NR, &NP);
00940
00941 if ( LF == 1 )
00942 {
00943
00944 table_vec[num_table].read_data( inFile, NR, NP );
00945 if( table_vec[num_table].duplicate_Ein )
00946 table_vec[num_table].widen_jumps( );
00947
00948 table_vec[num_table].weight_jumps();
00949 ++num_table;
00950 }
00951 else if ( LF == 5 )
00952 {
00953 Warning("add_them_up::one_model","Need new code for LF = 5");
00954 return;
00955 }
00956 else if ( LF == 7 )
00957 {
00958 Maxwell_vec[num_Maxwell].set_U( U );
00959 Maxwell_vec[num_Maxwell].read_data( inFile, NR, NP );
00960 Maxwell_vec[num_Maxwell].make_list();
00961 if( Maxwell_vec[num_Maxwell].duplicate_Ein )
00962 Maxwell_vec[num_Maxwell].widen_jumps( );
00963
00964 Maxwell_vec[num_Maxwell].weight_jumps();
00965 ++num_Maxwell;
00966 }
00967 else if ( LF == 9 )
00968 {
00969 evap_vec[num_evap].set_U( U );
00970 evap_vec[num_evap].read_data( inFile, NR, NP );
00971 evap_vec[num_evap].make_list();
00972 if( evap_vec[num_evap].duplicate_Ein )
00973 evap_vec[num_evap].widen_jumps( );
00974
00975 evap_vec[num_evap].weight_jumps();
00976 ++num_evap;
00977 }
00978 else if ( LF == 11 )
00979 {
00980 Watt_vec[num_Watt].set_U( U );
00981 Watt_vec[num_Watt].read_data( inFile, NR, NP );
00982 Watt_vec[num_Watt].make_list();
00983 if( Watt_vec[num_Watt].duplicate_Ein )
00984 Watt_vec[num_Watt].widen_jumps( );
00985
00986 Watt_vec[num_Watt].weight_jumps();
00987 ++num_Watt;
00988 }
00989 else if ( LF == 12 )
00990 {
00991 Madland_vec[num_Madland].read_data( inFile, NR, NP );
00992 Madland_vec[num_Madland].make_list();
00993 if( Madland_vec[num_Madland].duplicate_Ein )
00994 Madland_vec[num_Madland].widen_jumps( );
00995
00996 Madland_vec[num_Madland].weight_jumps();
00997 ++num_Madland;
00998 }
00999 else
01000 {
01001 SevereError("add_them_up::one_model",
01002 pastenum("There is no model for LF = ",LF)+" for MF = 5 data.");
01003 }
01004 }
01005
01006 void add_them_up::common_Ein( )
01007
01008 {
01009 int j;
01010 list< double > E_incident;
01011
01012
01013 for( j = 0; j < num_table; ++j )
01014 {
01015 table_vec[j].collect_Ein( E_incident );
01016 }
01017 for( j = 0; j < num_evap; ++j )
01018 {
01019 evap_vec[j].collect_Ein( E_incident );
01020 }
01021 for( j = 0; j < num_Maxwell; ++j )
01022 {
01023 Maxwell_vec[j].collect_Ein( E_incident );
01024 }
01025 for( j = 0; j < num_Watt; ++j )
01026 {
01027 Watt_vec[j].collect_Ein( E_incident );
01028 }
01029 for( j = 0; j < num_Madland; ++j )
01030 {
01031 Madland_vec[j].collect_Ein( E_incident );
01032 }
01033
01034
01035 E_incident.sort( );
01036 E_incident.unique( );
01037
01038
01039 for( j = 0; j < num_table; ++j )
01040 {
01041 table_vec[j].fill_in_list( E_incident );
01042 }
01043 for( j = 0; j < num_evap; ++j )
01044 {
01045 evap_vec[j].fill_in_list( E_incident );
01046 }
01047 for( j = 0; j < num_Maxwell; ++j )
01048 {
01049 Maxwell_vec[j].fill_in_list( E_incident );
01050 }
01051 for( j = 0; j < num_Watt; ++j )
01052 {
01053 Watt_vec[j].fill_in_list( E_incident );
01054 }
01055 for( j = 0; j < num_Madland; ++j )
01056 {
01057 Madland_vec[j].fill_in_list( E_incident );
01058 }
01059 }
01060
01061 void add_them_up::wt_add( )
01062
01063 {
01064 int j;
01065 bool started = false;
01066
01067
01068 for( j = 0; j < num_table; ++j )
01069 {
01070 if( started )
01071 {
01072 sum_lists( *this, table_vec[j] );
01073 }
01074 else
01075 {
01076 copy_data( table_vec[j] );
01077 started = true;
01078 use_weight( );
01079 }
01080 }
01081
01082 for( j = 0; j < num_evap; ++j )
01083 {
01084 if( started )
01085 {
01086 sum_lists( *this, evap_vec[j] );
01087 }
01088 else
01089 {
01090 copy_data( evap_vec[j] );
01091 started = true;
01092 use_weight( );
01093 }
01094 }
01095
01096 for( j = 0; j < num_Maxwell; ++j )
01097 {
01098 if( started )
01099 {
01100 sum_lists( *this, Maxwell_vec[j] );
01101 }
01102 else
01103 {
01104 copy_data( Maxwell_vec[j] );
01105 started = true;
01106 use_weight( );
01107 }
01108 }
01109
01110 for( j = 0; j < num_Watt; ++j )
01111 {
01112 if( started )
01113 {
01114 sum_lists( *this, Watt_vec[j] );
01115 }
01116 else
01117 {
01118 copy_data( Watt_vec[j] );
01119 started = true;
01120 use_weight( );
01121 }
01122 }
01123
01124 for( j = 0; j < num_Madland; ++j )
01125 {
01126 if( started )
01127 {
01128 sum_lists( *this, Madland_vec[j] );
01129 }
01130 else
01131 {
01132 copy_data( Madland_vec[j] );
01133 started = true;
01134 use_weight( );
01135 }
01136 }
01137 }
01138
01139 void add_them_up::check_total_wt( )
01140
01141 {
01142 const double EPS = Global.Value( "mf5_weight_tol" );
01143 for( mf5_table::iterator this_list = begin( );
01144 this_list != end( ); ++this_list )
01145 {
01146 if( abs( this_list->weight - 1.0 ) > EPS )
01147 {
01148 Warning( "add_them_up::check_total_wt",
01149 pastenum( pastenum( "bad total weight for E_in ",
01150 this_list->E_in( ) )+": ",this_list->weight) );
01151 }
01152 }
01153 }
01154
01155
01156
01157 void fission_delay::manager(mf1_file& inFile)
01158
01159 {
01160
01161 read_mf1(inFile);
01162
01163
01164 mf5_file mf5_in;
01165 mf5_in.open(5, 455);
01166 ENDL.set_c_number(15);
01167 ENDL.set_s_number(7);
01168
01169 if( !mf5_in )
01170 {
01171 Info("fission_delay::manager",
01172 "No mf05mt455 file; writing total delayed neutron multiplicity");
01173 ENDL.set_yo(1);
01174 total_mult.widen_jumps();
01175 if ( ENDL.write_file ) total_mult.write_endl( 7 );
01176 return;
01177 }
01178
01179
01180 int ZA;
01181 double AWR;
01182 int NK;
01183 mf5_in.read_line1(&ZA, &AWR, &NK);
01184 if(NK != time_consts.size())
01185 {
01186 SevereError("fission_delay::manager","Wrong count for delayed neutron decay channels");
01187 }
01188
01189
01190 ENDL.append = false;
01191 for(int count = 0; count < NK; ++count)
01192 {
01193
01194 int LF = one_mult(mf5_in, count);
01195 if( LF == 5 )
01196 {
01197
01198 one_gen_evap( mf5_in, count );
01199 }
01200 else if( LF == 1 )
01201 {
01202
01203 one_table( mf5_in, count );
01204 }
01205 else
01206 {
01207 Unimplemented("fission_delay::manager",
01208 pastenum(" Implement model LF = ", LF) );
01209 }
01210 ENDL.append = true;
01211 }
01212 Info("fission_delay::manager","Closing file "+endf_file_name(5, 455)+"...");
01213 mf5_in.close();
01214 ENDL.append = false;
01215 }
01216
01217 void fission_delay::read_mf1(mf1_file& inFile)
01218
01219 {
01220 int NC;
01221 inFile.delay_head(&NC);
01222 time_consts.reserve(NC);
01223 time_consts.resize(NC);
01224
01225 string linebuff;
01226 string strbuff;
01227
01228 for( int iNC=0; iNC < NC; iNC++ )
01229 {
01230 int iC=iNC % 6;
01231 if ( iC == 0 )
01232 {
01233 getline( inFile, linebuff);
01234 }
01235 strbuff = linebuff.substr(iC*11, 11);
01236 read_d(&strbuff, &time_consts[iNC] );
01237 }
01238
01239
01240 int NR;
01241 int NP;
01242 inFile.mult_head(&NR, &NP);
01243
01244
01245 inFile.get_regions(NR, total_mult.NBT, total_mult.INT);
01246 if((NR > 1) || (total_mult.INT[0] != 2))
01247 {
01248 Unimplemented("fission_delay::read_mf1",
01249 "Implement interpolation for delayed fission neutrons");
01250 }
01251
01252
01253 for( int iNP=0; iNP < NP; iNP++ )
01254 {
01255 int iP=iNP % 3;
01256 if ( iP == 0 )
01257 {
01258 getline( inFile, linebuff);
01259 }
01260 strbuff = linebuff.substr(iP*22, 22);
01261 dd_link XYdata;
01262 read_dd(&strbuff, &XYdata.x, &XYdata.y );
01263
01264 XYdata.x *= ENDL.eV2MeV;
01265 total_mult.insert(total_mult.end(), XYdata);
01266 }
01267 }
01268
01269 int fission_delay::one_mult(mf5_file& inFile, int j)
01270
01271 {
01272 double U;
01273 int LF;
01274 int NR;
01275 int NP;
01276 inFile.read_line2(&U, &LF, &NR, &NP);
01277
01278 multiplicity partial_mult;
01279 dd_link XYdata;
01280
01281 inFile.get_regions(NR, partial_mult.NBT, partial_mult.INT);
01282 string linebuff;
01283 string strbuff;
01284
01285 for( int iNP=0; iNP < NP; iNP++ )
01286 {
01287 int iP=iNP % 3;
01288 if ( iP == 0 )
01289 {
01290 getline( inFile, linebuff);
01291 }
01292 strbuff = linebuff.substr(iP*22, 22);
01293 read_dd(&strbuff, &XYdata.x, &XYdata.y );
01294
01295 XYdata.x *= ENDL.eV2MeV;
01296 partial_mult.insert(partial_mult.end(), XYdata);
01297 }
01298 partial_mult *= total_mult;
01299 ENDL.set_c_number(15);
01300 ENDL.set_yo(1);
01301 ENDL.set_s_number(7);
01302 ENDL.set_x1(time_consts[j]);
01303 if ( ENDL.write_file ) partial_mult.write_endl( 7 );
01304
01305 return LF;
01306 }
01307
01308 void fission_delay::one_gen_evap(mf5_file& inFile, int count)
01309
01310
01311 {
01312 two_d_table e_dist;
01313 one_d_table one_E_in;
01314 dd_link XYdata;
01315
01316
01317 e_dist.insert(e_dist.end(), one_E_in);
01318 two_d_table::iterator dist_ptr = e_dist.end();
01319 --dist_ptr;
01320
01321 double U;
01322 int LF;
01323 int NR;
01324 int N_theta;
01325
01326 inFile.read_line2(&U, &LF, &NR, &N_theta);
01327 inFile.get_regions(NR, theta.NBT, theta.INT);
01328 string linebuff;
01329 string strbuff;
01330
01331 for( int iNP=0; iNP < N_theta; iNP++ )
01332 {
01333 int iP=iNP % 3;
01334 if ( iP == 0 )
01335 {
01336 getline( inFile, linebuff);
01337 }
01338 strbuff = linebuff.substr(iP*22, 22);
01339 read_dd(&strbuff, &XYdata.x, &XYdata.y );
01340
01341 XYdata.x *= ENDL.eV2MeV;
01342 theta.insert(theta.end(), XYdata);
01343 }
01344
01345
01346 int NP;
01347 inFile.read_line2(&U, &LF, &NR, &NP);
01348 inFile.get_regions(NR, dist_ptr->NBT, dist_ptr->INT);
01349
01350 for( int iNP=0; iNP < NP; iNP++ )
01351 {
01352 int iP=iNP % 3;
01353 if ( iP == 0 )
01354 {
01355 getline( inFile, linebuff);
01356 }
01357 strbuff = linebuff.substr(iP*22, 22);
01358 read_dd(&strbuff, &XYdata.x, &XYdata.y );
01359
01360 XYdata.x *= ENDL.eV2MeV;
01361 dist_ptr->insert(dist_ptr->end(), XYdata);
01362 }
01363
01364 dist_ptr->expand_interp( ENDL.Max_E_out );
01365
01366
01367 gen_mf5_expand( N_theta, e_dist );
01368
01369
01370 ENDL.set_yo(1);
01371 ENDL.set_x1(time_consts[count]);
01372 if ( ENDL.write_file ) e_dist.write_endl( 4 );
01373 }
01374
01375 void fission_delay::gen_mf5_expand(int N_theta, two_d_table& e_dist)
01376
01377 {
01378 one_d_table one_E_in;
01379 two_d_table::iterator g_list = e_dist.end();
01380 --g_list;
01381 two_d_table::iterator next_list = g_list;
01382 dd_link XYdata;
01383 dd_list::iterator g_list_ptr;
01384 int count;
01385
01386
01387 for(count = 1; count < N_theta; ++count)
01388 {
01389 e_dist.insert(e_dist.end(), one_E_in);
01390 ++next_list;
01391
01392 for(g_list_ptr = g_list->begin();
01393 g_list_ptr != g_list->end(); ++g_list_ptr)
01394 {
01395 XYdata.x = g_list_ptr->x;
01396 XYdata.y = g_list_ptr->y;
01397 next_list->insert(next_list->end(), XYdata);
01398 }
01399 }
01400
01401
01402 dd_list::iterator theta_ptr = theta.begin();
01403 for(g_list = e_dist.begin(); g_list != e_dist.end();
01404 ++g_list, ++theta_ptr)
01405 {
01406 g_list->E_in() = theta_ptr->x;
01407 double scale_E = theta_ptr->y;
01408
01409 for(dd_list::iterator g_list_ptr = g_list->begin();
01410 g_list_ptr != g_list->end(); ++g_list_ptr)
01411 {
01412 XYdata.x *= scale_E;
01413 }
01414
01415 g_list->renorm();
01416 }
01417 }
01418
01419 void fission_delay::one_table( mf5_file& inFile, int count )
01420
01421
01422 {
01423 mf5_table dist_table;
01424
01425
01426 dist_table.read_data( inFile, 0, 0 );
01427
01428
01429 ENDL.set_yo(1);
01430 ENDL.set_x1(time_consts[count]);
01431 if ( ENDL.write_file ) dist_table.write_endl( 4 );
01432 }