CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Plotting strainRate

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 9, 2012, 05:09
Default strainRate values
  #1
New Member
 
Join Date: Sep 2012
Location: Germany
Posts: 24
Rep Power: 4
Studi is on a distinguished road
Hello everybody!

Basically I am simulating a polymer flow in an easy curved channel. I am using the nonNewtonianIcoFoam solver to do so (Changed stock dictionarys copied from tutorial). The solver uses the pressure p and the velocity U as boundary conditions. So far no problems.
What I want/need is the written values of the StrainRate (which OF is using during calculating the solutions), so that I can plot them in ParaFoam like the values for p and U, which is possible by default. Every time step folder contains phi and nu in addition to p and U already, so I conclude that there must be a possibilty to tell OF which values to plot in the time step folders, that I don't know.
Can you, the professionals, help me with that? Hopefully I could set straight the things I want.

Any help is much appreciated!


Regards
Sebastian

Last edited by Studi; November 9, 2012 at 05:28.
Studi is offline   Reply With Quote

Old   November 10, 2012, 05:50
Default
  #2
Member
 
Jianye Xia
Join Date: Mar 2009
Posts: 32
Rep Power: 7
bioexplore is on a distinguished road
Hi, Studi!

I think what u want is the return value of member function strainRate() of viscosityModel, the calculating is finished in this function. So may be the source code of this function in source file "transportmodels/incompressible/viscosityModels/viscositymodel/viscosityModel.C" Line58.
that is "sqrt(2.0)*mag(symm(fvc::grad(U_)));"

You can get this value at postprocessing step by coding, reference code is located in "OpenFOAM-2.1.1\applications\utilities\postProcessing\stress Field\stressComponents\stressComponents.C"

