00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013 #include "PySimple1Gen.h"
00014
00015 using namespace std;
00016
00018
00019 PySimple1Gen::PySimple1Gen()
00020 {
00021 NumNodes = 0;
00022 NumPyEle = 0;
00023 NumPileEle = 0;
00024 NumLayer = 0;
00025 NumMpLoadSp = 0;
00026 NumLoad = 0;
00027 NumSp = 0;
00028 NumMp = 0;
00029 NumMat = 0;
00030 pult = 0.0;
00031 b = 0.0;
00032 maxz = 0.0;
00033 minz = 0.0;
00034 depth = 0.0;
00035 cu = 0.0;
00036 e50 = 0.0;
00037 stress = 0.0;
00038 phi = 0.0;
00039 sr = 0.0;
00040 PULT = 0.0;
00041 Y50 = 0.0;
00042 ru = 0.0;
00043 }
00044
00045
00047
00048 PySimple1Gen::~PySimple1Gen()
00049 {
00050 delete[] Nodex;
00051 delete[] Nodey;
00052 delete[] NodeNum;
00053 delete[] PyEleNum;
00054 delete[] PyNode1;
00055 delete[] PyNode2;
00056 delete[] PyMat;
00057 delete[] PyDir;
00058 delete[] PileEleNum;
00059 delete[] PileNode1;
00060 delete[] PileNode2;
00061 delete[] gamma_t;
00062 delete[] gamma_b;
00063 delete[] z_t;
00064 delete[] z_b;
00065 delete[] Cd_t;
00066 delete[] Cd_b;
00067 delete[] c_t;
00068 delete[] c_b;
00069 delete[] cu_t;
00070 delete[] cu_b;
00071 delete[] e50_t;
00072 delete[] e50_b;
00073 delete[] phi_t;
00074 delete[] phi_b;
00075 delete[] Sr_t;
00076 delete[] Sr_b;
00077 delete[] pult_t;
00078 delete[] pult_b;
00079 delete[] y50_t;
00080 delete[] y50_b;
00081 delete[] zLoad_t;
00082 delete[] zLoad_b;
00083 delete[] load_val_t;
00084 delete[] load_val_b;
00085 delete[] zSp_t;
00086 delete[] zSp_b;
00087 delete[] sp_val_t;
00088 delete[] sp_val_b;
00089 delete[] zMp_t;
00090 delete[] zMp_b;
00091 delete[] mp_val_t;
00092 delete[] mp_val_b;
00093 delete[] ru_t;
00094 delete[] ru_b;
00095 delete[] b_t;
00096 delete[] b_b;
00097 delete[] pyType;
00098 for(int i=0;i<NumMat;i++)
00099 delete[] MatType[i];
00100 delete[] MatType;
00101 }
00102
00104
00105 void PySimple1Gen::WritePySimple1(const char *file1, const char *file2, const char *file3, const char *file4, const char *file5)
00106 {
00107 GetPySimple1(file1, file2, file3, file4, file5);
00108 return;
00109 }
00110
00111 void PySimple1Gen::WritePySimple1(const char *file1, const char *file2, const char *file3, const char *file4, const char *file5, const char *file6)
00112 {
00113
00114 GetPySimple1(file1, file2, file3, file4, file5);
00115 GetPattern(file6);
00116 return;
00117 }
00118
00120
00121
00122 void PySimple1Gen::GetPySimple1(const char *file1, const char *file2, const char *file3, const char *file4, const char *file5)
00123 {
00124
00125 int i, j, k, pyelenum, PyIndex, pymat, NODENUM;
00126 double z, Cd, c, mp;
00127 double ztrib1, ztrib2, dzsub, zsub, depthsub, sublength, numpyshared;
00128 mp = 1.0;
00129 char* mattype;
00130 char py2[] = "py2";
00131
00132
00133 ofstream PyOut;
00134 PyOut.open(file5, ios::out);
00135
00136 if(!PyOut)
00137 {
00138 opserr << "Error opening output stream for :" << file5 << ". Must Exit.";
00139 exit(-1);
00140 }
00141
00142
00143 PyOut << "#######################################################################################" << endln;
00144 PyOut << "##" << endln;
00145 PyOut << "## This file contains PySimple1 materials associated with pre-defined nodes, zeroLength" << endln;
00146 PyOut << "## elements and pile beam column elements. The file was created using the program" << endln;
00147 PyOut << "## PySimple1Gen.cpp written by Scott Brandenberg (sjbrandenberg@ucdavis.edu)" << endln;
00148 PyOut << "##" << endln;
00149 PyOut << "#######################################################################################" << endln << endln;
00150 PyOut << "########################################################################################" << endln;
00151 PyOut << "## Material Properties for py Elements" << endln << endln;
00152
00153
00154 GetSoilProperties(file1);
00155 GetNodes(file2);
00156 GetPyElements(file3);
00157 GetPileElements(file4);
00158
00159
00160 for(i=0;i<NumPyEle;i++)
00161 {
00162
00163 pyelenum = 0;
00164 z = 0;
00165 PyIndex = -1;
00166
00167
00168 for(j=0;j<NumNodes;j++)
00169 {
00170 if(NodeNum[j] == PyNode1[i])
00171 {
00172 for(k=0;k<NumPileEle;k++)
00173 {
00174 if(PileNode1[k] == PyNode1[i] || PileNode2[k] == PyNode1[i])
00175 {
00176 pyelenum = PyEleNum[i];
00177 PyIndex = i;
00178 pymat = PyMat[i];
00179 z = Nodey[j];
00180 NODENUM = NodeNum[j];
00181 }
00182 }
00183 }
00184 else if(NodeNum[j] == PyNode2[i])
00185 {
00186 for(k=0;k<NumPileEle;k++)
00187 {
00188 if(PileNode1[k] == PyNode2[i] || PileNode2[k] == PyNode2[i])
00189 {
00190 pyelenum = PyEleNum[i];
00191 PyIndex = i;
00192 pymat = PyMat[i];
00193 z = Nodey[j];
00194 NODENUM = NodeNum[j];
00195 }
00196 }
00197 }
00198 }
00199
00200 if(PyIndex == -1)
00201 continue;
00202
00203
00204 maxz = z_t[0];
00205 minz = z_b[0];
00206 for (j=0;j<NumMat;j++)
00207 {
00208 if(z_t[j] > maxz)
00209 maxz = z_t[j];
00210 if(z_b[j] < minz)
00211 minz = z_b[j];
00212 }
00213
00214
00215 depth = maxz - z;
00216
00217 GetTributaryCoordsPy(NODENUM);
00218 ztrib1 = tribcoord[0];
00219 ztrib2 = tribcoord[1];
00220
00221
00222
00223 if(ztrib1 > maxz)
00224 ztrib1 = maxz;
00225 if(ztrib2 > maxz)
00226 ztrib2 = maxz;
00227 if(ztrib1 < minz)
00228 ztrib1 = minz;
00229 if(ztrib2 < minz)
00230 ztrib2 = minz;
00231
00232
00233 if(PyIndex != -1)
00234 {
00235
00236
00237 for(j=0;j<NumMat;j++)
00238 {
00239 if(z<=z_t[j] && z>=z_b[j])
00240 {
00241 mattype = MatType[j];
00242 if(strcmp(MatType[j],"py1")==0)
00243 stype = 1;
00244 else if((strcmp(MatType[j],"py2")==0) || (strcmp(MatType[j],"py3")==0))
00245 stype = 2;
00246 else if(strcmp(MatType[j],"py4")==0)
00247 stype = pyType[j];
00248 else
00249 {
00250 opserr << "MatType must be py1, py2, py3 or py4. " << MatType[j] << " is not supported." << endln;
00251 exit(0);
00252 }
00253
00254 b = linterp(z_t[j], z_b[j], b_t[j], b_b[j], z);
00255 cu = linterp(z_t[j], z_b[j], cu_t[j], cu_b[j], z);
00256 e50 = linterp(z_t[j], z_b[j], e50_t[j], e50_b[j], z);
00257 phi = linterp(z_t[j], z_b[j], phi_t[j], phi_b[j], z);
00258 sr = linterp(z_t[j], z_b[j], Sr_t[j], Sr_b[j], z);
00259 Cd = linterp(z_t[j], z_b[j], Cd_t[j], Cd_b[j], z);
00260 c = linterp(z_t[j], z_b[j], c_t[j], c_b[j], z);
00261 PULT = linterp(z_t[j], z_b[j], pult_t[j], pult_b[j], z);
00262 Y50 = linterp(z_t[j], z_b[j], y50_t[j], y50_b[j], z);
00263 ru = linterp(z_t[j], z_b[j], ru_t[j], ru_b[j], z);
00264
00265 break;
00266 }
00267 }
00268
00269 stress = GetVStress(z);
00270 pult = GetPult(mattype);
00271
00272 if(strcmp(mattype,"py3")==0)
00273 pult = GetPult(py2);
00274 y50 = GetY50(mattype);
00275
00276
00277 dzsub = (ztrib2 - ztrib1)/10.0;
00278 sublength = fabs(dzsub);
00279 pult = 0.0;
00280 for(k=0;k<10;k++)
00281 {
00282 zsub = ztrib1 + dzsub/2.0 + k*dzsub;
00283 depthsub = maxz - zsub;
00284
00285
00286 for(j=0;j<NumMat;j++)
00287 {
00288 if(zsub<=z_t[j] && zsub>=z_b[j])
00289 {
00290 mattype = MatType[j];
00291 if(strcmp(MatType[j],"py1")==0)
00292 stype = 1;
00293 else if((strcmp(MatType[j],"py2")==0) || (strcmp(MatType[j],"py3")==0))
00294 stype = 2;
00295 else if(strcmp(MatType[j],"py4")==0)
00296 stype = pyType[j];
00297 else
00298 {
00299 opserr << "MatType must be py1, py2, py3 or py4. " << mattype << " is not supported." << endln;
00300 exit(0);
00301 }
00302
00303 b = linterp(z_t[j], z_b[j], b_t[j], b_b[j], zsub);
00304 cu = linterp(z_t[j], z_b[j], cu_t[j], cu_b[j], zsub);
00305 e50 = linterp(z_t[j], z_b[j], e50_t[j], e50_b[j], zsub);
00306 phi = linterp(z_t[j], z_b[j], phi_t[j], phi_b[j], zsub);
00307 sr = linterp(z_t[j], z_b[j], Sr_t[j], Sr_b[j], zsub);
00308 Cd = linterp(z_t[j], z_b[j], Cd_t[j], Cd_b[j], zsub);
00309 c = linterp(z_t[j], z_b[j], c_t[j], c_b[j], zsub);
00310 PULT = linterp(z_t[j], z_b[j], pult_t[j], pult_b[j], zsub);
00311 Y50 = linterp(z_t[j], z_b[j], y50_t[j], y50_b[j], zsub);
00312 ru = linterp(z_t[j], z_b[j], ru_t[j], ru_b[j], zsub);
00313 break;
00314 }
00315 }
00316
00317 for(j=0;j<NumMp;j++)
00318 {
00319 if(zsub<=zMp_t[j] && zsub>=zMp_b[j])
00320 mp = linterp(zMp_t[j], zMp_b[j], mp_val_t[j], mp_val_b[j], zsub);
00321 else mp = 1.0;
00322 }
00323
00324
00325 stress = GetVStress(zsub);
00326
00327
00328 pult = GetPult(mattype)*sublength*mp + pult;
00329 }
00330
00331
00332 numpyshared = 1;
00333 for(j=0;j<NumPyEle;j++)
00334 {
00335 if(j!=i)
00336 {
00337 if(PyNode1[j] == PyNode1[i] || PyNode1[j] == PyNode2[i])
00338 numpyshared += 1.0;
00339 }
00340 }
00341
00342 PyOut << "uniaxialMaterial PySimple1 " << pymat << " " << stype << " " << pult/numpyshared << " " << y50 << " " << Cd << " " << c << endln;
00343 }
00344 }
00345
00346
00347 PyOut << endln << "## End Material Properties for py Elements" << endln;
00348 PyOut << "########################################################################################" << endln;
00349
00350 PyOut.close();
00351
00352 return;
00353 }
00354
00356
00357 void PySimple1Gen::GetPattern(const char *file6)
00358 {
00359 double ztrib1, ztrib2, maxz, minz, dzsub, sublength, zsub, depthsub;
00360 int node, i, j, k;
00361 double patternvalue, z, load, sp;
00362 char patterntype[] = "trash";
00363
00364
00365 ofstream PatOut(file6, ios::out);
00366 if(!PatOut)
00367 {
00368 opserr << "Error opening " << file6 << " in PySimple1Gen.cpp. Must Exit." << endln;
00369 exit(-1);
00370 }
00371
00372 patternvalue = 0.0;
00373 z = 0.0;
00374
00375
00376 PatOut << "#######################################################################################" << endln;
00377 PatOut << "##" << endln;
00378 PatOut << "## This file contains either load patterns applied to pile nodes, or displacement" << endln;
00379 PatOut << "## patterns applied to the free ends of py elements. The file was created using" << endln;
00380 PatOut << "## PySimple1Gen.cpp written by Scott Brandenberg (sjbrandenberg@ucdavis.edu)" << endln;
00381 PatOut << "##" << endln;
00382 PatOut << "#######################################################################################" << endln << endln;
00383 PatOut << "#######################################################################################" << endln;
00384 PatOut << "## Begin Pattern File" << endln << endln;
00385
00386
00387
00388
00389
00390 for(i=0;i<NumNodes;i++)
00391 {
00392 z = Nodey[i];
00393 GetTributaryCoordsPile(NodeNum[i]);
00394 ztrib1 = tribcoord[0];
00395 ztrib2 = tribcoord[1];
00396
00397
00398 maxz = z_t[0];
00399 minz = z_b[0];
00400 for (j=0;j<NumMat;j++)
00401 {
00402 if(z_t[j] > maxz)
00403 maxz = z_t[j];
00404 if(z_b[j] < minz)
00405 minz = z_b[j];
00406 }
00407
00408
00409
00410 load = 0.0;
00411 dzsub = (ztrib2 - ztrib1)/10.0;
00412 sublength = fabs(dzsub);
00413 for(k=0;k<10;k++)
00414 {
00415 zsub = ztrib1 + dzsub/2.0 + k*dzsub;
00416 depthsub = maxz - zsub;
00417
00418 for(j=0;j<NumLoad;j++)
00419 {
00420 if(zsub<=zLoad_t[j] && zsub>=zLoad_b[j])
00421 {
00422 load = linterp(zLoad_t[j], zLoad_b[j], load_val_t[j], load_val_b[j], zsub)*sublength + load;
00423 strcpy(patterntype,"load");
00424 }
00425
00426 }
00427 }
00428 node = -1;
00429 if(strcmp(patterntype,"load")==0)
00430 {
00431 for(j=0;j<NumPileEle;j++)
00432 {
00433 if(NodeNum[i] == PileNode1[j] || NodeNum[i] == PileNode2[j])
00434 {
00435 node = NodeNum[i];
00436 }
00437 }
00438 if(node!=-1)
00439 PatOut << "load " << node << " " << load << " 0.0 0.0" << endln;
00440 }
00441
00442 for(j=0;j<NumSp;j++)
00443 {
00444 if(z<=zSp_t[j] && z>=zSp_b[j])
00445 {
00446 sp = linterp(zSp_t[j], zSp_b[j], sp_val_t[j], sp_val_b[j], z);
00447 strcpy(patterntype,"sp");
00448 }
00449 }
00450
00451 node = -1;
00452 if(strcmp(patterntype,"sp")==0)
00453 {
00454 for(k=0;k<NumPyEle;k++)
00455 {
00456 if(NodeNum[i] == PyNode1[k] || NodeNum[i] == PyNode2[k])
00457 {
00458 node = NodeNum[i];
00459
00460 for(j=0;j<NumPileEle;j++)
00461 {
00462 if(PileNode1[j] == NodeNum[i] || PileNode2[j] == NodeNum[i])
00463 {
00464 node = -1;
00465 break;
00466 }
00467 }
00468 }
00469 }
00470
00471
00472 if(node != -1)
00473 PatOut << "sp " << node << " 1 " << sp << endln;
00474 }
00475
00476 }
00477
00478 PatOut << endln << endln;
00479
00480 PatOut << "## End Pattern File" << endln;
00481 PatOut << "#######################################################################################" << endln;
00482
00483 PatOut.close();
00484 return;
00485
00486 }
00487
00489
00490 void PySimple1Gen::GetNodes(const char *file)
00491 {
00492 int i = 0;
00493 char *trash2 = new char[5];
00494 char ch;
00495
00496 ifstream in2(file, ios::in);
00497
00498 if(!in2)
00499 {
00500 opserr << "File " << file << "does not exist. Must exit." << endln;
00501 exit(-1);
00502 }
00503
00504 NumNodes = NumRows(file,"node");
00505 NodeNum = new int[NumNodes];
00506 Nodex = new double[NumNodes];
00507 Nodey = new double[NumNodes];
00508
00509 while(in2)
00510 {
00511 if(char(in2.peek())=='n')
00512 {
00513 in2.getline(trash2,5,' ');
00514 if(strcmp(trash2,"node")==0)
00515 {
00516 in2 >> NodeNum[i] >> Nodex[i] >> Nodey[i];
00517 i+=1;
00518 }
00519 }
00520 while(in2.get(ch))
00521 {
00522 if(ch=='\n')
00523 break;
00524 }
00525 }
00526 delete[] trash2;
00527 in2.close();
00528 return;
00529 }
00530
00532
00533 void PySimple1Gen::GetPyElements(const char *file)
00534 {
00535 int i = 0;
00536 char *trash = new char[1000];
00537 char ch;
00538
00539 ifstream in3;
00540 in3.open(file, ios::in);
00541
00542 if(!in3)
00543 {
00544 opserr << "File " << file << "does not exist. Must exit." << endln;
00545 exit(-1);
00546 }
00547
00548 NumPyEle = NumRows(file,"element");
00549 PyEleNum = new int[NumPyEle];
00550 PyNode1 = new int[NumPyEle];
00551 PyNode2 = new int[NumPyEle];
00552 PyMat = new int[NumPyEle];
00553 PyDir = new int[NumPyEle];
00554
00555 while(in3)
00556 {
00557 if(in3.peek()=='e')
00558 {
00559 in3.get(trash,8);
00560 if(strcmp(trash,"element")==0)
00561 {
00562 in3 >> trash >> PyEleNum[i] >> PyNode1[i] >> PyNode2[i] >> trash >> PyMat[i] >> trash
00563 >> PyDir[i];
00564 i+=1;
00565 }
00566 continue;
00567 }
00568 while(in3.get(ch))
00569 {
00570 if(ch=='\n')
00571 break;
00572 }
00573 }
00574
00575 delete[] trash;
00576 in3.close();
00577 return;
00578 }
00579
00581
00582 void PySimple1Gen::GetPileElements(const char *file)
00583 {
00584 int i = 0;
00585 char* trash = new char[1000];
00586 char ch;
00587
00588 ifstream in4;
00589 in4.open(file, ios::in);
00590
00591 if(!in4)
00592 {
00593 opserr << "File " << file << "does not exist. Must exit." << endln;
00594 exit(-1);
00595 }
00596
00597 NumPileEle = NumRows(file,"element");
00598 PileEleNum = new int[NumPileEle];
00599 PileNode1 = new int[NumPileEle];
00600 PileNode2 = new int[NumPileEle];
00601
00602 while(in4)
00603 {
00604 if(in4.peek()=='e')
00605 {
00606 in4.get(trash,8);
00607 if(strcmp(trash,"element")==0)
00608 {
00609 in4 >> trash >> PileEleNum[i] >> PileNode1[i] >> PileNode2[i];
00610 i+=1;
00611 }
00612 continue;
00613 }
00614 while(in4.get(ch))
00615 {
00616 if(ch=='\n')
00617 break;
00618 }
00619 }
00620
00621 delete[] trash;
00622 in4.close();
00623 return;
00624 }
00625
00627
00628 void PySimple1Gen::GetSoilProperties(const char *file)
00629 {
00630 int i = 0;
00631 int I = 0;
00632 int J = 0;
00633 int K = 0;
00634 char OptionalTag[10];
00635 char ch;
00636
00637 ifstream in1;
00638 in1.open(file, ios::in);
00639
00640 if(!in1)
00641 {
00642 opserr << "File " << file << "does not exist. Must exit." << endln;
00643 exit(0);
00644 }
00645
00646
00647 NumMat = NumRows(file, "py1") + NumRows(file, "py2") + NumRows(file, "py3") + NumRows(file, "py4");
00648
00649
00650
00651
00652 MatType = new char*[NumMat];
00653 for(i=0;i<NumMat;i++)
00654 MatType[i] = new char[4];
00655 z_t = new double[NumMat];
00656 z_b = new double[NumMat];
00657 gamma_t = new double[NumMat];
00658 gamma_b = new double[NumMat];
00659 b_t = new double[NumMat];
00660 b_b = new double[NumMat];
00661 Cd_t = new double[NumMat];
00662 Cd_b = new double[NumMat];
00663 c_t = new double[NumMat];
00664 c_b = new double[NumMat];
00665 cu_t = new double[NumMat];
00666 cu_b = new double[NumMat];
00667 e50_t = new double[NumMat];
00668 e50_b = new double[NumMat];
00669 phi_t = new double[NumMat];
00670 phi_b = new double[NumMat];
00671 Sr_t = new double[NumMat];
00672 Sr_b = new double[NumMat];
00673 pyType = new int[NumMat];
00674 pult_t = new double[NumMat];
00675 pult_b = new double[NumMat];
00676 y50_t = new double[NumMat];
00677 y50_b = new double[NumMat];
00678 ru_t = new double[NumMat];
00679 ru_b = new double[NumMat];
00680
00681
00682 NumMp = NumRows(file,"mp");
00683 NumLoad = NumRows(file,"load");
00684 NumSp = NumRows(file,"sp");
00685 NumMpLoadSp = NumMp + NumLoad + NumSp;
00686
00687
00688 zMp_t = new double[NumMp];
00689 zMp_b = new double[NumMp];
00690 mp_val_t = new double[NumMp];
00691 mp_val_b = new double[NumMp];
00692
00693
00694 zLoad_t = new double[NumLoad];
00695 zLoad_b = new double[NumLoad];
00696 load_val_t = new double[NumLoad];
00697 load_val_b = new double[NumLoad];
00698
00699
00700 zSp_t = new double[NumSp];
00701 zSp_b = new double[NumSp];
00702 sp_val_t = new double[NumSp];
00703 sp_val_b = new double[NumSp];
00704
00705 for(i=0;i<NumMat;i++)
00706 {
00707
00708 z_t[i] = 0;
00709 z_b[i] = 0;
00710 gamma_t[i] = 0;
00711 gamma_b[i] = 0;
00712 b_t[i] = 0;
00713 b_t[i] = 0;
00714 Cd_t[i] = 0;
00715 Cd_b[i] = 0;
00716 c_t[i] = 0;
00717 c_b[i] = 0;
00718 cu_t[i] = 0;
00719 cu_b[i] = 0;
00720 e50_t[i] = 0;
00721 e50_b[i] = 0;
00722 phi_t[i] = 0;
00723 phi_b[i] = 0;
00724 Sr_t[i] = 0;
00725 Sr_b[i] = 0;
00726 pyType[i] = 0;
00727 pult_t[i] = 0;
00728 pult_b[i] = 0;
00729 y50_t[i] = 0;
00730 y50_b[i] = 0;
00731 ru_t[i] = 0;
00732 ru_b[i] = 0;
00733
00734
00735 in1.get(MatType[i],4);
00736 in1 >> z_t[i] >> z_b[i] >> gamma_t[i] >> gamma_b[i];
00737
00738
00739
00740 if(strcmp(MatType[i],"py1")==0)
00741 {
00742 in1 >> b_t[i] >> b_b[i] >> cu_t[i] >> cu_b[i] >> e50_t[i] >> e50_b[i] >> Cd_t[i] >> Cd_b[i];
00743 if(in1.peek() != '\n')
00744 in1 >> c_t[i] >> c_b[i];
00745 }
00746
00747 else if(strcmp(MatType[i],"py2")==0)
00748 {
00749 in1 >> b_t[i] >> b_b[i] >> phi_t[i] >> phi_b[i] >> Cd_t[i] >> Cd_b[i];
00750 if(in1.peek() != '\n')
00751 in1 >> c_t[i] >> c_b[i];
00752 }
00753
00754 else if(strcmp(MatType[i],"py3")==0)
00755 {
00756 in1 >> b_t[i] >> b_b[i] >> phi_t[i] >> phi_b[i] >> Sr_t[i] >> Sr_b[i] >> ru_t[i] >> ru_b[i] >> Cd_t[i] >> Cd_b[i];
00757 if(in1.peek() != '\n')
00758 in1 >> c_t[i] >> c_b[i];
00759 }
00760
00761 else if(strcmp(MatType[i],"py4")==0)
00762 {
00763 in1 >> pyType[i] >> pult_t[i] >> pult_b[i] >> y50_t[i] >> y50_b[i] >> Cd_t[i] >> Cd_b[i];
00764 if(in1.peek() != '\n')
00765 in1 >> c_t[i] >> c_b[i];
00766 }
00767
00768 else
00769 {
00770 opserr << "Invalid MatType in PySimple1Gen.cpp.";
00771 exit(0);
00772 }
00773 while(in1.get(ch))
00774 {
00775 if(ch=='\n')
00776 break;
00777 }
00778 }
00779
00780
00781
00782
00783 for(i=0;i<NumMpLoadSp;i++)
00784 {
00785 in1 >> OptionalTag;
00786 if(strcmp(OptionalTag,"load")==0)
00787 {
00788 in1 >> zLoad_t[I] >> zLoad_b[I] >> load_val_t[I] >> load_val_b[I];
00789 I+=1;
00790 }
00791 if(strcmp(OptionalTag,"sp")==0)
00792 {
00793 in1 >> zSp_t[J] >> zSp_b[J] >> sp_val_t[J] >> sp_val_b[J];
00794 J+=1;
00795 }
00796 if(strcmp(OptionalTag,"mp")==0)
00797 {
00798 in1 >> zMp_t[K] >> zMp_b[K] >> mp_val_t[K] >> mp_val_b[K];
00799 K+=1;
00800 }
00801 while(in1.get(ch))
00802 {
00803 if(ch=='\n')
00804 break;
00805 }
00806 }
00807
00808 in1.close();
00809 return;
00810 }
00811
00812
00814
00815 double PySimple1Gen::GetPult(const char *type)
00816 {
00817 double alpha, beta, Ko, Ka, pu1, pu2, A;
00818 double deg = 3.141592654/180;
00819 double pult_0, pult_1, pult_ru;
00820
00821
00822
00823 if(strcmp(type,"py1")==0)
00824 {
00825 if(3 + stress/cu + 0.5/b*depth > 9)
00826 return 9*cu*b;
00827 else
00828 return (3 + stress/cu + 0.5/b*depth)*cu*b;
00829 }
00830
00831
00832
00833 else if(strcmp(type,"py2")==0)
00834 {
00835 if(depth == 0)
00836 return 0.00001;
00837
00838 alpha = phi/2;
00839 beta = 45 + phi/2;
00840
00841 phi = phi;
00842 alpha = alpha;
00843 beta = beta;
00844 Ko = 0.4;
00845 Ka = pow(tan(45*deg - alpha*deg),2.0);
00846 pu1 = stress*(Ko*depth*tan(phi*deg)*sin(beta*deg)/(tan(beta*deg-phi*deg)*cos(alpha*deg))+tan(beta*deg)/(tan(beta*deg-phi*deg))*(b+depth*tan(beta*deg)*tan(alpha*deg))+Ko*depth*tan(beta*deg)*(tan(phi*deg)*sin(beta*deg) - tan(alpha*deg)) - Ka*b);
00847 pu2 = Ka*b*stress*(pow(tan(beta*deg),8.0) - 1.0) + Ko*b*stress*tan(phi*deg)*pow(tan(beta*deg),4.0);
00848
00850
00851
00852
00853
00854 if(depth < 5*b)
00855 A = 0.032*pow((5-depth/b),2.6)+0.88;
00856 else if(depth >= 5*b)
00857 A = 0.88;
00858
00859
00861
00863
00864
00865
00866
00867
00868
00870
00871 if (pu1 > pu2)
00872 return pu2*A;
00873 else
00874 return pu1*A;
00875 }
00876
00877
00878
00879 else if(strcmp(type,"py3")==0)
00880 {
00881 if(depth == 0)
00882 return 0.00001;
00883
00884 alpha = phi/2;
00885 beta = 45 + phi/2;
00886
00887 phi = phi;
00888 alpha = alpha;
00889 beta = beta;
00890 Ko = 0.4;
00891 Ka = pow(tan(45*deg - alpha*deg),2.0);
00892 pu1 = stress*(Ko*tan(phi*deg)*sin(beta*deg)/(tan(beta*deg-phi*deg)*cos(alpha*deg))+tan(beta*deg)/(tan(beta*deg-phi*deg))*(b+depth*tan(beta*deg)*tan(alpha*deg))+Ko*depth*tan(beta*deg)*(tan(phi*deg)*sin(beta*deg) - tan(alpha*deg)) - Ka*b);
00893 pu2 = Ka*b*stress*(pow(tan(beta*deg),8.0) - 1.0) + Ko*b*stress*tan(phi*deg)*pow(tan(beta*deg),4.0);
00894
00896
00897
00898
00899
00900 if(depth < 5*b)
00901 A = 0.032*pow((5-depth/b),2.6)+0.88;
00902 else if(depth >= 5*b)
00903 A = 0.88;
00904
00905
00907
00909
00910
00911
00912
00913
00914
00916
00917 if(pu1 > pu2)
00918 pult_0 = pu2*A;
00919 else
00920 pult_0 = pu1*A;
00921 pult_1 = 9.0*sr*stress*b;
00922
00923 pult_ru = linterp(0.0, 1.0, pult_0, pult_1, ru);
00924
00925 return pult_ru;
00926 }
00927
00928
00929
00930 else if(strcmp(type,"py4")==0)
00931 {
00932 return PULT;
00933 }
00934
00935 else
00936 {
00937 opserr << "Invalid py type in PySimple1GenPushover::GetPult. Setting pult = 0";
00938 return 0.0;
00939 }
00940
00941 }
00942
00944
00945 double PySimple1Gen::GetY50(const char *type)
00946 {
00947 double csigma = sqrt(50/stress);
00948 if(depth == 0)
00949 csigma = 1;
00950
00951
00952 if(strcmp(type,"py1")==0)
00953 return 2.5*b*e50;
00954
00955
00956 else if(strcmp(type,"py2")==0)
00957 {
00958
00959 if (depth == 0)
00960 {
00961 return 0.00001;
00962 }
00963
00964 double k;
00965
00966 k = (0.3141*pow(phi,3) - 32.114*pow(phi,2) + 1109.2*phi - 12808)*271.447;
00967 k = k*csigma;
00968 return 0.549*pult/k/depth;
00969
00970 }
00971
00972 else if(strcmp(type,"py3")==0)
00973 {
00974
00975 if (depth == 0)
00976 {
00977 return 0.00001;
00978 }
00979
00980 double k;
00981
00982 k = (0.3141*pow(phi,3) - 32.114*pow(phi,2) + 1109.2*phi - 12808)*271.447;
00983 k = k*csigma;
00984
00985 return 0.549*pult/k/depth;
00986
00987 }
00988
00989
00990 else if(strcmp(type,"py4")==0)
00991 return Y50;
00992
00993
00994 else
00995 {
00996 opserr << "Invalid py type in PySimple1GenPushover::GetY50. Setting y50 = 0";
00997 return 0.0;
00998 }
00999 }
01000
01002
01003 int PySimple1Gen::NumRows(const char *file, const char *begin)
01004 {
01005 if(!file)
01006 {
01007 opserr << "File " << file << "does not exist. Must exit." << endln;
01008 exit(0);
01009 }
01010
01011 ifstream in_file;
01012 in_file.open(file, ios::in);
01013 int i = 0;
01014 char *filein = new char[20];
01015
01016 while(!in_file.eof())
01017 {
01018
01019 while(in_file.peek()=='\n')
01020 in_file.getline(filein,1,'\n');
01021
01022 in_file.get(filein,19,' ');
01023 if(strcmp(filein, begin)==0)
01024 i = i+1;
01025
01026
01027 in_file.ignore(1000,'\n');
01028 }
01029
01030 delete [] filein;
01031
01032 in_file.close();
01033 return i;
01034
01035 }
01036
01038
01039 double PySimple1Gen::GetVStress(double z)
01040 {
01041 double stress, maxz, minz, z_top, z_bot, gamma_top, gamma_bot, gamma_z;
01042 int i;
01043 stress = 0;
01044 maxz = z_t[0];
01045 minz = z_b[0];
01046 z_top = 0;
01047 z_bot = 0;
01048 gamma_top = 0;
01049 gamma_bot = 0;
01050
01051
01052
01053 for (i=0;i<NumMat;i++)
01054 {
01055 if(z_t[i] >= maxz)
01056 maxz = z_t[i];
01057 if(z_b[i] <= minz)
01058 minz = z_b[i];
01059 }
01060
01061
01062 if(z > maxz || z < minz)
01063 {
01064 opserr << "Depth lies out of range of specified depth vectors in function 'vstress' in PySimple1GenPushover. Setting stress = 0." << endln;
01065 return 0.0;
01066 }
01067
01068
01069
01070 for(i=0;i<NumMat;i++)
01071 {
01072 if(z >= z_b[i] && z <= z_t[i])
01073 {
01074 z_top = z_t[i];
01075 z_bot = z_b[i];
01076 gamma_top = gamma_t[i];
01077 gamma_bot = gamma_b[i];
01078 }
01079 }
01080
01081
01082
01083
01084 gamma_z = linterp(z_top, z_bot, gamma_top, gamma_bot, z);
01085
01086
01087 for (i=0;i<NumMat;i++)
01088 {
01089 if(z <= z_b[i])
01090 stress = stress + 0.5*(gamma_t[i] + gamma_b[i])*(z_t[i] - z_b[i]);
01091 if(z > z_b[i] && z < z_t[i])
01092 stress = stress + 0.5*(gamma_t[i] + gamma_z)*(z_t[i] - z);
01093 }
01094
01095 return stress;
01096 }
01097
01099
01100
01101 double PySimple1Gen::linterp(double x1, double x2, double y1, double y2, double x3)
01102 {
01103 return y1 + (x3-x1)*(y2-y1)/(x2-x1);
01104 }
01105
01107
01108
01109
01110
01111 void PySimple1Gen::GetTributaryCoordsPy(int nodenum1)
01112 {
01113
01114 double coordnodenum1;
01115 int i, j, k, I, pyeletag;
01116 I = 0;
01117
01118
01119 for(i=0; i<NumNodes; i++)
01120 {
01121 if(nodenum1 == NodeNum[i])
01122 {
01123 coordnodenum1 = Nodey[i];
01124 tribcoord[0] = Nodey[i];
01125 tribcoord[1] = Nodey[i];
01126 }
01127 }
01128 for(i=0; i<NumPileEle; i++)
01129 {
01130 if(PileNode1[i] == nodenum1)
01131 {
01132 pyeletag = 0;
01133 for(j=0; j<NumPyEle; j++)
01134 {
01135 if(PyNode1[j] == PileNode1[i] || PyNode2[j] == PileNode1[i])
01136 {
01137 for(k=0; k<NumPyEle; k++)
01138 {
01139 if(PyNode1[k] == PileNode2[i] || PyNode2[k] == PileNode2[i])
01140 pyeletag = 1;
01141 }
01142 }
01143 }
01144 if(pyeletag==1)
01145 {
01146 for(j=0; j<NumNodes; j++)
01147 {
01148 if(PileNode2[i] == NodeNum[j])
01149 {
01150 tribcoord[0] = coordnodenum1 + 0.5*(Nodey[j] - coordnodenum1);
01151 }
01152 }
01153 }
01154 }
01155 if(PileNode2[i] == nodenum1)
01156 {
01157 pyeletag = 0;
01158 for(j=0;j<NumPyEle;j++)
01159 {
01160 if(PyNode1[j] == PileNode2[i] || PyNode2[j] == PileNode2[i])
01161 {
01162 for(k=0; k<NumPyEle; k++)
01163 {
01164 if(PyNode1[k] == PileNode1[i] || PyNode2[k] == PileNode1[i])
01165 pyeletag = 1;
01166 }
01167 }
01168 }
01169 if(pyeletag==1)
01170 {
01171 for(j=0; j<NumNodes; j++)
01172 {
01173 if(PileNode1[i] == NodeNum[j])
01174 {
01175 tribcoord[1] = coordnodenum1 + 0.5*(Nodey[j] - coordnodenum1);
01176 }
01177 }
01178 }
01179 }
01180 }
01181
01182 return;
01183 }
01184
01186
01187
01188
01189
01190
01191 void PySimple1Gen::GetTributaryCoordsPile(int nodenum1)
01192 {
01193
01194 double coordnodenum1;
01195 int i, j, I;
01196 I = 0;
01197
01198
01199 for(i=0; i<NumNodes; i++)
01200 {
01201 if(nodenum1 == NodeNum[i])
01202 {
01203 coordnodenum1 = Nodey[i];
01204 tribcoord[0] = Nodey[i];
01205 tribcoord[1] = Nodey[i];
01206 }
01207 }
01208 for(i=0; i<NumPileEle; i++)
01209 {
01210 if(PileNode1[i] == nodenum1)
01211 {
01212 for(j=0; j<NumNodes; j++)
01213 {
01214 if(PileNode2[i] == NodeNum[j])
01215 {
01216 tribcoord[0] = coordnodenum1 + 0.5*(Nodey[j] - coordnodenum1);
01217 }
01218 }
01219 }
01220 if(PileNode2[i] == nodenum1)
01221 {
01222 for(j=0; j<NumNodes; j++)
01223 {
01224 if(PileNode1[i] == NodeNum[j])
01225 {
01226 tribcoord[1] = coordnodenum1 + 0.5*(Nodey[j] - coordnodenum1);
01227 }
01228 }
01229 }
01230 }
01231
01232 return;
01233 }