PISM, A Parallel Ice Sheet Model stable 0.4.1779

src/coupler/PCFactory.cc

Go to the documentation of this file.
00001 // Copyright (C) 2010, 2011 Constantine Khroulev and Torsten Albrecht
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 "surface", "atmosphere" and "ocean" model factories: C++
00020 // classes processing -surface, -atmosphere and -ocean command-line options,
00021 // creating corresponding models and stringing them together to get requested
00022 // data-flow.
00023 
00024 #include "PCFactory.hh"
00025 #include "PSExternal.hh"
00026 #include "PASDirectForcing.hh"
00027 #include "PSElevation.hh"
00028 #include "pism_const.hh"
00029 #include "PASLapseRates.hh"
00030 #include "PASDirectForcing.hh"
00031 #include "PScalarForcing.hh"
00032 
00033 // Atmosphere
00034 static void create_pa_constant(IceGrid& g, const NCConfigVariable& conf, PISMAtmosphereModel* &result) {
00035   result = new PAConstant(g, conf);
00036 }
00037 
00038 static void create_pa_given(IceGrid& g, const NCConfigVariable& conf, PISMAtmosphereModel* &result) {
00039   result = new PADirectForcing(g, conf);
00040 }
00041 
00042 static void create_pa_searise_greenland(IceGrid& g, const NCConfigVariable& conf, PISMAtmosphereModel* &result) {
00043   result = new PA_SeaRISE_Greenland(g, conf);
00044 }
00045 
00046 static void create_pa_lapse_rates(IceGrid& g, const NCConfigVariable& conf,
00047                                   PISMAtmosphereModel *input, PAModifier* &result) {
00048   result = new PALapseRates(g, conf, input);
00049 }
00050 
00051 static void create_pa_anomalies(IceGrid& g, const NCConfigVariable& conf,
00052                                 PISMAtmosphereModel *input, PAModifier* &result) {
00053   result = new PAForcing(g, conf, input);
00054 }
00055 
00056 static void create_pa_dTforcing(IceGrid& g, const NCConfigVariable& conf,
00057                                 PISMAtmosphereModel *input, PAModifier* &result) {
00058   result = new PAdTforcing(g, conf, input);
00059 }
00060 
00061 void PAFactory::add_standard_types() {
00062   add_model("constant",          &create_pa_constant);
00063   add_model("given",             &create_pa_given);
00064   add_model("searise_greenland", &create_pa_searise_greenland);
00065   set_default("constant");
00066 
00067   add_modifier("anomaly",    &create_pa_anomalies);
00068   add_modifier("dTforcing",    &create_pa_dTforcing);
00069   add_modifier("lapse_rate", &create_pa_lapse_rates);
00070 }
00071 
00072 
00073 // Ocean
00074 static void create_po_constant(IceGrid& g, const NCConfigVariable& conf, PISMOceanModel* &result) {
00075   result = new POConstant(g, conf);
00076 }
00077 
00078 static void create_po_pik(IceGrid& g, const NCConfigVariable& conf, PISMOceanModel* &result) {
00079   result = new POConstantPIK(g, conf);
00080 }
00081 
00082 static void create_po_forcing(IceGrid& g, const NCConfigVariable& conf, PISMOceanModel *input, POModifier* &result) {
00083   result = new POdSLforcing(g, conf, input);
00084 }
00085 
00086 void POFactory::add_standard_types() {
00087   add_model("constant", &create_po_constant);
00088   add_model("pik",      &create_po_pik);
00089   set_default("constant");
00090 
00091   add_modifier("dSLforcing", &create_po_forcing);
00092 }
00093 
00094 // Surface
00095 static void create_ps_temperatureindex(IceGrid& g, const NCConfigVariable& conf, PISMSurfaceModel* &result) {
00096   result = new PSTemperatureIndex(g, conf);
00097 }
00098 
00099 static void create_ps_simple(IceGrid& g, const NCConfigVariable& conf, PISMSurfaceModel* &result) {
00100   result = new PSSimple(g, conf);
00101 }
00102 
00103 static void create_ps_constant(IceGrid& g, const NCConfigVariable& conf, PISMSurfaceModel* &result) {
00104   result = new PSConstant(g, conf);
00105 }
00106 
00107 static void create_ps_constant_pik(IceGrid& g, const NCConfigVariable& conf, PISMSurfaceModel* &result) {
00108   result = new PSConstantPIK(g, conf);
00109 }
00110 
00111 static void create_ps_elevation(IceGrid& g, const NCConfigVariable& conf, PISMSurfaceModel* &result) {
00112   result = new PSElevation(g, conf);
00113 }
00114 
00115 static void create_ps_forcing(IceGrid& g, const NCConfigVariable& conf,
00116                               PISMSurfaceModel *input, PSModifier* &result) {
00117   result = new PSForceThickness(g, conf, input);
00118 }
00119 
00120 static void create_ps_lapse_rates(IceGrid& g, const NCConfigVariable& conf,
00121                                   PISMSurfaceModel *input, PSModifier* &result) {
00122   result = new PSLapseRates(g, conf, input);
00123 }
00124 
00125 static void create_ps_given(IceGrid& g, const NCConfigVariable& conf, PISMSurfaceModel* &result) {
00126   result = new PSDirectForcing(g, conf);
00127 }
00128 
00129 static void create_ps_dTforcing(IceGrid& g, const NCConfigVariable& conf,
00130                                 PISMSurfaceModel *input, PSModifier* &result) {
00131   result = new PSdTforcing(g, conf, input);
00132 }
00133 
00134 void PSFactory::add_standard_types() {
00135   add_model("constant",      &create_ps_constant);
00136   add_model("simple",        &create_ps_simple);
00137   add_model("pdd",           &create_ps_temperatureindex); 
00138   add_model("given",         &create_ps_given); 
00139   add_model("pik",           &create_ps_constant_pik);
00140   add_model("elevation",     &create_ps_elevation);
00141   set_default("simple");
00142 
00143   add_modifier("forcing",    &create_ps_forcing);
00144   add_modifier("dTforcing",  &create_ps_dTforcing);
00145   add_modifier("lapse_rate", &create_ps_lapse_rates);
00146 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines