Computational modelling of photonic crystals