LS-DYNAとの結合

MotionViewアプリケーションとLS-DYNAソルバーとの結合の概要。

LS-DYNAにMDLモデルをエクスポートするためのガイドライン

LS-DYNAの.keyファイルにMotionViewのMDLモデルをエクスポートできます。

重力、単位、およびソルバーのパラメータ

MotionViewで、重力、単位、およびソルバーに関するDYNAのパラメータを使用できます。
Gravity
重力は暗黙的なデータセットです。つまり、重力の定義はMotionViewで自動的に作成されます。モデルのMiscシステムを使用しているときであれば、Formsパネルから重力の値を利用できます。重力のデフォルト値はstd_incファイルで設定されます。このファイルは、MotionViewのインストールの際にインストールされています。std_incには、Templexテンプレートも用意されています。このテンプレートを使用すると、DYNA入力ファイルに重力を書き込むことができます。
Units
MotionViewは“単位がない”インターフェースですが、一般的にはユーザー側で扱っている単位をソルバーの入力デックに通知する必要があります。したがって、質量、長さ、時間、力の定義はMotionViewで自動的に生成されます。この定義を利用するには、Formsパネルに移動し、MiscシステムでUnitsを選択します。DYNAに単位をエクスポートするために使用するデフォルト値とTemplexテンプレートはstd_incファイルで生成されます。
ソルバーパラメータ
ソルバーパラメータはソルバーごとに大きく異なります。これらのパラメータはデータセットに保存されています。ソルバーパラメータのデータセットを生成する方法には次の2種類があります:
  • データセットとそれに対応する各種フォームは、解析タスクでMDLライブラリに作成されます。独自のMDLライブラリを作成する場合は、解析タスクごとにソルバーパラメータのデータセットが定義されていることを確認する必要があります。
  • モデルの構築ではライブラリが使用されません。このような構築作業として、インタラクティブなモデルの構築と.mdlファイルの手動編集、またはこれらの組み合わせがあります。この場合、std_incファイルに記述された定義に基づくソルバーパラメータを持つシステムがMotionViewによって自動的に生成されます。

MDLステートメントのマッピング

MDLエンティティとそれに相当するDYNAエンティティとのマッピングについて説明します。
注: これらのエンティティのプロパティデータはすべて、各エンティティに対応する*Set()ステートメントで設定されます。
MDLステートメント DYNAエンティティ
*ActionOnlyForce() なし
*ActionReactionForce() なし
*AtPointJoint() Spherical (Joint)
*BallJoint() Spherical (Joint)
*Beam() なし
*Body() Part_Inertia
*Bush() Element_Discrete
*CoilSpring() なし
*ControlSISO() なし
*Coupler() なし
*Curve() AMPLITUDE
*CVJoint() Constant_Velocity
*CylJoint() Cylindrical
*FixedJoint() Rigid_Bodies
*Graphic() なし
*HookeJoint() ユニバーサル
*InlineJoint() Trans+D.B.+Sph
*InplaneJoint() Planar+D.B.+Univ
*Marker()  
*Motion() Constrained_Joint#_Motor
*OrientJoint() Trans+D.B.+Tran+D.B.+Trans
*Output() なし
*ParallelAxisJoint() Planar+D.B.+Trans
*PerpAxisJoint() Cyl+D.B.+Planar
*PlanarJoint() Planar
*Polybeam() なし
*RevJoint() 回転
*SetFlexbodyComplaince() n/a
*SolverArray() なし
*SolverDiffEquation() なし
*SolverString() なし
*SolverVariables() なし
*TorsionSpring() なし
*TransJoint() 並進
*UniversalJoint() ユニバーサル

MDL CommandSetのマッピング

DYNAソルバーにCommandSetは適用されません。

Templexテンプレートとソルバーモード

