00001 #include <string.h>
00002
00003 #include "nonlocplast.h"
00004 #include "global.h"
00005 #include "mechmat.h"
00006 #include "intpoints.h"
00007 #include "matrix.h"
00008 #include "vector.h"
00009 #include "vecttens.h"
00010
00011
00012
00013
00014
00015
00016
00017
00018 nonlocplast::nonlocplast(void)
00019 {
00020 r = 0;
00021 waf = wavrg(0);
00022 }
00023
00024
00025
00026
00027
00028
00029
00030
00031 nonlocplast::~nonlocplast(void)
00032 {
00033 r = 0;
00034 waf = wavrg(0);
00035 }
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 long nonlocplast::read(XFILE *in)
00050 {
00051 if (xfscanf(in, "%le %m", &r, &wavrg_kwdset, (int*)&waf) == 2)
00052 return 0;
00053
00054 print_err("cannot read parameters of nonlocal plasticity", __FILE__,__LINE__,__func__);
00055 return 1;
00056
00057 }
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 long nonlocplast::give_num_averq (long ipp)
00071 {
00072 switch (waf)
00073 {
00074 case avggamma:
00075 return Mm->ip[ipp].ncompeqother;
00076 case avgepsp:
00077 return Mm->ip[ipp].ncompstr;
00078 default:
00079 print_err("unknown plasticity material type is required", __FILE__, __LINE__, __func__);
00080 }
00081 return 0;
00082 }
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 void nonlocplast::give_aver_quantv(long ipp, long im, long ido, vector &qv)
00099 {
00100 switch (waf)
00101 {
00102 case avggamma:
00103 qv[0] = Mm->give_consparam(ipp, im+1, ido);
00104 return;
00105 case avgepsp:
00106 Mm->giveirrstrains(ipp, im+1, ido, qv);
00107 return;
00108 default:
00109 print_err("unknown damage material type is required", __FILE__, __LINE__, __func__);
00110 }
00111 return;
00112 }
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 void nonlocplast::average (long ipp, long ido)
00128 {
00129 double rr, alpha, sum = 0.0;
00130 long ncompo, ncomps = Mm->ip[ipp].ncompstr;
00131 matrix d(ncomps,ncomps), sigt(3,3), dgdst(3,3);
00132 double gamma, agamma = 0.0;
00133 vector dgds(ncomps),aepsp(ncomps), epsa(ncomps), epsn(ncomps), epsp(ncomps), sig(ncomps);
00134 vector q(1);
00135 long i, j, nad, aip;
00136
00137 for (i=0;i<ncomps;i++){
00138 Mm->ip[ipp].nonloc[i]=0.0;
00139 }
00140
00141
00142 nad=Mt->nadjip[ipp];
00143
00144
00145 for (i = 0; i < nad; i++)
00146 {
00147
00148 aip=Mt->adjip[ipp][i];
00149
00150 rr=Mt->dist[ipp][i];
00151
00152 alpha = (rr >= r) ? 0 : (1-rr*rr/(r*r));
00153
00154 alpha *= Mm->ipv[aip];
00155 sum += alpha;
00156
00157 switch (waf)
00158 {
00159 case avggamma:
00160 ncomps = Mm->ip[aip].ncompstr;
00161 gamma = Mm->ip[aip].other[ido+ncomps];
00162 agamma += alpha * gamma;
00163 break;
00164 case avgepsp:
00165 for (j = 0; j < ncomps; j++)
00166 Mm->ip[ipp].nonloc[j] += alpha*Mm->ip[aip].other[ido+j];
00167 break;
00168 default:
00169 print_err("unknown type of the averageing variable is required.",__FILE__,__LINE__,__func__);
00170 break;
00171 }
00172 }
00173 ncomps = Mm->ip[ipp].ncompstr;
00174 ncompo = Mm->ip[ipp].ncompother;
00175 switch (waf)
00176 {
00177 case avggamma:
00178 {
00179
00180 for (i = 0; i < ncomps; i++)
00181 {
00182 epsn[i]=Mm->ip[ipp].strain[i];
00183 epsp[i]=Mm->ip[ipp].eqother[ido+i];
00184 }
00185
00186 subv (epsn,epsp,epsa);
00187
00188 Mm->elmatstiff (d,ipp);
00189
00190 mxv (d,epsa,sig);
00191
00192 vector_tensor (sig, sigt, Mm->ip[ipp].ssst, stress);
00193
00194 q[0] = 0.0;
00195 if (ncompo-ncomps-1 > 0)
00196 q[0] = Mm->ip[ipp].nonloc[ncomps+1];
00197 Mm->dgdsigma (ipp, 0, sigt, q, dgds);
00198 vector_tensor (dgds,dgdst,Mm->ip[ipp].ssst, strain);
00199 cmulm((agamma-Mm->ip[ipp].eqother[ido+ncomps])/sum, dgdst);
00200 tensor_vector(aepsp, dgdst, Mm->ip[ipp].ssst, strain);
00201
00202 for (i = 0; i < ncomps; i++)
00203 Mm->ip[ipp].nonloc[i] = aepsp[i];
00204 Mm->ip[ipp].nonloc[ncomps] = agamma/sum;
00205 break;
00206 }
00207 case avgepsp:
00208
00209 for (i = 0; i < ncomps; i++)
00210 Mm->ip[ipp].nonloc[i] /= sum;
00211 break;
00212 default:
00213 print_err("unknown type of the averageing variable is required.",__FILE__,__LINE__,__func__);
00214 break;
00215 }
00216 }