📄 microfiber.cpp
字号:
#include <math.h>#include <stdlib.h>#include "microfiber.h"#include "global.h"#include "intpoints.h"microfiber::microfiber (void){ c1 = 6.20e-1; c2 = 2.76; c4 = 70.; c5 = 2.50; c6 = 1.30; c7 = 50.; c8 = 8.0; c9 = 1.30; c10 = 0.73; c11 = 0.2; c12 = 7000.; c13 = 0.23; c14 = 0.8; c15 = 1.0; c16 = 0.02; c17 = 0.01; c18 = 1.0; c19 = 0.4; mu = 1.0; kronecker.a = new double [6]; kronecker.n = 6; // kronecker delta kronecker [0]= 1.; kronecker [1]= 1.; kronecker [2]= 1.; kronecker [3]= 0.; kronecker [4]= 0.; kronecker [5]= 0.;}microfiber::~microfiber (void){}void microfiber::read(XFILE *in){ xfscanf(in,"%ld %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf ", &numberOfMicroplanes,&k1,&k2,&k3,&k4,&c3,&c20,&e,&nu,&k10,&k11,&k12,&k13); ev = e/(1-2*nu); ed = 5*e/(2+3*mu)/(1+nu); et = mu*ed; //compute microplaneweights and projection tensors initializeData (numberOfMicroplanes);}void microfiber::initializeData (long numberOfMicroplanes ){ //computes microplane normals, weights and projection tensors long i,i4,mPlane; long ij[6][2] = {{1,1},{2,2},{3,3},{2,3},{3,1},{1,2}}; matrix microplaneNormals(numberOfMicroplanes,3); projL.a = new double [numberOfMicroplanes*6]; projL.m = numberOfMicroplanes; projL.n = 6; projM.a = new double [numberOfMicroplanes*6]; projM.m = numberOfMicroplanes; projM.n = 6; projN.a = new double [numberOfMicroplanes*6]; projN.m = numberOfMicroplanes; projN.n = 6; microplaneWeights.a = new double [numberOfMicroplanes]; microplaneWeights.n = numberOfMicroplanes; // definition of intergation points and weights if (numberOfMicroplanes == 28) { for (i=0; i<4; i++) { microplaneWeights[i] = 0.0160714276E0; microplaneWeights[i+4] = 0.0204744730E0; microplaneWeights[i+8] = 0.0204744730E0; microplaneWeights[i+12] = 0.0204744730E0; microplaneWeights[i+16] = 0.0158350505E0; microplaneWeights[i+20] = 0.0158350505E0; microplaneWeights[i+24] = 0.0158350505E0; } double help[7][3]={{0.577350259E0, 0.577350259E0, 0.577350259E0}, {0.935113132E0, 0.250562787E0, 0.250562787E0}, {0.250562787E0, 0.935113132E0, 0.250562787E0}, {0.250562787E0, 0.250562787E0, 0.935113132E0}, {0.186156720E0, 0.694746614E0, 0.694746614E0}, {0.694746614E0, 0.186156720E0, 0.694746614E0}, {0.694746614E0, 0.694746614E0, 0.186156720E0}}; for (i=0; i< 7; i++) { i4 = i * 4; microplaneNormals[i4 ][0] = help[i][0]; microplaneNormals[i4 ][1] = help[i][1]; microplaneNormals[i4 ][2] = help[i][2]; microplaneNormals[i4+1][0] = help[i][0]; microplaneNormals[i4+1][1] = help[i][1]; microplaneNormals[i4+1][2] =-help[i][2]; microplaneNormals[i4+2][0] = help[i][0]; microplaneNormals[i4+2][1] =-help[i][1]; microplaneNormals[i4+2][2] = help[i][2]; microplaneNormals[i4+3][0] = help[i][0]; microplaneNormals[i4+3][1] =-help[i][1]; microplaneNormals[i4+3][2] =-help[i][2]; } /* -------- */ FILE * norm; norm= fopen("normals.dat","w"); for(i=0;i<28;i++){ fprintf(norm,"%ld %f %f %f\n",i,microplaneNormals[i][0],microplaneNormals[i][1],microplaneNormals[i][2]); } /* ------- */ } else if (numberOfMicroplanes == 21){ for (i=0; i<3; i++) microplaneWeights[i] = 0.02652141274; for (i=3; i<9; i++) microplaneWeights[i] = 0.01993014153; for (i=9; i<21; i++) microplaneWeights[i] = 0.02507124272; microplaneNormals[0][0] = microplaneNormals[1][1] = microplaneNormals[2][2] = 1. ; microplaneNormals[0][1] = microplaneNormals[0][2] = microplaneNormals[1][0] = microplaneNormals[1][2] = microplaneNormals[2][0] = microplaneNormals[2][1] = 0.; microplaneNormals[3][0] = microplaneNormals[3][1] = microplaneNormals[4][0] = microplaneNormals[5][0] = microplaneNormals[5][2] = microplaneNormals[6][0] = microplaneNormals[7][1] = microplaneNormals[7][2] = microplaneNormals[8][1] = 0.7071067812; microplaneNormals[4][1] = microplaneNormals[6][2] = microplaneNormals[8][2] = -0.7071067812; microplaneNormals[3][2] = microplaneNormals[4][2] = microplaneNormals[5][1] = microplaneNormals[6][1] = microplaneNormals[7][0] = microplaneNormals[8][0] = 0.; double help [3][3] = {{0.3879072746, 0.3879072746, 0.8360956240}, {0.3879072746, 0.8360956240, 0.3879072746}, {0.8360956240, 0.3879072746, 0.3879072746}}; for(i=0; i<3;i++){ i4 = i * 4; microplaneNormals[9+i4][0] = help [i][0]; microplaneNormals[9+i4][1] = help [i][1]; microplaneNormals[9+i4][2] = help [i][2]; microplaneNormals[10+i4][0] = help [i][0]; microplaneNormals[10+i4][1] = help [i][1]; microplaneNormals[10+i4][2] = -help [i][2]; microplaneNormals[11+i4][0] = help [i][0]; microplaneNormals[11+i4][1] = -help [i][1]; microplaneNormals[11+i4][2] = help [i][2]; microplaneNormals[12+i4][0] = help [i][0]; microplaneNormals[12+i4][1] = -help [i][1]; microplaneNormals[12+i4][2] = -help [i][2]; } } else if(numberOfMicroplanes == 61){ double help [61][4]={ {1.000000000000, 0.000000000000, 0.000000000000, 0.00795844204678}, {0.745355992500, 0.0 , 0.666666666667, 0.00795844204678}, {0.745355992500,-0.577350269190,-0.333333333333, 0.00795844204678}, {0.745355992500, 0.577350269190,-0.333333333333, 0.00795844204678}, {0.333333333333, 0.577350269190, 0.745355992500, 0.00795844204678}, {0.333333333333,-0.577350269190, 0.745355992500, 0.00795844204678}, {0.333333333333,-0.934172358963, 0.127322003750, 0.00795844204678}, {0.333333333333,-0.356822089773,-0.872677996250, 0.00795844204678}, {0.333333333333, 0.356822089773,-0.872677996250, 0.00795844204678}, {0.333333333333, 0.934172358963, 0.127322003750, 0.00795844204678}, {0.794654472292,-0.525731112119, 0.303530999103, 0.0105155242892}, {0.794654472292, 0.0 ,-0.607061998207, 0.0105155242892}, {0.794654472292, 0.525731112119, 0.303530999103, 0.0105155242892}, {0.187592474085, 0.0 , 0.982246946377, 0.0105155242892}, {0.187592474085,-0.850650808352,-0.491123473188, 0.0105155242892}, {0.187592474085, 0.850650808352,-0.491123473188, 0.0105155242892}, {0.934172358963, 0.0 , 0.356822089773, 0.0100119364272}, {0.934172358963,-0.309016994375,-0.178411044887, 0.0100119364272}, {0.934172358963, 0.309016994375,-0.178411044887, 0.0100119364272}, {0.577350269190, 0.309016994375, 0.755761314076, 0.0100119364272}, {0.577350269190,-0.309016994375, 0.755761314076, 0.0100119364272}, {0.577350269190,-0.809016994375,-0.110264089708, 0.0100119364272}, {0.577350269190,-0.5 ,-0.645497224368, 0.0100119364272}, {0.577350269190, 0.5 ,-0.645497224368, 0.0100119364272}, {0.577350269190, 0.809016994375,-0.110264089708, 0.0100119364272}, {0.356822089773,-0.809016994375, 0.467086179481, 0.0100119364272}, {0.356822089773, 0.0 ,-0.934172358963, 0.0100119364272}, {0.356822089773, 0.809016994375, 0.467086179481, 0.0100119364272}, {0.0 , 0.5 , 0.866025403784, 0.0100119364272}, {0.0 ,-1.0 , 0.0 , 0.0100119364272}, {0.0 , 0.5 ,-0.866025403784, 0.0100119364272}, {0.947273580412,-0.277496978165, 0.160212955043, 0.00690477957966}, {0.812864676392,-0.277496978165, 0.512100034157, 0.00690477957966}, {0.595386501297,-0.582240127941, 0.553634669695, 0.00690477957966}, {0.595386501297,-0.770581752342, 0.227417407053, 0.00690477957966}, {0.812864676392,-0.582240127941,-0.015730584514, 0.00690477957966}, {0.492438766306,-0.753742692223,-0.435173546254, 0.00690477957966}, {0.274960591212,-0.942084316623,-0.192025554687, 0.00690477957966}, {-0.076926487903,-0.942084316623,-0.326434458707, 0.00690477957966}, {-0.076926487903,-0.753742692223,-0.652651721349, 0.00690477957966}, {0.274960591212,-0.637341166847,-0.719856173359, 0.00690477957966}, {0.947273580412, 0.0 ,-0.320425910085, 0.00690477957966}, {0.812864676392,-0.304743149777,-0.496369449643, 0.00690477957966}, {0.595386501297,-0.188341624401,-0.781052076747, 0.00690477957966}, {0.595386501297, 0.188341624401,-0.781052076747, 0.00690477957966}, {0.812864676392, 0.304743149777,-0.496369449643, 0.00690477957966}, {0.492438766306, 0.753742692223,-0.435173546254, 0.00690477957966}, {0.274960591212, 0.637341166847,-0.719856173359, 0.00690477957966}, {-0.076926487903, 0.753742692223,-0.652651721349, 0.00690477957966}, {-0.076926487903, 0.942084316623,-0.326434458707, 0.00690477957966}, {0.274960591212, 0.942084316623,-0.192025554687, 0.00690477957966}, {0.947273580412, 0.277496978165, 0.160212955043, 0.00690477957966}, {0.812864676392, 0.582240127941,-0.015730584514, 0.00690477957966}, {0.595386501297, 0.770581752342, 0.227417407053, 0.00690477957966}, {0.595386501297, 0.582240127941, 0.553634669695, 0.00690477957966}, {0.812864676392, 0.277496978165, 0.512100034157, 0.00690477957966}, {0.492438766306, 0.0 , 0.870347092509, 0.00690477957966}, {0.274960591212, 0.304743149777, 0.911881728046, 0.00690477957966}, {-0.076926487903, 0.188341624401, 0.979086180056, 0.00690477957966}, {-0.076926487903,-0.188341624401, 0.979086180056, 0.00690477957966}, {0.274960591212,-0.304743149777, 0.911881728046, 0.00690477957966}}; for(i=0; i<numberOfMicroplanes; i++){ microplaneNormals[i][0]= help[i][0]; microplaneNormals[i][1]= help[i][1]; microplaneNormals[i][2]= help[i][2]; microplaneWeights[i] = help[i][3]; } }else{ fprintf (stderr,"microfiber::initializeData Unsupported number of microplanes"); } // compute projection tensors for each microplane long ii,jj; vector n(3), m(3), l(3); double aux; for (mPlane=0; mPlane < numberOfMicroplanes; mPlane++) { n[0] = microplaneNormals[mPlane][0]; n[1] = microplaneNormals[mPlane][1]; n[2] = microplaneNormals[mPlane][2]; if ((mPlane+1)%3 == 0) { aux = sqrt (n[0]*n[0] + n[1]*n[1]); if(fabs(aux) > 1.0e-12){ m[0] = n[1]/aux; m[1] = -n[0]/aux; m[2] = 0.0; } else { m[0] = 1.0; m[1] = 0.0; m[2] = 0.0; } } else if ((mPlane+1)%3 == 1) { aux = sqrt (n[1]*n[1] + n[2]*n[2]); if(fabs(aux) > 1.0e-12){ m[0] = 0.0; m[1] = n[2]/aux; m[2] = -n[1]/aux; } else { m[0] = 0.0; m[1] = 1.0; m[2] = 0.0; } } else { aux = sqrt (n[0]*n[0] + n[2]*n[2]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -