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

How to access field values in openFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 18, 2024, 15:45
Default How to access field values in openFOAM
  #1
New Member
 
hesam
Join Date: Dec 2013
Posts: 9
Rep Power: 12
ezlidor_shb is on a distinguished road
Hello,
My question is how to access openFOAM fields (density, velocity, temperature, user-defined scalar, etc.) in openFOAM functions. For example, how can I define my energy source in the following scalarCodedSource as a function of my user-defined scalar "wT"? I'm using chtMultiRegionSimpleFoam solver.

---Here's my function to add the scalar transport equation "wT" in the controlDict dictionary:

functions
{
Adsorption
{
type scalarTransport;
libs (solverFunctionObjects);
resetOnStartUp no;
field wT;
D 0.1;


fvOptions
{
}
}
}

---Here's the scalarCodedSource in my fvOptions:

codedSource
{
type scalarCodedSource;
selectionMode all;

fields (h);
name sourceVelocity;

codeCorrect
#{
#};

codeConstrain
#{
#};

codeAddSup
#{

// How do I access w_T here?

const scalarField& cellx = mesh_.C().component(0);

forAll(cellx, i)
{
heSource[i] += "I need to use w_T here";
};

#};
}

Thank you very much.
ezlidor_shb is offline   Reply With Quote

Reply

Tags
field values, function objects, openfoam


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
How to contribute to the community of OpenFOAM users and to the OpenFOAM technology wyldckat OpenFOAM 17 November 10, 2017 15:54
OpenFOAM 4.0 Released CFDFoundation OpenFOAM Announcements from OpenFOAM Foundation 2 October 6, 2017 05:40
Direction of B field and electric field in OpenFOAM (mhdFOAM) adkar Electromagnetics 1 April 26, 2016 00:02
OpenFOAM v3.0.1 Training, London, Houston, Berlin, Jan-Mar 2016 cfd.direct OpenFOAM Announcements from Other Sources 0 January 5, 2016 03:18
Setting patch field values equal to internal field values leroyv OpenFOAM Programming & Development 1 October 21, 2014 15:49


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