Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function influence_coeff(surf::TwoDSurf,curfield::TwoDFlowField,coll_loc,n,dt)
- # With the surface and flowfield, determine the influence matrix "a"
- a = zeros(surf.ndiv,surf.ndiv)
- a[end,:] .= 1. # for wake portion
- vc = surf.bv[1].vc
- if size(curfield.tev,1) == 0 # calculate TEV placement location
- xloc = surf.bv[end].x + 0.5*surf.kinem.u*dt*cos(surf.kinem.alpha)
- zloc = surf.bv[end].z + 0.5*surf.kinem.u*dt*sin(surf.kinem.alpha)
- else
- xloc = surf.bv[end].x + (1. /3.)*(curfield.tev[end].x - surf.bv[end].x)
- zloc = surf.bv[end].z + (1. /3.)*(curfield.tev[end].z - surf.bv[end].z)
- end
- for i = 1:surf.ndiv-1, j = 1:surf.ndiv
- # i is test location, j is vortex source
- t_x = coll_loc[i,1]
- t_z = coll_loc[i,2]
- if j < surf.ndiv # Bound vortices (a_ij)
- src = surf.bv[j]
- xdist = src.x .- t_x
- zdist = src.z .- t_z
- else # Wake vorticy (a_iw)
- xdist = xloc .- t_x
- zdist = zloc .- t_z
- end
- distsq = xdist.*xdist + zdist.*zdist
- u = -zdist./(2*pi*sqrt.(vc*vc*vc*vc .+ distsq.*distsq))
- w = xdist./(2*pi*sqrt.(vc*vc*vc*vc .+ distsq.*distsq))
- a[i,j] = u*n[i,1] + w*n[i,2]
- end
- return a
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement