superVisc/hypervisc.py
def superVisc(lengthOfPlate,girdPtsX,girdPtsY,machInf,TwTInf,residualTarget,K,adiabatic):
	"""
	This program uses an iterative method to solve
	the full Navier-Stokes equation for super sonic
	flow over a flat plate. 
	Input Parameters:
	girdPtsX    - Nodes in x
	girdPtsY    - Nodes in y
	machInf     - Inlet mach number
	TwTInf      - Relationship of wall temp over free stream 
	iters       - iterations to complete
	K           - Courant number
	"""
	# Set flow/geometry parameters
	aInf         = 317        # Speed of sound: m/s
	pressureInf  = 21.96    # Pressure N/m^2
	tempInf      = 247.02      # Kelvin
	gamma        = 1.4           # Ratio of specific heats
	Pr           = 0.71          # Prandtl number
	muRef        = 1.7894*10**-5  # Dynamic viscosity reference kg/(m*s)
	tempRef      = 288.16        # Reference temperature Kelvin
	R            = 287           # Gas constant Number J/(kg*K)
	cv           = R/(gamma-1)
	cp           = gamma * cv
	rhoInf       = pressureInf/(R*tempInf)
	uVelInf      = machInf*aInf
	vVelInf      = 0 
	muInf        = calcMu(muRef,tempInf,tempRef)
	ReL          = rhoInf*uVelInf*lengthOfPlate/muInf
	eInf         = cv*tempInf
	kInf         = muInf*cp/Pr
	tempWall     = TwTInf*tempInf
	# Calculate delta x
	deltax = lengthOfPlate/(girdPtsX-1)

	# Calculate delta y
	delta = (5*lengthOfPlate)/(ReL**.5)
	heightOfGrid = 5*delta
	print(heightOfGrid)
	deltay = heightOfGrid/(girdPtsY-1)
	print(deltay)
	print('GRID DIMENSIONS','\nDelta in x: ',deltax,'\nDelta in y: ',deltay)

	# Initialize free stream
	presDomain = np.ones([girdPtsX,girdPtsY])*pressureInf
	tempDomain = np.ones([girdPtsX,girdPtsY])*tempInf
	uVelDomain = np.ones([girdPtsX,girdPtsY])*uVelInf
	vVelDomain = np.ones([girdPtsX,girdPtsY])*vVelInf
	# Initialize BC's
	presDomain,tempDomain,uVelDomain,vVelDomain = initBoundaryCond(
		presDomain,tempDomain,uVelDomain,vVelDomain,tempWall)

	# Iteration Parameters
	iteration = 1
	residual = np.array([.1])
	# Begin Simulations 
	while residual[iteration-1] > residualTarget or iteration <50:
		rhoOld = presDomain/(R*tempDomain)
		# Calculate time step
		muDomain = calcMu(muRef,tempDomain,tempRef)
		deltat = calcTimeStep(presDomain,tempDomain,uVelDomain,
			vVelDomain,muDomain,deltax,deltay,gamma,Pr,R,K)
		#Solve internal points
		presDomain,tempDomain,uVelDomain,vVelDomain = solveFlow(
			presDomain,tempDomain,uVelDomain,vVelDomain,muDomain,
			deltat,deltay,deltax,cp,cv,R,tempRef,muRef,adiabatic)
		rhoNew = presDomain/(R*tempDomain)
		residuals = rhoOld - rhoNew
		residual = np.append(residual,residuals.max())
		print(
			'Iter: %4.i | Residual: %.3E | Max Pressure: %.2f | Max Temperature: %.2f | Max X-Vel: %.2f | Max Y_Vel: %.2f'
			 % (iteration,residual[iteration],presDomain.max(),tempDomain.max(),uVelDomain.max(),vVelDomain.max()))
		iteration = iteration + 1
	return presDomain,tempDomain,uVelDomain,vVelDomain,residual,deltax,deltay

	This program uses an iterative method to solve
	the full Navier-Stokes equation for super sonic
	flow over a flat plate. 
	Input Parameters:
	girdPtsX    - Nodes in x
	girdPtsY    - Nodes in y
	machInf     - Inlet mach number
	TwTInf      - Relationship of wall temp over free stream 
	iters       - iterations to complete
	K           - Courant number
	
