function d_vec = convert_3D_to_vec( grid, d_3D)
d_vec = zeros( grid.nijk,1);
for i = 1: grid.nx
  for j = 1: grid.ny
    for k = 1: grid.nz
      rc = grid.ijk2rc( i,j,k);
      d_vec( rc) = d_3D( i,j,k);
    end
  end
end
end