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 Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2019, 14:24
Unhappy scalarCodedSource how to access to field instance
  #1
New Member
 
Join Date: Jun 2019
Posts: 6
Rep Power: 2
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, 20:51
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 294
Rep Power: 8
clapointe is on a distinguished road
Have you tried

Code:
volScalarField T = mesh().lookupObject<volScalarField>("T")
Caelan
clapointe 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 On
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 4, 2018 23:05
New Solver error Foam::error::printStack upuli OpenFOAM Running, Solving & CFD 4 May 11, 2018 01:43
potential flows, helmholtz decomposition and other stuffs pigna Main CFD Forum 1 October 26, 2017 08:34
access to field data sepp OpenFOAM Programming & Development 0 February 15, 2011 09:13
Access to field data sepp OpenFOAM 2 February 10, 2011 11:45


All times are GMT -4. The time now is 23:25.