CM2 FEM® Engines /release 4.4.0

by | May 23, 2019

  • 4.4.0
  • May, 2019
  • All CM2 FEM® Engines
  • Major release of the CM2 FEM® Engines
  • Due to changes in the API, client applications must be recompiled against the new headers


  • Lib names suffix is _44 for this series.
  • New Visual Studio 2019 builds (Win32/64).
  • New GCC 7 and GCC 8 builds (Linux32/64).
  • Solvers are now OMP-parallelized on macOS.
  • Now requires run-time type information (RTTI), i.e. option /GR on Visual Studio.
  • Visual Studio < 2010 and GCC < 4.8 are no longer supported (minimum versions raised to Visual Studio 2010 and GCC 4.8).
  • The Visual Studio 2019 builds target Windows 7 or later. Windows XP is still supported for the Visual Studio builds ≤ 2017 but deprecated.
  • macOS < 10.9 is no longer supported (minimum deployment target raised to 10.9 Mavericks).

/new features


  • New elasto-plastic laws (only Prandtl-Reuss types based on Von-Mises criterion and isotropic hardening so far):
    • Scalar laws: fem::law_scalar_ep_perfect, fem::law_scalar_ep_piecewise_linear, fem::law_scalar_ep_power and fem::law_scalar_ep_RambergOsgood.
    • 1-D laws: fem::law_spring_ep_perfect, fem::law_spring_ep_piecewise_linear, fem::law_spring_ep_power and fem::law_spring_ep_RambergOsgood.
    • 3-D laws (also used in plane-strains and axi-3d models): fem::law_solid_ep_perfect, fem::law_solid_ep_piecewise_linear, fem::law_solid_ep_power and fem::law_solid_ep_RambergOsgood.
  • All solvers now manage elasto-plastic states, both from an initial state and to an output state (through the new fem::FEM_states class, see below).
    → Caveat: at present elasto-plastic laws are not thread-safe. You shouldn’t run concurrently several solvers (fem::solver_static_Newton) that change plastic states in shared laws (or duplicate the laws).
  • New class fem::solver_least_squares (superseding the former deprecated fem::solver_stress_nodal) to post-process data on nodes.
    This new class can smooth stresses but also cumulative plasticity, plastic strains, total strains, Von-Mises stress and heat flows (see below).
  • Cumulative plasticity and plastic strains can also be computed on an element-by-element basis with fem::elementary_server.
  • New fem::FEM_states to gather DOF-indexed solutions (similar to fem::FEM_matrix), thermal stress managers and internal states (historic plasticity parameters at integration points) required to reproduce (usually equilibrated) FEM states.
    Because fem::FEM_states publicly inherit from fem::FEM_matrix (and has a conversion constructor), instances of this new class can almost be used anywhere a fem::FEM_matrix used to be required.

Thermal static analysis

  • New thermal models fem::model_heat_conduction_1d, fem::model_heat_conduction_2d and fem::model_heat_conduction_3d (scalar isotropic Fourier models).
    These new physics models should be associated to the new fem::numerical_model_heat_conduction and, just like the mechanical model counterparts, to a mesh connectivity matrix (all element types are supported).
  • New user-defined thermal matrices: fem::thermal_diag and fem::thermal_sym.
  • New fem::solver_thermal_static_linear to solve static linear thermal problems.
  • Heat flows can be post-processed on nodes with the new class fem::solver_least_squares generalizing the former fem::solver_stress_nodal class (see below).
  • fem::elementary_server has been updated to computes elementary thermal matrices, vectors, temperatures and flows.
  • fem::solver_condensation_static can now condense also thermal models.
    For that purpose the new field fem::solver_condensation_static::settings_type::physics_kind should be set to FEM_DOFS_TEMPERATURE (default FEM_DOFS_STIFFNESS).
  • elementary_load now accepts also TEMPERATURE and HEAT_FLOW field types and works with fem::loads_mgr on both Dirichlet conditions (TEMPERATURE) and Neumann conditions (HEAT_FLOW).


  • Supersedes the deprecated fem::solver_stress_nodal to post-process data on nodes.
    This new class smooths stresses as before but now also cumulative plasticity, plastic strains, total strains, Von-Mises stress and heat flows.


  • New fem::law_shell_skyline for full (skyline profile) user-defined plate/shell elasticity law.


  • New fem::law_solid_skyline for full (skyline profile) user-defined solid elasticity law.


  • fem::post_processor_1d can now work on non-linear beam/rod models.
    Note that diagrams are not exact in these cases, especially when the elements are subjected to large displacement/deformations (exact only for 2-node linear thin, non-tapered beams/rods).


  • fem::solver_z_impedance: now accepts Dirichlet boundary conditions.
    Just as Neumann boundary conditions (force & momentum loads), Dirichlet boundary conditions are considered as periodic with pulsation omega (i.e. forced vibrations).


  • New data_type::output_steps giving the number of equilibrated solutions in the outputs solutions.
    The last converged solution is at column outputs.col(output_steps - 1) and output_steps < outputs.cols() in case of convergence error.
    Note that output_steps == pseudo_times.size().


  • New fem::context::get_max_threads and fem::context::get_LLC_size members.
  • New fem::context::set_max_total_size to set a limit for the total size of the global matrices.


  • Port to Visual Studio 2019, GCC 7, GCC 8.


