import math


def acoustic_rp(left, right, g):

	"""
	Pressure at the interface of a riemann problem in the case of two acoustic waves
	Input:
	left - Primitive variable on the left side
	right - Primitive variable on the right side
	g - Adiabatic index
	"""
	
	
	dl = left.Density
	pl = left.Pressure
	vl = left.Velocity
	dr = right.Density
	pr = right.Pressure
	vr = right.Velocity
	return (math.sqrt(dl*g*pl)*pr + math.sqrt(dr*g*pr)*(pl + math.sqrt(dl*g*pl)*(vl - vr)))\
			/(math.sqrt(dl*g*pl) + math.sqrt(dr*g*pr))