CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Siemens (https://www.cfd-online.com/Forums/siemens/)
-   -   Const. momentum surce (https://www.cfd-online.com/Forums/siemens/52632-const-momentum-surce.html)

TUU July 12, 2001 04:58

Const. momentum surce
 
I want to add an additional source of momentum. This source is a function of the position only (S=S(x,y,z)). I have S tabulated in a large ASCII table containing x,y,z,Sx,Sy,Sz. The way I wanted to use the table was by use of the user subroutine, sormom.f. This subroutine will then have to load the table-file and find the right values for Sx(x,y,z), Sy(x,y,z) and Sz(x,y,z). This does work but is very time consuming caused by the size of the file that has to be loaded for every single point in the domain during every iteration.

Question: Is it possible to load this table just once and then save it in the memory as it does not very with any values solved for?

Regards TUU

Philip Jones July 12, 2001 07:55

Re: Const. momentum surce
 
Hi

it is just standard Fortran, declare the variables you are using within a COMMON block or declare them with the SAVE function: this means that the next time you visit the routine they will still be there. You now need an extra flag that you set once you have visited and initialise to zero before you go there. The general structure will look like this:

COMMON /mycom/ thex,they,thez,thesx,thesy,thesz,ivisit
DATA ivisit/0/
if(ivisit.eq.0) then
read in data
ivisit=1
endif
calculate sormom values
return
end
Philip


All times are GMT -4. The time now is 05:03.