from c to fortran
please I need a help to understand this c-code (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 |
It is a NOT IF, so the way in FORTRAN to do this is : IF (.NOT.somelogical) THEN
Cheers :) |
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? |
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! |
You're totally right, thanks alot:)
|
question
what does i++ mean in the following sentence
i=0; i<LX; i++ and what does this mean ( i<LX-1)?( i+1):( 0 ); because I know fortran and not c programming Thanks |
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, |
All times are GMT -4. The time now is 02:05. |