Skip to content

Commit 1e22e19

Browse files
thomasthomas
authored andcommitted
merge master edelweissFE
2 parents 24015f0 + a63010f commit 1e22e19

File tree

89 files changed

+3105
-16724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+3105
-16724
lines changed

.github/workflows/run_tests.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
- uses: actions/checkout@v2
1111

1212
- name: Setup Mambaforge
13-
uses: conda-incubator/setup-miniconda@v2
13+
uses: conda-incubator/setup-miniconda@v3
1414
with:
1515
use-mamba: true
16-
miniforge-variant: Mambaforge
16+
miniforge-variant: Miniforge3
1717
miniforge-version: latest
1818
activate-environment: anaconda-client-env
19-
19+
2020
- name: Install conda packages
2121
shell: bash -l {0}
2222
run: |
@@ -27,9 +27,9 @@ jobs:
2727
shell: bash -l {0}
2828
run: |
2929
git clone --branch 3.4.0 https://gitlab.com/libeigen/eigen.git
30-
cd eigen
30+
cd eigen
3131
mkdir build
32-
cd build
32+
cd build
3333
cmake -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DINCLUDE_INSTALL_DIR=$CONDA_PREFIX/include ..
3434
make install
3535
cd ../..
@@ -57,16 +57,13 @@ jobs:
5757
- name: Install Marmot
5858
shell: bash -l {0}
5959
run: |
60-
git clone --recurse-submodules https://github.com/MAteRialMOdelingToolbox/Marmot/
61-
cd Marmot
62-
cd modules/core
63-
git clone ${{secrets.MARMOT_MPMCORE_TOKEN}}
64-
cd ../../
65-
mkdir build
66-
cd build
60+
git clone "https://github.com/MAteRialMOdelingToolbox/Marmot.git"
61+
git clone "https://github.com/BOKU-CMP-MEC-MAT/MarmotMeshfreeCore.git" ./Marmot/modules/core/MarmotMeshfreeCore
62+
mkdir ./Marmot/build
63+
cd ./Marmot/build
6764
cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX ..
6865
make install
69-
cd ../../
66+
cd ../..
7067
7168
- name: Install EdelweissFE
7269
shell: bash -l {0}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- [![documentation](https://github.com/EdelweissMPM/EdelweissMPM/actions/workflows/sphinx.yml/badge.svg)](https://edelweissfe.github.io/EdelweissMPM) -->
2-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
2+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
33

44
# EdelweissMPM: A light-weight, platform-independent, parallel material point module for EdelweissFE.
55

@@ -14,7 +14,7 @@ Some features are:
1414

1515
* Python for non performance-critical routines
1616
* Cython for performance-critical routines
17-
* Parallelization
17+
* Parallelization
1818
* Modular system, which is easy to extend
1919
* Output to Paraview, Ensight, CSV, matplotlib
2020
* Interfaces to powerful direct and iterative linear solvers

doc/source/documentation/material_point_managers.rst renamed to doc/source/documentation/mpm/material_point_managers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ Smart Material Point Manager
1818
.. automodule:: edelweissmpm.mpmmanagers.smartmpmmanager
1919
:private-members:
2020
:members:
21-
22-
21+
22+
File renamed without changes.

doc/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ EdelweissMPM aims to be...
99

1010
- ... a development and learning environment for constitutive models and the material point method,
1111
- ... an easy to use tool for coupled problems,
12-
- ... a very flexible tool for implementing and employing special techniques (e.g., the indirect displacement control technique),
12+
- ... a very flexible tool for implementing and employing special techniques (e.g., the indirect displacement control technique),
1313
which are often more difficult and time consuming to implement in mature, MPI-parallelized codes,
1414
- ... an efficient tool for nonlinear simulations up to medium sized problems (~ :math:`10^5` degrees of freedom).
1515

edelweissmpm/cells/base/cell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
to the material points. Cells are used to compute the residual and stiffness
3131
matrices for the global system of equations.
3232
33-
Implementing your own cells can be done easily by subclassing from
33+
Implementing your own cells can be done easily by subclassing from
3434
the abstract base class :class:`~CellBase`.
3535
"""
3636

edelweissmpm/cells/marmotcell/bsplinemarmotcell.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ cdef class BSplineMarmotCellWrapper(MarmotCellWrapper):
9090
&knotVectorsView[0,0],
9191
knotVectorsView.size)
9292

93-
except IndexError:
93+
except ValueError:
9494
raise NotImplementedError("Marmot cell {:} not found in library.".format(cellType))
9595

9696
def __dealloc__(self):

edelweissmpm/cells/marmotcell/lagrangianmarmotcell.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ cdef class LagrangianMarmotCellWrapper(MarmotCellWrapper):
8787

8888
try:
8989
self._marmotCell = MarmotCellFactory.createCell( cellType.encode('utf-8'), self._cellNumber, &self._nodeCoordinates[0,0], self._nodeCoordinates.size)
90-
except IndexError:
90+
except ValueError:
9191
raise NotImplementedError("Marmot cell {:} not found in library.".format(cellType))
9292

9393
def __dealloc__(self):

edelweissmpm/cells/test/cell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# the top level directory of EdelweissMPM.
2626
# ---------------------------------------------------------------------
2727
"""
28-
Implementing your own cells can be done easily by subclassing from
28+
Implementing your own cells can be done easily by subclassing from
2929
the abstract base class :class:`~CellBase`.
3030
"""
3131

edelweissmpm/constraints/particlelagrangianweakdirichlet.py

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,35 @@ def __init__(
3434
self,
3535
name: str,
3636
constrainedParticle: BaseParticle,
37-
constrainedLocation: int | str,
3837
field: str,
3938
prescribedStepDelta: dict,
4039
model,
40+
location: str = "center",
41+
faceID: int = None,
42+
vertexID: int = None,
4143
):
4244
self._name = name
4345
self._constrainedParticle = constrainedParticle
4446
self._field = field
4547
self._prescribedStepDelta = prescribedStepDelta
4648
self._fieldSize = getFieldSize(self._field, model.domainSize)
4749
self._nodes = dict()
48-
self._constrainedLocation = constrainedLocation
4950

50-
if isinstance(constrainedLocation, str):
51-
if constrainedLocation != "center":
52-
raise ValueError("Constrain must be 'center' or a vertex index.")
53-
# elif isinstance(constrainedLocation, int):
54-
# raise ValueError(f"Constrain must be 'center' or a vertex index, got {type(constrainedLocation)}.")
51+
def _getConstraintLocation():
52+
particle = self._constrainedParticle
53+
if location == "center":
54+
constraintLocation = particle.getCenterCoordinates()
55+
elif location == "face":
56+
if faceID is None:
57+
raise ValueError("faceID must be specified when location is 'face'.")
58+
constraintLocation = particle.getFaceCoordinates(faceID)
59+
elif location == "vertex":
60+
if vertexID is None:
61+
raise ValueError("vertexID must be specified when location is 'vertex'.")
62+
constraintLocation = particle.getVertexCoordinates(vertexID)
63+
return constraintLocation
64+
65+
self._getConstraintLocation = _getConstraintLocation
5566

5667
self._nLagrangianMultipliers = len(self._prescribedStepDelta)
5768
self.reactionForce = np.zeros(self._fieldSize)
@@ -119,10 +130,12 @@ def applyConstraint(self, dU_: np.ndarray, PExt: np.ndarray, V: np.ndarray, time
119130
self.reactionForce.fill(0.0)
120131
p = self._constrainedParticle
121132

122-
if self._constrainedLocation == "center":
123-
constrainedCoordinates = p.getCenterCoordinates()
124-
elif isinstance(self._constrainedLocation, int):
125-
constrainedCoordinates = p.getVertexCoordinates()[self._constrainedLocation]
133+
# if self._constrainedLocation == "center":
134+
# constrainedCoordinates = p.getCenterCoordinates()
135+
# elif isinstance(self._constrainedLocation, int):
136+
# constrainedCoordinates = p.getVertexCoordinates()[self._constrainedLocation]
137+
138+
constrainedCoordinates = self._getConstraintLocation()
126139

127140
for lag, (i, prescribedComponent) in enumerate(self._prescribedStepDelta.items()):
128141
# lag is the lagrange multiplier index
@@ -158,23 +171,27 @@ def applyConstraint(self, dU_: np.ndarray, PExt: np.ndarray, V: np.ndarray, time
158171
def ParticleLagrangianWeakDirichletOnParticleSetFactory(
159172
baseName: str,
160173
particleSet: list[BaseParticle],
161-
constrainedLocation: list[int] | str,
162174
field: str,
163175
prescribedStepDelta: dict,
164176
model: MPMModel,
177+
location: str = "center",
178+
faceID: int = None,
179+
vertexID: int | list[int] = None,
165180
):
166181
constraints = dict()
167182
for i, p in enumerate(particleSet):
168-
if isinstance(constrainedLocation, list):
169-
for vertIdx in constrainedLocation:
170-
name = f"{baseName}_{i}_{vertIdx}"
171-
constraint = ParticleLagrangianWeakDirichlet(
172-
name, p, vertIdx, field, prescribedStepDelta, model
173-
)
183+
if location == "vertex":
184+
if isinstance(vertexID, int):
185+
name = f"{baseName}_{i}_v{vertexID}"
186+
constraint = ParticleLagrangianWeakDirichlet( name, p, field, prescribedStepDelta, model, location, faceID, vertexID)
174187
constraints[name] = constraint
175-
else:
188+
else:
189+
for vertIdx in vertexID:
190+
name = f"{baseName}_{i}_v{vertIdx}"
191+
constraint = ParticleLagrangianWeakDirichlet( name, p, field, prescribedStepDelta, model, location, faceID, vertIdx)
192+
constraints[name] = constraint
193+
else:
176194
name = f"{baseName}_{i}"
177-
constraint = ParticleLagrangianWeakDirichlet(name, p, constrainedLocation, field, prescribedStepDelta, model)
195+
constraint = ParticleLagrangianWeakDirichlet( name, p, field, prescribedStepDelta, model, location, faceID, vertexID)
178196
constraints[name] = constraint
179-
180197
return constraints

0 commit comments

Comments
 (0)