00001
00002
00003
00004
00005
00006
00007 #include "Teuchos_TestForException.hpp"
00008 #include "Albany_ProblemFactory.hpp"
00009
00010
00011 #include "Albany_HeatProblem.hpp"
00012
00013 #ifdef ALBANY_DEMO_PDES
00014 #include "Albany_CahnHillProblem.hpp"
00015 #include "Albany_Helmholtz2DProblem.hpp"
00016 #include "Albany_NavierStokes.hpp"
00017 #include "Albany_GPAMProblem.hpp"
00018 #include "Albany_LinComprNSProblem.hpp"
00019 #include "Albany_ComprNSProblem.hpp"
00020 #include "Albany_ODEProblem.hpp"
00021 #include "Albany_PNPProblem.hpp"
00022 #endif
00023
00024 #ifdef ALBANY_QCAD
00025 #include "QCAD_PoissonProblem.hpp"
00026 #include "QCAD_SchrodingerProblem.hpp"
00027 #include "Albany_ThermoElectrostaticsProblem.hpp"
00028 #endif
00029
00030 #ifdef ALBANY_LCM
00031 #include "LCM/problems/MechanicsProblem.hpp"
00032 #include "LCM/problems/ElasticityProblem.hpp"
00033 #include "LCM/problems/ThermoElasticityProblem.hpp"
00034 #include "LCM/problems/PoroElasticityProblem.hpp"
00035 #include "LCM/problems/UnSatPoroElasticityProblem.hpp"
00036 #include "LCM/problems/TLPoroPlasticityProblem.hpp"
00037 #include "LCM/problems/ThermoPoroPlasticityProblem.hpp"
00038 #include "LCM/problems/GradientDamageProblem.hpp"
00039 #include "LCM/problems/ThermoMechanicalProblem.hpp"
00040 #include "LCM/problems/ProjectionProblem.hpp"
00041 #include "LCM/problems/ConcurrentMultiscaleProblem.hpp"
00042 #include "LCM/problems/SchwarzMultiscaleProblem.hpp"
00043 #include "LCM/problems/PeridigmProblem.hpp"
00044 #if defined(ALBANY_LAME) || defined(ALBANY_LAMENT)
00045 #include "LCM/problems/lame/LameProblem.hpp"
00046 #endif
00047 #endif
00048 #ifdef ALBANY_HYDRIDE
00049 #include "Hydride/problems/HydrideProblem.hpp"
00050 #include "Hydride/problems/HydMorphProblem.hpp"
00051 #include "Hydride/problems/MesoScaleLinkProblem.hpp"
00052 #include "Hydride/problems/LaplaceBeltramiProblem.hpp"
00053 #endif
00054
00055 #ifdef ALBANY_FELIX
00056 #include "FELIX/problems/FELIX_Stokes.hpp"
00057 #include "FELIX/problems/FELIX_StokesFO.hpp"
00058 #include "FELIX/problems/FELIX_StokesL1L2.hpp"
00059 #endif
00060
00061 #ifdef ALBANY_AERAS
00062 #include "Aeras/problems/Aeras_ShallowWaterProblem.hpp"
00063 #include "Aeras/problems/Aeras_XZScalarAdvectionProblem.hpp"
00064 #endif
00065
00066 Albany::ProblemFactory::ProblemFactory(
00067 const Teuchos::RCP<Teuchos::ParameterList>& problemParams_,
00068 const Teuchos::RCP<ParamLib>& paramLib_,
00069 const Teuchos::RCP<const Epetra_Comm>& comm_) :
00070 problemParams(problemParams_),
00071 paramLib(paramLib_),
00072 comm(comm_)
00073 {
00074 }
00075
00076 Teuchos::RCP<Albany::AbstractProblem>
00077 Albany::ProblemFactory::create()
00078 {
00079 Teuchos::RCP<Albany::AbstractProblem> strategy;
00080 using Teuchos::rcp;
00081
00082 std::string& method = problemParams->get("Name", "Heat 1D");
00083
00084 if (method == "Heat 1D") {
00085 strategy = rcp(new Albany::HeatProblem(problemParams, paramLib, 1, comm));
00086 }
00087 else if (method == "Heat 2D") {
00088 strategy = rcp(new Albany::HeatProblem(problemParams, paramLib, 2, comm));
00089 }
00090 else if (method == "Heat 3D") {
00091 strategy = rcp(new Albany::HeatProblem(problemParams, paramLib, 3, comm));
00092 }
00093 #ifdef ALBANY_DEMO_PDES
00094 else if (method == "CahnHill 2D") {
00095 strategy = rcp(new Albany::CahnHillProblem(problemParams, paramLib, 2, comm));
00096 }
00097 else if (method == "ODE") {
00098 strategy = rcp(new Albany::ODEProblem(problemParams, paramLib, 0));
00099 }
00100 else if (method == "Helmholtz 2D") {
00101 strategy = rcp(new Albany::Helmholtz2DProblem(problemParams, paramLib));
00102 }
00103 else if (method == "NavierStokes 1D") {
00104 strategy = rcp(new Albany::NavierStokes(problemParams, paramLib, 1));
00105 }
00106 else if (method == "NavierStokes 2D") {
00107 strategy = rcp(new Albany::NavierStokes(problemParams, paramLib, 2));
00108 }
00109 else if (method == "NavierStokes 3D") {
00110 strategy = rcp(new Albany::NavierStokes(problemParams, paramLib, 3));
00111 }
00112 else if (method == "GPAM 1D") {
00113 strategy = rcp(new Albany::GPAMProblem(problemParams, paramLib, 1));
00114 }
00115 else if (method == "GPAM 2D") {
00116 strategy = rcp(new Albany::GPAMProblem(problemParams, paramLib, 2));
00117 }
00118 else if (method == "GPAM 3D") {
00119 strategy = rcp(new Albany::GPAMProblem(problemParams, paramLib, 3));
00120 }
00121 else if (method == "LinComprNS 1D") {
00122 strategy = rcp(new Albany::LinComprNSProblem(problemParams, paramLib, 1));
00123 }
00124 else if (method == "LinComprNS 2D") {
00125 strategy = rcp(new Albany::LinComprNSProblem(problemParams, paramLib, 2));
00126 }
00127 else if (method == "LinComprNS 3D") {
00128 strategy = rcp(new Albany::LinComprNSProblem(problemParams, paramLib, 3));
00129 }
00130 else if (method == "ComprNS 2D") {
00131 strategy = rcp(new Albany::ComprNSProblem(problemParams, paramLib, 2));
00132 }
00133 else if (method == "ComprNS 3D") {
00134 strategy = rcp(new Albany::ComprNSProblem(problemParams, paramLib, 3));
00135 }
00136 else if (method == "PNP 1D") {
00137 strategy = rcp(new Albany::PNPProblem(problemParams, paramLib, 1));
00138 }
00139 else if (method == "PNP 2D") {
00140 strategy = rcp(new Albany::PNPProblem(problemParams, paramLib, 2));
00141 }
00142 else if (method == "PNP 3D") {
00143 strategy = rcp(new Albany::PNPProblem(problemParams, paramLib, 3));
00144 }
00145 #endif
00146 #ifdef ALBANY_QCAD
00147 else if (method == "Poisson 1D") {
00148 strategy = rcp(new QCAD::PoissonProblem(problemParams, paramLib, 1, comm));
00149 }
00150 else if (method == "Poisson 2D") {
00151 strategy = rcp(new QCAD::PoissonProblem(problemParams, paramLib, 2, comm));
00152 }
00153 else if (method == "Poisson 3D") {
00154 strategy = rcp(new QCAD::PoissonProblem(problemParams, paramLib, 3, comm));
00155 }
00156 else if (method == "Schrodinger 1D") {
00157 strategy = rcp(new QCAD::SchrodingerProblem(problemParams, paramLib, 1, comm));
00158 }
00159 else if (method == "Schrodinger 2D") {
00160 strategy = rcp(new QCAD::SchrodingerProblem(problemParams, paramLib, 2, comm));
00161 }
00162 else if (method == "Schrodinger 3D") {
00163 strategy = rcp(new QCAD::SchrodingerProblem(problemParams, paramLib, 3, comm));
00164 }
00165 else if (method == "ThermoElectrostatics 1D") {
00166 strategy = rcp(new Albany::ThermoElectrostaticsProblem(problemParams, paramLib, 1));
00167 }
00168 else if (method == "ThermoElectrostatics 2D") {
00169 strategy = rcp(new Albany::ThermoElectrostaticsProblem(problemParams, paramLib, 2));
00170 }
00171 else if (method == "ThermoElectrostatics 3D") {
00172 strategy = rcp(new Albany::ThermoElectrostaticsProblem(problemParams, paramLib, 3));
00173 }
00174 #endif
00175 #ifdef ALBANY_LCM
00176 else if (method == "LAME" || method == "Lame" || method == "lame") {
00177 #if defined(ALBANY_LAME) || defined(ALBANY_LAMENT)
00178 strategy = rcp(new Albany::LameProblem(problemParams, paramLib, 3, comm));
00179 #else
00180 TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error, " **** LAME materials not enabled, recompile with -DENABLE_LAME or -DENABLE_LAMENT ****\n");
00181 #endif
00182 }
00183 else if (method == "Mechanics 1D") {
00184 strategy = rcp(new Albany::MechanicsProblem(problemParams, paramLib, 1, comm));
00185 }
00186 else if (method == "Mechanics 2D") {
00187 strategy = rcp(new Albany::MechanicsProblem(problemParams, paramLib, 2, comm));
00188 }
00189 else if (method == "Mechanics 3D") {
00190 strategy = rcp(new Albany::MechanicsProblem(problemParams, paramLib, 3, comm));
00191 }
00192 else if (method == "Elasticity 1D") {
00193 strategy = rcp(new Albany::ElasticityProblem(problemParams, paramLib, 1));
00194 }
00195 else if (method == "Elasticity 2D") {
00196 strategy = rcp(new Albany::ElasticityProblem(problemParams, paramLib, 2));
00197 }
00198 else if (method == "Elasticity 3D") {
00199 strategy = rcp(new Albany::ElasticityProblem(problemParams, paramLib, 3));
00200 }
00201 else if (method == "ThermoElasticity 1D") {
00202 strategy = rcp(new Albany::ThermoElasticityProblem(problemParams, paramLib, 1));
00203 }
00204 else if (method == "ThermoElasticity 2D") {
00205 strategy = rcp(new Albany::ThermoElasticityProblem(problemParams, paramLib, 2));
00206 }
00207 else if (method == "ThermoElasticity 3D") {
00208 strategy = rcp(new Albany::ThermoElasticityProblem(problemParams, paramLib, 3));
00209 }
00210 else if (method == "PoroElasticity 1D") {
00211 strategy = rcp(new Albany::PoroElasticityProblem(problemParams, paramLib, 1));
00212 }
00213 else if (method == "PoroElasticity 2D") {
00214 strategy = rcp(new Albany::PoroElasticityProblem(problemParams, paramLib, 2));
00215 }
00216 else if (method == "PoroElasticity 3D") {
00217 strategy = rcp(new Albany::PoroElasticityProblem(problemParams, paramLib, 3));
00218 }
00219 else if (method == "UnSaturated PoroElasticity 1D") {
00220 strategy = rcp(new Albany::UnSatPoroElasticityProblem(problemParams, paramLib, 1));
00221 }
00222 else if (method == "UnSaturated PoroElasticity 2D") {
00223 strategy = rcp(new Albany::UnSatPoroElasticityProblem(problemParams, paramLib, 2));
00224 }
00225 else if (method == "UnSaturated PoroElasticity 3D") {
00226 strategy = rcp(new Albany::UnSatPoroElasticityProblem(problemParams, paramLib, 3));
00227 }
00228 else if (method == "Total Lagrangian PoroPlasticity 1D") {
00229 strategy = rcp(new Albany::TLPoroPlasticityProblem(problemParams, paramLib, 1));
00230 }
00231 else if (method == "Total Lagrangian PoroPlasticity 2D") {
00232 strategy = rcp(new Albany::TLPoroPlasticityProblem(problemParams, paramLib, 2));
00233 }
00234 else if (method == "Total Lagrangian PoroPlasticity 3D") {
00235 strategy = rcp(new Albany::TLPoroPlasticityProblem(problemParams, paramLib, 3));
00236 }
00237 else if (method == "Total Lagrangian ThermoPoroPlasticity 1D") {
00238 strategy = rcp(new Albany::ThermoPoroPlasticityProblem(problemParams, paramLib, 1));
00239 }
00240 else if (method == "Total Lagrangian ThermoPoroPlasticity 2D") {
00241 strategy = rcp(new Albany::ThermoPoroPlasticityProblem(problemParams, paramLib, 2));
00242 }
00243 else if (method == "Total Lagrangian ThermoPoroPlasticity 3D") {
00244 strategy = rcp(new Albany::ThermoPoroPlasticityProblem(problemParams, paramLib, 3));
00245 }
00246 else if (method == "Total Lagrangian Plasticity with Projection 1D") {
00247 strategy = rcp(new Albany::ProjectionProblem(problemParams, paramLib, 1));
00248 }
00249 else if (method == "Total Lagrangian Plasticity with Projection 2D") {
00250 strategy = rcp(new Albany::ProjectionProblem(problemParams, paramLib, 2));
00251 }
00252 else if (method == "Total Lagrangian Plasticity with Projection 3D") {
00253 strategy = rcp(new Albany::ProjectionProblem(problemParams, paramLib, 3));
00254 }
00255 else if (method == "Concurrent Multiscale 3D") {
00256 strategy = rcp(new Albany::ConcurrentMultiscaleProblem(problemParams, paramLib, 3, comm));
00257 }
00258 else if (method == "Schwarz Multiscale 3D") {
00259 strategy = rcp(new Albany::SchwarzMultiscaleProblem(problemParams, paramLib, 3, comm));
00260 }
00261 else if (method == "GradientDamage") {
00262 strategy = rcp(new Albany::GradientDamageProblem(problemParams, paramLib, 3));
00263 }
00264 else if (method == "ThermoMechanical") {
00265 strategy = rcp(new Albany::ThermoMechanicalProblem(problemParams, paramLib, 3));
00266 }
00267 #endif
00268 #ifdef ALBANY_HYDRIDE
00269 else if (method == "Hydride 2D") {
00270 strategy = rcp(new Albany::HydrideProblem(problemParams, paramLib, 2, comm));
00271 }
00272 else if (method == "HydMorph 2D") {
00273 strategy = rcp(new Albany::HydMorphProblem(problemParams, paramLib, 2, comm));
00274 }
00275 else if (method == "MesoScaleLink 1D") {
00276 strategy = rcp(new Albany::MesoScaleLinkProblem(problemParams, paramLib, 1, comm));
00277 }
00278 else if (method == "MesoScaleLink 2D") {
00279 strategy = rcp(new Albany::MesoScaleLinkProblem(problemParams, paramLib, 2, comm));
00280 }
00281 else if (method == "MesoScaleLink 3D") {
00282 strategy = rcp(new Albany::MesoScaleLinkProblem(problemParams, paramLib, 3, comm));
00283 }
00284 else if (method == "LaplaceBeltrami 2D") {
00285 strategy = rcp(new Albany::LaplaceBeltramiProblem(problemParams, paramLib, 2, comm));
00286 }
00287 else if (method == "LaplaceBeltrami 3D") {
00288 strategy = rcp(new Albany::LaplaceBeltramiProblem(problemParams, paramLib, 3, comm));
00289 }
00290 #endif
00291 #ifdef ALBANY_FELIX
00292 else if (method == "FELIX Stokes" || method == "FELIX Stokes 3D" ) {
00293 strategy = rcp(new FELIX::Stokes(problemParams, paramLib, 3));
00294 }
00295 else if (method == "FELIX Stokes 2D" ) {
00296 strategy = rcp(new FELIX::Stokes(problemParams, paramLib, 2));
00297 }
00298 else if (method == "FELIX Stokes First Order 2D" || method == "FELIX Stokes FO 2D" ) {
00299 strategy = rcp(new FELIX::StokesFO(problemParams, paramLib, 2));
00300 }
00301 else if (method == "FELIX Stokes First Order 3D" || method == "FELIX Stokes FO 3D" ) {
00302 strategy = rcp(new FELIX::StokesFO(problemParams, paramLib, 3));
00303 }
00304 else if (method == "FELIX Stokes L1L2 2D") {
00305 strategy = rcp(new FELIX::StokesL1L2(problemParams, paramLib, 2));
00306 }
00307 #endif
00308 #ifdef ALBANY_AERAS
00309 else if (method == "Aeras Shallow Water" ) {
00310 strategy = rcp(new Aeras::ShallowWaterProblem(problemParams, paramLib, 2));
00311 }
00312 else if (method == "Aeras Shallow Water 3D" ) {
00313 strategy = rcp(new Aeras::ShallowWaterProblem(problemParams, paramLib, 3));
00314 }
00315 else if (method == "Aeras XZ Scalar Advection" ) {
00316 strategy = rcp(new Aeras::XZScalarAdvectionProblem(problemParams, paramLib, 2));
00317 }
00318 #endif
00319 else if (method == "Peridigm Code Coupling" ) {
00320 #ifdef ALBANY_PERIDIGM
00321 strategy = rcp(new Albany::PeridigmProblem(problemParams, paramLib, 3, comm));
00322 #else
00323 TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error, " **** Peridigm code coupling not enabled, recompile with -DENABLE_PERIDIGM ****\n");
00324 #endif
00325 }
00326 else {
00327 TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
00328 std::endl <<
00329 "Error! Unknown problem " << method <<
00330 "!" << std::endl << "Supplied parameter list is " <<
00331 std::endl << *problemParams);
00332 }
00333
00334 return strategy;
00335 }