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

ForAll Loop

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By sanj
  • 1 Post By Lieven
  • 1 Post By akidess
  • 1 Post By akidess

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   January 22, 2014, 20:57
Default ForAll Loop
  #1
New Member
 
Sanj M
Join Date: Dec 2013
Location: Ohio
Posts: 10
Rep Power: 12
sanj is on a distinguished road
Hello Guys,

Is there an alternative to the forAll loop? Basically I need to run the following code every time step and as a result it takes a long time. The code is:

forAll(alpha1, celli)
{
if (alpha1[celli] < 0)
{
alpha1[celli] = 0;
}
else if (alpha1[celli] > 1)
{
alpha1[celli]=1;
}
else
{
alpha1[celli]=alpha1[celli];
}
}//end for loop

This ensures that alpha1 in any cell is always between 0 and 1. I have heard about field operations to make it faster but dont know how to implement it. Can some one please shed some light on this matter.

Thanks,
Sanj
vivek05 likes this.
sanj is offline   Reply With Quote

 


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 02:09
forAll loop getting stuck? I'm stuck too! CHARLES OpenFOAM Programming & Development 6 October 11, 2013 16:46
basic question with 'ForAll' loop Pascal_doran OpenFOAM Post-Processing 10 December 14, 2012 17:39
[CAD formats] my stl surface is seen as just a line rcastilla OpenFOAM Meshing & Mesh Conversion 2 January 6, 2010 01:30
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57


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