本文整理匯總了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