Large-Scale Simulations Using First And Second Order Adjoints With Applications In Data Assimilation