  We propose a model of allocating galaxies in cosmological N-body simulations.
we identify each subhalo with a galaxy, and assign luminosity and morphological
type assuming that the galaxy luminosity is a monotonic function of its host
subhalo mass. The morphology assignment is made by using two simple relations
between subhalo mass and galaxy luminosity of different types. One is using a
constant ratio in luminosity of early (E/SO) and late (S/Irr) type galaxies at
a fixed subhalo mass. And the other assumes that galaxies of different
morphological types but having an equal luminosity have a constant ratio in
their subhalo masses. We made a series of comparisons of the properties of
these simulated galaxies with those of the SDSS galaxies. The resulting
simulated galaxy sample is found to successfully reproduce the observed local
number density distribution except for in high density regions. The luminosity
function is studied as a function of local density. It was found that the
observed luminosity functions in different local density environments are
overall well-reproduced by the simulated galaxies. Discrepancy is found at the
bright end of the luminosity function of early types in the underdense regions
and at the faint end of both morphological types in very high density regions.
A significant fraction of the observed early type galaxies in voids seems to
have undergone a relatively recent star formation and became brighter. The lack
of faint simulated galaxies in dense regions may be due to the strong tidal
force of the central halo which destroys less massive satellite subhalos around
in the simulation. The mass-to-light ratio is found to depend on the local
density in the way similar to that observed in the SDSS sample. (abridged)
