We study the self-assembly of a diblock copolymer melt confined within a porous medium with a prescribed regular twodimensional geometry using self-consistent field theory. We find that the morphology of the polymer sensitively depends on the characteristic length scales of the porous material and the polymer radius of gyration (R g ). When the pore size is much larger than R g , the polymer self-assembly is affected only locally close to the contact with the pore surface. However, when the size of the pores and the distance between them is comparable to the diblock characteristic length, novel morphologies appear and the polymer structure changes according to the constraints imposed by the porous material. We develop an interaction potential for the solid particle and copolymer, and show how this provides an understanding of the qualitative feature of the morphologies.