00001 #include "globalt.h"
00002 #include "general3mat.h"
00003
00004
00005
00006
00007
00008
00009
00010 general3mat::general3mat ()
00011 {}
00012
00013 general3mat::~general3mat ()
00014 {}
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 void general3mat::matcond (matrix &d,long ri,long ci,long ipp)
00028 {
00029 long n;
00030 n = d.n;
00031
00032 switch (n){
00033 case 1:{
00034 matcond1d (d,ri,ci,ipp);
00035 break;
00036 }
00037 case 2:{
00038 matcond2d (d,ri,ci,ipp);
00039 break;
00040 }
00041 case 3:{
00042 matcond3d (d,ri,ci,ipp);
00043 break;
00044 }
00045 default:{
00046 fprintf (stderr,"\n unknown number of components of stress tensor is required");
00047 fprintf (stderr,"\n in function (%s, line %d).\n",__FILE__,__LINE__);
00048 }
00049 }
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 void general3mat::matcond1d (matrix &d,long ri,long ci,long ipp)
00062 {
00063 double k;
00064 double x1,x2,x3;
00065 k = 0.0;
00066
00067 x1 = Tm->ip[ipp].av[0];
00068 x2 = Tm->ip[ipp].av[1];
00069 x3 = Tm->ip[ipp].av[2];
00070
00071 if((ri == 0) && (ci == 0))
00072 k = k11 (x1,x2,x3);
00073 if((ri == 0) && (ci == 1))
00074 k = k12 (x1,x2,x3);
00075 if((ri == 0) && (ci == 2))
00076 k = k13 (x1,x2,x3);
00077
00078 if((ri == 1) && (ci == 0))
00079 k = k21 (x1,x2,x3);
00080 if((ri == 1) && (ci == 1))
00081 k = k22 (x1,x2,x3);
00082 if((ri == 1) && (ci == 2))
00083 k = k23 (x1,x2,x3);
00084
00085 if((ri == 2) && (ci == 0))
00086 k = k31 (x1,x2,x3);
00087 if((ri == 2) && (ci == 1))
00088 k = k32 (x1,x2,x3);
00089 if((ri == 2) && (ci == 2))
00090 k = k33 (x1,x2,x3);
00091
00092 d[0][0] = k;
00093 }
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 void general3mat::matcond2d (matrix &d,long ri,long ci,long ipp)
00104 {
00105 double k;
00106 double x1,x2,x3;
00107 k = 0.0;
00108
00109 x1 = Tm->ip[ipp].av[0];
00110 x2 = Tm->ip[ipp].av[1];
00111 x3 = Tm->ip[ipp].av[2];
00112
00113 if((ri == 0) && (ci == 0))
00114 k = k11 (x1,x2,x3);
00115 if((ri == 0) && (ci == 1))
00116 k = k12 (x1,x2,x3);
00117 if((ri == 0) && (ci == 2))
00118 k = k13 (x1,x2,x3);
00119
00120 if((ri == 1) && (ci == 0))
00121 k = k21 (x1,x2,x3);
00122 if((ri == 1) && (ci == 1))
00123 k = k22 (x1,x2,x3);
00124 if((ri == 1) && (ci == 2))
00125 k = k23 (x1,x2,x3);
00126
00127 if((ri == 2) && (ci == 0))
00128 k = k31 (x1,x2,x3);
00129 if((ri == 2) && (ci == 1))
00130 k = k32 (x1,x2,x3);
00131 if((ri == 2) && (ci == 2))
00132 k = k33 (x1,x2,x3);
00133
00134 fillm(0.0,d);
00135
00136 d[0][0] = k; d[0][1] = 0.0;
00137 d[1][0] = 0.0; d[1][1] = k;
00138 }
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 void general3mat::matcond3d (matrix &d,long ri,long ci,long ipp)
00150 {
00151 double k;
00152 double x1,x2,x3;
00153 k = 0.0;
00154
00155 x1 = Tm->ip[ipp].av[0];
00156 x2 = Tm->ip[ipp].av[1];
00157 x3 = Tm->ip[ipp].av[2];
00158
00159 if((ri == 0) && (ci == 0))
00160 k = k11 (x1,x2,x3);
00161 if((ri == 0) && (ci == 1))
00162 k = k12 (x1,x2,x3);
00163 if((ri == 0) && (ci == 2))
00164 k = k13 (x1,x2,x3);
00165
00166 if((ri == 1) && (ci == 0))
00167 k = k21 (x1,x2,x3);
00168 if((ri == 1) && (ci == 1))
00169 k = k22 (x1,x2,x3);
00170 if((ri == 1) && (ci == 2))
00171 k = k23 (x1,x2,x3);
00172
00173 if((ri == 2) && (ci == 0))
00174 k = k31 (x1,x2,x3);
00175 if((ri == 2) && (ci == 1))
00176 k = k32 (x1,x2,x3);
00177 if((ri == 2) && (ci == 2))
00178 k = k33 (x1,x2,x3);
00179
00180 fillm(0.0,d);
00181
00182 d[0][0]=k; d[0][1]=0.0; d[0][2]=0.0;
00183 d[1][0]=0.0; d[1][1]=k; d[1][2]=0.0;
00184 d[2][0]=0.0; d[2][1]=0.0; d[2][2]=k;
00185 }
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 void general3mat::matcap (double &c,long ri,long ci,long ipp)
00197 {
00198 double x1,x2,x3;
00199 c = 0.0;
00200
00201 x1 = Tm->ip[ipp].av[0];
00202 x2 = Tm->ip[ipp].av[1];
00203 x3 = Tm->ip[ipp].av[2];
00204
00205 if((ri == 0) && (ci == 0))
00206 c = c11 (x1,x2,x3);
00207 if((ri == 0) && (ci == 1))
00208 c = c12 (x1,x2,x3);
00209 if((ri == 0) && (ci == 2))
00210 c = c13 (x1,x2,x3);
00211
00212 if((ri == 1) && (ci == 0))
00213 c = c21 (x1,x2,x3);
00214 if((ri == 1) && (ci == 1))
00215 c = c22 (x1,x2,x3);
00216 if((ri == 1) && (ci == 2))
00217 c = c23 (x1,x2,x3);
00218
00219 if((ri == 2) && (ci == 0))
00220 c = c31 (x1,x2,x3);
00221 if((ri == 2) && (ci == 1))
00222 c = c32 (x1,x2,x3);
00223 if((ri == 2) && (ci == 2))
00224 c = c33 (x1,x2,x3);
00225 }
00226
00227
00228
00229
00230
00231
00232
00233
00234 void general3mat::read (FILE *in)
00235 {
00236
00237 }
00238
00239
00240
00241
00242
00243
00244 double general3mat::k11(double x1,double x2,double x3)
00245 {
00246 double k11;
00247
00248
00249
00250 return (k11);
00251 }
00252
00253 double general3mat::k12(double x1,double x2,double x3)
00254 {
00255 double k12;
00256
00257
00258
00259 return (k12);
00260 }
00261
00262 double general3mat::k13(double x1,double x2,double x3)
00263 {
00264 double k13;
00265
00266
00267
00268 return (k13);
00269 }
00270
00271 double general3mat::k21(double x1,double x2,double x3)
00272 {
00273 double k21;
00274
00275
00276
00277 return (k21);
00278 }
00279
00280 double general3mat::k22(double x1,double x2,double x3)
00281 {
00282 double k22;
00283
00284
00285
00286 return (k22);
00287 }
00288
00289 double general3mat::k23(double x1,double x2,double x3)
00290 {
00291 double k23;
00292
00293
00294
00295 return (k23);
00296 }
00297
00298 double general3mat::k31(double x1,double x2,double x3)
00299 {
00300 double k31;
00301
00302
00303
00304 return (k31);
00305 }
00306
00307 double general3mat::k32(double x1,double x2,double x3)
00308 {
00309 double k32;
00310
00311
00312
00313 return (k32);
00314 }
00315
00316 double general3mat::k33(double x1,double x2,double x3)
00317 {
00318 double k33;
00319
00320
00321
00322 return (k33);
00323 }
00324
00325 double general3mat::c11(double x1,double x2,double x3)
00326 {
00327 double c11;
00328
00329
00330
00331 return(c11);
00332 }
00333
00334 double general3mat::c12(double x1,double x2,double x3)
00335 {
00336 double c12;
00337
00338
00339
00340 return(c12);
00341 }
00342
00343 double general3mat::c13(double x1,double x2,double x3)
00344 {
00345 double c13;
00346
00347
00348
00349 return(c13);
00350 }
00351
00352 double general3mat::c21(double x1,double x2,double x3)
00353 {
00354 double c21;
00355
00356
00357
00358 return(c21);
00359 }
00360
00361 double general3mat::c22(double x1,double x2,double x3)
00362 {
00363 double c22;
00364
00365
00366
00367 return(c22);
00368 }
00369
00370 double general3mat::c23(double x1,double x2,double x3)
00371 {
00372 double c23;
00373
00374
00375
00376 return(c23);
00377 }
00378
00379 double general3mat::c31(double x1,double x2,double x3)
00380 {
00381 double c31;
00382
00383
00384
00385 return(c31);
00386 }
00387
00388 double general3mat::c32(double x1,double x2,double x3)
00389 {
00390 double c32;
00391
00392
00393
00394 return(c32);
00395 }
00396
00397 double general3mat::c33(double x1,double x2,double x3)
00398 {
00399 double c33;
00400
00401
00402
00403 return(c33);
00404 }
00405
00406
00407
00408 void general3mat::auxiliarydata (double x1,double x2,double x3)
00409 {}
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427 double general3mat::transmission_transcoeff(double trc,long ri,long ci,long nn,long bc,long ipp)
00428 {
00429 long k;
00430 double new_trc,x1,x2,x3;
00431 new_trc = 0.0;
00432
00433 k=Gtt->give_dof(nn,0);
00434 if (k>0) {x1 = Lsrst->lhs[k-1]+Lsrst->lhsi[k-1];}
00435 if (k==0) {x1 = 0.0;}
00436 if (k<0) {x1 = Tb->lc[0].pv[0-k-1].getval();}
00437 k=Gtt->give_dof(nn,1);
00438 if (k>0) {x2 = Lsrst->lhs[k-1]+Lsrst->lhsi[k-1];}
00439 if (k==0) {x2 = 0.0;}
00440 if (k<0) {x2 = Tb->lc[0].pv[0-k-1].getval();}
00441 k=Gtt->give_dof(nn,2);
00442 if (k>0) {x3 = Lsrst->lhs[k-1]+Lsrst->lhsi[k-1];}
00443 if (k==0) {x3 = 0.0;}
00444 if (k<0) {x3 = Tb->lc[0].pv[0-k-1].getval();}
00445
00446 if((ri == 0) && (ci == 0))
00447 new_trc = get_transmission_transcoeff_11(x1,x2,x3,bc,ipp);
00448 if((ri == 0) && (ci == 1))
00449 new_trc = 0.0;
00450 if((ri == 0) && (ci == 2))
00451 new_trc = 0.0;
00452
00453 if((ri == 1) && (ci == 0))
00454 new_trc = 0.0;
00455 if((ri == 1) && (ci == 1))
00456 new_trc = 0.0;
00457 if((ri == 1) && (ci == 2))
00458 new_trc = 0.0;
00459
00460 if((ri == 2) && (ci == 0))
00461 new_trc = 0.0;
00462 if((ri == 2) && (ci == 1))
00463 new_trc = 0.0;
00464 if((ri == 2) && (ci == 2))
00465 new_trc = 0.0;
00466
00467 new_trc = new_trc*trc;
00468
00469 return (new_trc);
00470 }
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483 double general3mat::transmission_nodval(double nodval,long ri,long ci,long nn,long bc,long ipp)
00484 {
00485 long k;
00486 double new_nodval,x1,x2,x3;
00487 new_nodval = 0.0;
00488
00489 k=Gtt->give_dof(nn,0);
00490 if (k>0) {x1 = Lsrst->lhs[k-1]+Lsrst->lhsi[k-1];}
00491 if (k==0) {x1 = 0.0;}
00492 if (k<0) {x1 = Tb->lc[0].pv[0-k-1].getval();}
00493 k=Gtt->give_dof(nn,1);
00494 if (k>0) {x2 = Lsrst->lhs[k-1]+Lsrst->lhsi[k-1];}
00495 if (k==0) {x2 = 0.0;}
00496 if (k<0) {x2 = Tb->lc[0].pv[0-k-1].getval();}
00497 k=Gtt->give_dof(nn,2);
00498 if (k>0) {x3 = Lsrst->lhs[k-1]+Lsrst->lhsi[k-1];}
00499 if (k==0) {x3 = 0.0;}
00500 if (k<0) {x3 = Tb->lc[0].pv[0-k-1].getval();}
00501
00502 if((ri == 0) && (ci == 0))
00503 new_nodval = get_transmission_nodval_11(nodval,x1,x2,x3,bc,ipp);
00504 if((ri == 0) && (ci == 1))
00505 new_nodval = 0.0;
00506 if((ri == 0) && (ci == 2))
00507 new_nodval = 0.0;
00508
00509 if((ri == 1) && (ci == 0))
00510 new_nodval = 0.0;
00511 if((ri == 1) && (ci == 1))
00512 new_nodval = 0.0;
00513 if((ri == 1) && (ci == 2))
00514 new_nodval = 0.0;
00515
00516 if((ri == 2) && (ci == 0))
00517 new_nodval = 0.0;
00518 if((ri == 2) && (ci == 1))
00519 new_nodval = 0.0;
00520 if((ri == 2) && (ci == 2))
00521 new_nodval = 0.0;
00522
00523 return (new_nodval);
00524 }
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538 double general3mat::transmission_flux(double nodval,long ri,long ci,long nn,long bc,long ipp)
00539 {
00540 long k;
00541 double flux,x1,x2,x3;
00542 flux = 0.0;
00543
00544 k=Gtt->give_dof(nn,0);
00545 if (k>0) {x1 = Lsrst->lhs[k-1]+Lsrst->lhsi[k-1];}
00546 if (k==0) {x1 = 0.0;}
00547 if (k<0) {x1 = Tb->lc[0].pv[0-k-1].getval();}
00548 k=Gtt->give_dof(nn,1);
00549 if (k>0) {x2 = Lsrst->lhs[k-1]+Lsrst->lhsi[k-1];}
00550 if (k==0) {x2 = 0.0;}
00551 if (k<0) {x2 = Tb->lc[0].pv[0-k-1].getval();}
00552 k=Gtt->give_dof(nn,2);
00553 if (k>0) {x3 = Lsrst->lhs[k-1]+Lsrst->lhsi[k-1];}
00554 if (k==0) {x3 = 0.0;}
00555 if (k<0) {x3 = Tb->lc[0].pv[0-k-1].getval();}
00556
00557 if((ri == 0) && (ci == 0))
00558 flux = get_transmission_flux_11(nodval,x1,x2,x3,bc,ipp);
00559 if((ri == 0) && (ci == 1))
00560 flux = 0.0;
00561 if((ri == 0) && (ci == 2))
00562 flux = 0.0;
00563
00564 if((ri == 1) && (ci == 0))
00565 flux = 0.0;
00566 if((ri == 1) && (ci == 1))
00567 flux = 0.0;
00568 if((ri == 1) && (ci == 2))
00569 flux = 0.0;
00570
00571 if((ri == 2) && (ci == 0))
00572 flux = 0.0;
00573 if((ri == 2) && (ci == 1))
00574 flux = 0.0;
00575 if((ri == 2) && (ci == 2))
00576 flux = 0.0;
00577
00578 return (flux);
00579 }
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590 double general3mat::get_transmission_nodval_11(double bv,double x1,double x2,double x3,long bc,long ipp)
00591 {
00592 double nodval;
00593
00594 switch (bc){
00595 case 30:{
00596 nodval = bv;
00597 break;
00598 }
00599 default:{
00600 fprintf (stderr,"\n\n No real boundary condition is prescribed (%s, line %d).\n",__FILE__,__LINE__);
00601 exit(0);
00602 }
00603 }
00604
00605 return(nodval);
00606 }
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616 double general3mat::get_transmission_transcoeff_11(double x1,double x2,double x3,long bc,long ipp)
00617 {
00618 double trc;
00619
00620 switch (bc){
00621 case 30:{
00622 trc=1.0;
00623 break;
00624 }
00625 default:{
00626 fprintf (stderr,"\n\n No real boundary condition is prescribed (%s, line %d).\n",__FILE__,__LINE__);
00627 exit(0);
00628 }
00629 }
00630
00631 return(trc);
00632 }
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643 double general3mat::get_transmission_flux_11(double bv,double x1,double x2,double x3,long bc,long ipp)
00644 {
00645 double flux;
00646
00647 switch (bc){
00648 case 30:{
00649 flux = (bv - x1);
00650 break;
00651 }
00652 default:{
00653 fprintf (stderr,"\n\n No real boundary condition is prescribed (%s, line %d).\n",__FILE__,__LINE__);
00654 exit(0);
00655 }
00656 }
00657
00658 return(flux);
00659 }
00660
00661
00662
00663
00664
00665
00666
00667
00668 double general3mat::get_othervalue(long compother,long ipp, double x1,double x2,double x3)
00669 {
00670 double other;
00671
00672 switch (compother){
00673 case 0:{
00674 other = x1;
00675 break;
00676 }
00677 default:{
00678 fprintf (stderr,"\n\n unknown type of component is required in function (%s, line %d).\n",__FILE__,__LINE__);
00679 }
00680 }
00681 return (other);
00682 }
00683
00684
00685
00686
00687
00688
00689 void general3mat::print_othervalue_name(FILE *out,long compother)
00690 {
00691 switch (compother){
00692 case 0:{
00693 fprintf (out,"First unknown (Units) ");
00694 break;
00695 }
00696 default:{
00697 fprintf (stderr,"\n\n unknown type of component is required in function (%s, line %d).\n",__FILE__,__LINE__);
00698 }
00699 }
00700 }