Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b790448
Refactor MMG utilities to enhance parameter handling and error checki…
loumalouomega May 28, 2026
a5f8e51
Enhance MmgProcess default parameters with additional configuration o…
loumalouomega May 28, 2026
a8c4786
Add MmgModeler class to integrate MMG remeshing process into Kratos m…
loumalouomega May 28, 2026
6239d5b
Add MMG modelers to Python bindings and update CMake configuration
loumalouomega May 28, 2026
5eb4392
Add MmgModeler class to implement MMG remeshing functionality in the …
loumalouomega May 28, 2026
2c2a4cb
Register MMG modelers in the MeshingApplication for 2D, 3D, and surfa…
loumalouomega May 28, 2026
0c91929
Refactor MMG modeler integration by updating includes and using stati…
loumalouomega May 28, 2026
9c4cd1f
Temporarily disable lagrangian movement in MMG utilities due to depen…
loumalouomega May 28, 2026
0b7ea64
[GeoMechanicsApplication] Add CRS test (#14447)
Sabine-van-Dijk May 29, 2026
e6b9367
jeez it is truly back
AlejandroCornejo May 29, 2026
2fbef17
registering the Legacy elements
AlejandroCornejo May 29, 2026
caa750d
deadline by Dec 2026 approx
AlejandroCornejo May 29, 2026
1a9456b
CI reordering registry
AlejandroCornejo Jun 1, 2026
0fa11f4
bump version to 10.4.2
roigcarlo May 20, 2026
fc98f15
Remove deprecated CSharap from release list
roigcarlo May 20, 2026
cddb512
disabled swimming dem until fixed
roigcarlo May 20, 2026
750ba74
Moving variables
roigcarlo May 20, 2026
afbf76d
Remove fracture energy from mat_variables
roigcarlo May 20, 2026
143150b
CROSS_AREA from IGA
roigcarlo May 20, 2026
d780cc1
Loading velocity
roigcarlo May 20, 2026
4d35a9e
Restore accidentaly removed SHEAR_FRACTURE_ENERGY
roigcarlo May 21, 2026
513c371
Temporal fix
roigcarlo May 21, 2026
9c0001e
Temporal fix P2
roigcarlo May 21, 2026
e69f2f2
Maybe fix...
roigcarlo May 21, 2026
44ccaba
Update MPICH paths
roigcarlo May 22, 2026
a79338d
Explicitly stating standards for gcc 15
roigcarlo May 22, 2026
b0a22f7
Explicitly stating standards for gcc 15 (2)
roigcarlo May 22, 2026
1a386e9
Update build scripts, renable hdf5
roigcarlo May 25, 2026
22a64fe
Fix global recurse ommiting hdf5 libs
roigcarlo May 27, 2026
b795460
Update tag selection
roigcarlo May 27, 2026
f4734c2
Added support for extensions
roigcarlo May 27, 2026
f23a4a4
Fixing linux being linux
roigcarlo May 27, 2026
21f0e5b
Fix non optional metadata
roigcarlo May 27, 2026
2529d16
Update dockerfile
roigcarlo May 27, 2026
90b42d9
syntax
roigcarlo May 27, 2026
2652219
typo
roigcarlo May 27, 2026
242c992
Enhance MMG parameter handling with version checks and warnings for b…
loumalouomega Jun 4, 2026
cf461f4
Merge branch 'master' into meshing/improve-mmg-process
loumalouomega Jun 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions applications/MeshingApplication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ if(${INCLUDE_MMG} MATCHES ON)
${CMAKE_CURRENT_SOURCE_DIR}/custom_utilities/mmg/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_processes/mmg/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_io/mmg/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_modelers/mmg/*.cpp
)

IF (MMG_ROOT)
Expand Down
115 changes: 115 additions & 0 deletions applications/MeshingApplication/custom_modelers/mmg/mmg_modeler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// KRATOS __ __ _____ ____ _ _ ___ _ _ ____
// | \/ | ____/ ___|| | | |_ _| \ | |/ ___|
// | |\/| | _| \___ \| |_| || || \| | | _
// | | | | |___ ___) | _ || || |\ | |_| |
// |_| |_|_____|____/|_| |_|___|_| \_|\____| APPLICATION
//
// License: BSD License
// license: MeshingApplication/license.txt
//
// Main authors: Vicente Mataix Ferrandiz
//

// System includes

// External includes

// Project includes
#include "custom_modelers/mmg/mmg_modeler.h"
#include "custom_processes/mmg/mmg_process.h"

// NOTE: The following contains the license of the MMG library
/* =============================================================================
** Copyright (c) Bx INP/Inria/UBordeaux/UPMC, 2004- .
**
** mmg is free software: you can redistribute it and/or modify it
** under the terms of the GNU Lesser General Public License as published
** by the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** mmg is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
** License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License and of the GNU General Public License along with mmg (in
** files COPYING.LESSER and COPYING). If not, see
** <http://www.gnu.org/licenses/>. Please read their terms carefully and
** use this copy of the mmg distribution only if you accept them.
** =============================================================================
*/

namespace Kratos
{

template<MMGLibrary TMMGLibrary>
MmgModeler<TMMGLibrary>::MmgModeler(
Model& rModel,
Parameters ModelerParameters
) : Modeler(rModel, ModelerParameters)
, mpModel(&rModel)
{
KRATOS_ERROR_IF_NOT(mParameters.Has("model_part_name"))
<< "MmgModeler requires \"model_part_name\" in the parameters." << std::endl;
}

/***********************************************************************************/
/***********************************************************************************/

template<MMGLibrary TMMGLibrary>
Modeler::Pointer MmgModeler<TMMGLibrary>::Create(
Model& rModel,
const Parameters ModelParameters
) const
{
return Kratos::make_shared<MmgModeler<TMMGLibrary>>(rModel, ModelParameters);
}

/***********************************************************************************/
/***********************************************************************************/

template<MMGLibrary TMMGLibrary>
void MmgModeler<TMMGLibrary>::SetupModelPart()
{
KRATOS_TRY;

const std::string model_part_name = mParameters["model_part_name"].GetString();
KRATOS_ERROR_IF_NOT(mpModel->HasModelPart(model_part_name))
<< "MmgModeler: ModelPart \"" << model_part_name << "\" not found in the model." << std::endl;

ModelPart& r_model_part = mpModel->GetModelPart(model_part_name);

// Build the process parameters by forwarding all keys except model_part_name
Parameters process_parameters(mParameters);
if (process_parameters.Has("model_part_name"))
process_parameters.RemoveValue("model_part_name");

MmgProcess<TMMGLibrary> mmg_process(r_model_part, process_parameters);
mmg_process.Execute();

KRATOS_CATCH("");
}

/***********************************************************************************/
/***********************************************************************************/

template<MMGLibrary TMMGLibrary>
const Parameters MmgModeler<TMMGLibrary>::GetDefaultParameters() const
{
// Minimal defaults β€” all MmgProcess parameters keep their own defaults
// and are validated when the process is constructed in SetupModelPart.
const Parameters default_parameters = Parameters(R"({
"model_part_name" : ""
})");
return default_parameters;
}

/***********************************************************************************/
/***********************************************************************************/

template class MmgModeler<MMGLibrary::MMG2D>;
template class MmgModeler<MMGLibrary::MMG3D>;
template class MmgModeler<MMGLibrary::MMGS>;

} // namespace Kratos
135 changes: 135 additions & 0 deletions applications/MeshingApplication/custom_modelers/mmg/mmg_modeler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// KRATOS __ __ _____ ____ _ _ ___ _ _ ____
// | \/ | ____/ ___|| | | |_ _| \ | |/ ___|
// | |\/| | _| \___ \| |_| || || \| | | _
// | | | | |___ ___) | _ || || |\ | |_| |
// |_| |_|_____|____/|_| |_|___|_| \_|\____| APPLICATION
//
// License: BSD License
// license: MeshingApplication/license.txt
//
// Main authors: Vicente Mataix Ferrandiz
//

