Modeling smectic layers in confined geometries: order parameter and defects.