Skip to content

Commit

Permalink
Merge pull request #12011 from KratosMultiphysics/mpm/change-applicat…
Browse files Browse the repository at this point in the history
…ion-name

[MPM] Change application name
  • Loading branch information
ncrescenzio authored Mar 13, 2024
2 parents 9c0870a + 855f989 commit 0f83a7f
Show file tree
Hide file tree
Showing 436 changed files with 2,364 additions and 2,198 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
/applications/IgaApplication/ @KratosMultiphysics/nurbs-breps
/applications/HDF5Application/ @KratosMultiphysics/hdf5-application
/applications/MultilevelMonteCarloApplication/ @KratosMultiphysics/uncertainty-quantification
/applications/ParticleMechanicsApplication/ @KratosMultiphysics/mpm
/applications/MPMApplication/ @KratosMultiphysics/mpm
/applications/RomApplication/ @KratosMultiphysics/rom
/applications/GeoMechanicsApplication/.................@KratosMultiphysics/geomechanics
/applications/GeoMechanicsApplication/.................@KratosMultiphysics/geomechanics
2 changes: 1 addition & 1 deletion .github/workflows/ci_apps_linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"HDF5Application",
"ContactStructuralMechanicsApplication",
"IgaApplication",
"ParticleMechanicsApplication",
"MPMApplication",
"ChimeraApplication",
"StatisticsApplication",
"SwimmingDEMApplication",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_apps_windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"DEMApplication",
"ChimeraApplication",
"IgaApplication",
"ParticleMechanicsApplication",
"MPMApplication",
"MappingApplication",
"CoSimulationApplication",
"StatisticsApplication",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/configure.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%KRATOS_APP_DIR%\StructuralMechanic
set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%KRATOS_APP_DIR%\DEMApplication;
set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%KRATOS_APP_DIR%\ChimeraApplication;
set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%KRATOS_APP_DIR%\IgaApplication;
set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%KRATOS_APP_DIR%\ParticleMechanicsApplication;
set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%KRATOS_APP_DIR%\MPMApplication;
set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%KRATOS_APP_DIR%\MappingApplication;
set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%KRATOS_APP_DIR%\CoSimulationApplication;
set KRATOS_APPLICATIONS=%KRATOS_APPLICATIONS%%KRATOS_APP_DIR%\StatisticsApplication;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ add_app ${KRATOS_APP_DIR}/CompressiblePotentialFlowApplication;
add_app ${KRATOS_APP_DIR}/HDF5Application;
add_app ${KRATOS_APP_DIR}/ContactStructuralMechanicsApplication;
add_app ${KRATOS_APP_DIR}/IgaApplication;
add_app ${KRATOS_APP_DIR}/ParticleMechanicsApplication;
add_app ${KRATOS_APP_DIR}/MPMApplication;
add_app ${KRATOS_APP_DIR}/ChimeraApplication;
add_app ${KRATOS_APP_DIR}/StatisticsApplication;
add_app ${KRATOS_APP_DIR}/SwimmingDEMApplication;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/intel_configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export KRATOS_INSTALL_PYTHON_USING_LINKS=ON
# add_app ${KRATOS_APP_DIR}/HDF5Application;
# add_app ${KRATOS_APP_DIR}/ContactStructuralMechanicsApplication;
# add_app ${KRATOS_APP_DIR}/IgaApplication;
# add_app ${KRATOS_APP_DIR}/ParticleMechanicsApplication;
# add_app ${KRATOS_APP_DIR}/MPMApplication;
# add_app ${KRATOS_APP_DIR}/ChimeraApplication;
# add_app ${KRATOS_APP_DIR}/MultilevelMonteCarloApplication;
# add_app ${KRATOS_APP_DIR}/StatisticsApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Importing the Kratos Library
import KratosMultiphysics as KM
from KratosMultiphysics.kratos_utilities import CheckIfApplicationsAvailable

# Importing the base class
from KratosMultiphysics.CoSimulationApplication.solver_wrappers.kratos import kratos_base_wrapper

# Importing MPM
if not CheckIfApplicationsAvailable("MPMApplication"):
raise ImportError("The MPMApplication is not available!")
import KratosMultiphysics.MPMApplication as KPM
from KratosMultiphysics.MPMApplication.mpm_analysis import MPMAnalysis

# Other imports
import math

def Create(settings, model, solver_name):
return MPMDirichletWrapper(settings, model, solver_name)

class MPMDirichletWrapper(kratos_base_wrapper.KratosBaseWrapper):
"""This class is the interface to the MPMApplication of Kratos."""
"""It is designed for the Dirichlet Interface in the MPMApplication"""

def _CreateAnalysisStage(self):
return MPMAnalysis(self.model, self.project_parameters)

def SolveSolutionStep(self):
coupling_model_part = self.model.GetModelPart("MPM_Coupling_Dirichlet_Interface")
model_part_name = self.settings["solver_wrapper_settings"]["interface_model_part_name"].GetString()
model_part = self.model.GetModelPart(model_part_name)

## Transfer information from coupling_mp to mp
for coupling_node in coupling_model_part.Nodes:
coupling_id = coupling_node.Id

## IMPOSED DISPLACEMENT
total_displacement = coupling_node.GetSolutionStepValue(KM.DISPLACEMENT,0)
old_displacement = model_part.GetCondition(coupling_id).CalculateOnIntegrationPoints(KPM.MPC_DISPLACEMENT, model_part.ProcessInfo)[0]
incremental_displacement = total_displacement - old_displacement
model_part.GetCondition(coupling_id).SetValuesOnIntegrationPoints(KPM.MPC_IMPOSED_DISPLACEMENT, [incremental_displacement], model_part.ProcessInfo)

## ADD VELOCITY
current_velocity = coupling_node.GetSolutionStepValue(KM.VELOCITY,0)
model_part.GetCondition(coupling_id).SetValuesOnIntegrationPoints(KPM.MPC_VELOCITY, [current_velocity], model_part.ProcessInfo)

## ADD NORMAL
normal = coupling_node.GetSolutionStepValue(KM.NORMAL,0)
# Check and see whether the normal is not zero
norm_normal = math.sqrt(normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2])
if norm_normal > 1.e-10:
model_part.GetCondition(coupling_id).SetValuesOnIntegrationPoints(KPM.MPC_NORMAL, [normal], model_part.ProcessInfo)

super().SolveSolutionStep()

### Get contact force from mp to coupling_mp
for mpc in model_part.Conditions:
if (mpc.Is(KM.INTERFACE)):
coupling_id = mpc.Id
contact_force = mpc.CalculateOnIntegrationPoints(KPM.MPC_CONTACT_FORCE, model_part.ProcessInfo)[0]
coupling_model_part.GetNode(coupling_id).SetSolutionStepValue(KM.CONTACT_FORCE,0,contact_force)
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Importing the Kratos Library
import KratosMultiphysics as KM
from KratosMultiphysics.kratos_utilities import CheckIfApplicationsAvailable

# Importing the base class
from KratosMultiphysics.CoSimulationApplication.solver_wrappers.kratos import kratos_base_wrapper

# Importing MPM
if not CheckIfApplicationsAvailable("MPMApplication"):
raise ImportError("The MPMApplication is not available!")
import KratosMultiphysics.MPMApplication as KPM
from KratosMultiphysics.MPMApplication.mpm_analysis import MPMAnalysis

def Create(settings, model, solver_name):
return MPMNeumannWrapper(settings, model, solver_name)

class MPMNeumannWrapper(kratos_base_wrapper.KratosBaseWrapper):
"""This class is the interface to the MPMApplication of Kratos"""
"""It is designed for the Neumann Interface in the MPMApplication"""

def _CreateAnalysisStage(self):
return MPMAnalysis(self.model, self.project_parameters)

def SolveSolutionStep(self):
coupling_model_part = self.model.GetModelPart("MPM_Coupling_Neumann_Interface")
model_part_name = self.settings["solver_wrapper_settings"]["interface_model_part_name"].GetString()
model_part = self.model.GetModelPart(model_part_name)

