anchor.diff:      if (AllocateStatus /= 0) STOP "*** Not enough memory for solver_solution array ***"
       allocate (update_resistance_entries(num_elems), STAT = AllocateStatus)
       if (AllocateStatus /= 0) STOP "*** Not enough memory for solver_solution array ***"
  +    update_resistance_entries = 0
       !calculate the sparsity structure
  -    call calc_sparse_1dtree(density,FIX,grav_vect,mesh_dof,depvar_at_elem, &
  +    call calc_sparse_1dtree(bc_type,density,FIX,grav_vect,mesh_dof,depvar_at_elem, &
           depvar_at_node,NonZeros,MatrixSize,SparseCol,SparseRow,SparseVal,RHS, &
  -        prq_solution,update_resistance_entries)
  +        prq_solution,update_resistance_entries,update_flow_nzz_row)
   !!! --ITERATIVE LOOP--
       MIN_ERR=1.d10
       N_MIN_ERR=0
  
positive.code:     inletbc=inlet_bc
      outletbc=outlet_bc
  elseif(bc_type.eq.'flow')then
      print  *, "ERROR: Flow boundary conditions not yet implemented"
       call exit(0)
  endif
  
  !!---------PHYSICAL PARAMETERS-----------
  
negative.code:     call enter_exit(sub_name,2)
  end subroutine calculate_ppl
  
  !
  !##################################################################
  !
  subroutine get_variable_offset(depvar,mesh_dof,FIX,offset)
  !*Description*: This subroutine returns the number of fixed variables in the depvar array that came before the input depvar
      integer, intent(in) :: depvar, mesh_dof
      logical, intent(in) :: FIX(mesh_dof)
      integer, intent(inout) :: offset
  
      integer :: depvar1
  
      offset = 0
      do depvar1 = 1,depvar
          if(FIX(depvar1))then
              offset = offset + 1
          endif
      enddo
  
  end subroutine get_variable_offset
  
  end module pressure_resistance_flow
  
  