Home > リソース > MBDynモデル集 > 9. １次元弾性接触
MBDynモデル集

## 9. １次元弾性接触

### 入力ファイル

```# elastic_contact_1d.mbd

#-----------------------------------------------------------------------------
# [Data Block]

begin: data;
problem: initial value;
end: data;

#-----------------------------------------------------------------------------
# [<Problem> Block]

begin: initial value;
initial time:   0.;
final time:     4.;
time step:      1.e-3;
max iterations: 10;
tolerance:      1.e-7;
end: initial value;

#-----------------------------------------------------------------------------
# [Control Data Block]

begin: control data;
use: rigid bodies, gravity, in assembly;
output frequency: 10;
structural nodes: 3;
rigid bodies:     1;
joints:           5;
forces:           1;
gravity;
end: control data;

#-----------------------------------------------------------------------------
# Design Variables
set: real M  = 1.;     # Mass
set: real L  = 1.;     # Spring Natural Length
set: real K  = 40.;    # Spring Stiffness
set: real H  = -1.5;   # Table Position
set: real Kc = 10000.; # Contact Stiffness
set: real Ec = 1.2;    # Contact Stiffness Exponent
set: real Cc = 10.;    # Contact Damping
set: real Dc = 0.0001; # Contact Damping Activation Depth

#-----------------------------------------------------------------------------
# Node Labels
set: integer Node_Actuator = 1;
set: integer Node_Mass     = 2;
set: integer Node_Ground   = 3;

# Body Labels
set: integer Body_Mass = 1;

# Joint Labels
set: integer JoDrivp_Actuator      = 1;
set: integer JoInlin_Actuator_Mass = 2;
set: integer JoPrism_Actuator_Mass = 3;
set: integer JoDfmd_Spring         = 4;
set: integer JoClamp_Ground        = 5;

# Force Labels
set: integer FoStr_Contact_Mass = 1;

#-----------------------------------------------------------------------------
# Scalar Functions
scalar function: "cubstep",
cubicspline, do not extrapolate,
-0.03, 0.00,
-0.02, 0.00,
-0.01, 0.00,
0.00, 0.00,
1.00, 1.00,
1.01, 1.00,
1.02, 1.00,
1.03, 1.00;

#-----------------------------------------------------------------------------
# [Nodes Block]

begin: nodes;

#-----------------------------------------------------------------------------
# Nodes
structural: Node_Actuator, dynamic,
null, # absolute position
eye,  # absolute orientation
null, # absolute velocity
null; # absolute angular velocity

structural: Node_Mass, dynamic,
0., 0., -L, # absolute position
eye,        # absolute orientation
null,       # absolute velocity
null;       # absolute angular velocity

structural: Node_Ground, static,
null, # absolute position
eye,  # absolute orientation
null, # absolute velocity
null; # absolute angular velocity

end: nodes;

#-----------------------------------------------------------------------------
# Plugin Variables
set: [node, DZ, Node_Mass, structural, string="X[3]"];
set: [node, VZ, Node_Mass, structural, string="XP[3]"];

#-----------------------------------------------------------------------------
# [Elements Block]

begin: elements;

#-----------------------------------------------------------------------------
# Bodies
body: Body_Mass, Node_Mass,
M,    # mass
null, # relative center of mass
eye;  # inertia matrix

#-----------------------------------------------------------------------------
# Joints
joint: JoDrivp_Actuator,
drive displacement pin,
Node_Actuator,
null,                                           # node offset
null,                                           # offset
single, 0., 0., 1., sine, 1., pi/2., -1., one, 0.; # position

joint: JoInlin_Actuator_Mass,
in line,
Node_Actuator,
null, # relative line position
eye,  # relative normal direction
Node_Mass;

joint: JoPrism_Actuator_Mass,
prismatic,
Node_Actuator,
Node_Mass;

joint: JoDfmd_Spring,
deformable displacement joint,
Node_Actuator,
null,
Node_Mass,
null,
linear elastic isotropic, K,
prestrain, single, 0., 0., -1, const, L;

joint: JoClamp_Ground,
clamp,
Node_Ground,
null, # absolute position
eye;  # absolute orientation

#-----------------------------------------------------------------------------
# Forces
force: FoStr_Contact_Mass,
absolute,
Node_Mass,
position, null,                                       # relative arm
single, 0., 0., 1.,
string, "max(0,Kc*sign(H-DZ)*abs(H-DZ)^Ec
-Cc*VZ*model::sf::cubstep((H-DZ)/Dc))"; # force value

#-----------------------------------------------------------------------------
# Gravity
gravity: 0., 0., -1., const, 9.81;

end: elements;
```