How to temporarily store fields and use them in for loop
Hello all,
I have implemented some changes to the k-omega model in order to update it (2006 version) but I have run into some problems... although the code compiles, the computer seems to run out of memory when I run a simulation. I was wondering if anybody could please help me out... Below you will find the changes I have made, I believe the problem is in the way that I have defined the volTensorFields. I think I should define them as a tmp<volTensorField> but I don't know how to do so, or how to use the values obtained from tmp in the for loop that follows the volTensorField definitions. Commenting out the lines below allowed the code to compile. Something I find troubling is that it seems to me like RORP_ and RORS_ should be checked at every cell but for some reason the compiler doesn't like that... so I commented them out. I'm very new to modifying OpenFOAM so I have no clue about what I'm doing most of the time. The goal: to modify beta_ (which requires for the computer to look into RORP_,RORS_) for every cell according to the definition in the code below. Thank you in advance! Code:
const volTensorField& RORP_(skew(fvc::grad(U_)) & skew(fvc::grad(U_))); //O_ij O_jk |
At first look, the "const" key word prevents you from modifying RORP_ etc. But I don't know if there are any further problems with your code.
|
I believe that may have solved the running out of memory problem... Thank you very much!!!
I still have my doubts about my implementation with the goal of checking/modifying the variables at every cell. If there is anyone who has experience modifying OpenFOAM, your input would be greatly appreciated! |
Fields in OpenFoam are cleverly designed, such that you do not need to use loops. In your case, you can easily
Code:
fomega_=(1.+85.*Chi_)/(1.+100.*Chi_) For the latter statement for beta, I highly doubt if you really gain anything by the beta variable, as it is only a multiplication with a scalar. |
Thanks for replying Bernhard!
That answers my question of why OpenFOAM doesn't have any loops in any of the source files for the equations. :rolleyes: Could you explain what you mean by "For the latter statement for beta, I highly doubt if you really gain anything by the beta variable, as it is only a multiplication with a scalar"? You doubt I'll gain anything in what sense? |
All times are GMT -4. The time now is 09:17. |