This program uses an iterative method to solve
the full Navier-Stokes equation for super sonic
flow over a flat plate.
This program uses an iterative method to solve the full Navier - Stokes equation for super sonic flow over a flat plate .
def superVisc(lengthOfPlate,girdPtsX,girdPtsY,machInf,TwTInf,residualTarget,K,adiabatic):
	aInf         = 317        
	pressureInf  = 21.96    
	tempInf      = 247.02      
	gamma        = 1.4           
	Pr           = 0.71          
	muRef        = 1.7894*10**-5  
	tempRef      = 288.16        
	R            = 287           
	cv           = R/(gamma-1)
	cp           = gamma * cv
	rhoInf       = pressureInf/(R*tempInf)
	uVelInf      = machInf*aInf
	vVelInf      = 0 
	muInf        = calcMu(muRef,tempInf,tempRef)
	ReL          = rhoInf*uVelInf*lengthOfPlate/muInf
	eInf         = cv*tempInf
	kInf         = muInf*cp/Pr
	tempWall     = TwTInf*tempInf
	deltax = lengthOfPlate/(girdPtsX-1)
	delta = (5*lengthOfPlate)/(ReL**.5)
	heightOfGrid = 5*delta
	print(heightOfGrid)
	deltay = heightOfGrid/(girdPtsY-1)
	print(deltay)
	print('GRID DIMENSIONS','\nDelta in x: ',deltax,'\nDelta in y: ',deltay)
	presDomain = np.ones([girdPtsX,girdPtsY])*pressureInf
	tempDomain = np.ones([girdPtsX,girdPtsY])*tempInf
	uVelDomain = np.ones([girdPtsX,girdPtsY])*uVelInf
	vVelDomain = np.ones([girdPtsX,girdPtsY])*vVelInf
	presDomain,tempDomain,uVelDomain,vVelDomain = initBoundaryCond(
		presDomain,tempDomain,uVelDomain,vVelDomain,tempWall)
	iteration = 1
	residual = np.array([.1])
	while residual[iteration-1] > residualTarget or iteration <50:
		rhoOld = presDomain/(R*tempDomain)
		muDomain = calcMu(muRef,tempDomain,tempRef)
		deltat = calcTimeStep(presDomain,tempDomain,uVelDomain,
			vVelDomain,muDomain,deltax,deltay,gamma,Pr,R,K)
		presDomain,tempDomain,uVelDomain,vVelDomain = solveFlow(
			presDomain,tempDomain,uVelDomain,vVelDomain,muDomain,
			deltat,deltay,deltax,cp,cv,R,tempRef,muRef,adiabatic)
		rhoNew = presDomain/(R*tempDomain)
		residuals = rhoOld - rhoNew
		residual = np.append(residual,residuals.max())
		print(
			'Iter: %4.i | Residual: %.3E | Max Pressure: %.2f | Max Temperature: %.2f | Max X-Vel: %.2f | Max Y_Vel: %.2f'
			 % (iteration,residual[iteration],presDomain.max(),tempDomain.max(),uVelDomain.max(),vVelDomain.max()))
		iteration = iteration + 1
	return presDomain,tempDomain,uVelDomain,vVelDomain,residual,deltax,deltay
def superVisc ( lengthOfPlate , girdPtsX , girdPtsY , machInf , TwTInf , residualTarget , K , adiabatic ) : aInf = 317 pressureInf = 21.96 tempInf = 247.02 gamma = 1.4 Pr = 0.71 muRef = 1.7894 * 10 ** - 5 tempRef = 288.16 R = 287 cv = R / ( gamma - 1 ) cp = gamma * cv rhoInf = pressureInf / ( R * tempInf ) uVelInf = machInf * aInf vVelInf = 0 muInf = calcMu ( muRef , tempInf , tempRef ) ReL = rhoInf * uVelInf * lengthOfPlate / muInf eInf = cv * tempInf kInf = muInf * cp / Pr tempWall = TwTInf * tempInf deltax = lengthOfPlate / ( girdPtsX - 1 ) delta = ( 5 * lengthOfPlate ) / ( ReL ** .5 ) heightOfGrid = 5 * delta print ( heightOfGrid ) deltay = heightOfGrid / ( girdPtsY - 1 ) print ( deltay ) print ( 'GRID DIMENSIONS' , '\nDelta in x: ' , deltax , '\nDelta in y: ' , deltay ) presDomain = np . ones ( [ girdPtsX , girdPtsY ] ) * pressureInf tempDomain = np . ones ( [ girdPtsX , girdPtsY ] ) * tempInf uVelDomain = np . ones ( [ girdPtsX , girdPtsY ] ) * uVelInf vVelDomain = np . ones ( [ girdPtsX , girdPtsY ] ) * vVelInf presDomain , tempDomain , uVelDomain , vVelDomain = initBoundaryCond ( presDomain , tempDomain , uVelDomain , vVelDomain , tempWall ) iteration = 1 residual = np . array ( [ .1 ] ) while residual [ iteration - 1 ] > residualTarget or iteration < 50 : rhoOld = presDomain / ( R * tempDomain ) muDomain = calcMu ( muRef , tempDomain , tempRef ) deltat = calcTimeStep ( presDomain , tempDomain , uVelDomain , vVelDomain , muDomain , deltax , deltay , gamma , Pr , R , K ) presDomain , tempDomain , uVelDomain , vVelDomain = solveFlow ( presDomain , tempDomain , uVelDomain , vVelDomain , muDomain , deltat , deltay , deltax , cp , cv , R , tempRef , muRef , adiabatic ) rhoNew = presDomain / ( R * tempDomain ) residuals = rhoOld - rhoNew residual = np . append ( residual , residuals . max ( ) ) print ( 'Iter: %4.i | Residual: %.3E | Max Pressure: %.2f | Max Temperature: %.2f | Max X-Vel: %.2f | Max Y_Vel: %.2f' % ( iteration , residual [ iteration ] , presDomain . max ( ) , tempDomain . max ( ) , uVelDomain . max ( ) , vVelDomain . max ( ) ) ) iteration = iteration + 1 return presDomain , tempDomain , uVelDomain , vVelDomain , residual , deltax , deltay
This program uses an iterative method to solve
the full Navier-Stokes equation for super sonic
flow over a flat plate.
This program uses an iterative method to solve the full Navier - Stokes equation for super sonic flow over a flat plate .
"""
	This program uses an iterative method to solve
	the full Navier-Stokes equation for super sonic
	flow over a flat plate. 
	Input Parameters:
	girdPtsX    - Nodes in x
	girdPtsY    - Nodes in y
	machInf     - Inlet mach number
	TwTInf      - Relationship of wall temp over free stream 
	iters       - iterations to complete
	K           - Courant number
	""" # Set flow/geometry parameters # Speed of sound: m/s # Pressure N/m^2 # Kelvin # Ratio of specific heats # Prandtl number # Dynamic viscosity reference kg/(m*s) # Reference temperature Kelvin # Gas constant Number J/(kg*K) # Calculate delta x # Calculate delta y # Initialize free stream # Initialize BC's # Iteration Parameters # Begin Simulations  # Calculate time step #Solve internal points
lengthOfPlate
girdPtsX
girdPtsY
machInf
TwTInf
residualTarget
K
adiabatic