|
PISM, A Parallel Ice Sheet Model stable 0.4.1779
|
00001 // Copyright (C) 2011 Constantine Khroulev 00002 // 00003 // This file is part of PISM. 00004 // 00005 // PISM is free software; you can redistribute it and/or modify it under the 00006 // terms of the GNU General Public License as published by the Free Software 00007 // Foundation; either version 2 of the License, or (at your option) any later 00008 // version. 00009 // 00010 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY 00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with PISM; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 // Implementation of lapse rate corrections for 00020 // * ice-surface temperature and ice-surface mass balance (-surface ...,lapse_rate) and 00021 // * near-surface air temperature and precipitation (-atmosphere ...,lapse_rate). 00022 00023 #include "PASLapseRates.hh" 00024 00026 00027 PetscErrorCode PSLapseRates::init(PISMVars &vars) { 00028 PetscErrorCode ierr; 00029 bool smb_lapse_rate_set; 00030 00031 ierr = input_model->init(vars); CHKERRQ(ierr); 00032 00033 ierr = verbPrintf(2, grid.com, 00034 " [using temperature and mass balance lapse corrections]\n"); CHKERRQ(ierr); 00035 00036 ierr = init_internal(vars); CHKERRQ(ierr); 00037 00038 ierr = PetscOptionsBegin(grid.com, "", "Lapse rate options", ""); CHKERRQ(ierr); 00039 { 00040 ierr = PISMOptionsReal("-smb_lapse_rate", 00041 "Elevation lapse rate for the surface mass balance, in m/year per km", 00042 smb_lapse_rate, smb_lapse_rate_set); CHKERRQ(ierr); 00043 } 00044 ierr = PetscOptionsEnd(); CHKERRQ(ierr); 00045 00046 ierr = verbPrintf(2, grid.com, 00047 " ice upper-surface temperature lapse rate: %3.3f K per km\n" 00048 " ice-equivalent surface mass balance lapse rate: %3.3f m/year per km\n", 00049 temp_lapse_rate, smb_lapse_rate); CHKERRQ(ierr); 00050 00051 temp_lapse_rate = convert(temp_lapse_rate, "K/km", "K/m"); 00052 00053 smb_lapse_rate = convert(smb_lapse_rate, "m/year / km", "m/s / m"); 00054 00055 return 0; 00056 } 00057 00058 PetscErrorCode PSLapseRates::ice_surface_mass_flux(IceModelVec2S &result) { 00059 PetscErrorCode ierr; 00060 ierr = input_model->ice_surface_mass_flux(result); CHKERRQ(ierr); 00061 ierr = lapse_rate_correction(result, smb_lapse_rate); CHKERRQ(ierr); 00062 return 0; 00063 } 00064 00065 PetscErrorCode PSLapseRates::ice_surface_temperature(IceModelVec2S &result) { 00066 PetscErrorCode ierr; 00067 ierr = input_model->ice_surface_temperature(result); CHKERRQ(ierr); 00068 ierr = lapse_rate_correction(result, temp_lapse_rate); CHKERRQ(ierr); 00069 return 0; 00070 } 00071 00073 00074 PetscErrorCode PALapseRates::init(PISMVars &vars) { 00075 PetscErrorCode ierr; 00076 bool precip_lapse_rate_set; 00077 00078 ierr = input_model->init(vars); CHKERRQ(ierr); 00079 00080 ierr = verbPrintf(2, grid.com, 00081 " [using air temperature and precipitation lapse corrections]\n"); CHKERRQ(ierr); 00082 00083 ierr = init_internal(vars); CHKERRQ(ierr); 00084 00085 ierr = PetscOptionsBegin(grid.com, "", "Lapse rate options", ""); CHKERRQ(ierr); 00086 { 00087 ierr = PISMOptionsReal("-precip_lapse_rate", 00088 "Elevation lapse rate for the surface mass balance, in m/year per km", 00089 precip_lapse_rate, precip_lapse_rate_set); CHKERRQ(ierr); 00090 } 00091 ierr = PetscOptionsEnd(); CHKERRQ(ierr); 00092 00093 ierr = verbPrintf(2, grid.com, 00094 " air temperature lapse rate: %3.3f K per km\n" 00095 " precipitation lapse rate: %3.3f m/year per km\n", 00096 temp_lapse_rate, precip_lapse_rate); CHKERRQ(ierr); 00097 00098 temp_lapse_rate = convert(temp_lapse_rate, "K/km", "K/m"); 00099 00100 precip_lapse_rate = convert(precip_lapse_rate, "m/year / km", "m/s / m"); 00101 00102 return 0; 00103 } 00104 00105 00106 PetscErrorCode PALapseRates::mean_precip(IceModelVec2S &result) { 00107 PetscErrorCode ierr; 00108 ierr = input_model->mean_precip(result); CHKERRQ(ierr); 00109 ierr = lapse_rate_correction(result, precip_lapse_rate); CHKERRQ(ierr); 00110 return 0; 00111 } 00112 00113 PetscErrorCode PALapseRates::mean_annual_temp(IceModelVec2S &result) { 00114 PetscErrorCode ierr; 00115 ierr = input_model->mean_annual_temp(result); CHKERRQ(ierr); 00116 ierr = lapse_rate_correction(result, temp_lapse_rate); CHKERRQ(ierr); 00117 return 0; 00118 } 00119 00120 00121 PetscErrorCode PALapseRates::begin_pointwise_access() { 00122 PetscErrorCode ierr; 00123 ierr = input_model->begin_pointwise_access(); CHKERRQ(ierr); 00124 ierr = reference_surface.begin_access(); CHKERRQ(ierr); 00125 ierr = surface->begin_access(); CHKERRQ(ierr); 00126 return 0; 00127 } 00128 00129 PetscErrorCode PALapseRates::end_pointwise_access() { 00130 PetscErrorCode ierr; 00131 ierr = input_model->end_pointwise_access(); CHKERRQ(ierr); 00132 ierr = reference_surface.end_access(); CHKERRQ(ierr); 00133 ierr = surface->end_access(); CHKERRQ(ierr); 00134 return 0; 00135 } 00136 00137 00138 PetscErrorCode PALapseRates::temp_time_series(int i, int j, int N, 00139 PetscReal *ts, PetscReal *values) { 00140 PetscErrorCode ierr; 00141 vector<PetscScalar> usurf(N); 00142 00143 ierr = input_model->temp_time_series(i, j, N, ts, values); CHKERRQ(ierr); 00144 00145 ierr = reference_surface.interp(i, j, N, ts, usurf.data()); CHKERRQ(ierr); 00146 00147 for (int m = 0; m < N; ++m) { 00148 values[m] -= temp_lapse_rate * ((*surface)(i, j) - usurf[m]); 00149 } 00150 00151 return 0; 00152 } 00153 00154 PetscErrorCode PALapseRates::temp_snapshot(IceModelVec2S &result) { 00155 PetscErrorCode ierr; 00156 ierr = input_model->temp_snapshot(result); CHKERRQ(ierr); 00157 ierr = lapse_rate_correction(result, temp_lapse_rate); CHKERRQ(ierr); 00158 return 0; 00159 } 00160
1.7.3