Skip to content

Commit

Permalink
Merge branch 'improvements' into 'development'
Browse files Browse the repository at this point in the history
misc improvements.

See merge request damask/DAMASK!974
  • Loading branch information
FranzRoters committed Sep 16, 2024
2 parents 8df4990 + a460c80 commit 965a0e1
Show file tree
Hide file tree
Showing 16 changed files with 145 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitlab/issue_templates/new_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Detailed instructions for each step are documented in the [wiki](https://git.dam
- [ ] PyPi package (wheel)
- [ ] Arch Linux (PKGBUILD)
- [ ] Ubuntu (Launchpad)
- [ ] Flatpak (Flathub)
- Open build service
- [ ] Debian
- [ ] Fedora/Suse
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Copyright 2024 Max-Planck-Institut für Nachhaltige Materialien GmbH
Copyright 2011-2024 Max-Planck-Institut für Eisenforschung GmbH

DAMASK is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion PRIVATE
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The site is primarily meant to provide a forum for [Discussions](https://github.

## Contact Information

Max-Planck-Institut für Eisenforschung GmbH
Max-Planck-Institut für Nachhaltige Materialien GmbH
Max-Planck-Str. 1
40237 Düsseldorf
Germany
2 changes: 1 addition & 1 deletion cmake/Compiler-IntelLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif ()
set (STANDARD_CHECK "-stand f18 -assume nostd_mod_proc_name")
set (LINKER_FLAGS "${LINKER_FLAGS} -shared-intel")
# Link against shared Intel libraries instead of static ones
set (LINKER_FLAGS "${LINKER_FLAGS} -shared-intel -fc=ifx")
set (LINKER_FLAGS "${LINKER_FLAGS} -fc=ifx")
# enforce use of ifx for MPI wrapper

#------------------------------------------------------------------------------------------------
Expand Down
11 changes: 7 additions & 4 deletions env/DAMASK.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd

PATH=${DAMASK_ROOT}/bin:$PATH

SOLVER=$(type -p DAMASK_grid || true 2>/dev/null)
[ "x$SOLVER" == "x" ] && SOLVER=$(blink 'Not found!')
SOLVER_GRID=$(type -p DAMASK_grid || true 2>/dev/null)
[ "x$SOLVER_GRID" == "x" ] && SOLVER_GRID=$(blink 'Not found!')
SOLVER_MESH=$(type -p DAMASK_mesh || true 2>/dev/null)
[ "x$SOLVER_MESH" == "x" ] && SOLVER_MESH=$(blink 'Not found!')


# currently, there is no information that unlimited stack size causes problems
Expand All @@ -42,12 +44,13 @@ ulimit -s unlimited 2>/dev/null # maximum stack size (kB)
if [ ! -z "$PS1" ]; then
echo
echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK
echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf
echo Max-Planck-Institut für Nachhaltige Materialien GmbH, Düsseldorf
echo https://damask.mpie.de
echo
echo Using environment with ...
echo "DAMASK $DAMASK_ROOT $BRANCH"
echo "Grid Solver $SOLVER"
echo "Grid Solver $SOLVER_GRID"
echo "Mesh Solver $SOLVER_MESH"
if [ "x$PETSC_DIR" != "x" ]; then
echo -n "PETSc location "
[ -d $PETSC_DIR ] && echo $PETSC_DIR || blink $PETSC_DIR
Expand Down
11 changes: 7 additions & 4 deletions env/DAMASK.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd

PATH=${DAMASK_ROOT}/bin:$PATH

SOLVER=$(which DAMASK_grid || true 2>/dev/null)
[[ "x$SOLVER" == "x" ]] && SOLVER=$(blink 'Not found!')
SOLVER_GRID=$(which DAMASK_grid || true 2>/dev/null)
[[ "x$SOLVER_GRID" == "x" ]] && SOLVER_GRID=$(blink 'Not found!')
SOLVER_MESH=$(which DAMASK_mesh || true 2>/dev/null)
[[ "x$SOLVER_MESH" == "x" ]] && SOLVER_MESH=$(blink 'Not found!')


# currently, there is no information that unlimited stack size causes problems
Expand All @@ -32,12 +34,13 @@ ulimit -s unlimited 2>/dev/null # maximum stack size (kB)
if [ ! -z "$PS1" ]; then
echo
echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK
echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf
echo Max-Planck-Institut für Nachhaltige Materialien GmbH, Düsseldorf
echo https://damask.mpie.de
echo
echo "Using environment with ..."
echo "DAMASK $DAMASK_ROOT $BRANCH"
echo "Grid Solver $SOLVER"
echo "Grid Solver $SOLVER_GRID"
echo "Mesh Solver $SOLVER_MESH"
if [ "x$PETSC_DIR" != "x" ]; then
echo -n "PETSc location "
[ -d $PETSC_DIR ] && echo $PETSC_DIR || blink $PETSC_DIR
Expand Down
2 changes: 1 addition & 1 deletion img/DAMASK_Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 28 additions & 8 deletions python/damask/_crystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,13 +685,33 @@ def symmetry_operations(self) -> Rotation:
"""
Return symmetry operations.
Notes
-----
The symmetry operations defined here only consider Rotations.
More specifically, for each crystal family, an enantiomorphic
point symmetry is selected. In case that there are multiple
point groups with enantiomorphic point symmetry, the one with
the highest order is chosen:
Overview of crystal classes and point group in Hermann-Mauguin
notation used for definition of symmetry operations.
- tricinic: 1
- monoclinic: 2
- orthorhombic: 222
- tetragonal: 422
- hexagonal: 622
- cubic: 432
References
----------
U.F. Kocks et al.,
Texture and Anisotropy:
Preferred Orientations in Polycrystals and their Effect on Materials Properties.
Texture and Anisotropy: Preferred Orientations in Polycrystals
and their Effect on Materials Properties.
Cambridge University Press 1998. Table II
https://en.wikipedia.org/wiki/Crystal_system#Crystal_classes
"""
_symmetry_operations: Dict[CrystalFamily, List] = {
'cubic': [
Expand Down Expand Up @@ -719,7 +739,7 @@ def symmetry_operations(self) -> Rotation:
[-0.5*np.sqrt(2), 0.0, -0.5*np.sqrt(2), 0.0 ],
[-0.5*np.sqrt(2), 0.5*np.sqrt(2), 0.0, 0.0 ],
[-0.5*np.sqrt(2),-0.5*np.sqrt(2), 0.0, 0.0 ],
],
], # 432
'hexagonal': [
[ 1.0, 0.0, 0.0, 0.0 ],
[-0.5*np.sqrt(3), 0.0, 0.0, -0.5 ],
Expand All @@ -733,7 +753,7 @@ def symmetry_operations(self) -> Rotation:
[ 0.0, 0.0, 1.0, 0.0 ],
[ 0.0, -0.5, -0.5*np.sqrt(3), 0.0 ],
[ 0.0, 0.5*np.sqrt(3), 0.5, 0.0 ],
],
], # 622
'tetragonal': [
[ 1.0, 0.0, 0.0, 0.0 ],
[ 0.0, 1.0, 0.0, 0.0 ],
Expand All @@ -743,20 +763,20 @@ def symmetry_operations(self) -> Rotation:
[ 0.0, -0.5*np.sqrt(2), 0.5*np.sqrt(2), 0.0 ],
[ 0.5*np.sqrt(2), 0.0, 0.0, 0.5*np.sqrt(2) ],
[-0.5*np.sqrt(2), 0.0, 0.0, 0.5*np.sqrt(2) ],
],
], # 422
'orthorhombic': [
[ 1.0,0.0,0.0,0.0 ],
[ 0.0,1.0,0.0,0.0 ],
[ 0.0,0.0,1.0,0.0 ],
[ 0.0,0.0,0.0,1.0 ],
],
], # 222
'monoclinic': [
[ 1.0,0.0,0.0,0.0 ],
[ 0.0,0.0,1.0,0.0 ],
],
], # 2
'triclinic': [
[ 1.0,0.0,0.0,0.0 ],
]}
]} # 1
return Rotation.from_quaternion(_symmetry_operations[self.family],accept_homomorph=True)


