Difference between revisions of "KrakenTools examples"
(→Creating Serpent water compositions) |
|||
Line 8: | Line 8: | ||
>>> import krakentools | >>> import krakentools | ||
>>> help(krakentools.writeWaterComposition) | >>> help(krakentools.writeWaterComposition) | ||
− | + | Help on function writeWaterComposition in module krakentools.utils: | |
− | + | ||
+ | writeWaterComposition(fresh_water_mass_density:float, boron_in_ppm_weight:float, | ||
+ | temperature:float, fout:TextIO=None, fname:str='./watercomp.txt', thermlibs:Sequence[Tuple[str, float]]=[], mat_name:str='') -> None | ||
Writes water material card and optionally the therm-card for Serpent into a file | Writes water material card and optionally the therm-card for Serpent into a file | ||
for a specific state point (fresh water density + boron ppm) | for a specific state point (fresh water density + boron ppm) | ||
Arguments: | Arguments: | ||
− | fresh_water_mass_density {float} -- target mass density of non-borated water (positive number, g/cm3) | + | fresh_water_mass_density {float} -- |
− | boron_in_ppm_weight {float} -- boron concentration in ppm weight | + | target mass density of non-borated water (positive number, g/cm3) |
− | temperature {float} -- water temperature in Kelvin | + | boron_in_ppm_weight {float} -- |
+ | boron concentration in ppm weight | ||
+ | temperature {float} -- | ||
+ | water temperature in Kelvin | ||
Keyword Arguments: | Keyword Arguments: | ||
− | fout {file handle} -- Handle to a pre-opened file into which the water | + | fout {file handle} -- |
− | + | Handle to a pre-opened file into which the water composition will be | |
− | fname {str} -- Optional name of file into which the water composition | + | written (default: {None}) |
− | + | fname {str} -- | |
− | thermlibs {[N*[str, float]]} -- A list of (thermal scattering library | + | Optional name of file into which the water composition will be |
− | + | written (default: {"./watercomp.txt"}) | |
− | + | thermlibs {[N*[str, float]]} -- | |
+ | A list of (thermal scattering library identifier)-(temperature) pairs | ||
+ | (default: {None}) | ||
+ | mat_name {str} -- | ||
+ | Name for the created material (default: {""}, will be created based on state point) | ||
Raises: | Raises: |
Revision as of 14:06, 30 July 2019
Creating Serpent water compositions
Water composition material cards for Serpent can be generated using the krakentools.writeWaterComposition() method:
By default, the function writes the material card to a file ./watercomp.txt but a pre-opened file handle can be passed as fout keyword argument also. For example:
will produce the following file:
The tmp and moder cards are automatically written based on the requested temperature, but as we provided no thermal scattering libraries, the therm card is not written. We could add a list of thermal scattering library identifiers and their corresponding temperatures, which would also append the correct therm card for the identifier specified in the moder card:
would produce the file
This works even if the material temperature is between two library temperatures, in which case the therm card will use interpolation.