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 Tree5Likes

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   January 25, 2022, 14:59
Default coded energysource in fvModels
  #1
New Member
 
Per Nilsson
Join Date: Mar 2009
Location: Lund, Sweden
Posts: 21
Rep Power: 17
borrbyper is on a distinguished road
In OF8, I used "scalarCodedSource" in fvOptions to add a source to the field e. The source term is a function of coordinate and resides in a field, sourceTerm.

In OF9, I had to rephrase a bit to "coded" in fvModels to get it running.
It does however not seem to add any source in the energy equation - the temperatures are unaffected by it.

Would you have an idea why (or alternatives how to add a constant heat source which is a function of coordinate)?

Code:
energySource
{
	type		coded;

	selectionMode   all;

	field e;

	codeAddSup
	#{
		Pout<< "**codeAddSup**" << endl;

	 	volScalarField ST
 		(
 			IOobject
        		(
 				"sourceTerm",
				"0",
				mesh(),
				IOobject::MUST_READ,
				IOobject::NO_WRITE
			),
 			mesh()
	 	);

		const scalarField& V = mesh().V();
		scalarField& heSource = eqn.source();
		//heSource = 1e8;
 		heSource = -1*ST*V;

	#};

}
borrbyper is offline   Reply With Quote

 

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


All times are GMT -4. The time now is 03:30.