
[Sponsors] 
March 3, 2011, 08:44 
Defining additionally variables of U in OF 1.6

#1 
Member
don lenardo
Join Date: Nov 2010
Posts: 75
Rep Power: 8 
Hello,
I am an OF Newbie and want to set up a case of a pump turbine in OF 1.6. Therefor I have to integrate some additionally variables of the Velocity in 3 different local coordinate systems, such as: U_new1=Ux*cos(10°)+Uy*sin(10°) U_new2=Ux*cos(12°)+Uy*sin(12°) U_new3=Ux*cos(30°)+Uy*sin(30°) Can anyone tell me, where I have to define this 3 velocities and in which Script I have to perform this Integration? Or do you think it's better to output the standard Velocity U and transform it later during post? Thanks in advance. Regards Markus 

March 5, 2011, 08:51 

#2 
Senior Member
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 10 
Hi Markus,
The xcomponent of a field, here U, is U.component(0). The y and zcomponents would be U.component(1) and U.component(2), respectively. Now, the way you have written it gives a volScalarField, not a volVectorField (like U itself). For instance, you could plug the following in the solver after U is solved: Code:
scalar angle1 = mathematicalConstant::pi/6.0; volScalarField Unew = U.component(0) * Foam::cos(angle1) + U.component(1) * Foam::sin(angle1); Code:
Info << "Reading field Unew\n" << endl; volScalarField Unew ( IOobject ( "Unew", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); If you'd like to write every time step, function objects are handy. In your case probably the turboPerformance function objects. Hope this helps you on your way a bit!
__________________
Regards, Gijs 

March 7, 2011, 09:56 

#3 
Member
don lenardo
Join Date: Nov 2010
Posts: 75
Rep Power: 8 
Hy Gijsbert,
thank you very much for your instruction!Now, I have to think about if it's necessary to perfom the transformation during solving  in my opinion this may rise the calculation time?! For this reason I think it's much easier to output only the velocity U and to create a script in python during post,which transform it to local coordinate systems. Regards Markus 

March 7, 2011, 10:10 

#4 
Senior Member
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 10 
Hi Markus,
Sure, the calculation, although small, will take some time. You could use the U file in the time step directories. This, however, only gives you data at write time. If you need data at every time step I suggest to either use a function object or put the above code in and write out the data in an info statement to a log file. For that simply add Code:
Info << "Unew = " << Unew << endl; Code:
somethingFoam > log &
__________________
Regards, Gijs 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
komegaSST model (OF 1.6)  turbulent flat plate  cboss  OpenFOAM Running, Solving & CFD  25  August 9, 2016 09:53 
Accessing other variables in defining boundary condition  Cynthia Poon  OpenFOAM Running, Solving & CFD  0  March 25, 2009 04:36 
Defining New Variables  Tim  Phoenics  0  September 30, 2003 14:52 
PHI file structure  Eugene  Phoenics  9  November 2, 2001 23:00 
Saving variables on a user patch with physical coordinates  Zoltan Turzo  CFX  2  April 20, 2000 15:05 