00001 #include <math.h>
00002 #include <stdlib.h>
00003 #include <string.h>
00004 #include "nonlocmicroM4.h"
00005 #include "global.h"
00006 #include "intpoints.h"
00007 #include "microM4.h"
00008
00009
00010 nonlocmicroM4::nonlocmicroM4 (void)
00011 {
00012 }
00013 nonlocmicroM4::~nonlocmicroM4 (void)
00014 {
00015 }
00016
00017 void nonlocmicroM4::read(XFILE *in)
00018 {
00019 xfscanf(in,"%lf",&r);
00020 }
00021
00022
00023
00024
00025
00026
00027
00028
00029 long nonlocmicroM4::give_num_averq (long ipp)
00030 {
00031 return Mm->ip[ipp].ncompstr;
00032 }
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 void nonlocmicroM4::average (long ipp)
00043 {
00044 matrix e(6,6);
00045 vector S1(6);
00046 double sigma_elast,sigma_loc,sigma_inelast;
00047 double S2=0;
00048 double rr,alfa;
00049 long i,j,k,aip,nad,numberOfMicroplanes;
00050
00051 numberOfMicroplanes = Mm->mpM4[0].numberOfMicroplanes;
00052
00053
00054 fillv(0.0,S1);
00055
00056 nad=Mt->nadjip[ipp];
00057
00058
00059 for (k=0;k<nad;k++){
00060
00061
00062
00063 aip=Mt->adjip[ipp][k];
00064
00065 rr=Mt->dist[ipp][k];
00066
00067 alfa=(rr>=r)?0:(1-rr*rr/(r*r));
00068
00069 alfa *= Mm->ipv[aip];
00070
00071 Mm->elmatstiff(e,aip);
00072
00073
00074 for (i=0;i<6;i++){
00075
00076 sigma_elast=0;
00077 for (j=0;j<6;j++){
00078 sigma_elast += e[i][j] * (Mm->ip[aip].strain[j]);
00079 }
00080
00081
00082 sigma_loc=Mm->ip[aip].stress[i];
00083
00084 sigma_inelast=sigma_loc-sigma_elast;
00085
00086 S1[i]+=alfa*sigma_inelast;
00087 }
00088
00089 S2+=alfa;
00090 }
00091
00092
00093 for(i=0;i<6;i++)
00094 Mm->ip[ipp].nonloc[i] = S1[i]/S2;
00095
00096
00097 }