Modeling of pressure sensors based on two-dimensional photonic crystals