All solvers

  • Minor speed-ups in the computation of external load works.
  • Use of OMP ordered clauses for numerical reproductibility of the assemblies (factorizations and resolutions are still affected by parallel noise).


  • Speed-ups with Dirichlet-only boundary conditions on unfixed DOFs (unfixed DOFs with prescribed values are now eliminated just like fixed DOFs).
  • Minor speed-ups within the conjugate-gradient solver (called only with multiple load cases + mixed Dirichlet/Neumann conditions).

solver_modal, solver_modal_ldrv, solver_modal_gyroscopic, solver_buckling_Euler

  • Minor speed-ups.


All solvers

  • Some crashes in multi-threaded resolutions when out-of-core (OOC) management is activated (i.e. for big models exceeding the value set in fem::context::memory_management).
  • The P14 (quadratic pyramid) stiffness element was not fully compatible with T10 and W18 elements.
    This caused significant numerical errors with quadratic mixed solid meshes.
  • The quadrature schemes were inaccurate in W6, PY5, TH10, W18 and P14 elements (mass and stiffness).
    For instance, we now use 5 points in TH10 stiffness (instead of 4), 12 points in W6 mass (instead of 6), 21 points in W18 mass (instead of 18).
    This can lead to slight increases in computation times.
    The quadrature scheme in P5 is also more accurate now (with unchanged number of points).
  • Reproducibility issues.


  • Serious performance issue with settings.mass_matrix_kind = cm2::FEM_LUMPED_MATRIX and activated out-of-core (OOC) management.


  • Didn’t take external loads into account. This led to inaccurate results.


  • Crashed with 3-node beam elements and hard offsets.

solver_Newmark, solver_static_Newton

  • Bug when a problem had multiple load cases and different prescribed DOFs on these load cases.
    As stated in the API, only the first load case should have been taken into account.
    This wasn’t true. The next load cases could clobber this first one leading to erratic results.


  • Could erroneously declare convergence.


  • Any convergence error of the conjugate-gradient solver (called only with multiple load cases + mixed Dirichlet/Neumann conditions) was silently discarded leading to unwarned wrong solutions.


  • Error on data_type::Fc (usually wrong sign).


  • With fem::numerical_models_mgr::get_NM, the returned numerical model lost track of its underlying mechanical model if any (i.e. the fem::numerical_model_base::get_mechanical_model() failed).
    Note that fem::numerical_model_base::get_mechanical_model() is deprecated and renamed fem::numerical_model_base::get_physics_model(). See below.


  • Fix physical core count for some CPUs (Intel) and LLC size (AMD).

/breaking changes

