本文整理汇总了Python中pyne.material.Material.mass方法的典型用法代码示例。如果您正苦于以下问题:Python Material.mass方法的具体用法?Python Material.mass怎么用?Python Material.mass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyne.material.Material
的用法示例。
在下文中一共展示了Material.mass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LWR_delR_BU_
# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import mass [as 别名]
#Calculate delta R for the Guess
LWR_CoreInput = U238 + U235
LWR_CoreInput.name = "LWR_CoreInput"
LWR_CoreInput.normalize()
LWR_delR_Guess = LWR_delR_BU_(LWR_CoreInput)
k = LWR.batch_average_k(LWR_Params.BUt)
n = 0
if not Quiet:
print("{0}) {1}".format(1, k), end=" ")
while 0.001 < abs(1.0 - k) and n < 10:
#Adjust Masses based on pertubation guess.
LWR_DeltaM_U238 = - LWR_delR_Guess / (delR_U238 - delR_U235)
U238.mass = U238.mass + LWR_DeltaM_U238
U235.mass = U235.mass - LWR_DeltaM_U238
#Recalculate core parameters for new masses guess
LWR_CoreInput = U238 + U235
LWR_CoreInput.name ="LWR_CoreInput"
LWR_CoreInput.normalize()
LWR_delR_Guess = LWR_delR_BU_(LWR_CoreInput)
k = LWR.batch_average_k(LWR_Params.BUt)
n = n+1
if not Quiet:
print(k, end=" ")
if not Quiet:
print()
print()
示例2: test_read_mcnp
# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import mass [as 别名]
def test_read_mcnp():
expected_material = Material(nucvec={922350000: 0.04, 922380000: 0.96},
mass=-1.0,
density=19.1,
metadata={"comments": (
" first line of comments second line of "
"comments third line of comments forth "
"line of comments"),
"mat_number": "1",
"name": " leu",
"source": " Some http://URL.com",
"table_ids": {'922350': "15c"}})
expected_material.mass = -1.0 # to avoid reassignment to +1.0
expected_multimaterial = MultiMaterial({
Material(
{10000000: 0.11189838783149784, 80000000: 0.8881016121685023},
-1.0, 0.9, 3,
{"comments":
(" Here are comments the comments "
"continue here are more even more"),
"mat_number": "2",
"name": " water",
"source": " internet",
"table_ids": {'10000': "05c"}}): 1,
Material(
{10000000: 0.11189838783149784, 80000000: 0.8881016121685023},
-1.0,
1.0021552889223864, 3,
{"comments":
(" Here are comments the comments "
"continue here are more even more"),
"mat_number": "2",
"name": " water",
"source": " internet",
"table_ids": {'10000': "05c"}}): 1})
read_materials = read_mcnp_inp('mcnp_inp.txt')
assert_equal(expected_material, read_materials[0])
assert_equal(
list(expected_multimaterial._mats.keys())[0].comp,
list(read_materials[1]._mats.keys())[0].comp)
assert_equal(
list(expected_multimaterial._mats.keys())[0].mass,
list(read_materials[1]._mats.keys())[0].mass)
assert_equal(
list(expected_multimaterial._mats.keys())[0].density,
list(read_materials[1]._mats.keys())[0].density)
assert_equal(
list(expected_multimaterial._mats.keys())[0].atoms_per_molecule,
list(read_materials[1]._mats.keys())[0].atoms_per_molecule)
assert_equal(
list(expected_multimaterial._mats.keys())[0].metadata,
list(read_materials[1]._mats.keys())[0].metadata)
assert_equal(
list(expected_multimaterial._mats.keys())[1].comp,
list(read_materials[1]._mats.keys())[1].comp)
assert_equal(
list(expected_multimaterial._mats.keys())[1].mass,
list(read_materials[1]._mats.keys())[1].mass)
assert_equal(
list(expected_multimaterial._mats.keys())[1].density,
list(read_materials[1]._mats.keys())[1].density)
assert_equal(
list(expected_multimaterial._mats.keys())[1].atoms_per_molecule,
list(read_materials[1]._mats.keys())[1].atoms_per_molecule)
assert_equal(
list(expected_multimaterial._mats.keys())[1].metadata,
list(read_materials[1]._mats.keys())[1].metadata)
示例3:
# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import mass [as 别名]
m2.density = -1.106
m3.density = -2.66
m5.density = -6.56
# from pixels, re-normalize
m1_frac = 0.488
m2_frac = 0.238
m3_frac = 0.056
m5_frac = 0.100
#tot = m1_frac + m2_frac + m3_frac + m5_frac
#m1_frac = m1_frac / tot
#m2_frac = m2_frac / tot
#m3_frac = m3_frac / tot
#m5_frac = m5_frac / tot
### density times area fraction gives "mass"
m1.mass = m1.density * m1_frac
m2.mass = m2.density * m2_frac
m3.mass = m3.density * m3_frac
m5.mass = m5.density * m5_frac
### average density
avg_density = m1.density * m1_frac + m2.density * m2_frac + m3.density * m3_frac + m5.density * m5_frac
avg_material = m1 + m2 + m3 + m5
#print m1,m2,m3,m5
print avg_density
#print avg_material
print avg_material.mcnp()