00001 #include "coupmatl.h"
00002 #include "globalc.h"
00003 #include <math.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "constrelcl.h"
00007 #include "onemediumc.h"
00008 #include "twomediac.h"
00009 #include "threemediac.h"
00010
00011 coupmatl::coupmatl (void)
00012 {
00013 tnip=0;
00014 ip=NULL;
00015
00016 itrmc=NULL;
00017 sejtkrmc=NULL;
00018
00019 concretec=NULL;
00020 baroghelc = NULL;
00021 C60baroghelc = NULL;
00022 C30baroghelc = NULL;
00023 o30bazantc = NULL;
00024 C60bazantc = NULL;
00025
00026 consol_awf2c = NULL;
00027
00028 tenchc = NULL;
00029 }
00030
00031 coupmatl::~coupmatl (void)
00032 {
00033 delete [] ip;
00034
00035 delete [] itrmc;
00036 delete [] sejtkrmc;
00037
00038 delete [] concretec;
00039 delete [] baroghelc;
00040 delete [] C60baroghelc;
00041 delete [] C30baroghelc;
00042 delete [] o30bazantc;
00043 delete [] C60bazantc;
00044
00045 delete [] consol_awf2c;
00046
00047 delete [] tenchc;
00048 }
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 void coupmatl::ipalloc (void)
00150 {
00151 long i,j,ii,jj,ne,ntm,gdim,ippl,mnb,nip,mncomp;
00152 strastrestate mssst;
00153
00154
00155 ntm=Tp->ntm;
00156
00157 gdim = Tp->gdim;
00158
00159 ne=Ct->ne;
00160
00161 for (i=0;i<ne;i++){
00162
00163 mnb=Ct->give_mnb (i);
00164
00165 mncomp=Ct->give_mncomp (i);
00166
00167 for (ii=0;ii<mnb;ii++){
00168
00169 mssst=Ct->give_mssst (i,ii);
00170
00171 for (jj=0;jj<ntm;jj++){
00172 ippl=Ct->elements[i].ippl[jj][ii];
00173 nip=Ct->give_lower_nip (i,jj,ii);
00174
00175 for (j=0;j<nip;j++){
00176 ip[ippl].nmcomp=mncomp;
00177 ip[ippl].mssst=mssst;
00178 ip[ippl].stresses = new double [mncomp];
00179 ip[ippl].strains = new double [mncomp];
00180
00181 if ((mssst == planestrain) || (mssst == planestress))
00182 ip[ippl].nmcomp=4;
00183
00184 ippl++;
00185 }
00186 }
00187 }
00188 }
00189
00190 for (i=0;i<tnip;i++){
00191 ip[i].av = new double [ntm];
00192 ip[i].pv = new double [ntm];
00193 ip[i].grad = new double* [ntm];
00194 ip[i].fluxes = new double* [ntm];
00195
00196 for (j=0;j<ntm;j++){
00197 ip[i].grad[j] = new double [gdim];
00198 ip[i].fluxes[j] = new double [gdim];
00199 }
00200 }
00201
00202 }
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 long coupmatl::intpnum (void)
00215 {
00216 long i,j,k,ne,n,nb;
00217 elemtypec te;
00218 ne=Ct->ne;
00219
00220 n=0;
00221 for (i=0;i<ne;i++){
00222 te = Ct->give_elem_type (i);
00223 nb=Mt->give_nb (i);
00224 Ct->elements[i].ippl = new long* [Tp->ntm];
00225 for (j=0;j<Tp->ntm;j++){
00226 Ct->elements[i].ippl[j] = new long [nb];
00227 for (k=0;k<nb;k++){
00228 Ct->elements[i].ippl[j][k]=n;
00229 n+=Ct->give_lower_nip (i,j,k);
00230 }
00231 }
00232 }
00233 return n;
00234 }
00235
00236
00237
00238
00239 void coupmatl::intpointalloc ()
00240 {
00241 ip = new intpointsc [tnip];
00242 ipalloc ();
00243 }
00244
00245
00246
00247
00248 void coupmatl::intpointinit ()
00249 {
00250 long i,j,k,ii,jj,nb,ntm,nip,ipp;
00251
00252 for (i=0;i<Tt->ne;i++){
00253 ntm=Tp->ntm; k=0;
00254 nb=Mt->give_nb (i);
00255 for (ii=0;ii<ntm;ii++){
00256 for (jj=0;jj<nb;jj++){
00257 nip=Ct->give_lower_nip(i,ii,jj);
00258 ipp=Ct->elements[i].ippl[ii][jj];
00259 for (j=0;j<nip;j++){
00260 ip[ipp].tm = Ct->elements[i].tml[k];
00261 ip[ipp].idm = Ct->elements[i].idml[k];
00262 ipp++;
00263 }
00264 k++;
00265 }
00266 }
00267 }
00268 }
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281 void coupmatl::matcond (matrix &d,long ipp,long ri,long ci)
00282 {
00283 switch (Cp->tmatt){
00284 case mech_onemedium:{
00285 medc1 mc1;
00286
00287 mc1.matcond_l(d,ri,ci,ipp);
00288 break;
00289 }
00290 case mech_twomedia:{
00291 medc2 mc2;
00292
00293 mc2.matcond_l(d,ri,ci,ipp);
00294 break;
00295 }
00296 case mech_threemedia:{
00297 medc3 mc3;
00298
00299 mc3.matcond_l(d,ri,ci,ipp);
00300 break;
00301 }
00302 default:{
00303 fprintf (stderr,"\n unknown number of transported media is required in function (%s, line %d).\n",__FILE__,__LINE__);
00304 }
00305 }
00306 }
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318 void coupmatl::matcap (matrix &d,long ipp,long ri,long ci)
00319 {
00320 switch (Cp->tmatt){
00321 case mech_onemedium:{
00322 medc1 mc1;
00323
00324 mc1.matcap_l(d,ri,ci,ipp);
00325 break;
00326 }
00327 case mech_twomedia:{
00328 medc2 mc2;
00329
00330 mc2.matcap_l(d,ri,ci,ipp);
00331 break;
00332 }
00333 case mech_threemedia:{
00334 medc3 mc3;
00335
00336 mc3.matcap_l(d,ri,ci,ipp);
00337 break;
00338 }
00339 default:{
00340 fprintf (stderr,"\n unknown number of transported media is required in function (%s, line %d).\n",__FILE__,__LINE__);
00341 }
00342 }
00343 }
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353 void coupmatl::computenlfluxes (matrix &d,long lcid,long ipp)
00354 {
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452 }
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463 void coupmatl::storestrain_cml (long ipp,long fi,vector &eps)
00464 {
00465 long i,j,ncomp=eps.n;
00466 j=0;
00467 for (i=fi;i<fi+ncomp;i++){
00468 ip[ipp].strains[i]=eps[j];
00469 j++;
00470 }
00471 }
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482 void coupmatl::storegrad_cml (long lcid,long ipp,vector &gr)
00483 {
00484 long i,j,ncomp;
00485 ncomp=gr.n;
00486
00487 j=0;
00488 for (i=0;i<ncomp;i++){
00489 ip[ipp].grad[lcid][i]=gr[j];
00490 j++;
00491 }
00492
00493 }
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505 void coupmatl::givegrad_cml (long lcid,long ipp,vector &gr)
00506 {
00507 long i,ncomp;
00508 ncomp=gr.n;
00509
00510 for (i=0;i<ncomp;i++){
00511 gr[i] = ip[ipp].grad[lcid][i];
00512 }
00513 }
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524 void coupmatl::storeflux_cml (long lcid,long ipp,vector &fl)
00525 {
00526 long i,ncomp;
00527 ncomp=fl.n;
00528
00529 for (i=0;i<ncomp;i++){
00530 ip[ipp].fluxes[lcid][i]=fl[i];
00531 }
00532
00533 }
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544 void coupmatl::givefluxes_cml (long lcid,long ipp,vector &fl)
00545 {
00546 long i,ncomp;
00547 ncomp=fl.n;
00548
00549 for (i=0;i<ncomp;i++){
00550 fl[i] = ip[ipp].fluxes[lcid][i];
00551 }
00552 }
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562 void coupmatl::read (XFILE *in)
00563 {
00564
00565 tnip = intpnum ();
00566 if (Mesprc==1){
00567 fprintf (stdout,"\n number of integration points coupmatl %ld",tnip);
00568 }
00569
00570
00571
00572 intpointalloc ();
00573 intpointinit ();
00574
00575
00576 readmatchar (in);
00577 }
00578
00579 void coupmatl::readmatchar (XFILE *in)
00580 {
00581 long i,j,k;
00582 long numtype;
00583 mattypec mattype;
00584
00585 xfscanf (in,"%ld",&nmt);
00586 if (nmt<1){
00587 fprintf (stderr,"\n\n wrong number of material types in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00588 }
00589 if (Mesprc==1) fprintf (stdout,"\n number of different types of materials %ld",nmt);
00590
00591 for (i=0;i<nmt;i++){
00592 xfscanf (in,"%d %ld",(int*)&mattype,&numtype);
00593 if (numtype<1){
00594 fprintf (stderr,"\n\n wrong number of material characteristics in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00595 }
00596
00597 switch (mattype){
00598
00599 case isotransmatc:{
00600 if (Mesprt==1) fprintf (stdout,"\n number of material models for concrete at high temperature %ld",numtype);
00601 itrmc = new isotrmatc [numtype];
00602 for (j=0;j<numtype;j++){
00603 k=numtype+1;
00604 xfscanf (in,"%ld",&k);
00605 if (k>numtype || k<1){
00606 fprintf (stderr,"\n\n wrong number of material models for concrete at high temperature");
00607 fprintf (stderr,"\n in function coupmatu::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00608 }
00609 itrmc[k-1].read (in);
00610 }
00611 break;
00612 }
00613
00614 case sejtkrc:{
00615 if (Mesprt==1) fprintf (stdout,"\n number of material models for one-phase flow in deforming medium %ld",numtype);
00616 sejtkrmc = new sejtkrmatc [numtype];
00617 for (j=0;j<numtype;j++){
00618 k=numtype+1;
00619 xfscanf (in,"%ld",&k);
00620 if (k>numtype || k<1){
00621 fprintf (stderr,"\n\n wrong number of material models for one-phase flow in deforming medium is required");
00622 fprintf (stderr,"\n in function coupmatu::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00623 }
00624 sejtkrmc[k-1].read (in);
00625 }
00626 break;
00627 }
00628
00629 case consolawf1c:{
00630 if (Mesprc==1) fprintf (stdout,"\n number of material models for two-phase flow in deforming medium %ld",numtype);
00631 consol_awf1c = new con_awf1matc [numtype];
00632 for (j=0;j<numtype;j++){
00633 k=numtype+1;
00634 xfscanf (in,"%ld",&k);
00635 if (k>numtype || k<1){
00636 print_err("wrong number of material models for two-phase flow in deforming medium is required",__FILE__,__LINE__,__func__);
00637 }
00638 consol_awf1c[k-1].read (in);
00639 }
00640 break;
00641 }
00642
00643 case concreteBc:{
00644 if (Mesprt==1) fprintf (stdout,"\n number of material models for concrete at high temperature %ld",numtype);
00645 concretec = new concreteBmatc [numtype];
00646 for (j=0;j<numtype;j++){
00647 k=numtype+1;
00648 xfscanf (in,"%ld",&k);
00649 if (k>numtype || k<1){
00650 fprintf (stderr,"\n\n wrong number of material models for concrete at high temperature");
00651 fprintf (stderr,"\n in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00652 }
00653 concretec[k-1].read (in);
00654 }
00655 break;
00656 }
00657
00658 case baroghelBc:{
00659 if (Mesprt==1) fprintf (stdout,"\n number of baroghel material models for concrete %ld",numtype);
00660 baroghelc = new baroghelmatc [numtype];
00661 for (j=0;j<numtype;j++){
00662 k=numtype+1;
00663 xfscanf (in,"%ld",&k);
00664 if (k>numtype || k<1){
00665 fprintf (stderr,"\n\n wrong number of baroghel material models for concrete");
00666 fprintf (stderr,"\n in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00667 }
00668 baroghelc[k-1].read (in);
00669 }
00670 break;
00671 }
00672
00673
00674 case C60baroghelBc:{
00675 if (Mesprt==1) fprintf (stdout,"\n number of baroghel material models for concrete %ld",numtype);
00676 C60baroghelc = new C60barmatc [numtype];
00677 for (j=0;j<numtype;j++){
00678 k=numtype+1;
00679 xfscanf (in,"%ld",&k);
00680 if (k>numtype || k<1){
00681 fprintf (stderr,"\n\n wrong number of baroghel material models for concrete");
00682 fprintf (stderr,"\n in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00683 }
00684 C60baroghelc[k-1].read (in);
00685 }
00686 break;
00687 }
00688
00689 case C30baroghelBc:{
00690 if (Mesprt==1) fprintf (stdout,"\n number of baroghel material models for concrete %ld",numtype);
00691 C30baroghelc = new C30barmatc [numtype];
00692 for (j=0;j<numtype;j++){
00693 k=numtype+1;
00694 xfscanf (in,"%ld",&k);
00695 if (k>numtype || k<1){
00696 fprintf (stderr,"\n\n wrong number of baroghel material models for concrete");
00697 fprintf (stderr,"\n in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00698 }
00699 C30baroghelc[k-1].read (in);
00700 }
00701 break;
00702 }
00703
00704
00705 case o30bazantBc:{
00706 if (Mesprt==1) fprintf (stdout,"\n number of baroghel material models for concrete %ld",numtype);
00707 o30bazantc = new o30bazmatc [numtype];
00708 for (j=0;j<numtype;j++){
00709 k=numtype+1;
00710 xfscanf (in,"%ld",&k);
00711 if (k>numtype || k<1){
00712 fprintf (stderr,"\n\n wrong number of baroghel material models for concrete");
00713 fprintf (stderr,"\n in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00714 }
00715 o30bazantc[k-1].read (in);
00716 }
00717 break;
00718 }
00719
00720
00721 case C60bazantBc:{
00722 if (Mesprt==1) fprintf (stdout,"\n number of baroghel material models for concrete %ld",numtype);
00723 C60bazantc = new C60bazmatc [numtype];
00724 for (j=0;j<numtype;j++){
00725 k=numtype+1;
00726 xfscanf (in,"%ld",&k);
00727 if (k>numtype || k<1){
00728 fprintf (stderr,"\n\n wrong number of baroghel material models for concrete");
00729 fprintf (stderr,"\n in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00730 }
00731 C60bazantc[k-1].read (in);
00732 }
00733 break;
00734 }
00735
00736 case glasgowc:{
00737 if (Mesprt==1) fprintf (stdout,"\n number of Glasgow material models %ld",numtype);
00738 tenchc = new glasgowmatc [numtype];
00739 for (j=0;j<numtype;j++){
00740 k=numtype+1;
00741 xfscanf (in,"%ld",&k);
00742 if (k>numtype || k<1){
00743 fprintf (stderr,"\n\n wrong number of Glasgow material models for concrete");
00744 fprintf (stderr,"\n in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00745 }
00746 tenchc[k-1].read (in);
00747 }
00748 break;
00749 }
00750
00751 case consolawf2c:{
00752 if (Mesprc==1) fprintf (stdout,"\n number of material models for two-phase flow in deforming medium %ld",numtype);
00753 consol_awf2c = new con_awf2matc [numtype];
00754 for (j=0;j<numtype;j++){
00755 k=numtype+1;
00756 xfscanf (in,"%ld",&k);
00757 if (k>numtype || k<1){
00758 print_err("wrong number of material models for two-phase flow in deforming medium is required",__FILE__,__LINE__,__func__);
00759 }
00760 consol_awf2c[k-1].read (in);
00761 }
00762 break;
00763 }
00764
00765 case glascoup:{
00766 if (Mesprt==1) fprintf (stdout,"\n number of Glasgow material models %ld",numtype);
00767 gcm = new glasgowcoup [numtype];
00768 for (j=0;j<numtype;j++){
00769 k=numtype+1;
00770 xfscanf (in,"%ld",&k);
00771 if (k>numtype || k<1){
00772 fprintf (stderr,"\n\n wrong number of Glasgow material models for concrete");
00773 fprintf (stderr,"\n in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00774 }
00775 gcm[k-1].read (in);
00776 }
00777 break;
00778 }
00779
00780 default:{
00781 fprintf (stderr,"\n\n unknown material type is required in function coupmatl::readmatchar (%s, line %d).\n",__FILE__,__LINE__);
00782 }
00783 }
00784 }
00785 }