CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Solver Run-Time Value Output

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 22, 2015, 03:05
Default Solver Run-Time Value Output
  #1
Member
 
Matt
Join Date: Oct 2012
Posts: 39
Rep Power: 13
fatirishman53 is on a distinguished road
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:



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.
fatirishman53 is offline   Reply With Quote

Old   September 22, 2015, 10:52
Default
  #2
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
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
agustinvo is offline   Reply With Quote

Old   September 23, 2015, 02:43
Default
  #3
Member
 
Matt
Join Date: Oct 2012
Posts: 39
Rep Power: 13
fatirishman53 is on a distinguished road
Quote:
Originally Posted by agustinvo View Post
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.
fatirishman53 is offline   Reply With Quote

Old   September 23, 2015, 07:53
Default
  #4
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
Quote:
Originally Posted by fatirishman53 View Post
- 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 View Post
- 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.
agustinvo is offline   Reply With Quote

Old   September 23, 2015, 11:23
Default
  #5
Member
 
Matt
Join Date: Oct 2012
Posts: 39
Rep Power: 13
fatirishman53 is on a distinguished road
Quote:
Originally Posted by agustinvo View Post
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!
fatirishman53 is offline   Reply With Quote

Old   September 25, 2015, 09:56
Default U.mesh.C() coordinates?
  #6
Member
 
Matt
Join Date: Oct 2012
Posts: 39
Rep Power: 13
fatirishman53 is on a distinguished road
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.
fatirishman53 is offline   Reply With Quote

Old   September 25, 2015, 16:37
Default Correlate velocities and y-position of cell centers
  #7
Member
 
Matt
Join Date: Oct 2012
Posts: 39
Rep Power: 13
fatirishman53 is on a distinguished road
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!
fatirishman53 is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 02:36
Behaviour of the kOmegaSST in a steady-state case Max1234 OpenFOAM Running, Solving & CFD 18 October 31, 2018 08:03
Flow Solver: Run time error Son_Goku Fidelity CFD 2 August 21, 2018 09:21
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
lift and drag on ship superstructures vaina74 OpenFOAM Running, Solving & CFD 3 June 8, 2010 12:30


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