My Project
programmer's documentation
Electric arcs example

Electric arcs example

Local variables to be added

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

integer iel, mode
integer iesp , idimve
double precision tinit, hinit, coefe(ngazem)
character(len=80) :: f_name
integer, allocatable, dimension(:) :: lstelt
double precision, dimension(:), pointer :: cvar_scalt, cvar_ycoel
double precision, dimension(:), pointer :: cvar_potr, cvar_poti
double precision, dimension(:,:), pointer :: cvar_potva

Allocation

Before user initialization, work arrays lstelt must be allocated, like in basic example.

Initialization

Classical initialization:

allocate(lstelt(ncel)) ! temporary array for cells selection
! Control output
write(nfecra,9001)
!===============================================================================
! Initialization
! (only at the beginning of the calculation)
!===============================================================================
if ( isuite.eq.0 ) then
! --> Enthalpy = H(T0) ou 0
! For electric arc,
! for the whole compution domain enthalpy is set to H(T0) of the 1st
! constituant of the gas
!
! For Joule jeating by direct conduction,
! enthalpy is set to zero, and the user will enter his H(T) function
! tabulation.
!
! -- HINIT calculations
if ( ippmod(ielarc).ge.1 ) then
mode = -1
tinit = t0
coefe(1) = 1.d0
if ( ngazge .gt. 1 ) then
do iesp = 2, ngazge
coefe(iesp) = 0.d0
enddo
endif
call elthht(mode,coefe,hinit,tinit)
else
mode = -1
tinit = t0
call usthht(mode,hinit,tinit)
endif
! -- Entahlpy value
call field_get_val_s(ivarfl(isca(iscalt)), cvar_scalt)
do iel = 1, ncel
cvar_scalt(iel) = hinit
enddo
! --> Mass fraction = 1 ou 0
if ( ngazge .gt. 1 ) then
write(f_name,'(a13,i2.2)') 'esl_fraction_', 1
call field_get_val_s_by_name(trim(f_name), cvar_ycoel)
do iel = 1, ncel
cvar_ycoel(iel) = 1.d0
enddo
do iesp = 2, ngazge-1
write(f_name,'(a13,i2.2)') 'esl_fraction_',iesp
call field_get_val_s_by_name(trim(f_name), cvar_ycoel)
do iel = 1, ncel
cvar_ycoel(iel) = 0.d0
enddo
enddo
endif
! --> Electric potentials = 0
! -- Real Component
call field_get_val_s_by_name('elec_pot_r', cvar_potr)
do iel = 1, ncel
cvar_potr(iel) = 0.d0
enddo
! -- Imaginary (for Joule heating by direct conduction)
if ( ippmod(ieljou).eq.2 .or. ippmod(ieljou).eq.4 ) then
call field_get_val_s_by_name('elec_pot_r', cvar_poti)
do iel = 1, ncel
cvar_poti(iel) = 0.d0
enddo
endif
! -- Vector potential (3D electric arc 3D)
if (ippmod(ielarc).ge.2) then
call field_get_val_v_by_name('vec_potential', cvar_potva)
do iel = 1, ncel
cvar_potva(1, iel) = 0.d0
cvar_potva(2, iel) = 0.d0
cvar_potva(3, iel) = 0.d0
enddo
endif
endif

Finalization

At the end of the subroutine, it is recommended to deallocate the work array lstelt, like in basic example.

usthht
subroutine usthht(mode, enthal, temper)
Definition: usthht.f90:39