|
[Sponsors] |
November 9, 2012, 05:09 |
strainRate values
|
#1 |
New Member
Join Date: Sep 2012
Location: Germany
Posts: 25
Rep Power: 13 |
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. |
|
November 10, 2012, 05:50 |
|
#2 |
Member
Jianye Xia
Join Date: Mar 2009
Posts: 32
Rep Power: 18 |
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! |
|
November 12, 2012, 10:45 |
|
#3 |
New Member
Join Date: Sep 2012
Location: Germany
Posts: 25
Rep Power: 13 |
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 |
|
November 13, 2012, 03:53 |
|
#4 |
Member
Jianye Xia
Join Date: Mar 2009
Posts: 32
Rep Power: 18 |
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! |
|
November 13, 2012, 09:22 |
|
#5 |
New Member
Join Date: Sep 2012
Location: Germany
Posts: 25
Rep Power: 13 |
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 adressed line 217 contains the calculation of my strainRate: Code:
sqrt(2.0)*mag(symm(fvc::grad(U))) Regards Sebastian |
|
November 13, 2012, 22:40 |
|
#6 |
Member
Jianye Xia
Join Date: Mar 2009
Posts: 32
Rep Power: 18 |
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 |
|
November 14, 2012, 01:55 |
|
#7 |
New Member
Join Date: Sep 2012
Location: Germany
Posts: 25
Rep Power: 13 |
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) Code:
1.414213562 I just have to confirm the new results. Regards Sebastian |
|
November 14, 2012, 03:11 |
|
#8 |
New Member
Emil Baric
Join Date: May 2012
Location: Graz. Austria
Posts: 12
Rep Power: 14 |
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 |
|
November 14, 2012, 03:13 |
|
#9 |
New Member
Join Date: Sep 2012
Location: Germany
Posts: 25
Rep Power: 13 |
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!! Sebastian Last edited by Studi; November 15, 2012 at 04:29. |
|
November 14, 2012, 03:23 |
|
#10 | |
New Member
Join Date: Sep 2012
Location: Germany
Posts: 25
Rep Power: 13 |
Quote:
Sebastian |
||
July 22, 2015, 20:24 |
where should add
|
#11 | |
New Member
jafar
Join Date: Jul 2014
Posts: 16
Rep Power: 11 |
Quote:
i have same problem ,where should i add this code. Thanks |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Free surface flow settubg boundary conditions and plotting velocity profiles | prashanthreddyh | FLUENT | 2 | October 21, 2015 09:58 |
Plotting a contour of the turbulence production term in CFX-Post | kellio9 | CFX | 4 | March 19, 2013 11:34 |
Contours of 2D plotting | therockyy | FLOW-3D | 4 | December 22, 2012 15:04 |
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 |