User Tools

Site Tools


walkthrough

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
walkthrough [2017/10/17 15:09]
marijn.nijenhuis
walkthrough [2017/10/18 10:51] (current)
marijn.nijenhuis [Element properties]
Line 15: Line 15:
 We start by defining the positions of the nodes where we place the origin at node 1. ''nodes'' is an n<sub>n</sub>×3 matrix for //defining the positions of the nodes//. Each row represents a node (there are n<sub>n</sub> nodes). The row number determines the number a node gets. The first column contains the ''x''-coordinate of the node position, the second column the ''y''-coordinate, and the third column the ''z''-coordinate. We start by defining the positions of the nodes where we place the origin at node 1. ''nodes'' is an n<sub>n</sub>×3 matrix for //defining the positions of the nodes//. Each row represents a node (there are n<sub>n</sub> nodes). The row number determines the number a node gets. The first column contains the ''x''-coordinate of the node position, the second column the ''y''-coordinate, and the third column the ''z''-coordinate.
 <code matlab> <code matlab>
-clc    %clear command window +clear   %clear workspace 
-clear  %clear workspace+clc     %clear command window
  
-%% NODE POSITIONS+addpath('spacar'%have this point to the folder where spacar is located 
 + 
 +%some dimensions
 L = 0.1;    %[m] L = 0.1;    %[m]
 W = 0.05;   %[m] W = 0.05;   %[m]
 + 
 %% NODE POSITIONS %% NODE POSITIONS
 nodes = [0 0 0;     %node 1 nodes = [0 0 0;     %node 1
Line 37: Line 39:
            3 4];    %leafspring between node 3 and 4             3 4];    %leafspring between node 3 and 4 
 </code> </code>
- 
 ===== Node properties ===== ===== Node properties =====
 Node properties are defined by a structure array to assign properties to nodes, such as boundary conditions, applied loads, and inertia. The usage is ''nprops(i).field = value;'' to assign property ''field'' with value ''value'' to node ''i''. For a full syntax list with all possible inputs, see [[full_syntax#3. Node properties|SPACAR Light syntax]]. Node properties are defined by a structure array to assign properties to nodes, such as boundary conditions, applied loads, and inertia. The usage is ''nprops(i).field = value;'' to assign property ''field'' with value ''value'' to node ''i''. For a full syntax list with all possible inputs, see [[full_syntax#3. Node properties|SPACAR Light syntax]].
Line 49: Line 50:
 Furthermore, we would like for the parallel flexure guide to start 10mm deflected to the left and let it move 20mm to the right. For this purpose, we pre-describe the position of node 2 in x-direction: Furthermore, we would like for the parallel flexure guide to start 10mm deflected to the left and let it move 20mm to the right. For this purpose, we pre-describe the position of node 2 in x-direction:
 <code matlab> <code matlab>
-nprops(2).displ_initial_x =-0.01; %start with node 2 displaced 10mm to the left +nprops(2).displ_initial_x =-0.01; %start with node 2 displaced 10 mm to the left 
-nprops(2).displ_x =         0.02; %displace node 2 20mm to the right+nprops(2).displ_x =         0.02; %displace node 2 20 mm to the right
 </code> </code>
 At last we apply a load of 5N in Z-direction on node 2 and 3 At last we apply a load of 5N in Z-direction on node 2 and 3
 <code matlab> <code matlab>
-nprops(2).force_initial = [0 0 5]; %initial load of 5N z-direction  +nprops(2).force_initial = [0 0 5]; %initial load of 5N in z-direction on node 2 
-nprops(3).force_initial = [0 0 5]; %initial load of 5N z-direction +nprops(3).force_initial = [0 0 5]; %initial load of 5N in z-direction on node 3
 </code> </code>
  
Line 66: Line 67:
 <code matlab> <code matlab>
 %% ELEMENT PROPERTIES %% ELEMENT PROPERTIES
- 
 %first element property set %first element property set
-eprops(1).elems = [1 3];        %assing property set 1 to element 1 and 3+eprops(1).elems = [1 3];        %assing property set 1 to elements 1 and 3
 eprops(1).emod = 210e9;         %E-modulus [Pa] eprops(1).emod = 210e9;         %E-modulus [Pa]
-eprops(1).smod = 70e9;          %G-modulus [Pa]+eprops(1).smod = 70e9;          %shear modulus [Pa]
 eprops(1).dens = 7800;          %density   [kg/m^3] eprops(1).dens = 7800;          %density   [kg/m^3]
-eprops(1).dim = [0.05 0.0005];  %cross-sectional dimension [w t] in [m] +eprops(1).dim = [0.05 0.0005];  %cross-sectional dimension (width and thickness, resp.) [m] 
-eprops(1).cshape = 'rect';      %cross-sectional shape rectangular +eprops(1).cshape = 'rect';      %rectangular cross-sectional shape  
-eprops(1).flex = [2 3 4];       %torsional (2) and out-of-plane bending (3,4) deformations are flexible+eprops(1).flex = [2 3 4];       %flexible deformations: torsion (2) and out-of-plane bending (3,4) 
 eprops(1).orien = [0 0 1];      %width-direction of leafspring oriented in z-direction eprops(1).orien = [0 0 1];      %width-direction of leafspring oriented in z-direction
-eprops(1).nbeams 2          %Leafspring simulated with 2 SPACAR beams (instead of 1) for increased accuracy+eprops(1).color [0.8549    0.8588    0.8667]; %color in rgb values between 0 and 1
 </code> </code>
  
Line 84: Line 84:
 eprops(2).elems = [2];          %assing property set 2 to element 2 eprops(2).elems = [2];          %assing property set 2 to element 2
 eprops(2).dens = 2700;          %density   [kg/m^3] eprops(2).dens = 2700;          %density   [kg/m^3]
-eprops(2).dim = [0.05 0.025];   %cross-sectional dimension [w t] in [m] +eprops(2).dim = [0.05 0.025];   %cross-sectional dimension (width and thickness, resp.) [m] 
-eprops(2).cshape = 'rect';      %cross-sectional shape rectangular+eprops(2).cshape = 'rect';      %rectangular cross-sectional shape
 eprops(2).orien = [0 0 1];      %width-direction of leafspring oriented in z-direction eprops(2).orien = [0 0 1];      %width-direction of leafspring oriented in z-direction
 +eprops(2).color = [0.1686    0.3922    0.6627]; %color in rgb values between 0 and 1
 </code> </code>
- 
  
 ====== Run simulation ====== ====== Run simulation ======
Line 104: Line 104:
 clc clc
  
 +% addpath('spacar') %have this point to the folder where spacar is located
 +
 +%some dimensions
 L = 0.1;    %[m] L = 0.1;    %[m]
 W = 0.05;   %[m] W = 0.05;   %[m]
 + 
 %% NODE POSITIONS %% NODE POSITIONS
 nodes = [0 0 0;     %node 1 nodes = [0 0 0;     %node 1
Line 112: Line 115:
          W L 0;     %node 3          W L 0;     %node 3
          W 0 0];    %node 4          W 0 0];    %node 4
-      +  
 + 
 %% ELEMENT CONNECTIVITY %% ELEMENT CONNECTIVITY
 elements= [1 2;     %leafspring between node 1 and 2  elements= [1 2;     %leafspring between node 1 and 2 
            2 3;     %intermediate body            2 3;     %intermediate body
            3 4];    %leafspring between node 3 and 4             3 4];    %leafspring between node 3 and 4 
- +  
- +  
- + %% NODE PROPERTIES
-%% NODE PROPERTIES+
 nprops(1).fix = true;       %fix node 1 nprops(1).fix = true;       %fix node 1
 nprops(4).fix = true;       %fix node 4 nprops(4).fix = true;       %fix node 4
- +  
-nprops(2).displ_initial_x =-0.01; %start with node 2 displaced 10mm to the left +nprops(2).displ_initial_x =-0.01; %start with node 2 displaced 10 mm to the left 
-nprops(2).displ_x =         0.02; %displace node 2 20mm to the right +nprops(2).displ_x =         0.02; %displace node 2 20 mm to the right 
- +  
-nprops(2).force_initial = [0 0 5]; %initial load of 5N in z-direction  +nprops(2).force_initial = [0 0 5]; %initial load of 5N in z-direction on node 2 
-nprops(3).force_initial = [0 0 5]; %initial load of 5N in z-direction  +nprops(3).force_initial = [0 0 5]; %initial load of 5N in z-direction on node 3 
- +  
 + 
 %% ELEMENT PROPERTIES %% ELEMENT PROPERTIES
- 
 %first element property set %first element property set
-eprops(1).elems = [1 3];        %assing property set 1 to element 1 and 3+eprops(1).elems = [1 3];        %assing property set 1 to elements 1 and 3
 eprops(1).emod = 210e9;         %E-modulus [Pa] eprops(1).emod = 210e9;         %E-modulus [Pa]
-eprops(1).smod = 70e9;          %G-modulus [Pa]+eprops(1).smod = 70e9;          %shear modulus [Pa]
 eprops(1).dens = 7800;          %density   [kg/m^3] eprops(1).dens = 7800;          %density   [kg/m^3]
-eprops(1).dim = [0.05 0.0005];  %cross-sectional dimension [w t] in [m] +eprops(1).dim = [0.05 0.0005];  %cross-sectional dimension (width and thickness, resp.) [m] 
-eprops(1).cshape = 'rect';      %cross-sectional shape rectangular +eprops(1).cshape = 'rect';      %rectangular cross-sectional shape  
-eprops(1).flex = [2 3 4];       %torsional (2) and out-of-plane bending (3,4) deformations are flexible+eprops(1).flex = [2 3 4];       %flexible deformations: torsion (2) and out-of-plane bending (3,4) 
 eprops(1).orien = [0 0 1];      %width-direction of leafspring oriented in z-direction eprops(1).orien = [0 0 1];      %width-direction of leafspring oriented in z-direction
 +eprops(1).color = [0.8549    0.8588    0.8667]; %color in rgb values between 0 and 1 
 + 
 %second element property set %second element property set
 eprops(2).elems = [2];          %assing property set 2 to element 2 eprops(2).elems = [2];          %assing property set 2 to element 2
 eprops(2).dens = 2700;          %density   [kg/m^3] eprops(2).dens = 2700;          %density   [kg/m^3]
-eprops(2).dim = [0.05 0.025];   %cross-sectional dimension [w t] in [m] +eprops(2).dim = [0.05 0.025];   %cross-sectional dimension (width and thickness, resp.) [m] 
-eprops(2).cshape = 'rect';      %cross-sectional shape rectangular+eprops(2).cshape = 'rect';      %rectangular cross-sectional shape
 eprops(2).orien = [0 0 1];      %width-direction of leafspring oriented in z-direction eprops(2).orien = [0 0 1];      %width-direction of leafspring oriented in z-direction
 +eprops(2).color = [0.1686    0.3922    0.6627]; %color in rgb values between 0 and 1
 + 
  
 %% DO SIMULATION %% DO SIMULATION
 out = spacarlight(nodes,elements,nprops,eprops); out = spacarlight(nodes,elements,nprops,eprops);
 </code> </code>
walkthrough.1508245772.txt.gz · Last modified: 2017/10/17 15:09 by marijn.nijenhuis