# Defining additionally variables of U in OF 1.6

 Register Blogs Members List Search Today's Posts Mark Forums Read

 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 x-component of a field, here U, is U.component(0). The y- and z-components 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);``` This calculates a field of scalars that consist of Ux*cos(pi/6) + Uy*sin(pi/6), where cos and sin use rad. But the field is not written every time step. For that you need to put Code: ```Info << "Reading field Unew\n" << endl; volScalarField Unew ( IOobject ( "Unew", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh );``` in createFields.H. Then, you don't need to specify the type of Unew in the code, i.e. leave out "volScalarField" in the code that calculates Unew. If you use "MUST_READ" in createFields.H you need to make a file in the 0 folder of the case, where the initial and boundary conditions of Unew are specified. 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;` to the solver, run the solver with Code: `somethingFoam > log &` and grep Unew from the log file. __________________ Regards, Gijs

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post cboss OpenFOAM Running, Solving & CFD 25 August 9, 2016 09:53 Cynthia Poon OpenFOAM Running, Solving & CFD 0 March 25, 2009 04:36 Tim Phoenics 0 September 30, 2003 14:52 Eugene Phoenics 9 November 2, 2001 23:00 Zoltan Turzo CFX 2 April 20, 2000 15:05

All times are GMT -4. The time now is 19:14.