Templexテンプレートは、必要であればパラメトリック置換を含め、構文をソルバー入力デックに直接エクスポートするために使用することができます。LS-DYNAの場合、ソルバーの入力デックでシンタックスが占める位置に対する依存性があります。以下に挙げる4つのキーワードを使用して追加のテキストを配置できます。これらのキーワードは、Templexテンプレートの最初の行に含まれていなければなりません。テンプレートの残りのテキストは、指定された位置に従って書き出されます。
<@ABAQ/MODEL/HEAD>
モデルデータの先頭に記述するテキストを指定します。
<@ABAQ/MODEL/TAIL>
モデルデータの末尾を指定します。
<@ABAQ/HISTO/HEAD>
履歴データの先頭を指定します。
<@ABAQ/HISTO/TAIL>
履歴データの末尾を指定します。
solvermode
1つのMDLモデルを複数のソルバーへのエクスポートに使用できます。この場合、solvermodeで予約されているキーワードを使用してTemplexテンプレートのインスタンスを作成します。これを行うには、以下の2つの方法があります:
例えば、次のように記述したMDLモデルがあるとします。
if( solvermode == "DYNA" )

 *Template(.....1...)

else

 *Template(.....2...)

endif
これによって、SolversメニューでDYNAを選択すると、Template 1の全体が使用されます。別のソルバーを選択すると、Template 2が使用されます。何らかのテンプレートを使用すると、それがTemplatesパネルのインターフェースに表示され、ソルバーの入力デックを保存するときに機能します。
これらのキーワードを使用するには、必要な文字列をテンプレートの先頭行に記述します。例えば、次のように記述したMDLモデルがあるとします。
*DefineTemplate(........)

 <@DYNA/MODEL/HEAD>

 text for dyna

*EndDefine()
これによって、ソルバーとしてDYNAを選択すると、“text for dyna”が入力デックにエクスポートされます。テンプレートのうち、ユーザーインターフェースに表示される部分についても同様の処理が適用されます。

テンプレートのタイプ

Templexテンプレートには、独自のデフォルト動作と並んで、いくつかの出力先を設定できます。
  • USERテンプレートはどのようなソルバーファイルにもエクスポートできませんが、パラメータ記述によるテキストを他のファイルに配置する場合や(TemplexのOpenコマンドとCloseコマンドを使用します)、GUI専用としたテキストを扱う場合などに使用できます。
  • SOLVER_INPUTテンプレートでは、そのテンプレートのテキストがDYNAの.keyファイルにエクスポートされます。
  • 次の各テンプレートはDYNAソルバーには適用されません。
    • SOLVER_PARAM
    • GRAPHICS
    • ADAMS
    • ACF

関数式

MotionViewでは、その多くのエンティティで関数式をサポートしています。これらの関数は、時間と状態変数の関数とすることができます。関数式に対応するソルバーエンティティの一部として直接エクスポートされる関数式を作成できます。

ソルバーでは、MotionViewでエクスポートされるシンタックスを扱う必要があるので、その中立性にはある程度の制限があります。DYNAソルバーの場合、サポートされている式とカーブは時間の関数とする必要があります。2つのポイント間の軸方向距離の関数とした式もサポートされています。MotionViewでは、このような関数がX座標とY座標のペアに変換されて入力デックで使用できるようになります。

弾性体 / サブストラクチャ

DYNAでは弾性体をサポートしていません。

ユーザーサブルーチン

DYNAにはユーザーサブルーチンが適用されません。ユーザーサブルーチンを参照するエンティティは、ソルバーの入力デックへのエクスポートでは使用されません。

MotionViewからのソルバーの起動

MotionViewでは、ソルバーの入力デックをエクスポートした後、プロセスを自動的に起動できます。LS-DYNAについては、インストール環境のaltair/utilities/mbd/launch_scriptsにデフォルトの起動セッションが用意されています。preferences.mvwファイルを使用して、これらの起動セッションを1つ以上登録しておくと、プリファレンスステートメント*RegisterSolverScript()を使用して、そのセッションをRunパネルで選択できます。

ポスト処理

DYNAのポスト処理について以下で説明します。
アニメーション - 剛体のみを使用した過渡解析
剛体モデルのアニメーションはサポートされていません。
プロッティング
剛体モデルによる結果のプロットはサポートされていません。

MotionViewのModel API

MotionViewのModel APIについて簡単に説明します。

Model APIの例に関する情報を入手するには、MotionViewのサポート担当までお問い合わせください。

Model APIは、主にSendOff関数のグループで構成されています。これらの関数は、MDLファイルのモデルデータをソルバーライタープログラムに渡すためのインターフェースとして機能します。API_MDLModelReadconst char *filename)を呼び出すことで、これらの関数がアクティブになります。

