# problem computing maximum

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

 August 31, 2009, 12:00 problem computing maximum #1 Member   Julien Schaguene Join Date: Apr 2009 Location: France Posts: 55 Rep Power: 8 Hi all, I'm facing a problem computing a maximum value for a time interval on each cell. I put there my code: volVectorField Umax (initiated full of (0 0 0)) forAll(times, timeI) { forAll(U,cellI) { if (mag(U[cellI]) > mag (Umax[cellI]) { Umax[cellI]=U[cellI]; } } } I get strange results, such as velocity in a cell that is not reach on my interval. Does anybody has an idea? Any advice would be welcome. Thank you!

 August 31, 2009, 16:44 #2 Super Moderator     Niklas Nordin Join Date: Mar 2009 Location: Stockholm, Sweden Posts: 693 Rep Power: 20 so.... in cell2 it can be the value from time=1s and in cell3 it can be the value from time=2s...for instance Im just curious why that would be interesting, to mix together the different times. Or have you left out pieces of code, like where you read in the U at different times? Where in that loop is that read? And why not initiate Umax with the values from the first time, that way you dont have to check for that time and can skip 1 iteration...not much, but still. anyways...your code (as it is written) does neither change the time or U in that loop.

 September 1, 2009, 02:41 #3 Member   Julien Schaguene Join Date: Apr 2009 Location: France Posts: 55 Rep Power: 8 Yes, that's the point, I can have U from time 1 in cell 3, and U from time 254 in cell 68957. It is interesting for me because I want to study sediment, so I have to know the maximum velocity in a non steady flow. I could have initiate Umax with U(t=0), but that's not the point. And of course, I have many pieces of code left, I don't have just these lines, it would be dummy to think it would work! My base was the vorticity application. So for each time, I read U and it works. I obtain a correct average, it's just the maximum that doesn't work. I think my problem is the if (mag(U[cellI]) > mag (Umax[cellI]) { Umax[cellI]=U[cellI]; } because when I suppress the if, I get Umax=U at each time step (ouf!) Any idea?

 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 Amr FLUENT 1 March 15, 2013 12:47 Phanindra FLUENT 5 April 17, 2007 09:57 BeatrÃ­z Navarro FLUENT 0 June 24, 2006 18:22 zuozicheng CFX 1 July 12, 2005 18:39 Gauthier Lambert Main CFD Forum 1 August 3, 2000 09:22

All times are GMT -4. The time now is 20:50.