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

scalarCodedSource how to access to field instance

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2019, 15:24
Unhappy scalarCodedSource how to access to field instance
  #1
New Member
 
Join Date: Jun 2019
Posts: 15
Rep Power: 7
samiahmed is on a distinguished road
Hello
I am using scalarCodedSource in fvOptions.
Currently, I am solving my case with laplacianFoam. I want to access to the T field from the codeAddSup section
I tried the following:

Code:
...
 codeAddSup
     #{
          Info << "Inside codeAddSup" << endl;
          scalarField& T = this->db(); // This doesn't work
          scalarField& T = *this // This also doesn't work
      #};
 ...
Could you please tell me what is wrong? how can I access the T field?
In general, for other solvers, say, (simpleFoam, pimpleFoam, ...etc) how can I access other fields, say: velocity, pressure, epsilon, ....etc?

Thank you
samiahmed is offline   Reply With Quote

Old   June 30, 2019, 21:51
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
Have you tried

Code:
volScalarField T = mesh().lookupObject<volScalarField>("T")
Caelan
clapointe is offline   Reply With Quote

Reply


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
Access and compare volume Scalar Field value of a cell with neighbouring cell upuli OpenFOAM Programming & Development 0 November 5, 2018 00:05
New Solver error Foam::error::printStack upuli OpenFOAM Running, Solving & CFD 4 May 11, 2018 02:43
potential flows, helmholtz decomposition and other stuffs pigna Main CFD Forum 1 October 26, 2017 09:34
access to field data sepp OpenFOAM Programming & Development 0 February 15, 2011 10:13
Access to field data sepp OpenFOAM 2 February 10, 2011 12:45


All times are GMT -4. The time now is 19:21.