## Transfer information from coupling_mp to mp
for coupling_node in coupling_model_part.Nodes:
coupling_id = coupling_node.Id

## IMPOSED Point load
point_load = coupling_node.GetSolutionStepValue(KM.CONTACT_FORCE)
model_part.GetCondition(coupling_id).SetValuesOnIntegrationPoints(KPM.POINT_LOAD, [point_load], model_part.ProcessInfo)

super().SolveSolutionStep()

### Save displacement of mpc in coupling node
for mpc in model_part.Conditions:
if (mpc.Is(KM.INTERFACE)):
coupling_id = mpc.Id

# Update displacement
delta_x = mpc.CalculateOnIntegrationPoints(KPM.MPC_DELTA_DISPLACEMENT, model_part.ProcessInfo)[0]
displacement = coupling_model_part.GetNode(coupling_id).GetSolutionStepValue(KM.DISPLACEMENT)
displacement += delta_x
coupling_model_part.GetNode(coupling_id).SetSolutionStepValue(KM.DISPLACEMENT,0,displacement)

# Update velocity
velocity = mpc.CalculateOnIntegrationPoints(KPM.MPC_VELOCITY, model_part.ProcessInfo)[0]
coupling_model_part.GetNode(coupling_id).SetSolutionStepValue(KM.VELOCITY,0,velocity)
Original file line number Diff line number Diff line change
@@ -1,60 +1,15 @@
# Importing the Kratos Library
import KratosMultiphysics as KM
import KratosMultiphysics
from KratosMultiphysics.kratos_utilities import CheckIfApplicationsAvailable
from KratosMultiphysics.kratos_utilities import IssueDeprecationWarning

# Importing the base class
from KratosMultiphysics.CoSimulationApplication.solver_wrappers.kratos import kratos_base_wrapper
from KratosMultiphysics.CoSimulationApplication.solver_wrappers.kratos.mpm_dirichlet_wrapper import MPMDirichletWrapper

# Importing ParticleMechanics
if not CheckIfApplicationsAvailable("ParticleMechanicsApplication"):
raise ImportError("The ParticleMechanicsApplication is not available!")
import KratosMultiphysics.ParticleMechanicsApplication as KPM
from KratosMultiphysics.ParticleMechanicsApplication.particle_mechanics_analysis import ParticleMechanicsAnalysis

# Other imports
import math
# Importing MPM
if not CheckIfApplicationsAvailable("MPMApplication"):
raise ImportError("The MPMApplication is not available!")
import KratosMultiphysics.MPMApplication as KPM
from KratosMultiphysics.MPMApplication.mpm_analysis import MPMAnalysis

def Create(settings, model, solver_name):
return ParticleMechanicsDirichletWrapper(settings, model, solver_name)

class ParticleMechanicsDirichletWrapper(kratos_base_wrapper.KratosBaseWrapper):
"""This class is the interface to the ParticleMechanicsApplication of Kratos."""
"""It is designed for the Dirichlet Interface in the ParticleMechanicsApplication"""

def _CreateAnalysisStage(self):
return ParticleMechanicsAnalysis(self.model, self.project_parameters)

def SolveSolutionStep(self):
coupling_model_part = self.model.GetModelPart("MPM_Coupling_Dirichlet_Interface")
model_part_name = self.settings["solver_wrapper_settings"]["interface_model_part_name"].GetString()
model_part = self.model.GetModelPart(model_part_name)

## Transfer information from coupling_mp to mp
for coupling_node in coupling_model_part.Nodes:
coupling_id = coupling_node.Id

## IMPOSED DISPLACEMENT
total_displacement = coupling_node.GetSolutionStepValue(KM.DISPLACEMENT,0)
old_displacement = model_part.GetCondition(coupling_id).CalculateOnIntegrationPoints(KPM.MPC_DISPLACEMENT, model_part.ProcessInfo)[0]
incremental_displacement = total_displacement - old_displacement
model_part.GetCondition(coupling_id).SetValuesOnIntegrationPoints(KPM.MPC_IMPOSED_DISPLACEMENT, [incremental_displacement], model_part.ProcessInfo)

