I'm trying to impose several uniform space dependent volumetric heat source in a domain. A good exapmle has been given in tutorials(cs user_source_terms: subroutine ustssc) for just one uniform source:
pwatt = 1000000.d0
! calculation of volf
volf = 0.d0
CALL GETCEL('X > 0.0',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
!--------
! Formats
!--------
1000 format(' User source terms for variable ',A8,/)
!----
! End
!----
! Deallocate the temporary array
deallocate(lstelt)
return
end subroutine ustssc
It works well, no trouble. Now, how can i modify it if I have several pwatt not just one? I've tried to put them in seperate subroutines with different name but it does not work; no compilation error but seems that it is not called if I modify the statement (i.e. ustssc).
Do you mean the soubroutine should call GETCEL for each segment related to the source terms and that should be repeated from just one cs_user_source_terms.f90? Then how should I modify:
you must build only one list in one cs_user_source_terms.f90 call.
You may build it using multiple calls to getcell and appending sublists to a more complete list, but it is simpler to adjust the cell criteria to obtain all segments in one call.
So if your source term is uniform, a single getcell is better. If your source term is dependent on zones, then building the list by pieces may be better, so you then assign the correct values for each list.
If your source terms do not require a too complex formula, I recommend defining the thermal source terms with the GUI. It allows defining thermal source terms by zones, while you need to mange zones yourself with a user subroutine.
Yvan I've already tried to impose these source terms by using the GUI but it does'nt work even for one zone selection. For any intensity of thermal source, the temperature remains equal to the initial value! Could you please take a look at my xml file?
Thanks alot
Which version of the code are you using ? There was a bug due to which the thermal source terms defined by the GUI were ignored, but it seems to have been fixed on all branches last December (so the bug may be in 3.02 but should be fixed in 3.0.3 or at worst 3.0.4, although it seems the info on this fix is missing in the NEWS file).
I am trying to impose a volumetric heat source thoughout the domain(not on boundary cells- they have different BCs) in an non regular geometry. I am trying to use following
do iel=1,ncel
crvexp(iel) = volume(iel)*pwatt/voltf;
enddo
for imposing the heat source term. Do these 'ncel' also select cells on the boundaries or only the cells within the domain(and not boundary cells) are selected ??
As my domain has an arc of a circle instead of other two walls in a regular rectangular geometry. And geometrically it is a bit difficult to define them for cell selection.
Thanks in advance.
you must build only one list in one cs_user_source_terms.f90 call.
You may build it using multiple calls to getcell and appending sublists to a more complete list, but it is simpler to adjust the cell criteria to obtain all segments in one call.
So if your source term is uniform, a single getcell is better. If your source term is dependent on zones, then building the list by pieces may be better, so you then assign the correct values for each list.
If your source terms do not require a too complex formula, I recommend defining the thermal source terms with the GUI. It allows defining thermal source terms by zones, while you need to mange zones yourself with a user subroutine.
If you look on all cells those adjacent to the boundary will be selected also.
Note that selection criteria can also include cylinders ou spheres, though using groups is always better when available. (see documentation) but if cells adjacent to the boundary have a special role In your case you can still cancel the contribution on them. If you look on boundary faces, ifabor(iface) gives you the I'd of the adjacent cell.
Hope I understood your question correctly (a diagram would help otherwise if this is a complex case).
Thank you for your reply. Currently I am using following code which adds heat source in each cell and then removes from the boundary cells. But I am not entirely sure if this the correct way of writing it. Boundary faces have colors 1to5.