hp2FEM
0.1
|
00001 #ifndef _SOLVER_H_ 00002 #define _SOLVER_H_ 00003 // --------------------------------------------- 00004 // company : 00005 // user : 00006 // date : 22 Mar 2015 17:25 00007 // file : Solver.h 00008 // markers : Full 00009 // language : C++ 00010 // generator : Metamill 6.0 00011 // --------------------------------------------- 00012 00013 //#UBLK-BEG-HEADERH 00014 //#UBLK-END-HEADERH 00015 00016 /*================================================================================================= 00017 = = 00018 = Copyright 2010-2015 Marco Lucio Bittencourt / Fabiano Fernandes Bargos = 00019 = Gilberto Luis Valente / Jorge Luis Suzuki / Allan Patrick Cordeiro Dias = 00020 = = 00021 = Licensed under the Apache License, Version 2.0 (the "License"); = 00022 = you may not use this file except in compliance with the License. = 00023 = You may obtain a copy of the License at = 00024 = = 00025 = http://www.apache.org/licenses/LICENSE-2.0 = 00026 = = 00027 = Unless required by applicable law or agreed to in writing, software = 00028 = distributed under the License is distributed on an "AS IS" BASIS, = 00029 = WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. = 00030 = See the License for the specific language governing permissions and = 00031 = limitations under the License. = 00032 = = 00033 =================================================================================================*/ 00034 00035 00036 #include <cstdio> 00037 #include <mpi.h> 00038 #include "solvercontrol/PartitionData.h" 00039 #include "solvercontrol/SolverParam_S.h" 00040 #include "solvercontrol/TheoreticalSolution_S.h" 00041 #include "ds/Vector.h" 00042 #include "ds/Matrix.h" 00043 #include "ds/OneIndexTable.h" 00044 #include "ds/TwoIndexTable.h" 00045 #include "enumerations/PostProcessorProgram_E.h" 00046 #include "fegroups/FEGroups.h" 00047 #include "model/Model.h" 00048 #include "model/Nodes.h" 00049 #include "symbolicanalyzer/SymbolicParse.h" 00050 #include "enumerations/ContactSolver_E.h" 00051 #include "enumerations/ContactModel_E.h" 00052 00053 00062 class Solver 00063 { 00064 //#UBLK-BEG-CLASSDEF mm:8ed17010-020e-11e0-9503-bdd33c3b382f 00065 //#UBLK-END-CLASSDEF 00066 00067 public: 00068 00069 // METHOD=mm:75c8b726-020e-11e0-9503-bdd33c3b382f 00070 Solver(); 00071 00072 // METHOD=mm:80bf84ed-3aaa-11e0-87c1-fb85dddc7efb 00073 ~Solver(); 00074 00075 // METHOD=mm:f12724b7-66f5-11e0-94a8-e19117dd202e 00076 Solver(Solver& Instance); 00077 00078 // METHOD=mm:3f3c1168-66f6-11e0-94a8-e19117dd202e 00079 Solver& operator=(Solver& Instance); 00080 00081 // METHOD=mm:a0db204d-61ec-11e0-99a5-df56fb5dd99d 00082 void SetSolverAttributes(SolverParam_S& SolverParameters); 00083 00084 // METHOD=mm:337cc73d-61ef-11e0-99a5-df56fb5dd99d 00085 void SetSolverAttributes(SolverType_E SolvType, MassStiffType_E MassType, StiffnessType_E StiffType, ContactModel_E ContactMod, ContactSolver_E ContactSol, LinearSystemSolutionMethod_E LSMethod, unsigned long LSMaxIt, double LSPrec, SolutionAlgorithm_E SoluAlgorithm, unsigned long SolMaxIt, double SolPrec, unsigned long NumLoadSteps, AnalysisType_E Atype, OperatorType_E OpType, double to, double tf, unsigned long NTS, unsigned long FrictionCoef, double PenaltyParameter, unsigned long ContactInteOrder, TimeIntegrationMeth_E TimeIntMeth, unsigned long OutFreqNR, unsigned long OutFreqTime); 00086 00087 // METHOD=mm:19dfad9f-645b-11e0-8923-dd061b2ac5dc 00088 void SetTheoreticalSolutionParameters(TheoreticalSolution_S& TheoSol); 00089 00090 // METHOD=mm:b679fb37-0219-11e0-8f07-c00dff923bc5 00091 LinearSystemSolutionMethod_E GetLSMethod(); 00092 00093 // METHOD=mm:a620d0eb-8c78-487f-8e4e-66a6ce9a725c 00094 ContactSolver_E GetContactIntegrationMethod(); 00095 00096 // METHOD=mm:69fd560c-a7c8-42c1-b9c7-b9c51c5cdb63 00097 ContactModel_E GetContactFrictionCondition(); 00098 00099 // METHOD=mm:89fdff20-1654-476b-9425-e1c2cc1cbd29 00100 unsigned long GetFrictionCoef(); 00101 00102 // METHOD=mm:e6291d77-0219-11e0-8f07-c00dff923bc5 00103 SolverType_E GetSolverType(); 00104 00105 // METHOD=mm:f6d986a7-0219-11e0-8f07-c00dff923bc5 00106 OperatorType_E GetOperatorType(); 00107 00108 // METHOD=mm:048f0399-021a-11e0-8f07-c00dff923bc5 00109 unsigned long GetIterativeSolutionMaxIterations(); 00110 00111 // METHOD=mm:1a043feb-021a-11e0-8f07-c00dff923bc5 00112 double GetIterativeSolutionPrecision(); 00113 00114 // METHOD=mm:298388eb-021a-11e0-8f07-c00dff923bc5 00115 SolutionAlgorithm_E GetSolutionAlgorithm(); 00116 00117 // METHOD=mm:4c15ae1b-021a-11e0-8f07-c00dff923bc5 00118 unsigned long GetSolutionMaxIterations(); 00119 00120 // METHOD=mm:5df746b7-021a-11e0-8f07-c00dff923bc5 00121 double GetNewtonRaphsonSolutionPrecision(); 00122 00123 // METHOD=mm:b6c6df37-021a-11e0-8f07-c00dff923bc5 00124 unsigned long GetNumberLoadSteps(); 00125 00126 // METHOD=mm:75c8b72a-020e-11e0-9503-bdd33c3b382f 00127 void PostProcessing(PostProcessorProgram_E PostProgram); 00128 00129 // METHOD=mm:75c8b727-020e-11e0-9503-bdd33c3b382f 00130 void Read(FILE* FEMFile, FILE* DEFFile, FILE* LogFile); 00131 00132 // METHOD=mm:71579f31-0615-4534-9938-dbe72bfb50a0 00133 virtual void Run() = 0; 00134 00135 00136 // asse=mm:94b7d0c2-d1a6-4b4a-a51f-5ddab5e469b8 00137 TheoreticalSolution_S * theTheoreticalSolution_S; 00138 00139 // asse=mm:279080a8-7ca6-4d3f-b58b-7a1273020db2 00140 SolverParam_S * theSolverParam_S; 00141 00142 // asse=mm:9559a12c-9f2e-443a-ab8a-2edca2ac8547 00143 PartitionData * thePartitionData; 00144 00145 00146 protected: 00147 00148 // METHOD=mm:75c8b7c2-020e-11e0-9503-bdd33c3b382f 00149 void ExportGiDMeshFile(char* FileName, FEGroups& Groups, Nodes& Nds); 00150 00151 // METHOD=mm:7db8263d-8008-4e1f-8a44-f943eedbb89f 00152 void ExportGiDResFile(char* FileName, FEGroups& Groups, Nodes& Nds); 00153 00154 // METHOD=mm:75c8b7c3-020e-11e0-9503-bdd33c3b382f 00155 void ExportGMSHFile(char* FileName, FEGroups& Groups, Nodes& Nds, double* Solution); 00156 00157 // METHOD=mm:75c8b7c4-020e-11e0-9503-bdd33c3b382f 00158 void ExportHyperMeshFile(char* FileName, FEGroups& Groups, Nodes& Nds, double* Solution); 00159 00160 // METHOD=mm:f5e88b17-3abd-11e0-87c1-fb85dddc7efb 00161 void ComputeErrorNorm(); 00162 00163 // METHOD=mm:8c04ba7a-6d6b-4c48-b6c7-a098d3a37159 00164 void ComputeErrorNorm_Parallel(Vector& UPart); 00165 00166 // METHOD=mm:65dc182c-eba6-4483-9347-67c2652a16c1 00167 void ComputeErrorNorm1DMatrices(); 00168 00169 // METHOD=mm:ba356a64-7365-4a68-b5f3-9de96b1da240 00170 void ComputeErrorNorm1DMatrices_Parallel(Vector& UPart); 00171 00172 // METHOD=mm:7b3dba8d-3df6-11e0-891a-d4865a8b0383 00173 void MatrixSchurComplement(SymmetricMatrix& A, unsigned long NBD, unsigned long NID); 00174 00175 // METHOD=mm:ecf096c5-9f5f-48e1-8fc1-78f49e3a24ea 00176 void MatrixSchurComplement(SymmetricMatrix& A, double* Aint, unsigned long NBD, unsigned long NID); 00177 00178 // METHOD=mm:3e68cbc7-5516-4454-ba92-054edd943941 00179 void MatrixMatrixSchurComplement(SymmetricMatrix& A, double* B, unsigned long NBD, unsigned long NID); 00180 00181 // METHOD=mm:fcab3091-4b4e-49b7-aca8-02365f6ae746 00182 void MatrixVectorSchurComplement(SymmetricMatrix& A, double* B, unsigned long NBD, unsigned long NID); 00183 00184 // METHOD=mm:bf30b211-3df6-11e0-891a-d4865a8b0383 00185 void VectorSchurComplement(double* A, double* B, unsigned long NBD, unsigned long NID); 00186 00187 // METHOD=mm:9cd73cdd-2224-476b-9832-9bfe3af9e958 00188 void VectorSchurComplement(double* A, double* Aint, double* B, unsigned long NBD, unsigned long NID); 00189 00190 // METHOD=mm:3887f33d-ca1e-47f7-8fee-33b76369afa4 00191 void RecoverInternalSolSchur(double* A, double* B, double* Usol, unsigned long NBD, unsigned long NID, double c = 1); 00192 00193 // METHOD=mm:bde69226-cf9f-4f0e-8018-bf556deea2fe 00194 void RecoverInternalSolSchur(double* A, double* Aint, double* B, double* Usol, unsigned long NBD, unsigned long NID, double c = 1); 00195 00196 // METHOD=mm:27d4429f-48bd-4844-aaed-5139d56cd011 00197 void LinearSystemSolutionContact(SymmetricMatrix& A, double* F, unsigned long LSNum); 00198 00199 // METHOD=mm:22bbf330-8baf-42a3-8555-80edd424863e 00200 void LinearSystemSolutionContact(SymmetricMatrix& A, double* F, unsigned long LSNum, Vector& U); 00201 00202 // METHOD=mm:c4032b09-bf50-45e5-b10e-2a5090078b84 00203 void SetLoadIncidSchur(unsigned long& NLoadedElem); 00204 00205 00209 // attr=mm:cdc99e7b-3df3-11e0-891a-d4865a8b0383 00210 TheoreticalSolution_S TheoSolu; 00211 00215 // attr=mm:d3f9b745-0216-11e0-8f07-c00dff923bc5 00216 SolverParam_S SolvParam; 00217 00221 // attr=mm:e70c8399-0216-11e0-8f07-c00dff923bc5 00222 Model GlobalModel; 00223 00227 // attr=mm:b7f6499b-8365-4e33-8445-5d094c1b449c 00228 PartitionData PartitionInformations; 00229 00233 // attr=mm:66207b0d-69a6-11e0-94a8-e19117dd202e 00234 OneIndexTable<double> ElemMassMatrices; 00235 00239 // attr=mm:86e8c0ed-69a6-11e0-94a8-e19117dd202e 00240 OneIndexTable<double> ElemStiffMatrices; 00241 00245 // attr=mm:61286a20-7dd5-4d7f-a75a-476714e0f47f 00246 OneIndexTable<double> ElemEffMatrices; 00247 00251 // attr=mm:8fa04add-e777-4066-b96f-f65ba0cac569 00252 OneIndexTable<double> ElemInternalMatrices; 00253 00257 // attr=mm:4e95bf01-69a7-11e0-94a8-e19117dd202e 00258 OneIndexTable<double> ElemLoadVectors; 00259 00263 // attr=mm:c1eaeb35-69a6-11e0-94a8-e19117dd202e 00264 Vector PatchMeas; 00265 00269 // attr=mm:f2f8c721-41f1-4477-81f5-08807dfa13ba 00270 Vector AuxCoords; 00271 00275 // attr=mm:5a595d9a-4595-4d93-a57e-5420cb90e248 00276 SymmetricMatrix LocalMassMatrix; 00277 00281 // attr=mm:3b0cd21a-fec2-4142-8b4d-6397f3593271 00282 SymmetricMatrix LocalStiffMatrix; 00283 00287 // attr=mm:6636e96d-3aa5-11e0-87c1-fb85dddc7efb 00288 OneIndexTable<double> U; 00289 // attr=mm:337658d5-2b9f-4582-bb7a-ce71732c70d5 00290 Vector Displacement; 00291 00295 // attr=mm:7c44ab7d-3aa5-11e0-87c1-fb85dddc7efb 00296 OneIndexTable<double> Upt; 00297 00302 // attr=mm:7cdd3f7d-3aa5-11e0-87c1-fb85dddc7efb 00303 OneIndexTable<double> U2pt; 00304 00308 // attr=mm:aad3cc4d-6792-11e0-94a8-e19117dd202e 00309 TwoIndexTable<double> StrainSol; 00310 00314 // attr=mm:1f7d4cdd-69a3-11e0-94a8-e19117dd202e 00315 TwoIndexTable<double> StressSol; 00316 00320 // attr=mm:553a69c2-cb95-40b3-aa48-ee65533e9be2 00321 SymmetricMatrix ContactStiffMatrix; 00322 00326 // attr=mm:f90bdba0-f25a-4fd4-b785-0417e3d2cc82 00327 SymmetricMatrix Kc; 00328 00332 // attr=mm:3459caaf-69a3-11e0-94a8-e19117dd202e 00333 TwoIndexTable<double> ExtraSol; 00334 00338 // attr=mm:89fa251d-3aa5-11e0-87c1-fb85dddc7efb 00339 Vector incU; 00340 // attr=mm:f584b794-148b-42b4-9b83-0017902e4ed6 00341 Vector Fint; 00342 00346 // attr=mm:aac29087-3aa5-11e0-87c1-fb85dddc7efb 00347 OneIndexTable<double> F; 00348 00352 // attr=mm:ad1c997a-d8a2-48b0-b4cc-ba3ee6c8a45c 00353 Vector FeAux; 00354 00358 // attr=mm:ae55ff6d-3aa5-11e0-87c1-fb85dddc7efb 00359 OneIndexTable<double> Fgr; 00360 00364 // attr=mm:b44bf87d-3aa5-11e0-87c1-fb85dddc7efb 00365 OneIndexTable<double> Press; 00366 00370 // attr=mm:c62d971d-3aa5-11e0-87c1-fb85dddc7efb 00371 Vector Load; 00372 00376 // attr=mm:d5e6da02-a1a7-4e98-b452-03b58d3abedf 00377 Vector ContactResidual; 00378 00382 // attr=mm:1c826e4f-f24f-49e8-ab7d-a195e6699c9c 00383 Vector ContStressIP; 00384 00388 // attr=mm:4a7e2973-5360-4359-a473-da898131ca63 00389 Vector ContStressCP; 00390 00394 // attr=mm:04314480-0a4b-4f73-96d1-3bf82eca9b85 00395 Vector ContGap; 00396 00402 // attr=mm:bbf3bbbf-5ff8-40d2-887e-2cc5f9cb5a78 00403 Vector ContCondition; 00404 00408 // attr=mm:36b5b7cd-4818-4478-ba54-c42efd769414 00409 Vector StressPosition; 00410 00414 // attr=mm:1ae28008-b97c-4df8-b1d9-0a94e5385a10 00415 BuiltInArray<long> LoadIncidSchur; 00416 00420 // attr=mm:ca89923b-0051-4e6a-a9d9-fb0ecc0a3f92 00421 Vector ElemLoad; 00422 00426 // attr=mm:24825d62-66be-4296-92bf-e1053e4a0760 00427 Vector InternalForce; 00428 00432 // attr=mm:91714cbb-4685-4dc2-a7f1-fbaa7cd061d9 00433 Vector Damage; 00434 00438 // attr=mm:c9c1074d-3aa5-11e0-87c1-fb85dddc7efb 00439 OneIndexTable<double> React; 00440 00444 // attr=mm:a9df311d-3aa8-11e0-87c1-fb85dddc7efb 00445 char* PreFileName; //= NULL; 00446 00450 // attr=mm:32b47cd1-3abe-11e0-87c1-fb85dddc7efb 00451 Matrix ErrorNorm; 00452 00456 // attr=mm:492c4a49-3df6-11e0-891a-d4865a8b0383 00457 long SchurFlag; //= 0; 00458 00462 // attr=mm:276ab52b-66fd-4672-b48f-17d3d4bdd38d 00463 SymmetricMatrix Schur_AA; 00464 00468 // attr=mm:66e032a1-7c76-4c4f-b878-244d2d9a06dd 00469 SymmetricMatrix Schur_BB; 00470 00474 // attr=mm:21621b55-a3b1-4163-bc43-cec9bbd99a49 00475 Matrix Schur_AB; 00476 00480 // attr=mm:c79f2d2d-aa23-4e43-88ea-f77ec4973a32 00481 Matrix Schur_AB_Aux; 00482 00486 // attr=mm:0acbb9ea-e67d-422c-a64e-8b76d60ebb38 00487 Matrix Schur_Mat_Aux; 00488 00492 // attr=mm:c652c50e-ee8e-4bfb-903d-0998a8488bd4 00493 Vector Schur_Vec_Aux; 00494 00498 // attr=mm:878f4370-2143-4b42-9383-610e2b6cc8bc 00499 Vector Schur_Vec_Aux1; 00500 00504 // attr=mm:95927ba7-a722-4999-8e48-4d4acd58d563 00505 Vector Schur_fi; 00506 00510 // attr=mm:1ac5744e-b07d-4c34-905b-54882eb1f30f 00511 Vector Schur_fb; 00512 00516 // attr=mm:012a4ea4-cdea-4dc6-9716-d6ff32ab757e 00517 Vector LoadAux; 00518 00522 // attr=mm:4e70700e-ffb1-4461-91ae-e26b98c2ad7b 00523 Vector InternalMassME; 00524 00525 00526 private: 00527 00528 //#UBLK-BEG-CLASSMEMB mm:8ed17010-020e-11e0-9503-bdd33c3b382f 00529 //#UBLK-END-CLASSMEMB 00530 }; 00531 00532 //#UBLK-BEG-GLOBALH 00533 //*** Removed methods: 14 Mar 2012 17:03 00534 //--- 00535 //uuid=mm:75c8b72c-020e-11e0-9503-bdd33c3b382f 00536 // void Run(); 00537 00538 //*** Removed methods: 03 Dec 2012 16:18 00539 //--- 00540 //uuid=mm:3688029e-1526-4810-b7a4-fddae58b1cf1 00541 // void ComputeErrorNorm1DMatrices(); 00542 00543 //*** Removed methods: 13 May 2014 16:59 00544 //--- 00545 //uuid=mm:f5dfe496-c2b9-4339-a667-efca5c4a49f0 00546 // virtual void Run() = 0; 00547 00548 //*** Removed methods: 13 Mar 2015 16:16 00549 //--- 00550 //uuid=mm:d8baf3f9-800f-4039-8a39-8d263cf50629 00551 // ContactSolver_E GetContactIntegrationMethod(); 00552 //--- 00553 //uuid=mm:65a885f1-ee67-4534-b593-fa1b89915198 00554 // ContactModel_E GetContactFrictionCondition(); 00555 //--- 00556 //uuid=mm:bd26a52f-8120-4c8d-8d9b-713e214bfa5c 00557 // unsigned long GetFrictionCoef(); 00558 00559 //#UBLK-END-GLOBALH 00560 00561 00562 #endif // _SOLVER_H_