Here shortly, you can use
volScalarField strainRate
(
IOobject
(
"StrainRate",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
sqrt(2.0)*mag(symm(fvc::grad(U_))); //this command will calcualte strainRate
);
StrainRate.write();//this will write file "StrainRate" in each time dir!!

HOPE it will help!
bioexplore is offline   Reply With Quote

Old   November 12, 2012, 10:45
Default
  #3
New Member
 
Join Date: Sep 2012
Location: Germany
Posts: 24
Rep Power: 4
Studi is on a distinguished road
Hi bioexplore! Thanks for your hints...

You understand correctly. Unfortunately your method didn't work. And I can't find any connection between the nonNewtonianIcoFoam solver and the stressComponents.H file. Why do I have to place it there? Or is ParaFoam using this file?
Another question: The time step folders are containing 4 files! U, p, nu and Phi. Why can't ParaFoam show the values of Phi but all other values?

According to the Wiki here:
http://openfoamwiki.net/index.php/In...ect_and_fields
the code differs a little from yours. Any idea on this? I already tried it like this, but my time folders don't contain anything else when simulating the case again.

Thanks!

Regards
Sebastian
Studi is offline   Reply With Quote

Old   November 13, 2012, 03:53
Default
  #4
Member
 
Jianye Xia
Join Date: Mar 2009
Posts: 32
Rep Power: 7
bioexplore is on a distinguished road
Hi, Studi
You must write code and compile it as a tool, just like the tool of stressComponets done. You can use stressComponents.C as template and write your own code to do what you want (like the code I wrote) into the template source file, use wmake to compile it, You can put the new source file to $WM_PROJECT_USER_DIR/application/ and rename it as you wish, then following compiling instruction in user manual. After compile you own tool, you can get the tool.
Run your simulation, then at the case dir, run you new compiled tool and it will generate the field in each time directory, after that you can postprocessing with the strainrate field.

Hope it will help you!
bioexplore is offline   Reply With Quote

Old   November 13, 2012, 09:22
Default
  #5
New Member
 
Join Date: Sep 2012
Location: Germany
Posts: 24
Rep Power: 4
Studi is on a distinguished road
Hi bioexplore!

Thanks to enlighten me!
Now a lot more things are clear.

Unfortunately I am not capable op compiling my new tool. Typing wmake shows up an error.
Code:
stressComponents.C: In Funktion »int main(int, char**)«:
stressComponents.C:217:10: Fehler: Aufruf des überladenen »sqrt(double)« ist nicht eindeutig
The translation means as much as "Error: Call of overloaded 'sqrt (double)' is ambiguous"
The adressed line 217 contains the calculation of my strainRate:
Code:
sqrt(2.0)*mag(symm(fvc::grad(U)))
Do you have any idea how to manage this? I am not well-versed with c++ and a websearch didn't bring up the wanted solution. Thanks a lot again!

Regards
Sebastian
Studi is offline   Reply With Quote

Old   November 13, 2012, 22:40
Default
  #6
Member
 
Jianye Xia
Join Date: Mar 2009
Posts: 32
Rep Power: 7
bioexplore is on a distinguished road
Hi, Studi

I am not quite sure what cause this compiling error, I guess maybe compiler is confused between std::sqrt(double) and foam::sqrt(double) ???

bioexplore
bioexplore is offline   Reply With Quote

Old   November 14, 2012, 01:55
Default
  #7
New Member
 
Join Date: Sep 2012
Location: Germany
Posts: 24
Rep Power: 4
Studi is on a distinguished road
Well, right now I don't know why it gives this error, but I managed to compile it by replacing the
Code:
sqrt(2.0)
with the static value
Code:
1.414213562
Thanks to your help, the new utility works fine now!
I just have to confirm the new results.


Regards
Sebastian
Studi is offline   Reply With Quote

Old   November 14, 2012, 03:11
Default
  #8
New Member
 
Emil Baric
Join Date: May 2012
Location: Graz. Austria
Posts: 12
Rep Power: 4
emil is on a distinguished road
Hello Sebastian,

sorry to bother you but I would need the same thing and I am quite new to OF. So I would kindly ask you if you could send me this piece of code and explain the procedure a little bit. Also is the nonNewtonianIcoFoam working ok with your case? because I have the problem already with the pressure equation doing 1001 it. to achieve accuracy.

Regards,

Emil
emil is offline   Reply With Quote

Old   November 14, 2012, 03:13
Default
  #9
New Member
 
Join Date: Sep 2012
Location: Germany
Posts: 24
Rep Power: 4
Studi is on a distinguished road
I got it working now with a little change...
Placing the value in the sqrt function as a float makes the compiler work.
My code looks as follows for now.

Code:
volScalarField strainRate
	(
	IOobject 
	(
	"strainRate",
	runTime.timeName(),
	mesh,
	IOobject::NO_READ
	),
	sqrt(2.0f)*mag(symm(fvc::grad(U))) //this command will calculate strainRate
	);
	strainRate.write();//this will write file "StrainRate" in each time dir!!
Regards
Sebastian

Last edited by Studi; November 15, 2012 at 04:29.
Studi is offline   Reply With Quote

Old   November 14, 2012, 03:23
Default
  #10
New Member
 
Join Date: Sep 2012
Location: Germany
Posts: 24
Rep Power: 4
Studi is on a distinguished road
Quote:
Originally Posted by emil View Post
Hello Sebastian,

sorry to bother you but I would need the same thing and I am quite new to OF. So I would kindly ask you if you could send me this piece of code and explain the procedure a little bit. Also is the nonNewtonianIcoFoam working ok with your case? because I have the problem already with the pressure equation doing 1001 it. to achieve accuracy.

Regards,

Emil
I have sent you a PM.

Sebastian
Studi is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plotting a contour of the turbulence production term in CFX-Post kellio9 CFX 4 March 19, 2013 12:34
Contours of 2D plotting therockyy FLOW-3D 4 December 22, 2012 15:04
Free surface flow settubg boundary conditions and plotting velocity profiles prashanthreddyh FLUENT 1 December 2, 2009 11:06
Graph plotting Lam FLUENT 2 September 25, 2003 07:02
Plotting "in-plane" in 3-D Karl Kevala FLUENT 0 September 6, 2001 17:47


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