## ADD VELOCITY
current_velocity = coupling_node.GetSolutionStepValue(KM.VELOCITY,0)
model_part.GetCondition(coupling_id).SetValuesOnIntegrationPoints(KPM.MPC_VELOCITY, [current_velocity], model_part.ProcessInfo)

## ADD NORMAL
normal = coupling_node.GetSolutionStepValue(KM.NORMAL,0)
# Check and see whether the normal is not zero
norm_normal = math.sqrt(normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2])
if norm_normal > 1.e-10:
model_part.GetCondition(coupling_id).SetValuesOnIntegrationPoints(KPM.MPC_NORMAL, [normal], model_part.ProcessInfo)

super().SolveSolutionStep()

### Get contact force from mp to coupling_mp
for mpc in model_part.Conditions:
if (mpc.Is(KM.INTERFACE)):
coupling_id = mpc.Id
contact_force = mpc.CalculateOnIntegrationPoints(KPM.MPC_CONTACT_FORCE, model_part.ProcessInfo)[0]
coupling_model_part.GetNode(coupling_id).SetSolutionStepValue(KM.CONTACT_FORCE,0,contact_force)
IssueDeprecationWarning('CoSimulationApplication:','"ParticleMechanicsDirichletWrapper" is deprecated and replaced by "MPMDirichletWrapper"')
return MPMDirichletWrapper(settings, model, solver_name)
Original file line number Diff line number Diff line change
@@ -1,52 +1,15 @@
# Importing the Kratos Library
import KratosMultiphysics as KM
import KratosMultiphysics
from KratosMultiphysics.kratos_utilities import CheckIfApplicationsAvailable
from KratosMultiphysics.kratos_utilities import IssueDeprecationWarning

# Importing the base class
from KratosMultiphysics.CoSimulationApplication.solver_wrappers.kratos import kratos_base_wrapper
from KratosMultiphysics.CoSimulationApplication.solver_wrappers.kratos.mpm_neumann_wrapper import MPMNeumannWrapper

# Importing ParticleMechanics
if not CheckIfApplicationsAvailable("ParticleMechanicsApplication"):
raise ImportError("The ParticleMechanicsApplication is not available!")
import KratosMultiphysics.ParticleMechanicsApplication as KPM
from KratosMultiphysics.ParticleMechanicsApplication.particle_mechanics_analysis import ParticleMechanicsAnalysis
# Importing MPM
if not CheckIfApplicationsAvailable("MPMApplication"):
raise ImportError("The MPMApplication is not available!")
import KratosMultiphysics.MPMApplication as KPM
from KratosMultiphysics.MPMApplication.mpm_analysis import MPMAnalysis

def Create(settings, model, solver_name):
return ParticleMechanicsNeumannWrapper(settings, model, solver_name)

class ParticleMechanicsNeumannWrapper(kratos_base_wrapper.KratosBaseWrapper):
"""This class is the interface to the ParticleMechanicsApplication of Kratos"""
"""It is designed for the Neumann Interface in the ParticleMechanicsApplication"""

def _CreateAnalysisStage(self):
return ParticleMechanicsAnalysis(self.model, self.project_parameters)

def SolveSolutionStep(self):
coupling_model_part = self.model.GetModelPart("MPM_Coupling_Neumann_Interface")
model_part_name = self.settings["solver_wrapper_settings"]["interface_model_part_name"].GetString()
model_part = self.model.GetModelPart(model_part_name)

## Transfer information from coupling_mp to mp
for coupling_node in coupling_model_part.Nodes:
coupling_id = coupling_node.Id

## IMPOSED Point load
point_load = coupling_node.GetSolutionStepValue(KM.CONTACT_FORCE)
model_part.GetCondition(coupling_id).SetValuesOnIntegrationPoints(KPM.POINT_LOAD, [point_load], model_part.ProcessInfo)

super().SolveSolutionStep()

### Save displacement of mpc in coupling node
for mpc in model_part.Conditions:
if (mpc.Is(KM.INTERFACE)):
coupling_id = mpc.Id

