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

Seeking explanation why solve zeroes out solution in certain circumstances

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 19, 2013, 18:59
Default Seeking explanation why solve zeroes out solution in certain circumstances
  #1
New Member
 
Tom Chyczewski
Join Date: Mar 2009
Location: Bethpage, New York, USA
Posts: 15
Rep Power: 17
chyczewski is on a distinguished road
I am hoping someone can help me understand the behavior I'm observing with the code at bottom, which I adapted from scalarTransportFoam.C. Since my equation is stating that T isn't changing, I expect the T before the solve to be the same as T after the solve. However, as it is written, the T after the solve is equal to 0 for all m. If I change the construction of DD to

Code:
for (m=0; m<64, ++m)
  {
      DD[m] = scalar(l);
  }
then the code behaves as I'd expect. Namely, T before is equal to T after (=5).

Can anyone explain why solve is setting T to 0 if I use m in the construction of DD? Thanks.

Code:
#include "fvCFD.H"
#include "fvIOoptionList.H"
#include "simpleControl.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "createFields.H"
    #include "createFvOptions.H"

    simpleControl simple(mesh);

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    Info<< "\nCalculating scalar transport\n" << endl;

    #include "CourantNo.H"

    int m;
    int l = 5;

    scalar DD[64];

    for (m=0; m<64; ++m)
      {
        DD[m] = scalar(m);
      }

    for (m=0; m<64; ++m)
      {
        forAll(U,i)
         {
           T[i] = DD[m];
         }

         Info<<"T Before "<<T[56]<<endl;

         solve
          (
            fvm::ddt(T)
          );
    
        Info<<"T After "<<T[56]<<endl;
      }


    return 0;
}
chyczewski is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
smoothSolver diverges - solution in using PBiCG solver? makaveli_lcf OpenFOAM Running, Solving & CFD 3 September 11, 2013 13:44
Doubt on Implicit Methods analyse In India Main CFD Forum 10 March 9, 2007 04:01
Unsteady solution Christophe FLUENT 0 August 11, 2006 12:13
Problems with sonicTurbFoam tangd OpenFOAM Running, Solving & CFD 0 May 29, 2006 10:07
Which CFD software can solve this simulation accurately? Amilcar R Arvelo Main CFD Forum 1 December 1, 1998 16:55


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