# Solver Run-Time Value Output

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

 September 22, 2015, 03:05 Solver Run-Time Value Output #1 Member   Matt Join Date: Oct 2012 Posts: 39 Rep Power: 6 I am in the process of developing a custom solver based off of the icoFoam solver. I would like to output a value, after each time step, based off the following: $-\overline{u'v'} + \frac{1}{Re} \left( \frac{\partial \overline{u}}{\partial y} \right )$ Currently, I am judging quasi-steadiness of turbulent flow based off of the velocity of a probed location at the center of the mesh. However, being able to output this value would give me more information before having to do any post processing. If anyone could help, I would appreciate it. Thanks.

 September 22, 2015, 10:52 #2 Senior Member   Agustín Villa Join Date: Apr 2013 Location: Brussels Posts: 187 Rep Power: 7 Hi, I think you can use a "probe function", and each time you write the data, a file will be created. If you want to see it in the terminal, you just include a line like: Code: `Info << "my variable" << my_variable << endl;` But it will give you all the values. Maybe with the probe function you can see the value also in the terminal

September 23, 2015, 02:43
#3
Member

Matt
Join Date: Oct 2012
Posts: 39
Rep Power: 6
Quote:
 Originally Posted by agustinvo Hi, I think you can use a "probe function", and each time you write the data, a file will be created. If you want to see it in the terminal, you just include a line like: Code: `Info << "my variable" << my_variable << endl;` But it will give you all the values. Maybe with the probe function you can see the value also in the terminal
Thanks for your reply! However, the equation does not represent a standard variable which can be output with the use of probes. I figured it would be easiest to add it to the solver output messages since I have already been adding features to it anyway.

The crux of my problem is that I am unsure of how to obtain the velocity field values, within the solver, that are required to solve this equation. I think that if I can figure that out, I will have my problem whipped .

Specifically, I need to be able to (if I am interpreting the equation correctly)
- obtain all instantaneous u and v velocity components, multiply them, and average the products for the first term. (Reynolds stress)

- obtain an average of the u component of velocity across each mesh xz-plane and find the derivative with respect to y, for the last term.

- Calculate the Reynolds number, which should be an easy task once I figure out how to do the above two tasks.

Sorry, I probably should have included these details before.

September 23, 2015, 07:53
#4
Senior Member

Agustín Villa
Join Date: Apr 2013
Location: Brussels
Posts: 187
Rep Power: 7
Quote:
 Originally Posted by fatirishman53 - obtain all instantaneous u and v velocity components, multiply them, and average the products for the first term. (Reynolds stress)
You could define a variable UU to to that, and by using "fieldAverage" you can get the mean value

Quote:
 Originally Posted by fatirishman53 - obtain an average of the u component of velocity across each mesh xz-plane and find the derivative with respect to y, for the last term.
As previously, but first you have to define the gradient of U

In all these cases, you have to select the correct term in the tensor you obtain.

September 23, 2015, 11:23
#5
Member

Matt
Join Date: Oct 2012
Posts: 39
Rep Power: 6
Quote:
 Originally Posted by agustinvo In all these cases, you have to select the correct term in the tensor you obtain.
Thanks again! Apparently I have a lot of research to do

If you have any tips for implementation, I certainly welcome them!

 September 25, 2015, 09:56 U.mesh.C() coordinates? #6 Member   Matt Join Date: Oct 2012 Posts: 39 Rep Power: 6 Ok, so I think I can get all of the information I need from Code: `U.mesh.C()` by looping through all of the cell centers by index. I just need to figure out how to get access to the cell center coordinates so that I can average along horizontal planes. Could someone point me in the direction of the methods/members within U.mesh.C(), or tell me how I can return cell center coordinates? EDIT: Does "U.mesh.C()" return cell center coordinates or velocities? Perhaps "U.mesh.C().component()" returns cell center coordinate in a particular direction and "U.mesh.C().internalField()" returns the velocity values at the cell centers? Last edited by fatirishman53; September 25, 2015 at 12:37.

 September 25, 2015, 16:37 Correlate velocities and y-position of cell centers #7 Member   Matt Join Date: Oct 2012 Posts: 39 Rep Power: 6 Here is what I have figured out so far: For cell center positions: Code: `const vectorField centers = u.mesh().C().internalField();` For cell center velocities: Code: `scalarField velocityX = U.internalField()` I still can't seem to figure out how to correlate the values in my "scalarField" with the y-value of the "vectorField". I know that "centers.component(1)" will return the y-position of all cell centers, but how do I apply that to "velocityX" so that I can retrieve all velocities at a particular y-position? BTW, I am completely aware that I may be going about this completely wrong. Any help would be much appreciated!

 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 Max1234 OpenFOAM Running, Solving & CFD 15 July 2, 2015 06:38 lakeat OpenFOAM Mesh Utilities 57 February 1, 2015 09:25 Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20 Son_Goku NUMECA 1 February 6, 2014 04:33 vaina74 OpenFOAM Running, Solving & CFD 3 June 8, 2010 12:30

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