programmer's documentation
Basic example

Basic example

Local variables to be added

The following local variables need to be defined for the examples in this section:

integer iel, iutile
integer, allocatable, dimension(:) :: lstelt
double precision, dimension(:), pointer :: cvar_scal

Allocation

Before user initialization, work arrays must be allocated.

allocate(lstelt(ncel)) ! temporary array for cells selection

Initialization

isca(1) is the number related to the first user-defined scalar variable. rtp(iel,isca(1)) is the value of this variable in cell number iel.

ONLY done if there is no restart computation.

if (isuite.eq.0) then
call field_get_val_s(ivarfl(isca(1)), cvar_scal)
do iel = 1, ncel
cvar_scal(iel) = 25.d0
enddo
endif

Finalization

At the end of the subroutine, it is recommended to deallocate the work array:

deallocate(lstelt) ! temporary array for cells selection