# Update displacement
delta_x = mpc.CalculateOnIntegrationPoints(KPM.MPC_DELTA_DISPLACEMENT, model_part.ProcessInfo)[0]
displacement = coupling_model_part.GetNode(coupling_id).GetSolutionStepValue(KM.DISPLACEMENT)
displacement += delta_x
coupling_model_part.GetNode(coupling_id).SetSolutionStepValue(KM.DISPLACEMENT,0,displacement)

# Update velocity
velocity = mpc.CalculateOnIntegrationPoints(KPM.MPC_VELOCITY, model_part.ProcessInfo)[0]
coupling_model_part.GetNode(coupling_id).SetSolutionStepValue(KM.VELOCITY,0,velocity)
IssueDeprecationWarning('CoSimulationApplication:','"ParticleMechanicsNeumannWrapper" is deprecated and replaced by "MPMNeumannWrapper"')
return MPMNeumannWrapper(settings, model, solver_name)
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

have_fsi_dependencies = kratos_utils.CheckIfApplicationsAvailable("FluidDynamicsApplication", "StructuralMechanicsApplication", "MappingApplication", "MeshMovingApplication", "LinearSolversApplication")
have_potential_fsi_dependencies = kratos_utils.CheckIfApplicationsAvailable("CompressiblePotentialFlowApplication", "StructuralMechanicsApplication", "MappingApplication", "MeshMovingApplication", "LinearSolversApplication")
have_mpm_fem_dependencies = kratos_utils.CheckIfApplicationsAvailable("ParticleMechanicsApplication", "StructuralMechanicsApplication", "MappingApplication", "LinearSolversApplication", "ConstitutiveLawsApplication")
have_mpm_fem_dependencies = kratos_utils.CheckIfApplicationsAvailable("MPMApplication", "StructuralMechanicsApplication", "MappingApplication", "LinearSolversApplication", "ConstitutiveLawsApplication")
have_dem_fem_dependencies = kratos_utils.CheckIfApplicationsAvailable("DEMApplication", "StructuralMechanicsApplication", "MappingApplication", "LinearSolversApplication")
have_mpm_dem_dependencies = kratos_utils.CheckIfApplicationsAvailable("DEMApplication", "ParticleMechanicsApplication", "MappingApplication", "LinearSolversApplication")
have_mpm_dem_dependencies = kratos_utils.CheckIfApplicationsAvailable("DEMApplication", "MPMApplication", "MappingApplication", "LinearSolversApplication")
have_fem_fem_dependencies = kratos_utils.CheckIfApplicationsAvailable("StructuralMechanicsApplication", "MappingApplication")
have_pfem_fem_dependencies = kratos_utils.CheckIfApplicationsAvailable("PfemFluidDynamicsApplication", "StructuralMechanicsApplication", "MappingApplication", "LinearSolversApplication", "ConstitutiveLawsApplication")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"loads_process_list": [
{
"python_module": "apply_mpm_coupling_interface_neumann_condition_process",
"kratos_module": "KratosMultiphysics.ParticleMechanicsApplication",
"kratos_module": "KratosMultiphysics.MPMApplication",
"Parameters": {
"model_part_name": "Background_Grid.INTERFACE_coupling_to_dem",
"particles_per_condition": 1
Expand All @@ -68,7 +68,7 @@
"list_other_processes": [
{
"python_module": "particle_from_json_check_result_process",
"kratos_module": "KratosMultiphysics.ParticleMechanicsApplication",
"kratos_module": "KratosMultiphysics.MPMApplication",
"help": "",
"process_name": "ParticleFromJsonCheckResultProcess",
"Parameters": {
Expand All @@ -84,7 +84,7 @@
"print_output_process": [
{
"python_module": "particle_json_output_process",
"kratos_module": "KratosMultiphysics.ParticleMechanicsApplication",
"kratos_module": "KratosMultiphysics.MPMApplication",
"help": "",
"process_name": "ParticleJsonOutputProcess",
"Parameters": {
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 0f83a7f

Please sign in to comment.