MURE
Loading...
Searching...
No Matches
Material.hxx
Go to the documentation of this file.
1/*
2 This file is part of MURE,
3 Copyright (C) 2007-2021 MURE developers.
4
5 MURE is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 MURE is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with MURE. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef _MATERIAL_
20#define _MATERIAL_
26#include <cmath>
27#include <vector>
28#include <map>
29#include <string>
30#include <algorithm>
31#include <iosfwd>
32
33#include "Reaction.hxx"
34#include "Nucleus.hxx"
35#include "NucleiTree.hxx"
36#include "ZAI.hxx"
37
38class Cell;
39
40using namespace std;
41
42
44
50
55
56//________________________________________________________________________
57//
58// Material
60
80//________________________________________________________________________
81
83{
84 public:
86
89 Material();
90
92
97 Material(int theNumber);
98 Material(const Material &m);
99 virtual ~Material();
100
102
105 virtual Material *Copy();
107
126 virtual Material *Clone(double Temperature = - 1);
127
133
145 void AddNucleus(int Z, int A, double Proportion = 1., ProportionUnitType ProportionUnit = kpMOL, string ModeratorCategory = "");
147
160 void AddNucleus(int Z, int A, int I, double Proportion, ProportionUnitType ProportionUnit = kpMOL, string ModeratorCategory = "");
162
173 void AddNucleus(ZAI *zai, double Proportion = 1., ProportionUnitType ProportionUnit = kpMOL, string ModeratorCategory = "");
175
180 void AddNucleus(Nucleus_ptr nucleus, double Proportion = 1., ProportionUnitType ProportionUnit = kpMOL);
181
182 vector < Nucleus_ptr > &GetComposition()
183 {
184 return fComposition;
185 }
187 {
188 return fComposition[i];
189 }
190 void SetComposition(vector < Nucleus_ptr > f)
191 {
192 fComposition = f;
193 }
194 Nucleus_ptr GetNucleus(int Z, int A, int I = 0);
195
196 double GetProportion(int i, ProportionUnitType ProportionUnit);
198
205 void SetProportion(int i, double proportion, ProportionUnitType ProportionUnit);
206 void ResetProportion();
207
209
220 Material *Mix(Material *M2, double part, ProportionUnitType ProportionUnit = kpMOL);
221
222 virtual vector < Material *> Duplicate(int N, bool TrueClone = true);
223 void Proportion2AtomCM3();
225 {
226 return fProportionUnit;
227 }
228 double SumProportion();
229 int GetZAIIndex(ZAI *zai);
230 int GetZAIIndex(int Z, int A, int I);
231 void UpdateZAI(bool WithReactions = true, bool WithSF = true);
233 void AddZAIDaughters(ZAI *zai);
234 void CFAddElement(int Z, double p)
235 {
236 CFAddElement(1., Z, p);
237 };
238 void CFAddElement(double h, int Z, double p);
239 void CFAddElement(double h, string Z, double p);
240 void CFAddElement(string Z, double p);
241
242 void CFAddElementNucleus(int Z, int A, int I, double frac, ProportionUnitType unit);
243 void CFAddElementNucleus(int Z, int A, double frac, ProportionUnitType unit)
244 {
245 CFAddElementNucleus(Z, A, 0, frac, unit);
246 }
247 void CFCalculateMaterial();
248 void CFSetDensity(double dens, DensityUnitType unit)
249 {
250 CFDensity = dens;
251 CFDensityUnit = unit;
252 };
254
259
260 double GetDensity(DensityUnitType DensityUnit);
262
266 void SetDensity(double Density, DensityUnitType DensityUnit = kdGCM3);
268 {
269 return fDensityUnit;
270 }
272 {
273 return fTemperature;
274 }
275 void SetTemperature(double T = 293.6);
277 {
278 return (fModeratorName.size() > 0);
279 }
280 void SetModeratorName(string name)
281 {
282 fModeratorName = name;
283 }
285 {
286 return fModeratorName;
287 }
288 double MeanMolarMass();
289 bool IsFuel()
290 {
291 return fFuel;
292 }
294 {
295 return fModerator;
296 }
298 {
299 return fCladding;
300 }
302 {
303 return fCoolant;
304 }
306 {
307 return fCoolantGap;
308 }
310 {
311 return fModeratorBox;
312 }
314 {
315 return fControlMaterial;
316 }
317 void SetFuel(bool flag = true)
318 {
319 fFuel = flag;
320 }
321 void SetModerator(bool flag = true)
322 {
323 fModerator = flag;
324 }
325 void SetCladding(bool flag = true)
326 {
327 fCladding = flag;
328 }
329 void SetCoolant(bool flag = true)
330 {
331 fCoolant = flag;
332 }
333 void SetCoolantGap(bool flag = true)
334 {
335 fCoolantGap = flag;
336 }
337 void SetModeratorBox(bool flag = true)
338 {
339 fModeratorBox = flag;
340 }
342
347
349
353 string PrintAll();
354 string PrintCompositionInfo();
356
361 {
362 fPrintable = false;
363 }
365 {
366 fPrintable = true;
367 }
368
369
371
379 void SetPseudoMaterial();
381 {
382 return fPseudoMaterial;
383 }
384
386 {
387 return fPrintable;
388 }
389
391
394 string PrintDensityUnit(DensityUnitType DensityUnit = kdUNDEFINED);
396
399 string PrintProportionUnit(ProportionUnitType ProportionUnit = kpUNDEFINED);
400 void DumpMaterial(string filename = "material.dat");
401 void DumpCompositionInfo(string name = "CompInfo.dat");
402
403 void DumpMaterial(string Filename, double Mass, double Volume);
405
410 {
411 return fNumber;
412 }
413 void SetNumber(int n)
414 {
415 fNumber = n;
416 }
417
419
424 void SetDefaultXSExtension(string name);
426 {
427 return fDefaultXSExtension;
428 }
429 void SetEvolution();
431 {
432 return fEvolution;
433 }
435 {
436 return fPerturbative;
437 }
438 void SetPerturbative(bool flag = true)
439 {
440 fPerturbative = flag;
441 }
442
444 void SortCompositionByMass();
447 {
448 return fFatherOfPseudoClone;
449 }
450 void SetTemperatureEvolution(bool flag = true);
451
453 {
454 return fOutCore;
455 }
456 Cell *SetOutCore(int TheNumber, double TheVolume);
457 void SetMaterialName(string name)
458 {
459 fMaterialName = name;
460 }
462 {
463 return fMaterialName;
464 }
465
467 {
469 }
471 {
473 }
474 //________________________________________________________________________
475 bool IsZAIInTree(ZAI *zai)
476 {
477 return IsZAIInTree(zai->Z(), zai->A(), zai->I());
478 }
479 //________________________________________________________________________
480 bool IsZAIInTree(int Z, int A, int I);
482 {
483 return GetZAIInTree(zai->Z(), zai->A(), zai->I());
484 }
485 //________________________________________________________________________
486 ZAI *GetZAIInTree(int Z, int A, int I);
487
489
490 protected:
492
496 Material(Material *m);
497
499 double fDensity;
503
506
511
512 bool fUpdated;
513
514 vector < Nucleus_ptr > fComposition;
515 vector < double > fProportion;
516 map < int, map < int, map < int, int > > > fIndex;
518 bool fFuel;
522 bool fCoolant;
524
526 bool fOutCore;
530
531 vector < int > CFElements;
532 vector < double > CFps;
533 vector < double > CFhs;
534 vector< vector <ZAI *> > CFIsotopes;
535 vector< vector <double> > CFIsotopeProportions;
536 vector < double > CFElementMolarMass;
537 vector < double > CFElementRho;
538 vector<ProportionUnitType> CFPropElement;
540 double CFDensity;
542
543
544};
545#endif
DensityUnitType
Define the density units.
Definition Material.hxx:54
@ kdUNDEFINED
Definition Material.hxx:54
@ kdGCM3
Definition Material.hxx:54
@ kdATBCM
Definition Material.hxx:54
@ kdATCM3
Definition Material.hxx:54
ProportionUnitType
Define the proportion units.
Definition Material.hxx:48
@ kpMOL
Definition Material.hxx:48
@ kpMASS
Definition Material.hxx:48
@ kpUNDEFINED
Definition Material.hxx:48
@ kpATCM3
Definition Material.hxx:48
@ kpATBCM
Definition Material.hxx:48
Header file for NucleiTree class.
Header file for Nucleus class.
Header file for ZAI and ZAIReaction classes.
A Cell is composed from a Shape and a Material.
Definition Cell.hxx:84
A Material constituing a Cell.
Definition Material.hxx:83
bool fControlMaterial
This is a control material (e.g. for poison)
Definition Material.hxx:528
void SetPseudoMaterial()
Define a pesudo material.
Definition Material.cxx:719
void SetFuel(bool flag=true)
Definition Material.hxx:317
void EnablePrint()
Definition Material.hxx:364
bool IsControlMaterial()
Definition Material.hxx:313
virtual Material * Copy()
Copy a Material.
Definition Material.cxx:230
void SetMaterialName(string name)
Definition Material.hxx:457
Nucleus_ptr GetNucleus(int Z, int A, int I=0)
return the Nucleus Z, A, I
Definition Material.cxx:527
virtual vector< Material * > Duplicate(int N, bool TrueClone=true)
Duplicate material n times over.
Definition Material.cxx:1082
Material()
Normal Constructor.
Definition Material.cxx:47
void DumpMaterial(string filename="material.dat")
Make a nuclear chart &ascii tree of the material &write them to disk.
Definition Material.cxx:632
double fTemperature
Temperature (in K) at which the Material is used (to find the right MCNP code)
Definition Material.hxx:502
void SetModeratorBox(bool flag=true)
Definition Material.hxx:337
bool fFuel
whether or not this material is considered fuel.
Definition Material.hxx:518
void SetNumber(int n)
Definition Material.hxx:413
void CFAddElement(int Z, double p)
Definition Material.hxx:234
virtual Material * Clone(double Temperature=- 1)
Clone a Material.
Definition Material.cxx:306
string fMaterialName
Name of the material (uo2, water, ... used when thermal coupling)
Definition Material.hxx:509
void ResetProportion()
set all proprtion to 0.
Definition Material.cxx:1016
bool IsEvolving()
Definition Material.hxx:430
virtual ~Material()
Destructor.
Definition Material.cxx:359
bool fEvolution
whether or not will this Material will evolve with the time
Definition Material.hxx:504
bool IsFuel()
Definition Material.hxx:289
void AddNucleus(int Z, int A, double Proportion=1., ProportionUnitType ProportionUnit=kpMOL, string ModeratorCategory="")
Add a new Nucleus to the Material composition in the ground state.
Definition Material.cxx:386
bool IsModeratorBox()
Definition Material.hxx:309
bool fUpdated
true if ZAI have been updated (UpdateZAI) for evolution only
Definition Material.hxx:512
void SetPerturbative(bool flag=true)
Definition Material.hxx:438
bool IsPerturbativeTallyMaterial()
Definition Material.hxx:470
double fCFMeanMolarMass
Definition Material.hxx:539
bool IsOutCore()
Definition Material.hxx:452
void CFAddElement(double h, string Z, double p)
bool IsPerturbative()
Definition Material.hxx:434
void AddToGlobalNucleiVector()
add all nuclei of this material to GlobalNucleiVector
Definition Material.cxx:804
vector< Nucleus_ptr > fComposition
the Composition vector
Definition Material.hxx:514
void CFAddElement(string Z, double p)
void SetCladding(bool flag=true)
Definition Material.hxx:325
string PrintCompositionInfo()
Definition Material.cxx:941
void SetEvolution()
Say that this Material will evolve.
Definition Material.cxx:709
void SetDefaultXSExtension(string name)
Set a default extension for all nuclei of the material.
Definition Material.cxx:959
void SetCoolantGap(bool flag=true)
Definition Material.hxx:333
void SetCoolant(bool flag=true)
Definition Material.hxx:329
bool IsZAIInTree(ZAI *zai)
Definition Material.hxx:475
void DumpCompositionInfo(string name="CompInfo.dat")
Write the full composition information to a file.
Definition Material.cxx:910
ZAI * GetZAIInTree(ZAI *zai)
Definition Material.hxx:481
vector< ProportionUnitType > CFPropElement
Definition Material.hxx:538
ProportionUnitType fProportionUnit
Proportion vector unit (mol (default), at/barn.cm, at/cm3 or g/cm3)
Definition Material.hxx:501
void SetIsPerturbativeTallyMaterial(bool f=true)
Definition Material.hxx:466
int fNumber
Number of the Material in MCNP file.
Definition Material.hxx:498
Material * GetFatherOfPseudoClone()
Definition Material.hxx:446
void FindTotalSigmaPerNucleus()
Find total cross-section.
Definition Material.cxx:968
double MeanMolarMass()
return the mean molar mass (in gram)
Definition Material.cxx:822
double GetTemperature()
Definition Material.hxx:271
int GetZAIIndex(ZAI *zai)
Get the index of a given zai in the composition vector. Return -1 if not there.
Definition Material.cxx:684
string GetMaterialName()
Definition Material.hxx:461
bool fModeratorBox
whether or not this material is considered ModeratorBox.
Definition Material.hxx:520
bool fPerturbative
whether this Material is a virtual (perturbative) material for MCNP input
Definition Material.hxx:507
bool fModerator
whether or not this material is considered moderator.
Definition Material.hxx:519
bool HasModerator()
Definition Material.hxx:276
void SortCompositionByAmount()
Sort the proportions/compositions in proportion order (highest first).
Definition Material.cxx:575
Material * Mix(Material *M2, double part, ProportionUnitType ProportionUnit=kpMOL)
Mix 2 Materials.
Definition Material.cxx:1025
void CFAddElementNucleus(int Z, int A, double frac, ProportionUnitType unit)
Definition Material.hxx:243
bool fCoolantGap
whether or not this material is considered WaterGap.
Definition Material.hxx:523
string fModeratorName
Name of the moderator to be print in MT card (e.g. grph.06t)
Definition Material.hxx:508
bool fCladding
whether or not this material is considered cladding.
Definition Material.hxx:521
bool fPseudoMaterial
Is the material a pseudomaterial?
Definition Material.hxx:527
vector< Nucleus_ptr > & GetComposition()
Definition Material.hxx:182
vector< vector< ZAI * > > CFIsotopes
Definition Material.hxx:534
vector< vector< double > > CFIsotopeProportions
Definition Material.hxx:535
void SortCompositionByMass()
Sort the proportions/compositions in atomic mass order (highest first).
Definition Material.cxx:603
bool IsModerator()
Definition Material.hxx:293
DensityUnitType GetDensityUnit()
Definition Material.hxx:267
vector< double > CFps
Definition Material.hxx:532
bool IsCladding()
Definition Material.hxx:297
Cell * SetOutCore(int TheNumber, double TheVolume)
return a out core cell of volume TheVolume and number TheNumber
Definition Material.cxx:1101
void CFSetDensity(double dens, DensityUnitType unit)
Definition Material.hxx:248
bool IsPrintable()
Definition Material.hxx:385
bool fPrintable
whether or not material is printable in MCNP input file (default)
Definition Material.hxx:525
bool fIsPerturbativeTallyMaterial
Definition Material.hxx:529
void ForbidPrint()
Forbid Material print in MCNP.
Definition Material.hxx:360
string PrintProportionUnit(ProportionUnitType ProportionUnit=kpUNDEFINED)
Pretty print of proportion units.
Definition Material.cxx:1145
void Proportion2AtomCM3()
Convert proportion unit (kpMOL or kpMASS) in at/cm3.
Definition Material.cxx:1272
void SetModeratorName(string name)
Definition Material.hxx:280
void SetDensity(double Density, DensityUnitType DensityUnit=kdGCM3)
Set the density.
Definition Material.cxx:379
bool IsPseudoMaterial()
Definition Material.hxx:380
void CFAddElementNucleus(int Z, int A, int I, double frac, ProportionUnitType unit)
Definition Material.cxx:1309
void SetTemperatureEvolution(bool flag=true)
set the Temperature evolution flag
Definition Material.cxx:730
bool fTemperatureEvolution
whether or not temperature will evolve
Definition Material.hxx:505
bool fCoolant
whether or not this material is considered Coolant.
Definition Material.hxx:522
int GetNumber()
Definition Material.hxx:409
bool fOutCore
whether or not material is an Out core evolving material
Definition Material.hxx:526
Nucleus_ptr GetComposition(int i)
Definition Material.hxx:186
DensityUnitType fDensityUnit
Density unit (either g/cm3 (default), at/cm3 or at/barn.cm)
Definition Material.hxx:500
double GetDensity(DensityUnitType DensityUnit)
Definition Material.cxx:845
void SetProportion(int i, double proportion, ProportionUnitType ProportionUnit)
Set the Proportion of the ith nucleus.
Definition Material.cxx:1231
vector< double > CFhs
Definition Material.hxx:533
string fDefaultXSExtension
Give a default extension to all nucleus.
Definition Material.hxx:510
map< int, map< int, map< int, int > > > fIndex
The index of the ZAI in the material composition.
Definition Material.hxx:516
vector< int > CFElements
Definition Material.hxx:531
string PrintDensityUnit(DensityUnitType DensityUnit=kdUNDEFINED)
Pretty print of density units.
Definition Material.cxx:1125
double SumProportion()
return the sum of Proportion of each nucleus
Definition Material.cxx:566
void UpdateZAI(bool WithReactions=true, bool WithSF=true)
Update all ZAI of material (With reactions&decays or just decays).
Definition Material.cxx:741
void SetTemperature(double T=293.6)
Set the temperature in K.
Definition Material.cxx:812
vector< double > fProportion
the Proportion vector
Definition Material.hxx:515
double CFDensity
Definition Material.hxx:540
Material * fFatherOfPseudoClone
the father to used in cell in case of Pseudo clone
Definition Material.hxx:517
string GetDefaultXSExtension()
Definition Material.hxx:425
void AddZAIDaughters(ZAI *zai)
add the daughters of zai in this with proportion=0
Definition Material.cxx:498
void CFCalculateMaterial()
Definition Material.cxx:1350
vector< double > CFElementRho
Definition Material.hxx:537
double fDensity
Density of the Material.
Definition Material.hxx:499
void SetModerator(bool flag=true)
Definition Material.hxx:321
vector< double > CFElementMolarMass
Definition Material.hxx:536
bool IsCoolant()
Definition Material.hxx:301
DensityUnitType CFDensityUnit
Definition Material.hxx:541
string GetModeratorName()
Definition Material.hxx:284
string PrintAll()
Print the Material (and its Nuclei) in MCNP format.
Definition Material.cxx:535
double GetProportion(int i, ProportionUnitType ProportionUnit)
Definition Material.cxx:1169
void SetComposition(vector< Nucleus_ptr > f)
Definition Material.hxx:190
ProportionUnitType GetProportionUnit()
Definition Material.hxx:224
bool IsCoolantGap()
Definition Material.hxx:305
Handle dynamical object creation and pointer affectation.
Definition TReference.hxx:74
A ZAI defined a (Z, A, Isomere) for a Nucleus.
Definition ZAI.hxx:118
int I()
Definition ZAI.hxx:144
int A()
Definition ZAI.hxx:140
int Z()
Definition ZAI.hxx:136
the namespace of the Standard C++

MURE Project, documentation generated by Doxygen 1.9.7 - Fri Jan 19 2024