interfoam - maximal velocity in water phase

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

 October 27, 2015, 22:47 interfoam - maximal velocity in water phase #1 New Member   Matej Muller Join Date: Oct 2011 Location: Slovenia Posts: 23 Rep Power: 7 Hi! I want to get the maximal velocities for each velocity component in the water phase in each time step and get them in the log file. I've tried: Code: scalar maxUx_water=0 forAll(U,celli) { if (alpha1[celli]>0.5) { if (U[celli].x() > maxUx_water) { maxUx_water = U[celli].x(); } } } Info<< "maxUx_water= "<< maxUx_water << endl; but something is not working correctly. The values are not right (they are too small). Any ideas how to solve this? Thanks! Matej

 October 28, 2015, 04:25 #2 Member   Mattia de\' Michieli Vitturi Join Date: Mar 2009 Posts: 45 Rep Power: 10 I think you need the absolute value here: maxUx_water = U[celli].x() Mattia

 October 28, 2015, 04:52 #3 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,261 Rep Power: 23 Code: Info << "maxU: " << pos(alpha1-0.5)*max(U) << endl; or, if you want just a component: Code: Info << "maxU: " << pos(alpha1-0.5)*max(U.component(0)) << endl; (as Mattia already pointed out you may want to also print the minimum or use absolute values) How do you know your values are too small? __________________ *On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer.

 October 28, 2015, 09:26 #4 New Member   Matej Muller Join Date: Oct 2011 Location: Slovenia Posts: 23 Rep Power: 7 Hi! Thanks for the responses. Mattia, I need the minimal component values too, so I thought I'd use the same code as for the maximal. Anton, with my approach the given velocity values are smaller than obtained in postprocessing in paraView. I don't know what the code pos(alpha1-0.5) does exactly, but the whole line Code: Info << "maxU: " << pos(alpha1-0.5)*max(U.component(0)) << endl; gives a list of velocities for all cells. Weirdly, the values are eather 0, or the same value as max(U.component(0)). regards, matej

 October 28, 2015, 11:14 #5 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,261 Rep Power: 23 Are you looking at cell values or interpolated values in Paraview? I made a mistake in my code - pos() will return 1 whenever the expression in the brackets is positive, otherwise negative. And it does so for every cell, which is why you got what you got. So how to fix this? . . . Info << "maxU: " << max(pos(alpha1-0.5)*U.component(0)) << endl; Too bad I couldn't hide the answer behind a spoiler tag __________________ *On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer.

 October 28, 2015, 11:48 #6 New Member   Matej Muller Join Date: Oct 2011 Location: Slovenia Posts: 23 Rep Power: 7 I'm looking the cell values in paraView, and now they are correct! Thank you. Although, the line above gives: Code: maxU: max((pos((alpha.water-0.5))*U.component(0))) [0 1 -1 0 0 0 0] 0.549513 and I need only the values like: Code: maxU: 0.549513 Any ideas? Matej

 October 30, 2015, 02:41 #7 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,261 Rep Power: 23 Yes, what you want is the value. Hence Code: max((pos((alpha.water-0.5))*U.component(0))).value() should do the trick. __________________ *On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer.

 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 kevinmccartin CFX 10 July 9, 2015 21:36 xpqiu OpenFOAM Running, Solving & CFD 8 June 17, 2015 02:08 Nick_civ OpenFOAM Post-Processing 0 June 20, 2014 06:17 kbaker CFX 24 June 14, 2012 07:37 fredius,magige,tanzanian,(e.a) Main CFD Forum 0 January 27, 2002 08:10

All times are GMT -4. The time now is 18:54.