~tim-greaves/fluidity-launchtesting/trunk

« back to all changes in this revision

Viewing changes to main/Usage.cpp

  • Committer: Mark Filipiak
  • Date: 2012-11-20 10:39:22 UTC
  • mfrom: (4125.2.8 ocean-forcing)
  • Revision ID: mjf@staffmail.ed.ac.uk-20121120103922-f3etzynysyfzgjhy
Input of environmental options (e.g. forcing fields) is moved from
Usage.cpp into ocean_forcing/InitialiseOceanForcing.F90, to be
accessible in flredecomp as well as fluidity. Relevant Fortran-C
interfaces have been converted from using F77_FUNC to use
iso_c_binding.

Show diffs side-by-side

added added

removed removed

Lines of Context:
365
365
    print_options();
366
366
  }
367
367
 
368
 
  // Environmental stuff -- this needs to me moved out of here and
369
 
  // into populate state.
370
 
  if(have_option("/timestepping/current_time/time_units")){
371
 
    string option;
372
 
    get_option("/timestepping/current_time/time_units/date", option);
373
 
 
374
 
    FluxesReader_global.SetSimulationTimeUnits(option.c_str());
375
 
    ClimateReader_global.SetSimulationTimeUnits(option.c_str());
376
 
    NEMOReader_v2_global.SetSimulationTimeUnits(option.c_str());
377
 
  }
378
 
  if(have_option("/environmental_data/climatology/file_name")){
379
 
    string option;
380
 
    get_option("/environmental_data/climatology/file_name", option);
381
 
 
382
 
    ClimateReader_global.SetClimatology(option);
383
 
  }
384
 
  if(have_option("/ocean_forcing/bulk_formulae/input_file")) {
385
 
    string option;
386
 
    get_option("/ocean_forcing/bulk_formulae/input_file/file_name", option);
387
 
    string dataset = "ERA40"; //default
388
 
    if(have_option("/ocean_forcing/bulk_formulae/file_type")) {
389
 
        get_option("/ocean_forcing/bulk_formulae/file_type/filetype/name", dataset);
390
 
    }
391
 
    if (dataset == "ERA40") {
392
 
        FluxesReader_global.RegisterDataFile(option);
393
 
        // field from NetCDF file                         Index |   Physical meaning
394
 
        FluxesReader_global.AddFieldOfInterest("u10");  //  0   | 10 metre U wind component
395
 
        FluxesReader_global.AddFieldOfInterest("v10");  //  1   | 10 metre V wind component
396
 
        FluxesReader_global.AddFieldOfInterest("ssrd"); //  2   | Surface solar radiation
397
 
        FluxesReader_global.AddFieldOfInterest("strd"); //  3   | Surface thermal radiation 
398
 
        FluxesReader_global.AddFieldOfInterest("ro");   //  4   | Runoff
399
 
        FluxesReader_global.AddFieldOfInterest("tp");   //  5   | Total precipitation
400
 
        FluxesReader_global.AddFieldOfInterest("d2m");  //  6   | Dew point temp at 2m
401
 
        FluxesReader_global.AddFieldOfInterest("t2m");  //  7   | Air temp at 2m 
402
 
        FluxesReader_global.AddFieldOfInterest("msl");  //  8   | Mean sea level pressure
403
 
    } else {
404
 
        cerr<<"ERROR: unsupported bulk formula input file type. Choose ERA40\n";
405
 
        exit(-1);
406
 
    }
407
 
 
408
 
  }
409
 
 
410
 
  if(have_option("/ocean_biology/lagrangian_ensemble/hyperlight")) {
411
 
    FluxesReader_global.AddFieldOfInterest("tcc");  // Total cloud cover 
412
 
  }
413
 
 
414
 
  if(have_option("/ocean_forcing/external_data_boundary_conditions")) {
415
 
    string option;
416
 
    get_option("/ocean_forcing/external_data_boundary_conditions/input_file/file_name", option);
417
 
 
418
 
    if(verbosity >= 3)
419
 
      cout << "Registering external data forcing file: " << option << endl;
420
 
 
421
 
    NEMOReader_v2_global.RegisterDataFile(option);
422
 
 
423
 
    NEMOReader_v2_global.AddFieldOfInterest("temperature");  //  0   | Sea temperature
424
 
    NEMOReader_v2_global.AddFieldOfInterest("salinity");     //  1   | Salinity
425
 
    NEMOReader_v2_global.AddFieldOfInterest("u");            //  2   | Azimuthal velocity
426
 
    NEMOReader_v2_global.AddFieldOfInterest("v");            //  3   | Meridional velocity
427
 
    NEMOReader_v2_global.AddFieldOfInterest("ssh");          //  4   | Sea surface height
428
 
  }
 
368
  // Environmental stuff is now in populate_state_module (Populate_State.F90)
429
369
 
430
370
  return;
431
371
}