#pragma once

// System includes

// External includes

// Project includes
#include "modeler/modeler.h"
#include "includes/model_part.h"
#include "includes/kratos_parameters.h"
#include "meshing_application.h"

// NOTE: The following contains the license of the MMG library
/* =============================================================================
** Copyright (c) Bx INP/Inria/UBordeaux/UPMC, 2004- .
**
** mmg is free software: you can redistribute it and/or modify it
** under the terms of the GNU Lesser General Public License as published
** by the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** mmg is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
** License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License and of the GNU General Public License along with mmg (in
** files COPYING.LESSER and COPYING). If not, see
** <http://www.gnu.org/licenses/>. Please read their terms carefully and
** use this copy of the mmg distribution only if you accept them.
** =============================================================================
*/

namespace Kratos
{

/**
* @class MmgModeler
* @ingroup MeshingApplication
* @brief Modeler that wraps MmgProcess for use in the Kratos modeler pipeline.
* @details This modeler delegates remeshing to MmgProcess and is invoked during
* the SetupModelPart stage of the modeler pipeline. It is templated on the MMG
* library variant (MMG2D, MMG3D, or MMGS).
* @author Vicente Mataix Ferrandiz
*/
template<MMGLibrary TMMGLibrary>
class KRATOS_API(MESHING_APPLICATION) MmgModeler
: public Modeler
{
public:
///@name Type Definitions
///@{

KRATOS_CLASS_POINTER_DEFINITION(MmgModeler);

///@}
///@name Life Cycle
///@{

/**
* @brief Default constructor (used for registry prototype only).
*/
MmgModeler() = default;

/**
* @brief Constructor with model and parameters.
* @param rModel The model owning the model part to remesh.
* @param ModelerParameters Configuration parameters (must include "model_part_name").
*/
MmgModeler(
Model& rModel,
Parameters ModelerParameters = Parameters()
);

~MmgModeler() override = default;

/**
* @brief Factory method for the Modeler registry.
*/
Modeler::Pointer Create(
Model& rModel,
const Parameters ModelParameters
) const override;

///@}
///@name Modeler Stages
///@{

/**
* @brief Runs MMG remeshing on the configured ModelPart.
*/
void SetupModelPart() override;

/**
* @brief Returns the default parameters.
*/
const Parameters GetDefaultParameters() const override;

///@}
///@name Input and output
///@{

std::string Info() const override { return "MmgModeler"; }

void PrintInfo(std::ostream& rOStream) const override
{
rOStream << Info();
}

///@}

private:
///@name Member Variables
///@{

Model* mpModel = nullptr;

///@}

}; // class MmgModeler

} // namespace Kratos
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,12 @@ const Parameters MmgProcess<TMMGLibrary>::GetDefaultParameters() const
"invert_value" : false,
"nonhistorical_variable" : false,
"use_metric_field" : false,
"remove_internal_regions" : false
"remove_internal_regions" : false,
"force_level_set_value" : false,
"level_set_value" : 0.0,
"force_rmc" : false,
"rmc_value" : 0.0,
"isoref" : 0
},
"framework" : "Eulerian",
"internal_variables_parameters" : {
Expand All @@ -1474,7 +1479,9 @@ const Parameters MmgProcess<TMMGLibrary>::GetDefaultParameters() const
"force_min" : false,
"minimal_size" : 0.1,
"force_max" : false,
"maximal_size" : 10.0
"maximal_size" : 10.0,
"force_hsiz" : false,
"constant_size" : 0.1
},
"advanced_parameters" : {
"force_hausdorff_value" : false,
Expand All @@ -1484,12 +1491,26 @@ const Parameters MmgProcess<TMMGLibrary>::GetDefaultParameters() const
"no_insert_mesh" : false,
"no_swap_mesh" : false,
"normal_regularization_mesh" : false,
"boundary_regularization" : false,
"force_boundary_regularization_relaxation" : false,
"boundary_regularization_relaxation_value" : 0.5,
"deactivate_detect_angle" : false,
"force_angle_detection_value" : false,
"angle_detection_value" : 45.0,
"force_gradation_value" : false,
"mesh_optimization_only" : false,
"gradation_value" : 1.3,
"force_hgradreq" : false,
"gradation_required_value" : 1.3,
"mesh_optimization_only" : false,
"les_optimization" : false,
"anisotropic_metric_creation" : false,
"no_fem" : false,
"preserve_subdomain_boundaries" : false,
"avoid_size_at_required" : false,
"octree_max_vertices" : 0,
"save_subdomain" : 0,
"force_memory_size" : false,
"memory_size_mb" : -1,
"local_entity_parameters_list" : []
},
"collapse_prisms_elements" : false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// KRATOS __ __ _____ ____ _ _ ___ _ _ ____
// | \/ | ____/ ___|| | | |_ _| \ | |/ ___|
// | |\/| | _| \___ \| |_| || || \| | | _
// | | | | |___ ___) | _ || || |\ | |_| |
// |_| |_|_____|____/|_| |_|___|_| \_|\____| APPLICATION
//
// License: BSD License
// license: MeshingApplication/license.txt
//
// Main authors: Vicente Mataix Ferrandiz
//

