Introduction
The ushist function allows one to define non-standard monitoring points.
The following example shows the definition of 4 monitoring points and for each variable, a file is written.
Arguments of ushist
The ushist subroutine has the following arguments :
integer nvar , nscal
integer c_id, f_id0, f_dim
double precision dt(ncelet)
Local variable declaration
Local variables are declared hereafter :
integer ii, kk, node, ndrang, nvarpp, numcel, lng
double precision xx, yy, zz, xyztmp(3)
double precision, dimension(:), pointer :: cvar_var
double precision, dimension(:,:), pointer :: cvar_varv
integer ncapmx
parameter(ncapmx=100)
integer icapt(ncapmx)
save icapt
integer ircapt(ncapmx)
save ircapt
integer ncapts
save ncapts
integer ipass
data ipass /0/
save ipass
double precision vacapt(ncapmx)
Initialization
The ipass
variable, which is the current number of ushist calls, is initialized.
Searching of the monitoring points
The routine findpt is used to find the number of the closest cell center to a (x,y,z) point.
if (ipass.eq.1) then
ii = 0
xx = 0.20d0
yy = 0.15d0
zz = 0.01d0
( ncelet , ncel , xyzcen , &
xx , yy , zz , node , ndrang)
ii = ii + 1
icapt(ii) = node
ircapt(ii) = ndrang
xx = 0.70d0
yy = 0.15d0
zz = 0.01d0
( ncelet , ncel , xyzcen , &
xx , yy , zz , node , ndrang)
ii = ii + 1
icapt(ii) = node
ircapt(ii) = ndrang
xx = 0.20d0
yy = 0.75d0
zz = 0.01d0
( ncelet , ncel , xyzcen , &
xx , yy , zz , node , ndrang)
ii = ii + 1
icapt(ii) = node
ircapt(ii) = ndrang
xx = 0.70d0
yy = 0.75d0
zz = 0.01d0
( ncelet , ncel , xyzcen , &
xx , yy , zz , node , ndrang)
ii = ii + 1
icapt(ii) = node
ircapt(ii) = ndrang
ncapts = ii
if(ii.gt.ncapmx) then
write(nfecra,*) ' ushist: ncapmx should at least be', ii
endif
endif
Opening files
For each variable, a file is opened.
nvarpp = nvar
if (ipass.eq.1) then
if (nvarpp.gt.nushmx) then
write(nfecra,*) &
' ushist: no more than ', nushmx,' monitoring files are allowed'
endif
do ii = 1, nvarpp
if (irangp.le.0) then
open(file=ficush(ii), unit=impush(ii))
endif
do kk = 1, ncapts
numcel = icapt(kk)
if (irangp.lt.0 .or. irangp.eq.ircapt(kk)) then
xyztmp(1) = xyzcen(1,numcel)
xyztmp(2) = xyzcen(2,numcel)
xyztmp(3) = xyzcen(3,numcel)
else
xyztmp(1) = 0.d0
xyztmp(2) = 0.d0
xyztmp(3) = 0.d0
endif
if (irangp.ge.0) then
lng = 3
call parbcr(ircapt(kk), lng, xyztmp)
endif
if (irangp.le.0) then
write(impush(ii),1000) &
'#', ' Coord ', xyztmp(1), xyztmp(2), xyztmp(3)
endif
enddo
enddo
endif
1000 format(a,a9,3e14.5)
Writing files
For each variable, the file opened in shist_h_open is then written. It contains the time step value, the physical time value and the variable value at each monitoring points.
f_id0 = -1
c_id = -1
do ii = 1 , nvarpp
call field_get_dim(ivarfl(ii), f_dim)
if (f_dim.eq.1) then
call field_get_val_s(ivarfl(ii), cvar_var)
else
if (ivarfl(ii).ne.f_id0) c_id = 1
call field_get_val_v(ivarfl(ii), cvar_varv)
cvar_var => cvar_varv(c_id, :)
c_id = c_id + 1
endif
f_id0 = ivarfl(ii)
do kk = 1, ncapts
if (irangp.lt.0) then
vacapt(kk) = cvar_var(icapt(kk))
else
call parhis(icapt(kk), ircapt(kk), cvar_var, vacapt(kk))
endif
enddo
if (irangp.le.0) then
write(impush(ii),1010) ntcabs, ttcabs, (vacapt(kk),kk=1,ncapts)
endif
enddo
1010 format(i10,10e17.9)
Closing files
Each file is closed.
if (ntcabs.eq.ntmabs .and. irangp.le.0) then
do ii = 1, nvarpp
close(impush(ii))
enddo
endif