I would like to define a Neumann condition which is only activated under a temperature threshold (I was thinking of getting the temperature from a balance variable).
Let me be clearer by taking an example :
I want to define a wall that heat 100W/m² only if the average room temperature is below 30 degrees.
For now I managed to code what follow in cs_user_boundary.f90 :
Code: Select all
! From a boundary, get the mesh faces that fit
call getfbr('heating_wall', nlfac, lstfac4)
!==========
! get the number of fields
call field_get_n_fields(n_fields)
do ilelt = 1, nlfac
ifac = lstfac4(ilelt)
!get the neighboor cells
iel = ifabor(ifac)
!define the face as a wall
itypfb(ifac) = iparoi
! Handle temperature
call field_get_id("temperature", scal_id)
call field_get_key_id("scalar_id", keysca)
call field_get_key_int(scal_id, keysca, iscal)
call balance_by_zone(box[], "temperature")
!MODIFYING VALUES : Neumann condition on the wall
if (ntcabs.gt.1 .and. AVERAGE_TEMPERATURE.gt.30 .and. nscal.gt.0) then !AVERAGE_TEMPERATURE would be the balanced_by_zone variable)
rcodcl(ifac,iscal,3) = 0
else if (nscal.gt.0) then
rcodcl(ifac,iscal,3) = -100
endif
enddo
But I didn't find in the documentation how could I call the AVERAGE_TEMPERATURE, I was thinking of
Code: Select all
call balance_by_zone(box[a,b,c,x,y,z], "temperature")
- How can I get a control of a field in order to impose conditions on it?
- By the way, is it possible to impose neumann condition on an inlet, for the temperature? (As far as I know, it is not possible from the gui)
- I have tried to implement in an user fonction, but is it possible to do it from the gui and define Neumann (user law) with some conditions on balanced variable ?
Regards,