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

Coded heat source unrelistic tempearture increase

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 12, 2021, 07:49
Post Coded heat source unrelistic tempearture increase
  #1
New Member
 
Farouk
Join Date: Jul 2020
Posts: 11
Rep Power: 7
FaroukH is on a distinguished road
Hello Foamers,

I am having issues implementing a linearly increasing coded source in a trapezoidally shaped cell zone. The overall heat release of the linearly increasing heat source is the same as a uniform one that I implemented with a semiImplicidSource (I only used the explicit term), but the temperature always gets out of range. In both cases I am using the same mesh, and cellzone geometery.

My goal in the linearly increasing coded source is to have an incrementaly increasing heat source in the x-direction that is constant in the y-direction. To do this, I am using a simple function of q = a*x +b. Where q is the volume specific heat release (thermal power - [W/m^3]), with a and b be being constants determined such that the total heat release is always the same at 110 W.

Code:
energySource2
{
	type		scalarCodedSource;
	
	active		yes;
	
	name		sourceTime;
	
	scalarCodedSourceCoeffs
	{
		
		selectionMode		cellZone;

		cellZone		heatSourceZone;

		fields		 	(h);
		
		codeInclude
		#{
		
		#};
		
		codeCorrect
		#{
			Pout<< "**codeCorrect**" << endl;
		#};
		
		codeAddSup
		#{
			const Time& time = mesh().time();

			const vectorField& C = mesh_.C();
			const scalarField& V = mesh_.V();

			scalarField& heSource = eqn.source();

			const volVectorField& U = mesh().lookupObject<volVectorField>("U");
			const volScalarField cellx = U.mesh().C() & vector(1,0,0);

			const scalar a = 344947657.2909107;
			const scalar b = 80630728.52883253;
			
			//heSource -= 110;

			forAll(V, i)
			{
				heSource[i] -= (a*cellx[i] + b)*V[i];
			}
		#};
		
		codeSetValue
		#{
			
		#};
		
		// not sure if below code needed
		
		code
		#{
			$codeInclude
			$codeCorrect
			$codeAddSup
			$codeSetValue
		#};
		
	}
	
	sourceTimeCoeffs
	{
		$scalarCodedSourceCoeffs;	
	}
}
Some of the declared variables are not sued, just place holders at the moment. But I did base this on several other examples that I found here on the forum and the example found in the header file of the scalarCodedSource. One thing that also confuses me is the negative adition of the heat source, while in the simpleImplicit source the explicit variable is always positive.

The error:

Code:
--> FOAM Warning : 
    From function Foam::scalar Foam::janafThermo<EquationOfState>::limit(Foam::scalar) const [with EquationOfState = Foam::perfectGas<Foam::specie>; Foam::scalar = double]
    in file /import/usr_local/share/OpenFOAM/OpenFOAM-7/src/thermophysicalModels/specie/lnInclude/janafThermoI.H at line 117
    attempt to use janafThermo<EquationOfState> out of temperature range 200 -> 6000;  T = 6952.79
--> FOAM Warning : 
    From function Foam::scalar Foam::janafThermo<EquationOfState>::limit(Foam::scalar) const [with EquationOfState = Foam::perfectGas<Foam::specie>; Foam::scalar = double]
    in file /import/usr_local/share/OpenFOAM/OpenFOAM-7/src/thermophysicalModels/specie/lnInclude/janafThermoI.H at line 117
    attempt to use janafThermo<EquationOfState> out of temperature range 200 -> 6000;  T = 7029.23
--> FOAM Warning : 
    From function Foam::scalar Foam::janafThermo<EquationOfState>::limit(Foam::scalar) const [with EquationOfState = Foam::perfectGas<Foam::specie>; Foam::scalar = double]
    in file /import/usr_local/share/OpenFOAM/OpenFOAM-7/src/thermophysicalModels/specie/lnInclude/janafThermoI.H at line 117
    attempt to use janafThermo<EquationOfState> out of temperature range 200 -> 6000;  T = 7071.1
--> FOAM Warning : 
    From function Foam::scalar Foam::janafThermo<EquationOfState>::limit(Foam::scalar) const [with EquationOfState = Foam::perfectGas<Foam::specie>; Foam::scalar = double]
    in file /import/usr_local/share/OpenFOAM/OpenFOAM-7/src/thermophysicalModels/specie/lnInclude/janafThermoI.H at line 117
    attempt to use janafThermo<EquationOfState> out of temperature range 200 -> 6000;  T = 7078.56
--> FOAM Warning : 
    From function Foam::scalar Foam::janafThermo<EquationOfState>::limit(Foam::scalar) const [with EquationOfState = Foam::perfectGas<Foam::specie>; Foam::scalar = double]
    in file /import/usr_local/share/OpenFOAM/OpenFOAM-7/src/thermophysicalModels/specie/lnInclude/janafThermoI.H at line 117
    attempt to use janafThermo<EquationOfState> out of temperature range 200 -> 6000;  T = 7046.39
--> FOAM Warning : 
    From function Foam::scalar Foam::janafThermo<EquationOfState>::limit(Foam::scalar) const [with EquationOfState = Foam::perfectGas<Foam::specie>; Foam::scalar = double]
    in file /import/usr_local/share/OpenFOAM/OpenFOAM-7/src/thermophysicalModels/specie/lnInclude/janafThermoI.H at line 117
    attempt to use janafThermo<EquationOfState> out of temperature range 200 -> 6000;  T = 6951.62
As further reference, here is the python code that I used to calculate and visualize the heat source. b is based on a fraction of the uniformly distributed heat source that is then used to determine a.

Code:
import numpy as np
import matplotlib.pyplot as plt

H = 0.0254

z_th = 0.001

R1 = 0.003175
R2 = 0.00740833
L = H*4.06
Q = 110.0 #variable

alpha = ((R2-R1)/3 + R1/2)*L**2
beta = ((R2-R1)/2 + R1)*L

A_trapezoid = ((2*R1)+(2*R2))*L/2
Volume = A_trapezoid*0.001

q = Q/Volume


b = 0.9*q ##variable

a = ((Q/(2*z_th))-b*beta)/alpha

xRange = np.linspace(0,L, num = 20)

y_increase = xRange*a + b

plt.plot(xRange,y_increase)
plt.xlabel('mm')
plt.ylabel('W/m^3')
Thank You,
Farouk
FaroukH 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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 22:53
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error FerdiFuchs OpenFOAM Community Contributions 27 April 16, 2014 16:14
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 02:41
How can I increase Heat Transfer at Domain Interf? B.Simon CFX 3 October 28, 2008 19:53


All times are GMT -4. The time now is 09:52.