Expand Down
35 changes: 34 additions & 1 deletion python/damask/_geomgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ def from_Laguerre_tessellation(cells: IntSequence,
periodic : bool, optional
Assume grid to be periodic. Defaults to True.
Notes
-----
damask.seeds contains functionality for seed generation.
Returns
-------
new : damask.GeomGrid
Expand Down Expand Up @@ -537,6 +541,27 @@ def from_Voronoi_tessellation(cells: IntSequence,
new : damask.GeomGrid
Grid-based geometry from tessellation.
Notes
-----
damask.seeds contains functionality for seed generation.
Examples
--------
Generate microstructure with three grains.
>>> import numpy as np
>>> import damask
>>> seeds = np.array([[0.30828, 0.64020, 0.65237],
... [0.62200, 0.56858, 0.32842],
... [0.57315, 0.94534, 0.87531]])*1e-6
>>> damask.GeomGrid.from_Voronoi_tessellation(cells=[10,10,10],
... size=[1e-6]*3,
... seeds=seeds)
cells: 10 × 10 × 10
size: 1e-06 × 1e-06 × 1e-06 m³
origin: 0.0 0.0 0.0 m
# materials: 3
"""
coords = grid_filters.coordinates0_point(cells,size).reshape(-1,3)
tree = spatial.cKDTree(seeds,boxsize=size) if periodic else \
Expand Down Expand Up @@ -882,7 +907,7 @@ def flip(self,
Invariance of flipping a (fully) mirrored grid.
>>> g.mirror('x',True) == g.mirror('x',True).flip('x')
>>> g.mirror('x',reflect=True) == g.mirror('x',reflect=True).flip('x')
True
"""
Expand Down Expand Up @@ -1183,6 +1208,14 @@ def add_primitive(self,
"""
Insert a primitive geometric object at a given position.
The shape of the object is defined as
.. math::
|x|^{2^a} + |y|^{2^b} + |z|^{2^c} < 1
where dimension = (x,y,z) and exponent = (a,b,c).
Parameters
----------
dimension : sequence of int or float, len (3)
Expand Down
62 changes: 31 additions & 31 deletions src/grid/DAMASK_grid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ program DAMASK_grid
type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases
type(tSolutionState), allocatable, dimension(:) :: solres
procedure(grid_mechanical_spectral_basic_init), pointer :: &
mechanical_init
grid_mechanical_init
procedure(grid_mechanical_spectral_basic_forward), pointer :: &
mechanical_forward
grid_mechanical_forward
procedure(grid_mechanical_spectral_basic_solution), pointer :: &
mechanical_solution
grid_mechanical_solution
procedure(grid_mechanical_spectral_basic_updateCoords), pointer :: &
mechanical_updateCoords
grid_mechanical_updateCoords
procedure(grid_mechanical_spectral_basic_restartWrite), pointer :: &
mechanical_restartWrite
grid_mechanical_restartWrite

external :: &
quit
Expand Down Expand Up @@ -160,35 +160,35 @@ program DAMASK_grid
nActiveFields = 1
select case (solver%get_asStr('mechanical'))
case ('spectral_basic')
mechanical_init => grid_mechanical_spectral_basic_init
mechanical_forward => grid_mechanical_spectral_basic_forward
mechanical_solution => grid_mechanical_spectral_basic_solution
mechanical_updateCoords => grid_mechanical_spectral_basic_updateCoords
mechanical_restartWrite => grid_mechanical_spectral_basic_restartWrite
grid_mechanical_init => grid_mechanical_spectral_basic_init
grid_mechanical_forward => grid_mechanical_spectral_basic_forward
grid_mechanical_solution => grid_mechanical_spectral_basic_solution
grid_mechanical_updateCoords => grid_mechanical_spectral_basic_updateCoords
grid_mechanical_restartWrite => grid_mechanical_spectral_basic_restartWrite
active_Gamma = .true.

case ('spectral_polarization')
mechanical_init => grid_mechanical_spectral_polarization_init
mechanical_forward => grid_mechanical_spectral_polarization_forward
mechanical_solution => grid_mechanical_spectral_polarization_solution
mechanical_updateCoords => grid_mechanical_spectral_polarization_updateCoords
mechanical_restartWrite => grid_mechanical_spectral_polarization_restartWrite
grid_mechanical_init => grid_mechanical_spectral_polarization_init
grid_mechanical_forward => grid_mechanical_spectral_polarization_forward
grid_mechanical_solution => grid_mechanical_spectral_polarization_solution
grid_mechanical_updateCoords => grid_mechanical_spectral_polarization_updateCoords
grid_mechanical_restartWrite => grid_mechanical_spectral_polarization_restartWrite
active_Gamma = .true.

case ('spectral_Galerkin')
mechanical_init => grid_mechanical_spectral_Galerkin_init
mechanical_forward => grid_mechanical_spectral_Galerkin_forward
mechanical_solution => grid_mechanical_spectral_Galerkin_solution
mechanical_updateCoords => grid_mechanical_spectral_Galerkin_updateCoords
mechanical_restartWrite => grid_mechanical_spectral_Galerkin_restartWrite
grid_mechanical_init => grid_mechanical_spectral_Galerkin_init
grid_mechanical_forward => grid_mechanical_spectral_Galerkin_forward
grid_mechanical_solution => grid_mechanical_spectral_Galerkin_solution
grid_mechanical_updateCoords => grid_mechanical_spectral_Galerkin_updateCoords
grid_mechanical_restartWrite => grid_mechanical_spectral_Galerkin_restartWrite
active_G = .true.

case ('FEM')
mechanical_init => grid_mechanical_FEM_init
mechanical_forward => grid_mechanical_FEM_forward
mechanical_solution => grid_mechanical_FEM_solution
mechanical_updateCoords => grid_mechanical_FEM_updateCoords
mechanical_restartWrite => grid_mechanical_FEM_restartWrite
grid_mechanical_init => grid_mechanical_FEM_init
grid_mechanical_forward => grid_mechanical_FEM_forward
grid_mechanical_solution => grid_mechanical_FEM_solution
grid_mechanical_updateCoords => grid_mechanical_FEM_updateCoords
grid_mechanical_restartWrite => grid_mechanical_FEM_restartWrite

case default
call IO_error(error_ID = 891, ext_msg = trim(solver%get_asStr('mechanical')))
Expand Down Expand Up @@ -232,7 +232,7 @@ program DAMASK_grid
end select
end do

call mechanical_init(num_grid)
call grid_mechanical_init(num_grid)
call config_numerics_deallocate()

!--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -302,7 +302,7 @@ program DAMASK_grid
do field = 1, nActiveFields
select case(ID(field))
case(FIELD_MECH_ID)
call mechanical_forward (&
call grid_mechanical_forward (&
cutBack,guess,Delta_t,Delta_t_prev,t_remaining, &
deformation_BC = loadCases(l)%deformation, &
stress_BC = loadCases(l)%stress, &
Expand All @@ -324,7 +324,7 @@ program DAMASK_grid
do field = 1, nActiveFields
select case(ID(field))
case(FIELD_MECH_ID)
solres(field) = mechanical_solution(incInfo)
solres(field) = grid_mechanical_solution(incInfo)
case(FIELD_THERMAL_ID)
solres(field) = grid_thermal_spectral_solution(Delta_t)
case(FIELD_DAMAGE_ID)
Expand All @@ -344,7 +344,7 @@ program DAMASK_grid
! check solution and either advance or retry with smaller timestep

if (all(solres(:)%converged .and. solres(:)%stagConverged)) then ! converged and acceptable solution found
call mechanical_updateCoords()
call grid_mechanical_updateCoords()
Delta_t_prev = Delta_t
cutBack = .false.
guess = .true. ! start guessing after first converged (sub)inc
Expand Down Expand Up @@ -389,7 +389,7 @@ program DAMASK_grid
do field = 1, nActiveFields
select case (ID(field))
case(FIELD_MECH_ID)
call mechanical_restartWrite()
call grid_mechanical_restartWrite()
case(FIELD_THERMAL_ID)
call grid_thermal_spectral_restartWrite()
case(FIELD_DAMAGE_ID)
Expand Down Expand Up @@ -538,7 +538,7 @@ function parseLoadsteps(load_steps) result(loadCases)
transpose(loadCases(l)%rot%asMatrix())

if (loadCases(l)%r <= 0.0_pREAL) errorID = 833
if (loadCases(l)%t < 0.0_pREAL) errorID = 834
if (loadCases(l)%t <= 0.0_pREAL) errorID = 834
if (loadCases(l)%N < 1) errorID = 835
if (loadCases(l)%f_out < 1) errorID = 836
if (loadCases(l)%f_restart < 1) errorID = 839
Expand Down
4 changes: 2 additions & 2 deletions src/grid/grid_damage_spectral.f90
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function grid_damage_spectral_solution(Delta_t) result(solution)

call SNESGetDM(SNES_damage,DM_damage,err_PETSc)
CHKERRQ(err_PETSc)
call DMDAVecGetArrayF90(DM_damage,phi_PETSc,phi,err_PETSc) ! returns 0-indexed phi
call DMDAVecGetArrayReadF90(DM_damage,phi_PETSc,phi,err_PETSc) ! returns 0-indexed phi
CHKERRQ(err_PETSc)

stagNorm = maxval(abs(phi - phi_stagInc))
Expand All @@ -250,7 +250,7 @@ function grid_damage_spectral_solution(Delta_t) result(solution)

call homogenization_set_phi(reshape(phi,[product(cells(1:2))*cells3]))

call DMDAVecRestoreArrayF90(DM_damage,phi_PETSc,phi,err_PETSc)
call DMDAVecRestoreArrayReadF90(DM_damage,phi_PETSc,phi,err_PETSc)
CHKERRQ(err_PETSc)

if (solution%converged) &
Expand Down
Loading

0 comments on commit 965a0e1

Please sign in to comment.