00001 #include "edgem.h" 00002 #include "global.h" 00003 #include "globmat.h" 00004 00005 #include <math.h> 00006 00007 /** 00008 constructor 00009 00010 JK, 28.8.2007 00011 */ 00012 edgem::edgem (void) 00013 { 00014 //long fn,ln; 00015 00016 /* 00017 // number of nodes on edge 00018 nn = i; 00019 if (nn<2){ 00020 fprintf (stderr,"\n\n wrong number of nodes on edge (number of nodes %ld)",nn); 00021 fprintf (stderr,"\n in constructor edgem (file %s, line %d)\n",__FILE__,__LINE__); 00022 } 00023 00024 // number of approximated functions 00025 napfun = j; 00026 if (napfun<1){ 00027 fprintf (stderr,"\n\n wrong number of approximated functions on edge (number of functions %ld)",napfun); 00028 fprintf (stderr,"\n in constructor edgem (file %s, line %d)\n",__FILE__,__LINE__); 00029 } 00030 */ 00031 00032 // number of assigned general edge from GEFEL 00033 ned = 0; 00034 00035 // nodal displacements in the global coordinate system 00036 u1=0.0; u2=0.0; u3=0.0; u4=0.0; 00037 v1=0.0; v2=0.0; v3=0.0; v4=0.0; 00038 00039 // tangentional displacements (displacements in the direction defined by the edge) 00040 td1=0.0; td2=0.0; td3=0.0; td4=0.0; 00041 00042 // normal displacements (displacements normal to the direction defined by the edge) 00043 nd1=0.0; nd2=0.0; nd3=0.0; nd4=0.0; 00044 00045 // jumps in the tangential and normal directions 00046 jt1=0.0; jt2=0.0; jn1=0.0; jn2=0.0; 00047 00048 // auxiliary array for nodal displacements 00049 // this class serves only for 2D problems 00050 // it means that nodes contain 2 DOFs 00051 r = new double [2]; 00052 00053 // type of material model 00054 tm = NULL; 00055 // id of material model 00056 idm = NULL; 00057 } 00058 00059 edgem::~edgem () 00060 { 00061 delete [] tm; 00062 delete [] idm; 00063 delete [] r; 00064 } 00065 00066 /** 00067 JK, 8.8.2007 00068 */ 00069 void edgem::read (FILE *in) 00070 { 00071 00072 } 00073 00074 /** 00075 function initializes edge 00076 00077 @param edid - edge id 00078 00079 JK, 1.3.2009 00080 */ 00081 void edgem::init (long edid) 00082 { 00083 00084 } 00085 00086 00087 /** 00088 function assembles nodal displacements 00089 00090 example: 00091 ---3------4--- 00092 ---7------8--- 00093 nlist[0]=3, nlist[1]=7, nlist[2]=4, nlist[3]=8 00094 00095 @param lcid - load case id 00096 00097 JK, 28.8.2007 00098 */ 00099 void edgem::nodal_displacements (long lcid) 00100 { 00101 long nid; 00102 00103 // first node on the edge 00104 nid=Gtm->gedges[ned].nlist[0]; 00105 // nodal displacements 00106 noddispl (lcid,r,nid); 00107 u1=r[0]; v1=r[1]; 00108 00109 // second node on the edge 00110 nid=Gtm->gedges[ned].nlist[1]; 00111 // nodal displacements 00112 noddispl (lcid,r,nid); 00113 u2=r[0]; v2=r[1]; 00114 00115 // third node on the edge 00116 nid=Gtm->gedges[ned].nlist[2]; 00117 // nodal displacements 00118 noddispl (lcid,r,nid); 00119 u3=r[0]; v3=r[1]; 00120 00121 // fourth node on the edge 00122 nid=Gtm->gedges[ned].nlist[3]; 00123 // nodal displacements 00124 noddispl (lcid,r,nid); 00125 u4=r[0]; v4=r[1]; 00126 00127 } 00128 00129 /** 00130 function computes tangential and normal displacements 00131 00132 JK, 28.8.2007 00133 */ 00134 void edgem::tan_nor_displacements () 00135 { 00136 // tangent direction 00137 Gtm->gedges[ned].give_dirvect (r); 00138 00139 td1=u1*r[0]+v1*r[1]; 00140 td2=u2*r[0]+v2*r[1]; 00141 td3=u3*r[0]+v3*r[1]; 00142 td4=u4*r[0]+v4*r[1]; 00143 00144 // normal direction 00145 Gtm->gedges[ned].give_norvect (r); 00146 00147 nd1=u1*r[0]+v1*r[1]; 00148 nd2=u2*r[0]+v2*r[1]; 00149 nd3=u3*r[0]+v3*r[1]; 00150 nd4=u4*r[0]+v4*r[1]; 00151 00152 } 00153 00154 /** 00155 computes jumps in displacement field along the edge 00156 00157 JK, 28.8.2007 00158 */ 00159 void edgem::compute_jumps () 00160 { 00161 // jump in tangential direction 00162 jt1 = td2-td1; 00163 jt2 = td4-td3; 00164 00165 // jump in normal direction 00166 jn1 = nd2-nd1; 00167 jn2 = nd4-nd3; 00168 } 00169 00170 /** 00171 function computes derivative of the edge functional with respect 00172 to the nodal displacements 00173 the edge functional is called lipschitz continuous perturbation or 00174 local lipschitz functional 00175 00176 @param lcid - load case id 00177 @param v - array containing the %vector of derivative 00178 00179 JK, 1.3.2009 00180 */ 00181 void edgem::compute_edge_functional_derivative (long lcid,double *v) 00182 { 00183 // nodal displacements at nodes on edge 00184 nodal_displacements (lcid); 00185 // displacements in the tangential and normal directions 00186 tan_nor_displacements (); 00187 // magnitudes of jumps between two subdomains 00188 compute_jumps (); 00189 00190 } 00191