SendOff関数の引数を使用してモデルデータが渡されます。これらの関数は、クラス“Model_API”に仮想関数として定義されています。“Model_API”から派生した独自のクラスを定義し、渡すデータをその派生クラスで扱う必要があります。実働の例では、この関係は透過的です。

現在のところ、仮想関数にある問い合わせ関数API_InquiryFlexBodySendOffOptionの1つのみです。この関数は、ユーザーが選択したデータをAPIに返します。問い合わせ関数とAPI_MDLModelReadを除く他のすべてのAPI関数は、ユーザーにデータを送信する一方向でのみ動作します。

SendOff関数のリストを持つModel_APIクラスを次に示します。関数の名前は、その機能を表すものになっています。
class MODEL_API Model_API

{

public:

 

 bool API_MDLModelRead(const char *filename);

 bool API_MDLModelRead(MDL *user_mdl);

 static ostream &(* apiOut)();

 

private:

 

 bool _API_MDLModelRead(MDL *user_mdl, const char *filename);

 

// #1

 virtual void API_SendOffModelUnit(const char* force_unit, const char* length_unit,

         const char* mass_unit, const char* time_unit) {}

// #2

 virtual void API_SendOffGravityVector(const double gravity_x, const double gravity_y,

         const double gravity_z) {}

// #3        

 virtual void API_SendOffMarker(const int num_marker, const int idx,

         const int id, const int body_id, const int node_id,

         const double x,   const double y,   const double z,

         const double a00, const double a01, const double a02,

         const double a10, const double a11, const double a12,

         const double a20, const double a21, const double a22) {}

// #4        

 virtual void API_SendOffRigidBody(const int num_rigid_body, const int idx,

         const int id, const bool IsGround,

         const int cg_id, const int im_id, const int lprf_id,

         const double mass, const double ixx, const double iyy, const double izz,

         const double ixy,  const double iyz, const double ixz,

         const double vx,   const double vy,  const double vz,

         const double wx,   const double wy,  const double wz) {}

// #5

 // option: <=0    -> gloabal property (rigid body property only)

 //       :   1    -> SIMPACK SID_FEM file along with other info

 //       :   2    -> DADS fdf file along with other info

 //       :   3    -> ADAMS mtx file along with other info

 //       :   4    -> MADYMO dat file along with other info

 //       : >=5    -> modal matrix info (nodal mass, node position,

 //                   translational mode shapes, rotational mode shapes,

 //                   diagonal of modal stiffness matrix)

 virtual int API_InquiryFlexBodySendOffOption(const int num_flex_body,const int idx,

         const int id) {return 999999;}

// #6        

 virtual void API_SendOffFlexBodyGlobalProperty(const int num_flex_body, const int idx,

         const int id, const int lprf_id, const double mass,

         const double cm_x, const double cm_y, const double cm_z,

         const double ixx, const double iyy, const double izz,

         const double ixy,  const double iyz, const double ixz,

         const double vx,   const double vy,  const double vz,

         const double wx,   const double wy,  const double wz) {}

// #7        

 virtual void API_SendOffFlexBody(const int num_flex_body, const int idx,

         const int id, const int lprf_id, const char* h3d_file,

const char* fdf_file, const int sel_mode_count,

         const int *sel_mode, const double *mode_freq, const double *cdamp_ratio,

         const double *DMode, const double *VMode,

         const double vx,   const double vy,  const double vz,

         const double wx,   const double wy,  const double wz) {}

// #8

 virtual void API_SendOffNodeInfo(const int num_flex_body, const int idx,

         const int id, const int num_nodes, const int *node_id,

         const double *node_position_x, const double *node_position_y,

const double *node_position_z,

         const double *node_mass, const int HasNodeInertia) {}

// #9        

 virtual void API_SendOffNodeInertia(const int num_flex_body, const int idx,

         const int id, const int num_nodes,

         const double *ixx,  const double *iyy, const double *izz,

         const double *ixy,  const double *iyz, const double *ixz) {}

// #10        

