gdbaldw / BlenderAndMBDyn

Combines Blender's graphical interface and rendering capabilities with MBDyn's multi-body dynamics, aerodynamics, and aeroelastics simulation and analysis, for rapid modeling and realistic rendering of physics based multi-body simulations.
GNU General Public License v3.0
25 stars 13 forks source link

Node definition missing from MBDyn input file #14

Closed timgow closed 8 years ago

timgow commented 8 years ago

Doug, I've got the latest BAM code and building a crank-slider model; initially it's a 2-link pendulum until the slider is added. I tried to run this intermediate stage and I get the error:

reading from file "Scene.001.mbd"
Creating scalar solver with Naive linear solver
Reading Structural(1)
Reading Structural(0)
Reading Body(1)
Reading Body(0)
Reading Joint(2)
[mathp.cc:3635,func=TypedValue MathParser::expr()] (unknown token) at line 114
HighParser::GetValue(): error return from MathParser at line 114, file <Scene.001.mbd>
An error occurred during the execution of MBDyn; aborting... 

The MBDyn input file doesn't include the definition of the 'Node_Ground'. I modified the input file to include the definition and it runs ok; the DIFF output is:

4a5
> set: const integer Node_Ground = 99;
65c66
<     structural nodes: 2;

---
>     structural nodes: 3;
71a73,80
>     structural: Node_Ground, static,
>         reference, global, 0, 0, 0,
>         reference, global, matr,
>             1, 0, 0,
>             0, 1, 0,
>             0, 0, 1,
>         reference, global, null,
>         reference, global, null;

BAM generated MBDyn input file:

# MBDyn v1.6 input file generated using BlenderAndMBDyn v2.0

# Frame names: None
# Node names:
set: const integer Node_Conrod = 0;
set: const integer Node_Crank = 1;

# Element names:
set: const integer Body_Conrod = 0;
set: const integer Body_Crank = 1;
set: const integer Clamp = 2;
set: const integer Gravity = 3;
set: const integer Revolute_hinge = 4;
set: const integer Rigid_offset = 5;
set: const integer Rigid_offset_001 = 6;
set: const integer Rigid_offset_002 = 7;

# Drive names:
set: const integer Meter_drive = 0;
set: const integer Unit_drive = 1;

# Constitutive names: None

# Parameters: None

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

begin: initial value;
    initial time: 0;
    final time: 10;
    strategy: no change;
    time step: 0.001;
    tolerance: 1e-06;
    max iterations: 10;
    derivatives tolerance: 2;
    derivatives max iterations: 1;
    derivatives coefficient: 0.001;
end: initial value;

begin: control data;
    select timeout: forever;
    default orientation: orientation matrix;
    output meter: meter, 0, forever, steps, 1;
    output precision: 6;
    default output:
        reference frames,
        abstract nodes,
        electric nodes,
        hydraulic nodes,
        structural nodes,
        accelerations,
        aerodynamic elements,
        air properties,
        beams,
        electric elements,
        forces,
        genels,
        gravity,
        hydraulic elements,
        joints,
        rigid bodies,
        induced velocity elements;
    structural nodes: 2;
    joints: 2;
    rigid bodies: 2;
    gravity;
end: control data;

begin: nodes;
    structural: Node_Crank, dynamic,
        reference, global, 0.5, 0, 0,
        reference, global, matr,
            1, 0, 0,
            0, 1, 0,
            0, 0, 1,
        reference, global, null,
        reference, global, null;
    structural: Node_Conrod, dynamic,
        reference, global, 2, 0, 0,
        reference, global, matr,
            1, 0, 0,
            0, 1, 0,
            0, 0, 1,
        reference, global, null,
        reference, global, null;
end: nodes;

# Drives:
drive caller: Unit_drive, unit;
drive caller: Meter_drive, meter, 0, forever, steps, 1;

begin: elements;
    body: Body_Crank,
        Node_Crank,
            1,
            0, 0, 0, 
            eye,
            inertial, matr,
                1, 0, 0,
                0, 1, 0,
                0, 0, 1;
    body: Body_Conrod,
        Node_Conrod,
            1,
            0, 0, 0, 
            eye,
            inertial, matr,
                1, 0, 0,
                0, 1, 0,
                0, 0, 1;
    joint: Clamp, clamp,
        Node_Ground, node, node;
    joint: Revolute_hinge, revolute hinge,
        Node_Crank, 0.5, 0, 0,
            hinge, matr,
                1, 0, 0,
                0, 0, 1,
                0, -1, 0, 
        Node_Conrod, -1, 0, 0,
            hinge, matr,
                1, 0, 0,
                0, 0, 1,
                0, -1, 0;
    gravity: 
            0, 0, -1, scale, 9.81, reference, Unit_drive;
end: elements;

The follow images show the objects associated with each element in the BAM list: screenshot 01 screenshot 02 screenshot 03 screenshot 04 screenshot 05 screenshot 06 screenshot 07

I appreciate your time to check this out. Tim

gdbaldw commented 8 years ago

Hi Tim, Thanks for the example. To correct the model, Rigid_offset must be reversed (select the objects in the opposite order, then edit). Rigid_offset.001 must originate from the Ground_node (select Ground_node, then select Crank_pin, then edit). Rigid_offset.002, of course, will be ignored until another Element includes it. Your model will have only its two required nodes. -Doug

timgow commented 8 years ago

Hi Doug, Thank you for making the object selection clear to me, I have a working double pendulum now. I'm very pleased with this as I feel like I know a bit more of what's going on. Tim

timgow commented 8 years ago

Hi Doug, I have the crank-slider working under the gravity loading; my next difficulty is rotating the crank at a constant angular velocity, using a reference frame. I'm not clear on the BAM rules on this; in the MBDyn input file we're wanting to include the new reference frame in the node definition.  The element is associated with the node, and in BAM it looks like you're putting the element in the reference frame (rather than the node, from where we'd hang the element). Should I create a new blender object from which to create the reference frame?  I believe that I should select the body and then the new blender object, in order to create the reference frame.  In my crank-slider model, the body is half a unit away from the origin/axis of rotation; should this work, not coincident (I'm getting results with no motion)?  How is the reference frame related to the clamp at the origin and the revolute-hinge at the origin? I have tried again from scratch but I have a tangle of clamp, hinge, node rigid offset, body and reference frame. I'm seeking a logical path along which to build up the crank arm rotating about the origin, I appreciate your help. Tim

On 5 Oct 2015, at 15:25, gdbaldw notifications@github.com wrote:

Hi Tim,

Thanks for the example. To correct the model, Rigid_offset must be reversed (select the objects in the opposite order, then edit). Rigid_offset.001 must originate from the Ground_node (select Ground_node, then select Crank_pin, then edit). Rigid_offset.002, of course, will be ignored until another Element includes it. Your model will have only its two required nodes.

-Doug

— Reply to this email directly or view it on GitHub.