CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Gradients (http://www.cfd-online.com/Forums/openfoam-solving/59969-gradients.html)

coops October 16, 2006 00:17

Hello All, I am wondering i
 
Hello All,

I am wondering if it is possible to get access to the spatial gradient constituents of the divergence operator.

What I really want is to be able to look at the three seperate constituents of the divergence of the velocity (i.e du/dx, dv/dy, dw/dz). How can I access these so that I can print these fields out at each time step?

Thanks in advance,

Shaun

hjasak October 16, 2006 00:26

Calculate fvc::grad(U) and tak
 
Calculate fvc::grad(U) and take the xx, yy and zz component.

Hrv

coops October 16, 2006 00:52

Thanks for the advice thus far
 
Thanks for the advice thus far however I have the following problem.

I have created a field called gradU that is a volTensorField. It is written out at each time step. From this field I was then going to take the individual constituents I require. For example I created a volScalar field called streamwise and at the end of the application (just before runTime.write(); at the end of the time step) I have written the following:

streamwise = gradU.xx();

When I go to compile this I receive the following error:

newThermSolver.C:132: error: 'struct Foam::volTensorField' has no member named 'xx'

I am not sure what I have done wrong. Can someone help me with this error? This looks like an example that can be found on pg P-23 of the programmers guide.

The tensorfield gradU does write out at each time-step and does appear to work correctly.

Thanks,

Shaun

hjasak October 16, 2006 02:05

I am not sure what I have done
 
Quote:

I am not sure what I have done wrong
You didn't check the header files, you didn't look for example codes that may be using the same thing, you didn't check the documentation, you didn't even search this forum.

OK, enough of that - I think you've got the message :-)

gradU.component(tensor::XX);

Hrv

coops October 16, 2006 04:20

Sorry, Sorry, Sorry, Sorry.
 
Sorry, Sorry, Sorry, Sorry.

Thanks for you help!


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