All solvers

  • The output solutions is now a fem::FEM_states instead of fem::FEM_matrix.
    A conversion constructor is provided in fem::FEM_states to conveniently convert the latter into the former.
    However using the new class is recommended wherever needed.
  • For solvers with initial solution (almost all solvers) the initial thermal stresses field is removed and is now included in the field data_type::initial of class fem::FEM_states.
  • The input solution fields are renamed data_type::inputs and data_type::input_IDs.
    Former name data_type::sols and data_type::sols_IDs are still valid but deprecated.
  • The output solution fields are renamed data_type::outputs, data_type::S_outputs, data_type::D_outputs or data_type::B_outputs.
    Former names data_type::sols, data_type::stresses, data_type::reactions, data_type::S_modes, data_type::D_modes and data_type::B_modes are still valid but deprecated.
  • The output data data_type::sols_requested_memory, data_type::S_modes_requested_memory, data_type::D_modes_requested_memory and data_type::B_modes_requested_memory are deprecated.
    Use data_type::outputs_requested_memory, data_type::S_outputs_requested_memory, data_type::D_outputs_requested_memory and data_type::B_outputs_requested_memory instead.


  • Deprecated. Please use now fem::solver_least_squares.

law_plane_strain, law_axi3d_stiff, law_axi_torsion_stiff

  • law_plane_strain, law_axi3d_stiff and law_axi_torsion_stiff are removed.
    You must now use directly the fem::law_solid_stiff instead wherever the former laws was required (plane-strain, axi3d and axi-torsion mechanical model constructors and initializers).


  • Former class stiffness_sym is now split into two classes: fem::stiffness_sym for linear unmodifiable models (loosing the callback handler) and fem::stiffness_sym_nl for non-linear matrix modifiable through a call-back handler (fem::stiffness_sym_nl::stiff_callback_handler_type).
    This latter class gains two additional handlers (fem::stiffness_sym_nl::get_state_callback_handler_type and fem::stiffness_sym_nl::set_state_callback_handler_type) to allow users to manage internal states of elasto-plastic constitutive laws.
  • The stiffness handler can now be called with code_KFE = 0 (i.e. none of the stiffness matrix, internal work vector or elastic energy is requested). In these cases, the stiffness_sym_nl object should consider the current solution U_loc as balanced (i.e. no longer virtual) and save internally its current (plastic) state. This happens at each Newton and Newmark step.

contact_plane, contact_cyliner, contact_sphere

  • To help convergence of the Newton-Raphson algorithm, the stiffness law is now based on a Hill-sigmoid function instead of the former (not derivable) Heaviside march function.
    The new parameter lambda controls the slope near the e = 0 point (the larger, the stiffer the slope).
    The default (lambda = DBL_MAX) reduces the sigmoid to the former Heaviside function.
  • The lambda parameter can be negative. This has the effect of reversing the direction of contact (but only positive radius are now accepted).


  • Renamed fem::damping_Rayleigh.


  • Field fem::solver_condensation_static::data_type::Fc is now a cm2::DoubleMat (to be consistent with fem::solver_condensation_static::data_type::Kc).
    Used to be a fem::FEM_matrix.

DOF stride

  • The DOF stride is now 9 instead of 6.
    This change shouldn’t have any impact if you use the fem::DOFs_mgr::DOF_STRIDE() member as required (note however that this member is now deprecated, use fem::DOFs_mgr::stride() instead).


  • fem::numerical_model_base::get_mechanical_model() renamed fem::numerical_model_base::get_physics_model().
    fem::numerical_model_base::get_mechanical_model() is left for compatibility but deprecated.


  • fe::context::set_default_penalty_factor (resp. get_default_penalty_factor) renamed fem::context::set_min_penalty_factor (resp. get_min_penalty_factor). And the behaviour changed.
    The default penalty factor was used whenever the regular penalty factor (product of the raw penalty factor with the model’s characteristic stiffness) was 0.
    This happened when the model had no sub-models associated to a mesh (only springs, links, punctual masses for instance).
    Now, the minimum penalty factor is used as a lower bound for the regular penalty factor (even when this regular penalty factor is not 0).
    The default value for this minimum penalty factor is still 1E12 (like the default value for the former default penalty factor).
  • fem::context::memory_management is deprecated. Please use fem::context::set_max_incore_size instead (with same parameters).

File names

  • New files in the API and changes in old filenames.
    These changes shouldn’t have any impact if you include the main file cm2_fem.h as required.


  • Changes in physics_type enums (used in fem::elementary_server and new fem::solver_least_squares):

error_type, warning_type

  • Changes in values of enums in error_type and warning_type.


  • Now built on Windows with UNICODE encoding setting (used to be MBCS).
    This may impact functions taking a filename as argument such as fem::context::set_max_incore_size (formerly fem::context::memory_management).