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

Stupid question

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2006, 17:31
Default Stupid question
  #1
Dr. Nick
Guest
 
Posts: n/a
Hello all! Need a help, coz i can't see the mistake. What do i do wrong for the advection equation [ dU/dt=-Cx(dU/dx)-Cy(dU/dy)-Cz(dU/dz) ] in 3D unstructured tetrahedral mesh? Here's the code in C++ for the tetrahedra element. The spatial discrimination of the flux for a 1-st order Godunov method (made it just to check the code). CosX[i] etc.. are unit normals of a face. Here i calculate face values, to sum them, and divide by volume to get a flux in the center. It should work, but it doesn't! I know it's stupid, but what's wrong? I get spurious oscillations. Here's the part of the code:

double compressible_flow::calculate_advection() {

double ret=0.0;

// for each face

for(int i=0;i<4;i++){

double Ux=0.0;

double Uy=0.0;

double Uz=0.0;

double Cx=-0.5;//velocities

double Cy=0.0; //

double Cz=0.0; //

if(cosX[i]*Cx>0) // Nx*VelocityX

Ux=cv[number].U; // U inside of a tetrahedra

else

Ux=U_t; // U outside of a tetrahedra, next to the face 'i'

if(cosY[i]*Cy>0)

Uy=cv[number].U;

else

Uy=U_t;

if(cosZ[i]*Cz>0)

Uz=cv[number].U;

else

Uz=U_t;

ret=ret+S[i]*( Cx*Ux*cosX[i]+Cy*Uy*cosY[i]+Cz*Uz*cosZ[i] );

}

return ret;

}

Thanks in advance
  Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static pressure at outlet - Stupid question??? Miry CFX 0 September 16, 2007 19:14
[blockMesh] Question possible stupid about grid fabianpk OpenFOAM Meshing & Mesh Conversion 2 April 10, 2007 06:55
Perhaps a stupid question... HSeldon FLUENT 0 March 9, 2007 13:14
stupid question Andrew Hayes Main CFD Forum 9 December 20, 2005 12:25
A (very, very) stupid FEM Question Carlos Main CFD Forum 2 September 21, 2002 10:31


All times are GMT -4. The time now is 07:26.