00001 #include "hardsoft.h"
00002 #include "alias.h"
00003 #include "global.h"
00004 #include "tensor.h"
00005 #include "matrix.h"
00006 #include "vector.h"
00007 #include "intpoints.h"
00008 #include "vecttens.h"
00009 #include <math.h>
00010
00011 hardsoft::hardsoft ()
00012 {
00013
00014 ths = nohs;
00015
00016 ivhs = plstrnorm;
00017
00018
00019 epspu=0.0;
00020
00021 epsput=0.0;
00022
00023 epspuc=0.0;
00024
00025
00026 zero=1.0e-8;
00027
00028 }
00029
00030 hardsoft::~hardsoft ()
00031 {
00032 }
00033
00034
00035
00036
00037
00038
00039
00040
00041 void hardsoft::read (XFILE *in)
00042 {
00043
00044 xfscanf (in,"%m", &hardensoften_kwdset, (int*)&ths);
00045
00046 switch (ths){
00047 case nohs:{
00048
00049 if (Mespr==1)
00050 fprintf (stdout,"\n no hardening/softening is required");
00051 break;
00052 }
00053 case plstrainnorm:{
00054
00055 if (Mespr==1)
00056 fprintf (stdout,"\n hardening/softening is proportional to the norm of the plastic strain tensor");
00057 break;
00058 }
00059 case limplstrainnorm:{
00060
00061 if (Mespr==1)
00062 fprintf (stdout,"\n hardening/softening is proportional to the limited norm of the plastic strain tensor");
00063 break;
00064 }
00065 default:{
00066 fprintf (stderr,"\n\n unknown type of hardening/softening is required in function read (file %s, line %d).\n",__FILE__,__LINE__);
00067 }
00068 }
00069
00070 if (ths!=nohs){
00071
00072 xfscanf (in,"%m", &hsinputvar_kwdset, (int*)&ivhs);
00073
00074 if (ivhs==limplstrnorm){
00075 xfscanf (in,"%lf",&epspu);
00076 }
00077 if (ivhs==limanplstrnorm){
00078 xfscanf (in,"%lf %lf",&epsput,&epspuc);
00079 }
00080 }
00081
00082 }
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 void hardsoft::hvalues (matrix &sigt,matrix &dgds,vector &h)
00096 {
00097 double norm,inv;
00098
00099
00100 fillv (0.0,h);
00101
00102 switch (ths){
00103 case nohs:{
00104 break;
00105 }
00106 case plstrainnorm:{
00107
00108 norm = tensornorm (dgds);
00109 h[0]=norm;
00110 break;
00111 }
00112 case limplstrainnorm:{
00113
00114 norm = tensornorm (dgds);
00115
00116 inv = first_invar (sigt);
00117
00118 switch (ivhs){
00119 case limplstrnorm:{
00120 h[0]=norm/epspu;
00121 break;
00122 }
00123 case limanplstrnorm:{
00124 if (inv<0.0)
00125 h[0]=norm/epspuc;
00126 else
00127 h[0]=norm/epsput;
00128 break;
00129 }
00130 default:{
00131 fprintf (stderr,"\n unknown type of limit plastic strain is required in function hvalues (file %s, line %d)",__FILE__,__LINE__);
00132 }
00133 }
00134
00135 break;
00136 }
00137 default:{
00138 fprintf (stderr,"\n unknown type of hardening/softening is required in function hvalues (file %s, line %d)",__FILE__,__LINE__);
00139 }
00140 }
00141
00142 }
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 void hardsoft::dhdsigma (matrix &sigt,matrix &dgds,matrix &dgdsds,matrix &dhds)
00157 {
00158 long i,j;
00159 double norm,s,inv;
00160
00161
00162 fillm (0.0,dhds);
00163
00164 switch (ths){
00165 case nohs:{
00166 break;
00167 }
00168 case plstrainnorm:{
00169
00170 norm = tensornorm (dgds);
00171
00172 for (i=0;i<6;i++){
00173 s=0.0;
00174 for (j=0;j<6;j++){
00175 s+=dgdsds[i][j];
00176 }
00177 dhds[i][0]=s/norm;
00178 }
00179
00180 break;
00181 }
00182 case limplstrainnorm:{
00183
00184 norm = tensornorm (dgds);
00185
00186 inv = first_invar (sigt);
00187
00188 for (i=0;i<6;i++){
00189 s=0.0;
00190 for (j=0;j<6;j++){
00191 s+=dgdsds[i][j];
00192 }
00193
00194 switch (ivhs){
00195 case limplstrnorm:{
00196 dhds[i][0]=s/norm/epspu;
00197 break;
00198 }
00199 case limanplstrnorm:{
00200 if (inv<0.0)
00201 dhds[i][0]=s/norm/epspuc;
00202 else
00203 dhds[i][0]=s/norm/epsput;
00204 break;
00205 }
00206 default:{
00207 fprintf (stderr,"\n unknown type of limit plastic strain is required in function dhdsigma (file %s, line %d)",__FILE__,__LINE__);
00208 }
00209 }
00210
00211 }
00212
00213 break;
00214 }
00215 default:{
00216 fprintf (stderr,"\n unknown type of hardening/softening is required in function dhdsigma (file %s, line %d)",__FILE__,__LINE__);
00217 }
00218 }
00219
00220 }
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232 void hardsoft::dhdqpar (matrix &sigt,matrix &dgds,matrix &dgdsdq,matrix &dhdq)
00233 {
00234 long j;
00235 double norm,s,inv;
00236
00237
00238 fillm (0.0,dhdq);
00239
00240 switch (ths){
00241 case nohs:{
00242 break;
00243 }
00244 case plstrainnorm:{
00245
00246 norm = tensornorm (dgds);
00247
00248 s=0.0;
00249 for (j=0;j<6;j++){
00250 s+=dgdsdq[j][0];
00251 }
00252 dhdq[0][0]=s/norm;
00253
00254 break;
00255 }
00256 case limplstrainnorm:{
00257
00258 norm = tensornorm (dgds);
00259
00260 inv = first_invar (sigt);
00261
00262 s=0.0;
00263 for (j=0;j<6;j++){
00264 s+=dgdsdq[j][0];
00265 }
00266
00267 switch (ivhs){
00268 case limplstrnorm:{
00269 dhdq[0][0]=s/norm/epspu;
00270 break;
00271 }
00272 case limanplstrnorm:{
00273 if (inv<0.0)
00274 dhdq[0][0]=s/norm/epspuc;
00275 else
00276 dhdq[0][0]=s/norm/epsput;
00277 break;
00278 }
00279 default:{
00280 fprintf (stderr,"\n unknown type of limit plastic strain is required in function dhdqpar (file %s, line %d)",__FILE__,__LINE__);
00281 }
00282 }
00283
00284 break;
00285 }
00286 default:{
00287 fprintf (stderr,"\n unknown type of hardening/softening is required in function dhdqpar (file %s, line %d)",__FILE__,__LINE__);
00288 }
00289 }
00290
00291 }
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301 void hardsoft::dhdgamma (vector &dhdg)
00302 {
00303 fillv (0.0,dhdg);
00304 }
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317 void hardsoft::changeparam (atsel &atm,vector &val)
00318 {
00319 long i;
00320
00321 for (i=atm.nba;i<atm.num;i++){
00322 switch (atm.atrib[i]){
00323
00324
00325 case 0:{
00326 epspu=val[i];
00327 break;
00328 }
00329 case 1:{
00330 epsput=val[i];
00331 break;
00332 }
00333 case 2:{
00334 epspuc=val[i];
00335 break;
00336 }
00337
00338 default:{
00339 fprintf (stderr,"\n\n wrong number of atribute in function changeparam (file %s, line %d).\n",__FILE__,__LINE__);
00340 }
00341 }
00342 }
00343
00344 }