@@ -196,26 +196,28 @@ mod tests {
196196 use approx:: { assert_abs_diff_eq, assert_relative_eq} ;
197197 use iter_num_tools:: lin_space;
198198 use nalgebra:: { DMatrix , matrix, SMatrix , stack} ;
199- use crate :: elements:: beam:: geometry:: { ArcCurve , CrossSection , LineCurve , PlanarCurve , RectangularSection } ;
199+ use crate :: elements:: beam:: geometry:: { CrossSection , PlanarCurve } ;
200200 use crate :: elements:: beam:: linear:: LinearBeamSegment ;
201+ use crate :: testutils:: curves:: { ArcCurve , LineCurve } ;
202+ use crate :: testutils:: sections:: RectangularSection ;
201203
202204 #[ test]
203205 fn test_linear_stiffness_matrix_straight ( ) {
204206 // Computes the stiffness matrix of a straight beam segment with constant cross-section
205207 // and an arbitrary starting point and -angle and compares it to the exact solution
206208 // as well as the fem approximation.
207209
208- let angle = 0.1 ;
209210 let length = 0.8 ;
210- let curve = LineCurve { x : 1.5 , y : 2.0 , φ : angle, l : length } ;
211- let section = RectangularSection { w0 : 0.01 , h0 : 0.01 , w1 : 0.01 , h1 : 0.01 , ρ : 7850.0 , E : 210e9 , G : 80e9 } ;
211+ let angle = 0.1 ;
212+ let curve = LineCurve :: new ( [ 1.5 , 2.0 , angle] , length) ;
213+ let section = RectangularSection :: new ( 7850.0 , 210e9 , 80e9 , & [ 0.01 ] , & [ 0.01 ] , & [ 0.0 ] ) ;
212214
213215 let n_elements = 100 ;
214216 let segment_fem = LinearBeamSegmentFEM :: new ( & curve, & section, 0.0 , curve. length ( ) , n_elements) ;
215217 let segment_num = LinearBeamSegment :: new ( & curve, & section, 0.0 , curve. length ( ) , & segment_fem. s_eval ) ;
216218
217219 let C_sec = section. stiffness ( 0.0 ) ;
218- let K_ref = LinearBeamSegmentFEM :: element_stiffness_matrix ( C_sec [ ( 0 , 0 ) ] , C_sec [ ( 1 , 1 ) ] , C_sec [ ( 2 , 2 ) ] , curve . length ( ) , angle) ;
220+ let K_ref = LinearBeamSegmentFEM :: element_stiffness_matrix ( C_sec [ ( 0 , 0 ) ] , C_sec [ ( 1 , 1 ) ] , C_sec [ ( 2 , 2 ) ] , length, angle) ;
219221
220222 // Check stiffness matrices
221223 assert_relative_eq ! ( segment_num. K , K_ref , max_relative=1e-9 ) ;
@@ -227,7 +229,7 @@ mod tests {
227229 }
228230
229231 // Check total segment mass
230- assert_abs_diff_eq ! ( segment_num. m, section. ρ* section. w0 * section. h0 * length, epsilon=1e-12 ) ;
232+ assert_abs_diff_eq ! ( segment_num. m, section. ρ* section. w [ 0 ] * section. h [ 0 ] * length, epsilon=1e-12 ) ;
231233 }
232234
233235 #[ test]
@@ -236,8 +238,8 @@ mod tests {
236238 // and an arbitrary starting point and -angle and compares it to the fem approximation.
237239
238240 let length = 0.8 ;
239- let curve = ArcCurve { x : 1.5 , y : 2.0 , φ : 0.1 , l : length, r : 0.4 } ;
240- let section = RectangularSection { w0 : 0.01 , h0 : 0.01 , w1 : 0.01 , h1 : 0.01 , ρ : 7850.0 , E : 210e9 , G : 80e9 } ;
241+ let curve = ArcCurve :: new ( [ 1.5 , 2.0 , 0.1 ] , length, 0.4 ) ;
242+ let section = RectangularSection :: new ( 7850.0 , 210e9 , 80e9 , & [ 0.01 ] , & [ 0.01 ] , & [ 0.0 ] ) ;
241243
242244 let n_elements = 100 ;
243245 let segment_fem = LinearBeamSegmentFEM :: new ( & curve, & section, 0.0 , curve. length ( ) , n_elements) ;
@@ -252,7 +254,7 @@ mod tests {
252254 }
253255
254256 // Check total segment mass
255- assert_abs_diff_eq ! ( segment_num. m, section. ρ* section. w0 * section. h0 * length, epsilon=1e-12 ) ;
257+ assert_abs_diff_eq ! ( segment_num. m, section. ρ* section. w [ 0 ] * section. h [ 0 ] * length, epsilon=1e-12 ) ;
256258 }
257259
258260 #[ test]
@@ -261,8 +263,8 @@ mod tests {
261263 // and an arbitrary starting point and -angle and compares it to the fem approximation.
262264
263265 let length = 0.8 ;
264- let curve = ArcCurve { x : 1.5 , y : 2.0 , φ : 0.1 , l : length, r : 0.4 } ;
265- let section = RectangularSection { w0 : 0.01 , h0 : 0.01 , w1 : 0.005 , h1 : 0.005 , ρ : 7850 .0, E : 210e9 , G : 80e9 } ;
266+ let curve = ArcCurve :: new ( [ 1.5 , 2.0 , 0.1 ] , length, 0.4 ) ;
267+ let section = RectangularSection :: new ( 7850.0 , 210e9 , 80e9 , & [ 0.01 , 0.005 ] , & [ 0.01 , 0.005 ] , & [ 0 .0, 0.0 ] ) ;
266268
267269 let n_elements = 100 ;
268270 let segment_fem = LinearBeamSegmentFEM :: new ( & curve, & section, 0.0 , curve. length ( ) , n_elements) ;
@@ -278,8 +280,8 @@ mod tests {
278280
279281 // Check total segment mass
280282 // Analytical volume from truncated pyramid: https://de.wikipedia.org/wiki/Pyramidenstumpf
281- let A0 = section. w0 * section. h0 ;
282- let A1 = section. w1 * section. h1 ;
283+ let A0 = section. w [ 0 ] * section. h [ 0 ] ;
284+ let A1 = section. w [ 1 ] * section. h [ 1 ] ;
283285 assert_abs_diff_eq ! ( segment_num. m, section. ρ* length/3.0 * ( A0 + f64 :: sqrt( A0 * A1 ) + A1 ) , epsilon=1e-12 ) ;
284286 }
285287
0 commit comments