Variable volumetric source term

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
fomeh

Variable volumetric source term

Post by fomeh »

Hello guys,

I'm trying to implement volumetric heat source in a domain. The sources are not constant and they change with temperature. For constant terms, I've used ustssc.f90 with:

Code: Select all

	volf  = 0.d0
	
	
	CALL GETCEL(argument, NLELT,LSTELT)

	do ilelt = 1, nlelt
	  iel = lstelt(ilelt)
	  volf = volf + volume(iel)
	enddo

	do ilelt = 1, nlelt
	  iel = lstelt(ilelt)
	! No implicit source term
	  crvimp(iel) = 0.d0
	! Explicit source term
	  crvexp(iel) = volume(iel)*pwatt/volf
	enddo
	
enddo
Now pwatt should change with a linear equation as a function of temprature.

Any comment is appreciated.
Brian Angel

Re: Variable volumetric source term

Post by Brian Angel »

Hello,

You should be able to code pwatt directly in the ustssc routine. This routine has access to the rtp, rtpa and propce arrays which store the following:

rtp - all flow variables at the cell centres at the current time step / iteration
rtpa - all flow variables at the cell centres at the previous time step / iteration
propce - physical properties at the cell centres

Hence, once you have identified the cells with the source term you will have access to the temperature in these cells via the rtp and rtpa arrays and you can then code the equation for pwatt.

To see how rtp, rtpa and propce are structured, please refer to §3.9.3.3 of the V3.2.1 user manual.

Regards,

Brian Angel.
fomeh

Re: Variable volumetric source term

Post by fomeh »

Thanks you Brian
This works fine :)
Regards
Post Reply