
[Sponsors] 
November 5, 2013, 16:09 
from c to fortran

#1 
New Member
RAWNAK.h
Join Date: Oct 2013
Posts: 7
Rep Power: 5 
please I need a help to understand this ccode (two phase flow), which I try to write it using fortran
for( subs=0; subs<NUM_FLUID_COMPONENTS; subs++) }for( j=0; j<LY; j++) for( i=0; i<LX; i++) { rhoij[subs] = 0.; u_xij[subs] = 0.; u_yij[subs] = 0.; if( !is_solid_node[j][i]) { for( a=0; a<9; a++) { rhoij[subs] += ftemp_ij[a]; u_xij[subs] += ex[a]*ftemp_ij[a]; u_yij[subs] += ey[a]*ftemp_ij[a]; } } well here the code in fortran: do l=1,2 do j=0,m do i=0,n rho(i,j,l)=0.0 u(i,j,l)=0.0 v(i,j,l)=0.0 do k=0,8 rho(i,j,l)=rho(i,j,l)+f(k,i,j,l) u(i,j,l)=u(i,j,l)+f(k,i,j,l)*cx(k) u(i,j,l)=v(i,j,l)+f(k,i,j,l)*cy(k) end do enddo end do end do the thing that I don't understant how to write if( !is_solid_node[j][i]) Thank you 

November 5, 2013, 16:29 

#2 
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 12 
It is a NOT IF, so the way in FORTRAN to do this is : IF (.NOT.somelogical) THEN
Cheers 

November 5, 2013, 16:40 

#3 
New Member
RAWNAK.h
Join Date: Oct 2013
Posts: 7
Rep Power: 5 
Thank you for your reply,
Well, here we have two fluids sub=0 and 1 why we put if not solid, what do they mean? 

November 5, 2013, 16:44 

#4 
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 12 
That is something only you can answer, as you are the one who works with the codes... from the snippet you posted, there is no way to understand the whole issue....
You first should make sure you understand the equations, assumptions and schemes that are involved fully before you try to rewrite the program. without understanding what is going on, there's no chance! 

November 5, 2013, 16:54 

#5 
New Member
RAWNAK.h
Join Date: Oct 2013
Posts: 7
Rep Power: 5 
You're totally right, thanks alot


November 6, 2013, 15:47 
question

#6 
New Member
RAWNAK.h
Join Date: Oct 2013
Posts: 7
Rep Power: 5 
what does i++ mean in the following sentence
i=0; i<LX; i++ and what does this mean ( i<LX1)?( i+1) 0 ); because I know fortran and not c programming Thanks 

November 6, 2013, 17:28 

#7 
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 12 
The first one does just mean i=i+1. I can't read the second one due to the smiley. You should consult a C manual for your questions or use google, as they can be answered very easily that way.
Cheers, 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Fortran CompilerCFX12.1  Araz  CFX  12  November 2, 2014 13:46 
Using Fortran with CFX: How to connect Fortran to CFX?  l.te  CFX  0  October 21, 2012 11:42 
Intrinsic Procedure 'ISNAN' in GNU FORTRAN 77  hawk  Main CFD Forum  1  April 12, 2005 22:13 
visual fortran  Monica  Main CFD Forum  1  August 28, 2004 20:45 
Fortran77 or Fortran 90  Swapnil  CFX  2  November 26, 2002 16:16 