CM2 FEM® SDK /release 5.1.0

by | Oct 18, 2021

  • 5.1.0
  • October, 2021.
  • All CM2 FEM® SDK.
  • Major release of the CM2 FEM® SDK.
  • Due to changes in the API, client applications must be recompiled against the new headers.


  • Major version. Due to changes in the API, client applications must be recompiled against the new headers.
  • Lib names suffix is _51 for this series.
  • Win32 and Linux x86 (32-bit) builds are deprecated and will no longer be supported in future versions.
  • Visual Studio 2012 and GCC 6.1 are deprecated and will no longer be supported in future versions
    (Visual Studio 2010 and GCC 4.8 builds will remain for some times as legacy builds).

/new features

solver_static_linear, solver_heat_static_linear

  • Augmented Lagrange Method (ALM) to enforce more precisely the constraints (link, link_directional, rigid_body_lin…)
    The constraints are satisfied by still applying a high penalty stiffness but much lower than with the Pure Penalty Method (PPM), together with a few correction iterations.
    Pros: The constraints are satisfied accurately and the condition numbers of the global stiffness matrices remain reasonable.
    Cons: Needs some additional iterations, internal forces (i.e. reactions) inside the constraints are null (replaced with intern Lagrange multipliers).
    ALM is enabled by default but can be disabled and return to PPM with settings_type::method_code = 0.

solver_modal, solver_modal_ldrv

  • New settings_type::sort_modes_by_PF_flag to sort the dynamic modes by decreasing effective participation factor (most effective modes first).
    Defaults to sort_modes_by_PF_flag = false (lowest frequencies first as before).


  • Can now smooth Tresca equivalent stresses on nodes with the new FEM_NODES_TRESCA setting.
  • Can also now smooth signed Tresca with the FEM_NODES_TRESCA_SIGNED (signed with the sign of the trace of the stress tensors).
  • Now works also on FEM_NODES_VON_MISES_SIGNED (signed with the sign of the trace of the stress tensors).
    Note that signed Tresca and Von Mises stresses can flip between positive and negative values when trace is close to zero.

FEM_matrix, FEM_Zmatrix, FEM_states

  • New members push_back and pop_back to append/remove columns and states.

Constitutive laws

  • New unsymmetrical elasto-plastic laws law_scalar_ep_perfect_unsym and law_scalar_ep_piecewise_linear_unsym.
    These scalar laws are made of two elasto-plastic laws, one for traction (positive strains) and one for compression (negative strains).
    The laws are of the same class (both law_scalar_ep_perfect or both law_scalar_ep_piecewise_linear) but can have different diagrams (data) and state limits.
  • law_scalar_nl, law_spring_nl, pulley_rigid: new sigmoid smoothing (controlled by a new lambda parameter) to make the diagrams continuous and derivable (thus helping the Newton algorithm).
  • Data vectors and matrices are now checked for sanity (using vecscal::isfinite and matscal::isfinite) upon laws’ construction.


  • UNIFORM and TRAPEZE momentums are now allowed on linear 2-node beams (used to be silently discarded).
    These distributed momentums give however only approximative results (exact for UNIFORM and TRAPEZE forces, exact also for PUNCTUAL forces and momentums).


  • New get_max_penalty_factor and set_max_penalty_factor (default = DBL_MAX). Experienced users only.


  • In numerical_model_base::set_relaxations: new output parameters unsigned& fictitious0 and unsigned& fictitious1 to access the underlying fictitious nodes.
    For the same purpose, fem::hinge is now equipped with new members unsigned get_fictitious0() const and unsigned get_fictitious1() const.
  • New functions Tresca_stress and Tresca_stresses with optional parameter signed_flag (default = false).
  • Portage to GCC 11 and Clang 13.
  • Source code ported to stdc++17.


All types of models and elements

  • Major optimisations in the computation of elementary matrices and vectors:
    • Speed-ups in the 30-60 % range for model_beam_lin, model_beam_mass, model_beam_gyroscopic with CM2_EDGE2 mesh type.
    • Speed-ups in the 10-30 % range for other models and elements.

