The structure-rheology relationship in the shear alignment of a lamellar fluid is studied using a mesoscale model which provides access to the lamellar configurations and the rheology. Based on the equations and free energy functional, the complete set of dimensionless groups that characterize the system are the Reynolds number (ργL(2)/μ), the Schmidt number (μ/ρD), the Ericksen number (μγ/B), the interface sharpness parameter r, the ratio of the viscosities of the hydrophilic and hydrophobic parts μ(r), and the ratio of the system size and layer spacing (L/λ). Here, ρ and μ are the fluid density and average viscosity, γ is the applied strain rate, D is the coefficient of diffusion, B is the compression modulus, μ(r) is the maximum difference in the viscosity of the hydrophilic and hydrophobic parts divided by the average viscosity, and L is the system size in the cross-stream direction. The lattice Boltzmann method is used to solve the concentration and momentum equations for a two dimensional system of moderate size (L/λ=32) and for a low Reynolds number, and the other parameters are systematically varied to examine the qualitative features of the structure and viscosity evolution in different regimes. At low Schmidt numbers where mass diffusion is faster than momentum diffusion, there is fast local formation of randomly aligned domains with "grain boundaries," which are rotated by the shear flow to align along the extensional axis as time increases. This configuration offers a high resistance to flow, and the layers do not align in the flow direction even after 1000 strain units, resulting in a viscosity higher than that for an aligned lamellar phase. At high Schmidt numbers where momentum diffusion is fast, the shear flow disrupts layers before they are fully formed by diffusion, and alignment takes place by the breakage and reformation of layers by shear, resulting in defects (edge dislocations) embedded in a background of nearly aligned layers. At high Ericksen number where the viscous forces are large compared to the restoring forces due to layer compression and bending, shear tends to homogenize the concentration field, and the viscosity decreases significantly. At very high Ericksen number, shear even disrupts the layering of the lamellar phase. At low Ericksen number, shear results in the formation of well aligned layers with edge dislocations. However, these edge dislocations take a long time to anneal; the relatively small misalignment due to the defects results in a large increase in viscosity due to high layer stiffness and due to shear localization, because the layers between defects get pinned and move as a plug with no shear. An increase in the viscosity contrast between the hydrophilic and hydrophobic parts does not alter the structural characteristics during alignment. However, there is a significant increase in the viscosity, due to pinning of the layers between defects, which results in a plug flow between defects and a localization of the shear to a part of the domain.