CM2 FEM® Engines /release 5.0.0

by | Aug 12, 2020

  • 5.0.0.
  • August, 2020.
  • All CM2 FEM® Engines.


  • Major version. Due to changes in the API, client applications must be recompiled against the new headers.
  • Lib names suffix is _50 for this series (unified with CM2 MeshTools).
  • Port to gcc 10 and clang 10 with new builds (Linux 32/64 and macOS).
  • LInux gcc 5.3 builds removed.
  • Visual Studio 2010 and gcc 4.8 are deprecated and will be no longer supported in future versions.

/new features

All solvers

  • So far solver_static_linear was able to compute and export right-hand sides (with settings_type::rhs_loads_only_flag). solver_modal was able to compute and export diagonal mass matrix (with settings_type::mass_matrix_only_flag).
    To import them back it was necessary to use the loads manager (for the RHS) and a mass_diag (for the diagonal matrices).
    Consistent mass matrices could not be exported nor stiffness matrices (factorized or not). Neither imported.
    With this release, all solvers are now able to export and import these partial results: RHS, global mass matrices (lumped or consistent) and stiffness matrices (factorized or not). Exported/imported global matrices use the new symmetric_sparse matrix class of the CM2 Math1 library (Compact-Storage Scheme CRS) and can be saved to disk and loaded back. You can now use the CM2 solvers to compute for instance the global K matrix and the RHS and rely on an external solver to solve the linear system. Conversely you can import RHS and/or K, M, D matrices to have the system solved by a CM2 solver.
    You can also now ‘dry-run’ the solvers: only the number of active DOFs and the expected memory sizes of the matrices are computed.
    These partial computations are controlled by the new settings_type::inputs_code and settings_type::outputs_code, unified among all solvers. They replace the specialized settings such as rhs_loads_only_flag or mass_matrix_only_flag.


  • New solver_heat_dynamic_linear for linear transient thermal analysis (theta-method for the time integration).
  • New thermal models (model_heat_capacity_1d, model_heat_capacity_2d, model_heat_capacity_3d and numerical_model_heat_capacity).
    All types of elements are supported (1-D, 2-D, 3-D, linear and quadratic).

rigid_body_lin, rigid_body_gnl

  • New thermal expansion parameter (alpha).
    Note also that the R_coupling parameter doesn’t default to true anymore.


  • New elementary_load::HYDRO for hydrostatic pressures (defined as reference pressure at z = 0, a gradient of pressure along Z and a bracketing Z-range).
    The pressure is always in the normal direction (local) and the gradient of pressure is always along the global Z direction.


  • New data_type::min_dynamic_RPs: minimum acceptable dynamic participation ratios (load case by load case).
    The actual ratio considered for load case j is the lowest between settings_type::min_dynamic_PR (the global default) and min_dynamic_PRs[j] if any.
    Leave empty to apply the default settings_type::min_dynamic_PR ratio to all load cases as before.


  • Now accepts data_type::initials FEM states similarly to solver_reactions, solver_stress_1d and solver_least_squares.
    When initials is not empty, inputs are considered as linear perturbations over initials.
    Useful for non-linear models only.

FEM_matrix, FEM_Zmatrix

  • New member as_raw_matrix to get direct view to the underlying DoubleMat (resp. DoubleZMat) matrix. Experienced users only.
  • New member is_all_incore to check the in-core state of a matrix.
  • New member force_incore to force a matrix to be fully in-core.


  • New constructors with 2, 3 or 4 numerical model IDs.
  • New members size, get_NM_ID, get_NM_IDs, get_NM.

All classes

  • All cm2::fem classes are now equipped with a type_code member that gives a unique type ID, similar to typeid(T).hash_code(), suitable for dynamic type testing.


All solvers

  • Minor speed-ups on multi-core CPUs in the factorization step (up to 10 %).
  • Lots of minor streamlinings and fewer allocations of temporaries giving some noticeable speed-ups and less fragmented memory.
    This benefits mostly to post-processors (solver_least_squares, solver_reactions, solver_stress_1d, post_processor_1d).

solver_modal, solver_modal_ldrv, solver_modal_gyroscopic, solver_buckling_Euler, solver_condensation_static

  • Reduced memory consumption and speed-ups (10 – 20 %) by using the new symmetric_sparse matrix type for the mass matrix (only with FEM_CONSISTENT_MATRIX), the gyroscopic damping matrix and the geometric stiffness matrix.


  • Now properly OMP-parallelized.


  • Some improvements (data_type::dynamic_PR now on free DOFs only + speed-ups and stability).


  • Significant speed-ups.

block_stops, contact_plane, contact_cylinder, contact_sphere, rigid_body_lin, rigid_body_gnl

  • Speed-ups and reduced memory consumption.


All solvers

  • Thermal loads manager was lost in FEM_states when the solution had no active DOF (all-clamped problem).


  • Fixed behaviour with settings::update = NONE.
  • Fixed inaccurate elastic energy at each iteration.
    The elastic energy passed to the watch handler and used in the convergence criterion is now the energy upon entry of each iteration (except for the very first iteration where the delta energy is used instead).

All solvers (especially solver_least_squares and solver_reactions)

  • Speed regressions in 4.4.0 when many numerical models (had a quadratic complexity with respect to the number of models).


  • bases_mgr::create_cylindrical: major bug (leading to wrong numerical results).

solver_modal, solver_modal_ldrv

  • Bug with mass_sym elements extending outside of the global K stiffness matrix profile, leading to erratic numerical results or even crashes.


  • Didn’t work with inherited member law_base::get_data and law_base::set_element_by_element.

All classes

  • The RTTI info was bogus. Now all cm2::fem classes are equipped with a member such as size_t type_code() const (overridden classes) or static size_t type_code() (final classes) that gives a unique type ID (similar to typeid(T).hash_code()).

/breaking changes


  • Class removed (was deprecated in 4.4). Use solver_least_squares instead.


  • settings_type::rhs_loads_only_flag superseded by settings_type::inputs_code and settings_type::outputs_code.

solver_modal, solver_modal_ldrv

  • settings_type::mass_matrix_only_flag superseded by settings_type::inputs_code and settings_type::outputs_code.

rigid_body_lin, rigid_body_gnl

  • New thermal expansion parameter (alpha) in the init method.
  • The R_coupling parameter doesn’t default to true anymore.

cable, cable_rigid

  • Names changed into pulley and pulley_rigid. Former names are deprecated (still usable for now).