 virtual void API_SendOffOrthogonalizedModeInfo(const int num_flex_body, const int idx,

         const int id, const int num_modes, const int mode_idx, const int mode_id, const double frequency,

         const double modal_stiffness, const double modal_mass, const int num_nodes,

         const double *modeshape_x, const double *modeshape_y, const double *modeshape_z,

         const double *modeshape_rx, const double *modeshape_ry, const double *modeshape_rz) {}

// #11        

 virtual void API_SendOffBallJoint(const int num_ball_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #12        

 virtual void API_SendOffFixedJoint(const int num_fixed_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #13        

 virtual void API_SendOffRevJoint(const int num_rev_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #14        

 virtual void API_SendOffTransJoint(const int num_trans_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #15        

 virtual void API_SendOffCylJoint(const int num_cyl_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #16        

 virtual void API_SendOffUnivJoint(const int num_univ_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #17        

 virtual void API_SendOffInlineJoint(const int num_inline_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #18        

 virtual void API_SendOffOrientationJoint(const int num_orientation_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #19        

 virtual void API_SendOffCVJoint(const int num_convel_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #20

 virtual void API_SendOffPerpendicularJoint(const int num_perpendicular_joint,

         const int idx,

         const int id, const int i_marker_id, const int j_marker_id, const int body1_id,

         const int body2_id) {}

// #21        

 virtual void API_SendOffInplaneJoint(const int num_inplane_joint,

         const int idx, const int id,

         const int i_marker_id, const int j_marker_id, const int body1_id,

         const int body2_id) {}

// #22        

 virtual void API_SendOffPlanarJoint(const int num_planar_joint,

         const int idx, const int id,

         const int i_marker_id, const int j_marker_id, const int body1_id,

         const int body2_id) {}

// #23        

 virtual void API_SendOffParallelAxesJoint(const int num_par_axes_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #24        

 virtual void API_SendOffThreeJointCoupler(const int num_three_joint_coupler,

         const int idx, const int id,

         const int i_marker_id_joint1,  const int j_marker_id_joint1,

         const int body1_id_joint1,  const int body2_id_joint1,

         const char joint_type_joint1,

         const int i_marker_id_joint2,  const int j_marker_id_joint2,

         const int body1_id_joint2,  const int body2_id_joint2,

         const char joint_type_joint2,

         const int i_marker_id_joint3,  const int j_marker_id_joint3,

         const int body1_id_joint3,  const int body2_id_joint3,

         const char joint_type_joint3,

         const double ratio1, const double ratio2) {}

// #25        

 virtual void API_SendOffTwoJointCoupler(const int num_two_joint_coupler,

         const int idx, const int id,

         const int i_marker_id_joint1,  const int j_marker_id_joint1,

         const int body1_id_joint1,  const int body2_id_joint1,

         const char joint_type_joint1,

         const int i_marker_id_joint2,  const int j_marker_id_joint2,

         const int body1_id_joint2,  const int body2_id_joint2,

         const char joint_type_joint2,

         const double ratio) {}

// #26        

 virtual void API_SendOffConstantJointMotion(const int num_expr_motion,

         const int idx,

         const int id, const int joint_id, const char joint_type,

         const char motion_type, const double val) {}

// #27        

 virtual void API_SendOffExpressionJointMotion(const int num_expr_motion,

         const int idx,

         const int id, const int joint_id, const char joint_type,

         const char motion_type, const char *motion_expr) {}

// #28        

 virtual void API_SendOffCurveJointMotion(const int num_curve_motion,

         const int idx, const int id,

         const int joint_id, const char joint_type, const char motion_type,

         const char *interpol_type, const int curve_id) {}

 

// #29

 virtual void API_SendOffLinearTranslationalSpringDamper(const int num_lin_tsd,

         const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const double length, const double stiffness, const double damping,

         const double preload) {}

// #30

 virtual void API_SendOffGeneralTranslationalSpringDamper(

         const int num_general_tspdp, const int idx, const int id,

         const int i_marker_id,const int j_marker_id,const int body1_id,

         const int body2_id,const double length,

         const int is_k_expression, const char *k_expression,

         const int is_c_expression, const char *c_expression,

         const int is_k_curve, const char *k_interpol_type,

         const char *k_indep_var, const int k_curve_id,

         const int is_c_curve, const char *c_interpol_type,

         const char *c_indep_var, const int c_curve_id) {}        

// #31

 virtual void API_SendOffLinearRotationalSpringDamper(const int num_lin_rsd,

         const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const double length, const double stiffness, const double damping,

         const double preload) {}

// #32

 virtual void API_SendOffGeneralRotationalSpringDamper(

         const int num_general_rspdp, const int idx, const int id,

         const int i_marker_id,const int j_marker_id,const int body1_id,

         const int body2_id,const double length,

         const int is_k_expression, const char *k_expression,

         const int is_c_expression, const char *c_expression,

         const int is_k_curve, const char *k_interpol_type,

         const char *k_indep_var, const int k_curve_id,

         const int is_c_curve, const char *c_interpol_type,

         const char *c_indep_var, const int c_curve_id) {}

// #33

 virtual void API_SendOffBeam(const int num_beam, const int idx,

         const int id, const int i_marker_id,

         const int j_marker_id, const int body1_id, const int body2_id,

         const double length, const double E, const double G, const double area,

         const double ixx, const double iyy, const double ASY, const double ASZ,

         const double cratio) {}        

 

// #34        

 virtual void API_SendOffLinearBushing(const int num_lin_bush,

         const int idx, const int id,

         const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const double kx, const double cx, const double preload_x,

         const double ky, const double cy, const double preload_y,

         const double kz, const double cz, const double preload_z,

         const double ktx, const double ctx, const double preload_tx,

         const double kty, const double cty, const double preload_ty,

         const double ktz, const double ctz, const double preload_tz) {}

// #35

 virtual void API_SendOffGeneralBushing(const int num_general_bush,

         const int idx, const int id,

         const int i_marker_id,const int j_marker_id,

         const int body1_id,const int body2_id,                

         const int is_kx_expression, const char *kx_expression,

         const int is_cx_expression, const char *cx_expression,

         const int is_kx_curve, const char *kx_interpol_type,

         const char *kx_indep_var, const int kx_curve_id,

         const int is_cx_curve, const char *cx_interpol_type,

const char *cx_indep_var, const int cx_curve_id,                

         const int is_ky_expression, const char *ky_expression,

const int is_cy_expression, const char *cy_expression,

         const int is_ky_curve, const char *ky_interpol_type,

const char *ky_indep_var, const int ky_curve_id,

         const int is_cy_curve, const char *cy_interpol_type,

const char *cy_indep_var, const int cy_curve_id,                        

         const int is_kz_expression, const char *kz_expression,

         const int is_cz_expression, const char *cz_expression,

         const int is_kz_curve, const char *kz_interpol_type,

         const char *kz_indep_var, const int kz_curve_id,

         const int is_cz_curve, const char *cz_interpol_type,

         const char *cz_indep_var, const int cz_curve_id,                

         const int is_ktx_expression, const char *ktx_expression,

         const int is_ctx_expression, const char *ctx_expression,

         const int is_ktx_curve, const char *ktx_interpol_type,

         const char *ktx_indep_var, const int ktx_curve_id,

         const int is_ctx_curve, const char *ctx_interpol_type,

         const char *ctx_indep_var, const int ctx_curve_id,        

         const int is_kty_expression, const char *kty_expression,

         const int is_cty_expression, const char *cty_expression,

         const int is_kty_curve, const char *kty_interpol_type,

         const char *kty_indep_var, const int kty_curve_id,

         const int is_cty_curve, const char *cty_interpol_type,

         const char *cty_indep_var, const int cty_curve_id,

         const int is_ktz_expression, const char *ktz_expression,

         const int is_ctz_expression, const char *ctz_expression,

         const int is_ktz_curve, const char *ktz_interpol_type,

         const char *ktz_indep_var, const int ktz_curve_id,

         const int is_ctz_curve, const char *ctz_interpol_type,

         const char *ctz_indep_var, const int ctz_curve_id) {}

 

// #36

 virtual void API_SendOffActionOnlyConstantForce(

         const int num_action_only_const_force, const int idx,

         const int id, const int i_marker_id, const int ref_marker_id,

         const int body_id, const int ref_body_id,

         const double fx, const double fy, const double fz) {}

// #37

 virtual void API_SendOffActionOnlyConstantTorque(

         const int num_action_only_const_torque, const int idx,

         const int id, const int i_marker_id,

         const int ref_marker_id, const int body_id, const int ref_body_id,

         const double tx, const double ty, const double tz) {}

// #38

 virtual void API_SendOffActionReactionConstantForce(

         const int num_action_reac_const_force, const int idx,

         const int id, const int i_marker_id,

         const int j_floating_marker_id, const int ref_marker_id,

         const int body1_id, const int body2_id, const int ref_body_id,

         const double fx, const double fy, const double fz) {}

// #39

 virtual void API_SendOffActionReactionConstantTorque(

         const int num_action_reac_const_torque, const int idx,

         const int id, const int i_marker_id,

         const int j_floating_marker_id, const int ref_marker_id,

         const int body1_id, const int body2_id, const int ref_body_id,

         const double tx, const double ty, const double tz) {}

// #40

 virtual void API_SendOffConstantScalarForce(

         const int num_const_scalar_force, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id, const double force) {}

// #41

 virtual void API_SendOffConstantScalarTorque(

         const int num_const_scalar_torque, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id, const double torque) {}

// #42

 virtual void API_SendOffActionOnlyGeneralForce(

         const int num_action_only_const_force, const int idx,

         const int id, const int i_marker_id,

         const int ref_marker_id, const int body_id, const int ref_body_id,

         const int is_fx_expression, const char *fx_expression,

         const int is_fy_expression, const char *fy_expression,

         const int is_fz_expression, const char *fz_expression,

         const int is_fx_curve, const char *fx_interpol_type,

         const char *fx_indep_var, const int fx_curve_id,

         const int is_fy_curve, const char *fy_interpol_type,

         const char *fy_indep_var, const int fy_curve_id,                

         const int is_fz_curve, const char *fz_interpol_type,

         const char *fz_indep_var, const int fz_curve_id) {}

// #43

 virtual void API_SendOffActionOnlyGeneralTorque(

         const int num_action_only_general_torque, const int idx,

         const int id, const int i_marker_id,

         const int ref_marker_id, const int body_id, const int ref_body_id,

         const int is_tx_expression, const char *tx_expression,

         const int is_ty_expression, const char *ty_expression,

         const int is_tz_expression, const char *tz_expression,

         const int is_tx_curve, const char *tx_interpol_type,

         const char *tx_indep_var, const int tx_curve_id,

         const int is_ty_curve, const char *ty_interpol_type,

         const char *ty_indep_var, const int ty_curve_id,                

         const int is_tz_curve, const char *tz_interpol_type,

         const char *tz_indep_var, const int tz_curve_id) {}

// #44

 virtual void API_SendOffActionReactionGeneralForce(

         const int num_action_reac_general_force, const int idx,

         const int id, const int i_marker_id,

         const int j_floating_marker_id, const int ref_marker_id,

         const int body1_id, const int body2_id, const int ref_body_id,

         const int is_fx_expression, const char *fx_expression,

         const int is_fy_expression, const char *fy_expression,                

         const int is_fz_expression, const char *fz_expression,

         const int is_fx_curve, const char *fx_interpol_type,

         const char *fx_indep_var, const int fx_curve_id,

         const int is_fy_curve, const char *fy_interpol_type,

         const char *fy_indep_var, const int fy_curve_id,                

         const int is_fz_curve, const char *fz_interpol_type,

         const char *fz_indep_var, const int fz_curve_id) {}

// #45

 virtual void API_SendOffActionReactionGeneralTorque(

         const int num_action_reac_general_torque, const int idx,

         const int id, const int i_marker_id,

         const int j_floating_marker_id, const int ref_marker_id,

         const int body1_id, const int body2_id, const int ref_body_id,

         const int is_tx_expression, const char *tx_expression,

         const int is_ty_expression, const char *ty_expression,                

         const int is_tz_expression, const char *tz_expression,

         const int is_tx_curve, const char *tx_interpol_type,

         const char *tx_indep_var, const int tx_curve_id,

         const int is_ty_curve, const char *ty_interpol_type,

         const char *ty_indep_var, const int ty_curve_id,                

         const int is_tz_curve, const char *tz_interpol_type,

         const char *tz_indep_var, const int tz_curve_id) {}

// #46

 virtual void API_SendOffGeneralScalarForce(

         const int num_general_scalar_force, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const int is_force_expression, const char *force_expression,

         const int is_force_curve, const char *force_interpol_type,

         const char *force_indep_var, const int force_curve_id) {}

// #47

 virtual void API_SendOffGeneralScalarTorque(

         const int num_general_scalar_torque, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const int is_torque_expression, const char *torque_expression,

         const int is_torque_curve, const char *torque_interpol_type,

         const char *torque_indep_var, const int torque_curve_id) {}

 

// #48        

 virtual void API_SendOffXYCurveData(const int num_curve,

         const int idx, const int id,

         const int num_xy_pair, const double *x_val, const double *y_val) {}

// #49

 virtual void API_SendOffTemplate(const int num_template,

         const int idx, const char *text) {}

};

MotionViewのResult API

MotionViewのResult APIについて簡単に説明します。

Result APIの例に関する情報を入手するには、MotionViewのサポート担当までお問い合わせください。

Model APIは、主にmrf関数のグループで構成されています。これらの関数は、ソルバーからResult APIに結果データを渡します。これらの関数のほとんどで、Open関数とClose関数のペアが必要です。

Register関数は、アニメーション化できる履歴データを伴っている必要があります。この履歴データとして、剛体の位置と方向や弾性体のモーダル寄与率などがあります。剛体や弾性体などのタイプをアニメーションオブジェクトとして登録した場合は、この関数を使用してそのコンポーネントを作成する必要があります。
int mrfCreateElement(const char *element_name, const int element_id);
この場合は、“IDを持たない”形式のコンポーネントの代わりに作成します。
int mrfCreateElement(const char *element_name, const int element_id)

その理由は、結果データとモデルオブジェクトがIDでリンクしているからです。

剛体のアニメーションにタイプを登録する場合は、そのタイプのコンポーネントで登録の先頭に置くいくつかを、ヘッダーファイルに定義された順序に従って指定する必要があります。剛体の方向はオイラーパラメーターで定義します。

Result API関数のリストを記述したヘッダーファイルを以下に示します。関数の名前は、その機能を表すものになっています。
int mrfOpenResult(const float start_time,const float end_time, int num_time_steps);

int mrfCloseResult(int flag=0);

int mrfOpenResultHeader(const char *mrf_fliename, const char *abf_filename, const char *tab_filename);

int mrfCloseResultHeader(void);

int mrfCreateDataType(const char *type_name);

int mrfOpenDataTypeByIndex(const int type_idx);

int mrfOpenDataTypeByName(const char* type_name);

int mrfRegisterForTabulatedOutput(void);

int mrfRegisterForRigidBodyAnimation(void);

/*           x,y,z,e0,e1,e2,e3        

*/

int mrfRegisterNoGroundBody(void);

/* by default, the api assumes that the first rigid body is the ground body

  and its time history is discarded because they are time-invariant.

  If in your model there is no ground body or you do not want to make the

  ground body the first one in the rigid body element list, then you have

  to call this function.

*/

int mrfRegisterForModalFlexBodyAnimation(const int num_modal_coords);

/*           x,y,z,e0,e1,e2,e3        

    all followed by modal coordinates q1, q2, ....

*/

int mrfRegisterForAbsNodalFlexBodyAnimation(const int num_nodes);

/*     x1,x2,...,xn,y1,y2,...,yn,z1,z2,...,zn where n=num_nodes  */

int mrfCloseDataType(void);

int mrfCreateComponent(const char *component_name);

int mrfCreateElement(const char *element_name);

int mrfCreateElement(const char *element_name, const int element_id);

int mrfOpenTimeStep(const float time);

int mrfCloseTimeStep(void);

int mrfMoveToElementByIndex(const int element_idx);

int mrfMoveToElementByName(const char *element_name);

int mrfPutComponentData(const float *component_data);

簡単なソルバーでこのAPI関数を使用した実用例と、その使用方法に関するコメントを以下に示します。

このAPI関数を適切に配置したソルバーコードの例を以下に示します。
int main(int argc, char *argv[])

{

////////////// Read Model /////////////////////////////////////

 model_data model;

 ReadModel(argc, argv, &model);

 

////////////// Populate Header /////////////////////////////////////

 

 mrfOpenResult(0.0f, (float)model.tend, model.num_steps);

 mrfOpenResultHeader("balls.mrf", "balls.abf", "balls.tab");

 mrfCreateDataType("Rigid Body");

 mrfCreateDataType("System");

 

 mrfOpenDataTypeByName("Rigid Body");

 mrfRegisterForRigidBodyAnimation();

 mrfRegisterNoGroundBody();

 mrfRegisterForTabulatedOutput();

 mrfCreateComponent("x");

 mrfCreateComponent("y");

 mrfCreateComponent("z");

 mrfCreateComponent("e0");

 mrfCreateComponent("e1");

 mrfCreateComponent("e2");

 mrfCreateComponent("e3");        

 mrfCreateComponent("xd");

 mrfCreateComponent("yd");

 mrfCreateComponent("zd");

 mrfCreateComponent("xdd");

 mrfCreateComponent("ydd");

 mrfCreateComponent("zdd");

 mrfCloseDataType();

 

 mrfOpenDataTypeByName("System");

 mrfRegisterForTabulatedOutput();

 mrfCreateComponent("Potential");

 mrfCreateComponent("Kinetic");

 mrfCreateComponent("Total");

 mrfCloseDataType();

 

 int body_idx;

 

 mrfOpenDataTypeByIndex(0);

 for (body_idx=0;body_idx<model.num_balls;body_idx++)

 

         char name[20];

         sprintf(name,"Ball %i",body_idx+30102);

         mrfCreateElement(name, body_idx+30102);

 }

 mrfCloseDataType();

 

 mrfOpenDataTypeByIndex(1);

 mrfCreateElement("Energy");

 mrfCloseDataType();

 mrfCloseResultHeader();

 

 double *psi = new double [model.num_balls];

 double *dis = new double [model.num_balls];

 for (body_idx=0;body_idx<model.num_balls;body_idx++)

 

         dis[body_idx] = sqrt(model.x[body_idx]*model.x[body_idx]+

model.y[body_idx]*model.y[body_idx]);

         psi[body_idx] = asin(model.y[body_idx]/dis[body_idx]);

 }

 

 double step_size = model.tend/model.num_steps;

 double time=0;

 float q[13];

 float energy[3];

 

 for (int time_idx=0;time_idx<=model.num_steps;time_idx++,time+=step_size)

 

         memset(energy,0,3*sizeof(float));

         printf(" Time = %13.6E\n",time);

 

         mrfOpenTimeStep((float)time);

 

         mrfOpenDataTypeByIndex(0);

         for (body_idx=0;body_idx<model.num_balls;body_idx++)

         

                 mrfMoveToElementByIndex(body_idx);                        

                 q[0] = (float)(dis[body_idx]*cos(2*pi*model.freq*time+psi[body_idx]));

                 q[1] = (float)(dis[body_idx]*sin(2*pi*model.freq*time+psi[body_idx]));

                 q[2] = (float)(model.z[body_idx]);

                 q[3] = 1;

                 q[4] = 0;

                 q[5] = 0;

                 q[6] = 0;

 

                 q[7] = (float)(-dis[body_idx]*sin(2*pi*model.freq*time+

psi[body_idx])*2*pi*model.freq);

                 q[8] = (float)( dis[body_idx]*cos(2*pi*model.freq*time+

psi[body_idx])*2*pi*model.freq);

                 q[9] = 0;

 

                 energy[0] += 0.5f*(q[3]*q[3] + q[4]*q[4] + q[5]*q[5]);

                 energy[1] += 9.8f*q[2];

 

                 q[10] = (float)(-dis[body_idx]*cos(2*pi*model.freq*time+

psi[body_idx])*2*pi*model.freq*2*pi*model.freq);

                 q[11] = (float)(-dis[body_idx]*sin(2*pi*model.freq*time+

psi[body_idx])*2*pi*model.freq*2*pi*model.freq);

                 q[12] = 0;

                 mrfPutComponentData(q);

         }

         mrfCloseDataType();

 

         mrfOpenDataTypeByIndex(1);

         mrfMoveToElementByIndex(0);

         energy[2] = energy[0] + energy[1];

         mrfPutComponentData(energy);

         mrfCloseDataType();

 

         mrfCloseTimeStep();

 }

 

 mrfCloseResult();

 return 0;

}