// System includes

// External includes
#include <pybind11/pybind11.h>

// Project includes
#include "includes/define.h"
#include "modeler/modeler.h"
#include "custom_python/add_custom_modelers_to_python.h"

#ifdef INCLUDE_MMG
#include "custom_modelers/mmg/mmg_modeler.h"
#endif

namespace Kratos::Python
{

namespace py = pybind11;

void AddCustomModelersToPython(py::module& m)
{
#ifdef INCLUDE_MMG
py::class_<MmgModeler<MMGLibrary::MMG2D>,
MmgModeler<MMGLibrary::MMG2D>::Pointer,
Modeler>(m, "MmgModeler2D")
.def(py::init<Model&, Parameters>())
.def("SetupModelPart", &MmgModeler<MMGLibrary::MMG2D>::SetupModelPart)
;

py::class_<MmgModeler<MMGLibrary::MMG3D>,
MmgModeler<MMGLibrary::MMG3D>::Pointer,
Modeler>(m, "MmgModeler3D")
.def(py::init<Model&, Parameters>())
.def("SetupModelPart", &MmgModeler<MMGLibrary::MMG3D>::SetupModelPart)
;

py::class_<MmgModeler<MMGLibrary::MMGS>,
MmgModeler<MMGLibrary::MMGS>::Pointer,
Modeler>(m, "MmgModelerSurface")
.def(py::init<Model&, Parameters>())
.def("SetupModelPart", &MmgModeler<MMGLibrary::MMGS>::SetupModelPart)
;
#endif
}

} // namespace Kratos::Python
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// KRATOS __ __ _____ ____ _ _ ___ _ _ ____
// | \/ | ____/ ___|| | | |_ _| \ | |/ ___|
// | |\/| | _| \___ \| |_| || || \| | | _
// | | | | |___ ___) | _ || || |\ | |_| |
// |_| |_|_____|____/|_| |_|___|_| \_|\____| APPLICATION
//
// License: BSD License
// license: MeshingApplication/license.txt
//
// Main authors: Vicente Mataix Ferrandiz
//

#pragma once

// External includes
#include <pybind11/pybind11.h>

namespace Kratos::Python
{

void AddCustomModelersToPython(pybind11::module& m);

} // namespace Kratos::Python
Loading
Loading