elementary_server, solver_reactions

  • Major optimisations (on top of the above improvements in elementary computations).

    Total speed-ups can be massive.

solver_static_linear, solver_heat_static_linear

  • On many load cases, the assembly of RHS is parallelized over load cases instead of within each load case (coarser grain parallelism).
  • On many load cases with different Dirichlet conditions, the resolution of RHS is parallelized over load cases (was single threaded).

All solvers

  • Simpler and more reliable penalty factors.
    Now based on the diagonal terms associated to the penalty DOFs in the global stiffness matrix (instead of a characteristic value based on the constitutive laws’ parameters).
    They are now computed only when penalty models are present (link, link_directional, rigid_body_lin…)
    In addition, these penalty factors are now stored inside the solutions FEM_states to avoid their recomputation.

model_shell_lin, model_shell_gnl

  • Simpler and more reliable artificial drilling stiffness.

    Now based on rotation diagonal terms of the actual elementary stiffness matrices instead of a characteristic value based on the constitutive laws’ parameters (which could be null or irrelevant).



    • Members data_type::Ks and data_type::Ms were inverted.

    solver_static_linear, solver_heat_static_linear

    • Bug with prescribed values on free DOFs in multiple load cases.


    • Wrong output values in data_type::RHS_requested_memory and data_type::outputs_requested_memory.


    • Bad stress diagram with non-linear beam models.
    • Bad stress diagram with rod models (linear and non-linear).


    • Intern parameters of elasto-plastic solid constitutive laws weren’t properly stored.
      This could cause states to be non-equilibrated (leading to wrong restarts, bad reactions…)


    • Doc fixes and clarifications.

    /breaking changes


    • With the new formula for the penalty factors (see above), small numerical differences vs previous versions can be expected (when constraints models are present and Pure Penalty Method is still used).
      The new default minimum penalty factor (now 1, was 1E12) can also cause some numerical differences.

    elementary_server, solver_condensation_static, solver_energy, solver_reactions

    • Parameter reset_penalty_factors removed from the run functions (not needed any more because the penalty factors are passed through the FEM_states inputs parameter and do not need to be recomputed).


    • The Dirichlet boundary conditions loads_mgr::record_nodal_prescribed_value(s) and loads_mgr::record_DOF_prescribed_value(s) are no longer cumulative.
      When several Dirichlet values are associated to the same DOF, the last one prevails (overwrites any previous one).
      The Neumann boundary conditions loads_mgr::record_NM_load, loads_mgr::record_nodal_load and loads_mgr::record_DOF_load(s) remain cumulative.

    law_scalar_nl, law_spring_nl

    • At threshold e_i the stiffness used to be the right value k_i+1.
      Now the value is the _average_ value k(e) = 1/2 (k_i + k_i+1) (even when leaving the default lambda = DBL_MAX, i.e. no smoothing).


    • The offset vector represents the physical position of the mass minus the position of the node (used to be the other way round).

    solver_modal, solver_modal_ldrv, solver_modal_gyroscopic, solver_buckling_Euler

    • Deprecated data fields S_modes, D_modes, B_modes… have been removed.
      Use S_outputs, D_outputs, B_outputs… instead.
    • Deprecated data fields S_modes_requested_memory, D_modes_requested_memory, B_modes_requested_memory… have been removed.
      Use S_outputs_requested_memory, D_outputs_requested_memory, B_outputs_requested_memory… instead.


    • Function compute_3D_stress renamed Cauchy_stresses.
    • Functions compute_stress_invariants renamed stress_invariants.
    • Functions compute_Von_Mises_stress renamed Von_Mises_stress and Von_Mises_stresses.
      They gain the optional parameter signed_flag (default = false) as Tresca_stress and Tresca_stresses to sign with the sign of the trace of the stress tensors.
    • The 3d orthonormal Eigen vectors computed by eigen_pairs are now always positively oriented (trihedral with determinant = +1).