本文整理汇总了Python中amuse.community.hermite0.interface.Hermite.set_dmdt方法的典型用法代码示例。如果您正苦于以下问题:Python Hermite.set_dmdt方法的具体用法?Python Hermite.set_dmdt怎么用?Python Hermite.set_dmdt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类amuse.community.hermite0.interface.Hermite
的用法示例。
在下文中一共展示了Hermite.set_dmdt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: evolve_triple_with_wind
# 需要导入模块: from amuse.community.hermite0.interface import Hermite [as 别名]
# 或者: from amuse.community.hermite0.interface.Hermite import set_dmdt [as 别名]
#.........这里部分代码省略.........
elif scheme == 2:
# Derive dt from Pin using dtse_fac.
dt = dtse_fac*Pin_0
if time + dt > t_diag: dt = t_diag - time
if dt > 0|dt.unit:
t_se, dE_se = advance_stellar(t_se, dt)
time = advance_gravity(time, dt)
elif scheme == 3:
# Derive dt from Pin using dtse_fac.
dt = dtse_fac*Pin_0
if time + dt > t_diag: dt = t_diag - time
if dt > 0|dt.unit:
time = advance_gravity(time, dt)
t_se, dE_se = advance_stellar(t_se, dt)
elif scheme == 4:
# Derive dt from Pin using dtse_fac.
dt = dtse_fac*Pin_0
if time + dt > t_diag: dt = t_diag - time
if dt > 0|dt.unit:
t_se, dE_se = advance_stellar(t_se, 0.5*dt)
time = advance_gravity(time, dt)
t_se, dE_se2 = advance_stellar(t_se, 0.5*dt)
dE_se += dE_se2
elif scheme == 5:
# Use the specified dt_se.
dE_se = zero
dt = dt_se
if time + dt > t_diag: dt = t_diag - time
if dt > 0|dt.unit:
# For use with symple only: set up average mass loss.
channel_from_stellar.copy_attributes(["mass"])
m0 = triple.mass.copy()
stellar.evolve_model(t_se+dt)
channel_from_stellar.copy_attributes(["mass"])
t_se = stellar.model_time
m1 = triple.mass
dmdt = (m1-m0)/dt
for i in range(len(dmdt)):
gravity.set_dmdt(i, dmdt[i])
time = advance_gravity(time, dt)
else:
print 'unknown option'
sys.exit(0)
if time >= t_diag:
t_diag = time + dt_diag
Ekin = gravity.kinetic_energy
Epot = gravity.potential_energy
Etot = Ekin + Epot
dE = Etot_prev - Etot
Mtot = triple.mass.sum()
print "T=", time,
print "M=", Mtot, "(dM[SE]=", Mtot/Mtriple, ")",
print "E= ", Etot, "Q= ", Ekin/Epot,
print "dE=", (Etot_init-Etot)/Etot, "ddE=", (Etot_prev-Etot)/Etot,
print "(dE[SE]=", dE_se/Etot, ")"
Etot_init -= dE
Etot_prev = Etot
ain, ein, aout, eout = get_orbital_elements_of_triple(triple)
print "Triple elements t=", t_stellar + time, \
"inner:", triple[0].mass, triple[1].mass, ain, ein, \
"outer:", triple[2].mass, aout, eout
t.append(time.value_in(units.yr))
mtot.append(Mtot.value_in(units.MSun))
smai.append(ain/ain_0)
ecci.append(ein/ein_0)
smao.append(aout/aout_0)
ecco.append(eout/eout_0)
if eout > 1 or aout <= zero:
print "Binary ionized or merged"
break
gravity.stop()
stellar.stop()
return t, mtot, smai, ecci, smao, ecco