Exemplo n.º 1
0
def evap_shells_in(reglist, chainparams, sty={}, inf=5., npoints=5001):
	"""
	Add boundary lines to regions in reglist.
	"""
	Rh = chainparams['Rh']
	u0 = chainparams['fs_u0']
	v0 = chainparams['fs_v0']-1e-15
	r0 = chainparams['fs_r0']
	m = chainparams['m']
	M = np.max(m)
	for i in range(len(reglist[:-1])):
		reg = reglist[i]
		## evap only
		if Rh[i+1]<Rh[i]:
			## uv value
			uu = u0[i:i+1]
			vv = v0[i:i+1]
			rr = r0[i:i+1]
			## ingoing
			for b in reg.blocks:
				## mass
				dm = - (m[i+1] - m[i])
				print("EVAP IN SHELL COLOR dm/M=%s"%(dm/M))
				col = shell_col(dm/M)
				## style
				style = dict(lw=0.9, ls=':', c=1.*col, zorder=2000)
				style.update(sty)
				## inner blocks
				if b.rj[1]<rr:
					## values
					u = np.sort(np.concatenate([np.linspace(-1e-3,-1.,npoints//2),np.linspace(1e-3,1.,npoints//2),np.linspace(-inf,inf,npoints)]))
					v = vv+0.*u
					## make curve
					cv = xh.curve()
					cv.uv = np.array([u,v])
					cv.sty.update(style)
					## add
					b.add_curves_uv([cv])
				## outer block
				elif b.rj[0]<rr and not np.isfinite(b.uvbounds['umax']):
					## values
					u = np.linspace(uu,inf,npoints)
					v = vv+0.*u
					## make curve
					cv = xh.curve()
					cv.uv = np.array([u,v])
					cv.sty.update(style)
					## add
					b.add_curves_uv([cv])
Exemplo n.º 2
0
def tticks(reglist, dt=1., inf1=1., inf2=50.+irr, sty={}):
	"""
	Remainder lets dt carry across regions.
	"""
	if reglist[0].metfunc.info['Type']=='Anti de Sitter':
		inf1 = 9.*reglist[0].metfunc.fparams['L']
		## init
		remainder = 0.
		## regions
		for reg in reglist:
			## blocks
			for b in reg.blocks:
				## last blocks only
				if b.j == len(reg.metfunc.rj)-2:
					## outer last blocks only
					if (not np.isfinite(b.uvbounds['vmax'])) or (not np.isfinite(b.uvbounds['umin'])):
						## get min and max
						umin = np.max([b.uvbounds['umin'], -inf2])
						umax = np.min([b.uvbounds['umax'],  inf2])
						vmin = np.max([b.uvbounds['vmin'], -inf2])
						vmax = np.min([b.uvbounds['vmax'],  inf2])
						tmin = 0.5*(vmin+umin)
						tmax = 0.5*(vmax+umax)
						## is it too small
						toosmall = False
						if tmax-tmin <= remainder:
							toosmall = True
						## if too small adjust remainder
						if toosmall==True:
							remainder = remainder - (tmax-tmin)
						## if big enough go
						if toosmall==False:
							print "HELLLOOOOOOOOO tticks"
							print tmin, tmax, dt
							## make array
							tt = remainder + np.arange(tmin, tmax, dt)
							## get new remainder
							remainder = dt - (tmax - tt[-1])
							## make and add curve
							crv = xh.curve()
							crv.tr = np.array([1.*tt,1.*inf1])
							style = dict(markeredgecolor='k', alpha=.3, marker=(2,0,90), ls='none', markersize=7, zorder=100)
							style.update(sty)
							crv.sty.update(style)
							b.add_curves_tr([crv])
Exemplo n.º 3
0
def uticks(reglist, du=1., inf1=100., inf2=50.+irr, sty={}):
	"""
	Remainder lets dv carry across regions.
	"""
	## init
	remainder = 0.
	## regions
	for reg in reglist:
		## blocks
		for b in reg.blocks:
			## last blocks only
			if b.j == len(reg.metfunc.rj)-2:
				## outer last blocks only
				if not np.isfinite(b.uvbounds['vmax']):
					## get min and max
					umin = np.max([b.uvbounds['umin'], -inf2])
					umax = np.min([b.uvbounds['umax'],  inf2])
					## is it too small
					toosmall = False
					if umax-umin <= remainder:
						toosmall = True
					## if too small adjust remainder
					if toosmall==True:
						remainder = remainder - (umax-umin)
					## if big enough go
					if toosmall==False:
						## make array
						uu = remainder + np.arange(umin, umax, du)
						## get new remainder
						remainder = du - (umax - uu[-1])
						## make and add curve
						crv = xh.curve()
						crv.uv = np.array([1.*uu, inf1+0.*uu])
						style = dict(markeredgecolor='k', alpha=.3, marker=(2,0,-45), ls='none', markersize=7, zorder=100)
						style.update(sty)
						crv.sty.update(style)
						b.add_curves_uv([crv])
Exemplo n.º 4
0
def vticks(reglist, dv=1., inf1=100., inf2=50.+irr, sty={}):
	"""
	Remainder lets dv carry across regions.
	"""
	## init
	remainder = 0.
	## regions
	for reg in reglist:
		## blocks
		for b in reg.blocks:
			## last blocks only
			if b.j == reg.blocks[-1].j:
				## outer last blocks only
				if not np.isfinite(b.uvbounds['umin']):
					## get min and max
					vmin = np.max([b.uvbounds['vmin'], -inf2])
					vmax = np.min([b.uvbounds['vmax'],  inf2])
					## is it too small
					toosmall = False
					if vmax-vmin <= remainder:
						toosmall = True
					## if too small adjust remainder
					if toosmall==True:
						remainder = remainder - (vmax-vmin)
					## if big enough go
					if toosmall==False:
						## make array
						vv = remainder + np.arange(vmin, vmax, dv)
						## get new remainder
						remainder = dv - (vmax - vv[-1])
						## make and add curve
						crv = xh.curve()
						crv.uv = np.array([-inf1+0.*vv, 1.*vv])
						style = dict(markeredgecolor='k', alpha=0.3, ls='none', marker=(2,0,45), markersize=7, zorder=-100)
						style.update(sty)
						crv.sty.update(style)
						b.add_curves_uv([crv])
Exemplo n.º 5
0
# Create a "metfunc" object.
# Try adjusting the charge parameter Q to a lower value or increasing the mass M.
f = xh.mf.reissner_nordstrom(M=0.5, Q=0.3)

# Create a "region" object.
# Try changing the boolean keyword inputs to see effect. Or, try changing MAXreg (maximally extended) to EFreg (Eddington-Finklestein).
reg = xh.reg.MAXreg(f, rlines=True, boundary=True, uvgrid=False)

# Manually add some additional curves to the plot.
## Initialize list of curves to add.
crvlist = []
## Let's add some lines of t=constant in the exterior region.
T = np.linspace(-10, 10, 15)
for t0 in T:
    ## Create new "curve" object.
    crv = xh.curve()
    ## The Schwarzchild coordinates (t,r) of each curve will be parameterized by a parameter s.
    s = np.linspace(1e-9, 10, 1001)
    ## Define t and r coordinate arrays.
    t = t0 + 0. * s  ## t is a constant array of correct length
    r = f.rj[-2] + 1. * s  ## f.rj[-2] is the outer horizon radius
    ## Add coordinates to the curve object.
    crv.tr = np.array([t, r])
    ## Set curve display style. In this case red, .5 units wide, and behind rlines.
    crv.sty.update(dict(c='r', lw=.5, zorder=300))
    ## Add curve to curve list.
    crvlist += [crv]
## Add curves to all blocks in region. Will be rejected from incompatible blocks.
for b in reg.blocks:
    b.add_curves_tr(crvlist)