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

coded energysource in fvModels

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 19, 2024, 11:59
Default
  #21
New Member
 
Vittorio Nardin
Join Date: Jun 2023
Posts: 5
Rep Power: 3
vitto is on a distinguished road
Quote:
Originally Posted by shubhamkv1 View Post
I am using coded fvModel for this.
You must create a loop inside your code to assign the source in the the cells even using selectionMode cellZone:




volScalarField myField
(
IOobject
(
"myField",
"0",
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh()
);


const labelList& myCells = mesh().cellZones()["myZone"];


then

forAll(myCell, i)
{
myField[myCell[i]] = 1;

}

scalarField& mySource = eqn.source();
mySource += myField;
shubhamkv1 likes this.
vitto is offline   Reply With Quote

Old   February 20, 2024, 04:21
Default
  #22
New Member
 
Shubham
Join Date: Jan 2024
Posts: 8
Rep Power: 2
shubhamkv1 is on a distinguished road
Thank you for your prompt responses.
The absence of a loop in my implementation is a major issue. I presumed that specifying the "cellZone" within the "selectionMode" parameter would inherently apply the source term to the designated zone.
Thanks once again
shubhamkv1 is offline   Reply With Quote

Reply

Tags
coded, fvmodels, fvoptions, heatsource


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
Accessing species in coded function object Swirl OpenFOAM Programming & Development 2 January 24, 2022 05:52
coded functionObjects behaving not as expected alexfells OpenFOAM 2 October 28, 2020 04:58
Coded function object in openfoam v5 kit607 OpenFOAM Post-Processing 3 September 29, 2020 16:43
Unknown character in name of output variable when using coded function object pvergnol OpenFOAM Post-Processing 5 August 12, 2020 14:29
codeInclude in coded function in controlDict, and yPlus LuisAlberto OpenFOAM Programming & Development 4 August 18, 2015 13:48


All times are GMT -4. The time now is 16:06.