Extract a 1D profile
This is an example of cs_user_extra_operations which performs 1D profile.
Local variables to be added
integer          iel
integer          iel1
integer          impout
integer          ii     , irangv , irang1 , npoint
integer          iun
double precision xyz(3), xabs, xu, xv, xw, xk, xeps
Body
We seek here to extract the profile of U, V, W, k and epsilon on an arbitrary 1D curve based on a curvilear abscissa. The profile is described in the 'profile.dat' file (do not forget to define it as user data in the run script).
- the curve used here is the segment: [(0;0;0),(0;0.1;0)], but the generalization to an arbitrary curve is simple.
- the routine handles parallelism an periodicity, as well as the different turbulence models.
- the 1D curve is discretized into 'npoint' points. For each of these points, we search for the closest cell center and we output the variable values at this cell center. For better consistency, the coordinate which is output is that of the cell center (instead of the initial point).
- we avoid using the same cell multiple times (in case several points an the curve are associated with the same cell).
Here is the corresponding code:
  
  
    open(impout,file='profile.dat')
    write(impout,*)  &
         '# z(m) U(m/s) V(m/s) W(m/s) k(m2/s2) eps(m2/s3)'
  endif
  npoint = 200
  iel1   = -999
  irang1 = -999
  do ii = 1, npoint
    xyz(1) = 0.d0
    xyz(2) = float(ii-1)/float(npoint-1)*0.1d0
    xyz(3) = 0.d0
    
    if ((iel.ne.iel1).or.(irangv.ne.irang1)) then
      iel1   = iel
      irang1 = irangv
      
      
        xk   = 0.d0
        xeps = 0.d0
        endif
        elseif (
iturb.eq.60) 
then 
        endif
      else
        xabs = 0.d0
        xu   = 0.d0
        xv   = 0.d0
        xw   = 0.d0
        xk   = 0.d0
        xeps = 0.d0
      endif
      
        iun = 1
        call 
parbcr(irangv, iun, xabs)
        call 
parbcr(irangv, iun, xeps)
      endif
      if (
irangp.le.0) 
write(impout,99) xabs, xu, xv, xw, xk, xeps
 
99    format(6g17.9)
    endif
  enddo
  if (
irangp.le.0) 
close(impout)
 
endif