00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef MD_EL_CPP
00029 #define MD_EL_CPP
00030
00031 #include "MD_EL.h"
00032 #include <basics.h>
00033
00034
00035
00036
00037
00038
00039 MDEvolutionLaw::MDEvolutionLaw(const MDEvolutionLaw &MDE ) {
00040
00041 this->Mc = MDE.getMc();
00042 this->Me = MDE.getMe();
00043 this->Lambda = MDE.getLambda();
00044 this->ec_ref = MDE.getec_ref();
00045 this->p_ref= MDE.getp_ref();
00046 this->kc_b = MDE.getkc_b();
00047 this->kc_d = MDE.getkc_d();
00048 this->ke_b = MDE.getke_b();
00049 this->ke_d = MDE.getke_d();
00050
00051 this->ho = MDE.getho();
00052 this->Cm = MDE.getCm();
00053 this->eo = MDE.geteo();
00054
00055 this->Ao = MDE.getAo();
00056 this->Fmax = MDE.getFmax();
00057 this->Cf = MDE.getCf();
00058 }
00059
00060
00061
00062
00063
00064 MDEvolutionLaw * MDEvolutionLaw::newObj() {
00065
00066 MDEvolutionLaw *newEL = new MDEvolutionLaw( *this );
00067
00068 return newEL;
00069
00070 }
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 void MDEvolutionLaw::InitVars(EPState *EPS) {
00082
00083
00084 double p_atm = 100.0;
00085 double p = EPS->getStress().p_hydrostatic();
00086 double E = EPS->getEo() * pow( (p/p_atm), geta());
00087 EPS->setE( E );
00088
00089
00090
00091 double eo = EPS->getScalarVar( 3 );
00092 seteo( eo );
00093
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
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 void MDEvolutionLaw::setInitD(EPState *EPS) {
00136
00137
00138
00139 stresstensor S = EPS->getStress().deviator();
00140 double p = EPS->getStress().p_hydrostatic();
00141 stresstensor alpha = EPS->getTensorVar( 1 );
00142
00143
00144 tensor norm_alphat = alpha("ij") * alpha("ij");
00145 double norm_alpha = sqrt( norm_alphat.trace() );
00146
00147 stresstensor r = S * (1.0 / p);
00148
00149 stresstensor r_bar = r - alpha;
00150 stresstensor norm2 = r_bar("ij") * r_bar("ij");
00151 double norm = sqrt( norm2.trace() );
00152
00153 stresstensor n;
00154 if ( norm >= d_macheps() ){
00155 n = ( r - alpha ) *(1.0 / norm );
00156 }
00157 else {
00158 ::printf(" \n\n n_ij not defined!!!! Program exits\n");
00159 exit(1);
00160 }
00161
00162
00163 double e = EPS->getScalarVar(3);
00164 double ec = getec_ref() - getLambda() * log( p/getp_ref() );
00165 double xi = e - ec;
00166
00167
00168 double m = EPS->getScalarVar(1);
00169 stresstensor F = EPS->getTensorVar( 2 );
00170 tensor temp_tensor = F("ij") * n("ij");
00171 double temp = temp_tensor.trace();
00172 if (temp < 0) temp = 0;
00173 double A = Ao*(1.0 + temp);
00174
00175
00176 double J2_bar = r_bar.Jinvariant2();
00177 double J3_bar = r_bar.Jinvariant3();
00178 double tempd = 3.0*pow(3.0, 0.5)/2.0*J3_bar/ pow( J2_bar, 1.5);
00179
00180 if (tempd > 1.0 ) tempd = 1.0;
00181 if (tempd < -1.0 ) tempd = -1.0;
00182
00183 double theta = acos( tempd ) / 3.0;
00184
00185
00186
00187
00188 double c = getMe() / getMc();
00189
00190 double cd = getke_d() / getkc_d();
00191 double alpha_theta_dd = (g_WW(theta, c) * Mc + g_WW(theta, cd) * kc_d * xi - m);
00192 stresstensor alpha_theta_d = n("ij") * alpha_theta_dd * pow(2.0/3.0, 0.5);
00193
00194
00195 stresstensor d;
00196 d = alpha_theta_d - alpha;
00197 d.null_indices();
00198
00199 tensor temp1 = d("ij") * n("ij");
00200 temp1.null_indices();
00201 double D_new = temp1.trace() * A;
00202
00203 if ( (xi > 0.0) && ( D_new < 0.0) )
00204 D_new = 0.0;
00205
00206 EPS->setScalarVar(2, D_new);
00207
00208 }
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 void MDEvolutionLaw::UpdateAllVars( EPState *EPS, double dlamda) {
00220
00221
00222
00223 stresstensor S = EPS->getStress().deviator();
00224 double p = EPS->getStress().p_hydrostatic();
00225 stresstensor alpha = EPS->getTensorVar( 1 );
00226
00227
00228 tensor norm_alphat = alpha("ij") * alpha("ij");
00229 double norm_alpha = sqrt( norm_alphat.trace() );
00230
00231 stresstensor r = S * (1.0 / p);
00232
00233 stresstensor r_bar = r - alpha;
00234 stresstensor norm2 = r_bar("ij") * r_bar("ij");
00235 double norm = sqrt( norm2.trace() );
00236
00237 stresstensor n;
00238 if ( norm >= d_macheps() ){
00239 n = ( r - alpha ) *(1.0 / norm );
00240 }
00241 else {
00242 ::printf(" \n\n n_ij not defined!!!! Program exits\n");
00243 exit(1);
00244 }
00245
00246
00247
00248 double p_atm = 100.0;
00249 double E = EPS->getE();
00250 double E_new = EPS->getEo() * pow( (p/p_atm), geta() );
00251 EPS->setE( E_new );
00252
00253
00254
00255 double e = EPS->getScalarVar(3);
00256 double D = EPS->getScalarVar(2);
00257 double elastic_strain_vol = EPS->getdElasticStrain().Iinvariant1();
00258 double plastic_strain_vol = EPS->getdPlasticStrain().Iinvariant1();
00259
00260 double de_p = -( 1.0 + e ) * plastic_strain_vol;
00261 double de_e = -( 1.0 + e ) * elastic_strain_vol;
00262 cout << "get dPlasticStrain-vol" << plastic_strain_vol << endlnn;
00263 cout << "get dElasticStrain-vol" << elastic_strain_vol << endlnn;
00264
00265 cout << "^^^^^^^^^^^ de_e = " << de_e << " de_p = " << de_p << endlnn;
00266 double new_e = e + de_p + de_e;
00267
00268 EPS->setScalarVar( 3, new_e );
00269
00270
00271
00272 double ec = getec_ref() - getLambda() * log( p/getp_ref() );
00273
00274 double xi = e - ec;
00275
00276
00277
00278 double m = EPS->getScalarVar(1);
00279 stresstensor F = EPS->getTensorVar( 2 );
00280 tensor temp_tensor = F("ij") * n("ij");
00281 double temp = temp_tensor.trace();
00282 if (temp < 0) temp = 0;
00283 double A = Ao*(1.0 + temp);
00284
00285
00286 double J2_bar = r_bar.Jinvariant2();
00287 double J3_bar = r_bar.Jinvariant3();
00288 double tempd = 3.0*pow(3.0, 0.5)/2.0*J3_bar/ pow( J2_bar, 1.5);
00289
00290 if (tempd > 1.0 ) tempd = 1.0;
00291 if (tempd < -1.0 ) tempd = -1.0;
00292
00293 double theta = acos( tempd ) / 3.0;
00294
00295
00296
00297
00298 double c = getMe() / getMc();
00299
00300 double cd = getke_d() / getkc_d();
00301 double alpha_theta_dd = (g_WW(theta, c) * Mc + g_WW(theta, cd) * kc_d * xi - m);
00302 stresstensor alpha_theta_d = n("ij") * alpha_theta_dd * pow(2.0/3.0, 0.5);
00303
00304
00305 double cb = getke_b() / getkc_b();
00306 if ( xi > 0 ) xi = 0.0;
00307 double alpha_theta_bd = (g_WW(theta, c) * Mc + g_WW(theta, cb) * kc_b * (-xi) - m);
00308 stresstensor alpha_theta_b = n("ij") *alpha_theta_bd * pow(2.0/3.0, 0.5);
00309 alpha_theta_b.null_indices();
00310
00311 stresstensor b;
00312 b = alpha_theta_b - alpha;
00313 b.null_indices();
00314 stresstensor d;
00315 d = alpha_theta_d - alpha;
00316 d.null_indices();
00317
00318 tensor temp1 = d("ij") * n("ij");
00319 temp1.null_indices();
00320 double D_new = temp1.trace() * A;
00321
00322 if ( (xi > 0.0) && ( D_new < 0.0) )
00323 D_new = 0.0;
00324
00325 EPS->setScalarVar(2, D_new);
00326
00327
00328
00329
00330
00331
00332
00333 double dm = dlamda * getCm() * ( 1.0 + e ) * D;
00334 EPS->setScalarVar(1, m + dm);
00335 cout << endlnn << "dm = " << dm << endlnn;
00336
00337
00338
00339
00340
00341 double alpha_c_b = g_WW(0.0, c) * Mc + g_WW(0.0, cb) * kc_b * (-xi) - m;
00342 double b_ref = 2.0 * pow(2.0/3.0, 0.5) * alpha_c_b;
00343
00344 temp1 = b("ij") * n("ij");
00345 double bn = temp1.trace();
00346 cout << "xxxxxxxxxxxxxxxxxxx bn " << bn << endlnn;
00347
00348
00349
00350 double h = getho() * fabs(bn) / ( b_ref - fabs(bn) );
00351
00352
00353 cout << " ||b|| " << (alpha_theta_bd - norm_alpha) << endlnn;
00354 cout << " dlamda " << dlamda << " h = " << h << endlnn;
00355
00356 stresstensor dalpha;
00357 dalpha = dlamda * h * b("ij");
00358
00359 cout << "delta alpha =" << dalpha << endlnn;
00360
00361
00362 alpha = alpha + dalpha;
00363 alpha.null_indices();
00364
00365 EPS->setTensorVar(1, alpha);
00366
00367
00368
00369 stresstensor dF;
00370 if ( D > 0.0 ) D = 0.0;
00371 dF = dlamda * getCf() * (-D) * ( getFmax() * n("ij") + F("ij") );
00372
00373
00374 F = F - dF;
00375 EPS->setTensorVar(2, F);
00376
00377 }
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387 double MDEvolutionLaw::getKp( EPState *EPS , double dummy) {
00388
00389
00390
00391
00392
00393 stresstensor S = EPS->getStress().deviator();
00394 double p = EPS->getStress().p_hydrostatic();
00395 stresstensor alpha = EPS->getTensorVar( 1 );
00396
00397 stresstensor r = S * (1.0 / p);
00398
00399 stresstensor r_bar = r - alpha;
00400 stresstensor norm2 = r_bar("ij") * r_bar("ij");
00401 double norm = sqrt( norm2.trace() );
00402
00403 stresstensor n;
00404 if ( norm >= d_macheps() ){
00405 n = ( r - alpha ) *(1.0 / norm );
00406 }
00407 else {
00408 ::printf(" \n\n n_ij not defined!!!! Program exits\n");
00409 exit(1);
00410 }
00411
00412
00413
00414
00415
00416
00417 double e = EPS->getScalarVar(3);
00418 double ec = getec_ref() - getLambda() * log( p/getp_ref() );
00419 double xi = e - ec;
00420
00421
00422
00423
00424 double J2_bar = r_bar.Jinvariant2();
00425 double J3_bar = r_bar.Jinvariant3();
00426
00427 double tempd = 3.0*pow(3.0, 0.5)/2.0*J3_bar/ pow( J2_bar, 1.5);
00428 if (tempd > 1.0 ) tempd = 1.0;
00429 if (tempd < -1.0 ) tempd = -1.0;
00430 double theta = acos( tempd ) / 3.0;
00431
00432
00433
00434 double m = EPS->getScalarVar(1);
00435 double c = getMe() / getMc();
00436
00437 double cd = getke_d() / getkc_d();
00438 stresstensor alpha_theta_d = n("ij") * (g_WW(theta, c) * Mc + g_WW(theta, cd) * kc_d * xi - m) * pow(2.0/3.0, 0.5);
00439
00440
00441 double cb = getke_b() / getkc_b();
00442 if ( xi > 0.0 ) xi = 0.0;
00443 stresstensor alpha_theta_b = n("ij") * (g_WW(theta, c) * Mc - g_WW(theta, cb) * kc_b * xi - m) * pow(2.0/3.0, 0.5);
00444 alpha_theta_b.null_indices();
00445
00446
00447
00448 stresstensor b;
00449 b = alpha_theta_b - alpha;
00450 b.null_indices();
00451 stresstensor d;
00452 d = alpha_theta_d - alpha;
00453 d.null_indices();
00454
00455 double alpha_c_b = g_WW(0.0, c) * Mc + g_WW(0.0, cb) * kc_b * (-xi) - m;
00456 double b_ref = 2.0 * pow(2.0/3.0, 0.5) * alpha_c_b;
00457
00458
00459 tensor temp1 = b("ij") * n("ij");
00460 double bn = temp1.trace();
00461
00462 temp1 = d("ij") * n("ij");
00463 double dn = temp1.trace();
00464
00465
00466
00467
00468
00469 stresstensor F = EPS->getTensorVar( 2 );
00470 temp1 = F("ij") * n("ij");
00471 double temp = temp1.trace();
00472 if (temp < 0) temp = 0;
00473 double A = Ao*(1.0 + temp);
00474
00475 double h = getho() * fabs(bn) / ( b_ref - fabs(bn) );
00476 cout << "ho =" << getho() << " h =" << h << endlnn;
00477
00478
00479
00480
00481
00482
00483 double Kp = h * bn + pow(2.0/3.0, 0.5) * getCm() * ( 1.0 + geteo() ) * A * dn;
00484
00485 Kp = Kp * p;
00486
00487 return Kp;
00488
00489 }
00490
00491
00492
00493
00494
00495
00496
00497
00498 double MDEvolutionLaw::g_A(double theta, double e) {
00499
00500 double temp = 2.0 * e;
00501 temp = temp / ( (1.0 + e) - (1.0 - e) * cos(3.0*theta) );
00502
00503 return temp;
00504 }
00505
00506
00507
00508
00509
00510
00511 double MDEvolutionLaw::g_WW(double theta, double e) {
00512
00513
00514 double g1 = 4.0*( 1.0 - e*e ) * cos(theta) * cos(theta) + pow(2.0*e-1.0, 2.0);
00515 double d1 = 2.0*( 1.0 - e*e ) * cos( theta );
00516 double d2 = ( 2.0*e-1.0 ) * pow( (4.0*(1.0-e*e)*cos(theta)*cos(theta) + 5.0*e*e - 4.0*e), 0.5);
00517 double temp =( d1 + d2 ) / g1;
00518
00519 return temp;
00520 }
00521
00522
00523
00524
00525
00526 void MDEvolutionLaw::print()
00527 {
00528 cout << " Manzari-Dafalias Evolution Law's Parameters" << endlnn;
00529 cout << (*this);
00530 }
00531
00532
00533 double MDEvolutionLaw::getMc() const
00534 {
00535 return Mc;
00536 }
00537
00538
00539 double MDEvolutionLaw::getMe() const
00540 {
00541 return Me;
00542 }
00543
00544
00545
00546 double MDEvolutionLaw::getLambda() const
00547 {
00548 return Lambda;
00549 }
00550
00551
00552 double MDEvolutionLaw::getec_ref() const
00553 {
00554 return ec_ref;
00555 }
00556
00557
00558 double MDEvolutionLaw::getp_ref() const
00559 {
00560 return p_ref;
00561 }
00562
00563
00564 double MDEvolutionLaw::getkc_b() const
00565 {
00566 return kc_b;
00567 }
00568
00569
00570 double MDEvolutionLaw::getkc_d() const
00571 {
00572 return kc_d;
00573 }
00574
00575
00576 double MDEvolutionLaw::getke_b() const
00577 {
00578 return ke_b;
00579 }
00580
00581
00582 double MDEvolutionLaw::getke_d() const
00583 {
00584 return ke_d;
00585 }
00586
00587
00588
00589
00590
00591
00592
00593
00594 double MDEvolutionLaw::getho() const
00595 {
00596 return ho;
00597 }
00598
00599
00600 double MDEvolutionLaw::getCm() const
00601 {
00602 return Cm;
00603 }
00604
00605
00606 double MDEvolutionLaw::geteo() const
00607 {
00608 return eo;
00609 }
00610
00611
00612 void MDEvolutionLaw::seteo( double eod)
00613 {
00614 eo = eod;
00615 }
00616
00617
00618 double MDEvolutionLaw::getAo() const
00619 {
00620 return Ao;
00621 }
00622
00623
00624 double MDEvolutionLaw::getFmax() const
00625 {
00626 return Fmax;
00627 }
00628
00629
00630 double MDEvolutionLaw::getCf() const
00631 {
00632 return Cf;
00633 }
00634
00635
00636 double MDEvolutionLaw::geta() const
00637 {
00638 return a;
00639 }
00640
00641
00642 #endif
00643