CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

Confused about how these variables are used

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 3, 2011, 03:44
Thumbs down Confused about how these variables are used
  #1
New Member
 
Guo Qinghua
Join Date: Sep 2011
Location: Nanjing
Posts: 10
Rep Power: 5
gchnhn is on a distinguished road
Hello everybody,

I have downloaded a 2d simple euler fvm solver from http://code.google.com/p/cybo/. When I try to read the code, I come across some several variables qs1,qs2,fs,alpha,dfs, and can't figure out their meanings. Is alpha a factor of diffusion? The paper wrote by the author is not so clear, and he don't reply my email. I hope you can explain to me in more detailed way.

Here is part of the program that I got confused. The following attachment is a zip package of the code. The relevant paper by the author is too large and you can download it from http://code.google.com/p/cybo/downlo...o.pdf&can=2&q=

SUBROUTINE get_flux(flux)
USE euler
USE mesh
USE inputs, ONLY: gamma,mach
IMPLICIT NONE
DOUBLE PRECISION, DIMENSION(4,numpts), INTENT(INOUT) :: flux
DOUBLE PRECISION, DIMENSION(numpts) :: div
DOUBLE PRECISION, DIMENSION(4) :: fs,dfs,norm
INTEGER :: i,n1,n2,t1,t2
INTEGER :: bc,e
DOUBLE PRECISION :: dx,dy,qs1,qs2,alpha,c1,c2,len,u1,u2,v1,v2
!! Routine to get the flux (residual) for each cell volume

!! T1 Diagram of how the edge flux is used
!! /\ to update the total flux of T1 and T2.
!! / \
!! Tri 1 / \
!! / \
!! N1/__Edge__\N2
!! \ /
!! \ /
!! Tri 2 \ /
!! \ /
!! \/
!! T2

! Loop over the interior edges to get the flux balance of
! corresponding nodes
div = 0.0
!CALL get_div(div)
DO i=1,size(inter) !对内边循环
t1 = edg(1,inter(i)) ! Node 1 of tri 1
n1 = edg(2,inter(i)) ! Node 2 of tri 1/ node 1 of edge
t2 = edg(3,inter(i)) ! Node 1 of tri 2
n2 = edg(4,inter(i)) ! Node 2 of tri 2/ node 2 of edge

dx = x(n1) - x(n2) ! Get dx for edge
dy = y(n1) - y(n2) ! Get dy for edge

qs1 = (rhou(n1)*dy - rhov(n1)*dx)/rho(n1) ! Reused in flux
qs2 = (rhou(n2)*dy - rhov(n2)*dx)/rho(n2) ! Reused in flux

fs(1) = .5d0*(qs1*rho(n1) + qs2*rho(n2))
fs(2) = .5d0*(qs1*rhou(n1) + qs2*rhou(n2)) + .5d0*(p(n1) + p(n2))*dy
fs(3) = .5d0*(qs1*rhov(n1) + qs2*rhov(n2)) - .5d0*(p(n1) + p(n2))*dx
fs(4) = .5d0*(qs1*(rhoE(n1)+p(n1)) + qs2*(rhoE(n2)+p(n2)))

! Add scalar diffusion
c1 = sqrt( p(n1)*gamma/rho(n1)) !棱边两端的声速
c2 = sqrt( p(n2)*gamma/rho(n2)) !棱边两端的声速
dx = x(t2) - x(t1) ! Get dx for edge
dy = y(t2) - y(t1) ! Get dy for edge
len = sqrt(dx**2 + dy**2)

alpha = ( abs(qs1 + qs2)/2.0d0/len + (c1 + c2)/2.0d0 ) * len
dfs = - alpha/2.0d0*(w(1:4,n1)-w(1:4,n2))

! Add edge fluxes up for each T point
flux(:,t1) = flux(:,t1) - fs / area(t1)
flux(:,t2) = flux(:,t2) + fs / area(t2)

! Add diffusive fluxes for each N point
flux(:,n1) = flux(:,n1) - dfs / area(n1)
flux(:,n2) = flux(:,n2) + dfs / area(n2)

END DO
! Some loop over the boundary edges
.....

END SUBROUTINE
Attached Files
File Type: zip FVM 2d Euler.zip (96.6 KB, 2 views)
gchnhn is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ADDITIONAL VARIABLES LIMITERS N.P CFX 5 December 1, 2011 08:47
$FOAM_USER_APPBIN & LIBBIN variables not set rassilon OpenFOAM Installation 2 February 16, 2010 21:54
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 02:13
PHI file structure Eugene Phoenics 9 November 2, 2001 23:00
Saving variables on a user patch with physical coordinates Zoltan Turzo CFX 2 April 20, 2000 15:05


All times are GMT -4. The time now is 19:39.