CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Basic question about forAll loop and volVectorField (https://www.cfd-online.com/Forums/openfoam/128363-basic-question-about-forall-loop-volvectorfield.html)

tayo January 9, 2014 22:14

Basic question about forAll loop and volVectorField
 
Hello all, Pls I have two basic questions.
1.) What's the difference between the forAll loops below i.e. what's the effect of using the variable "A" with the index "celli"?

Code:

forAll (A,celli)
{
  if (A <= 1.0)
  {
  Talpha[A[celli]] = x[A[celli]]*y[A[celli]];
....

compared to solving as

Code:

  Talpha[celli] = x[celli]*y[celli];
2.) Given a surfaceVectorField, how can I transform it into a volVectorField? I've tried using fvc::reconstruct() but it makes my case blow up, guess it's only ideal for scalar field.

Thanks in advance for your help

nimasam January 10, 2014 01:23

1-
A is array so A[celli] returns the value of A in the celli, for example celli is 1 but the value of A[celli] is 10, then T[A[celli]] equals T[10] and T[celli] equals T[1]

2- you can use forexample: surfaceSum, there are several else in programmer guide

tayo January 10, 2014 01:56

Thanks for your quick response


All times are GMT -4. The time now is 15:49.