00001 #ifndef OPENTISSUE_DYNAMICS_FEM_FEM_COMPUTE_ISOTROPIC_ELASTICITY_H
00002 #define OPENTISSUE_DYNAMICS_FEM_FEM_COMPUTE_ISOTROPIC_ELASTICITY_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 namespace OpenTissue
00013 {
00014 namespace fem
00015 {
00016 namespace detail
00017 {
00025 template<typename real_type, typename vector3_type>
00026 inline void compute_isotropic_elasticity_vector(
00027 real_type const & young
00028 , real_type const & poisson
00029 , vector3_type & D
00030 )
00031 {
00032 assert(young>0 || !"compute_isotropic_elasticity_vector(): Young modulus must be positive");
00033 assert(poisson>0 || !"compute_isotropic_elasticity_vector(): Poisson ratio must be positive");
00034 assert(poisson<0.5 || !"compute_isotropic_elasticity_vector(): Poisson ratio must be less than a half");
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 real_type poisson2 = 2.0*poisson;
00047 real_type scale = young / ((1.0 + poisson) * (1.0 - poisson2));
00048 D(0) = (1.0 - poisson) * scale;
00049 D(1) = poisson * scale;
00050 D(2) = young / (2.0 + poisson2);
00051 }
00052
00060 template<typename real_type,typename matrix_type>
00061 inline void compute_isotropic_elasticity_matix(
00062 real_type const & young
00063 , real_type const & poisson
00064 , matrix_type & D
00065 )
00066 {
00067 assert(young>0 || !"compute_isotropic_elasticity_matix(): Young modulus must be positive");
00068 assert(poisson>0 || !"compute_isotropic_elasticity_matix(): Poisson ratio must be positive");
00069 assert(poisson<0.5 || !"compute_isotropic_elasticity_matix(): Poisson ratio must be less than a half");
00070 assert(D.size1()==6 || !"compute_isotropic_elasticity_matix(): D-matrix did not have 6 rows");
00071 assert(D.size2()==6 || !"compute_isotropic_elasticity_matix(): D-matrix did not have 6 columns");
00072
00073 typedef typename matrix_type::value_type value_type;
00074
00075 value_type lambda = (poisson*young)/(( 1+poisson )*( 1- (2*poisson) ));
00076 value_type mu = young/(2*(1+poisson));
00077 value_type tmp = lambda+(2*mu);
00078
00079 D(0,0) = tmp; D(0,1) = lambda; D(0,2) = lambda; D(0,3) = 0; D(0,4) = 0; D(0,5) = 0;
00080 D(1,0) = lambda; D(1,1) = tmp; D(1,2) = lambda; D(1,3) = 0; D(1,4) = 0; D(1,5) = 0;
00081 D(2,0) = lambda; D(2,1) = lambda; D(2,2) = tmp; D(2,3) = 0; D(2,4) = 0; D(2,5) = 0;
00082 D(3,0) = 0; D(3,1) = 0; D(3,2) = 0; D(3,3) = mu; D(3,4) = 0; D(3,4) = 0;
00083 D(4,0) = 0; D(4,1) = 0; D(4,2) = 0; D(4,3) = 0; D(4,4) = mu; D(4,5) = 0;
00084 D(5,0) = 0; D(5,1) = 0; D(5,2) = 0; D(5,3) = 0; D(5,4) = 0; D(5,5) = mu;
00085 }
00086
00098 template<typename real_type>
00099 inline void compute_isotropic_elasticity_vector(
00100 real_type const & young
00101 , real_type const & poisson
00102 , real_type & D00
00103 , real_type & D01
00104 , real_type & D33
00105 )
00106 {
00107 assert(young>0 || !"compute_isotropic_elasticity_vector(): Young modulus must be positive");
00108 assert(poisson>0 || !"compute_isotropic_elasticity_vector(): Poisson ratio must be positive");
00109 assert(poisson<0.5 || !"compute_isotropic_elasticity_vector(): Poisson ratio must be less than a half");
00110
00111 D01 = (poisson*young)/(( 1 + poisson )*( 1- (2*poisson) ));
00112 D33 = young/(2*(1+poisson));
00113 D00 = D01+(2*D33);
00114 }
00115
00116 }
00117 }
00118 }
00119
00120
00121 #endif