Skip to content

Commit

Permalink
Merge branch 'spectral_variation_solver_clean' into 'development'
Browse files Browse the repository at this point in the history
new spectral variation solver with matrix-free jacobian

See merge request damask/DAMASK!920
  • Loading branch information
MarDiehl committed Jul 31, 2024
2 parents 97ccccb + 14a057e commit 46c3009
Show file tree
Hide file tree
Showing 10 changed files with 984 additions and 164 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ stages:
###################################################################################################
default:
before_script:
- ${LOCAL_HOME}/bin/queue2 ${CI_JOB_ID} ${TOKEN}
- ${LOCAL_HOME}/bin/queue ${CI_JOB_ID} ${TOKEN}
- source env/DAMASK.sh
- export PATH=${TESTROOT}/bin:${PATH}
- echo Job start:" $(date)"
Expand Down Expand Up @@ -56,7 +56,7 @@ variables:
create_testroot:
stage: prepare
before_script:
- ${LOCAL_HOME}/bin/queue2 ${CI_JOB_ID} ${TOKEN}
- ${LOCAL_HOME}/bin/queue ${CI_JOB_ID} ${TOKEN}
- echo Job start:" $(date)"
script:
- mkdir -p ${TESTROOT}
Expand Down
2 changes: 1 addition & 1 deletion PRIVATE
18 changes: 16 additions & 2 deletions src/grid/DAMASK_grid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ program DAMASK_grid
use materialpoint
use material
use spectral_utilities
use grid_mech_utilities
use grid_utilities
use grid_mechanical_spectral_basic
use grid_mechanical_spectral_polarization
use grid_mechanical_spectral_Galerkin
use grid_mechanical_FEM
use grid_damage_spectral
use grid_thermal_spectral
Expand Down Expand Up @@ -88,6 +89,7 @@ program DAMASK_grid
nActiveFields = 0, &
maxCutBack, & !< max number of cut backs
stagItMax !< max number of field level staggered iterations
logical :: active_Gamma = .false., active_G = .false., active_parabolic = .false.
integer(MPI_INTEGER_KIND) :: err_MPI
character(len=pSTRLEN) :: &
incInfo
Expand Down Expand Up @@ -163,13 +165,23 @@ program DAMASK_grid
mechanical_solution => grid_mechanical_spectral_basic_solution
mechanical_updateCoords => grid_mechanical_spectral_basic_updateCoords
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
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
active_G = .true.

case ('FEM')
mechanical_init => grid_mechanical_FEM_init
Expand All @@ -196,15 +208,17 @@ program DAMASK_grid
thermalActive: if (solver%get_asStr('thermal',defaultVal = 'n/a') == 'spectral') then
field = field + 1
ID(field) = FIELD_THERMAL_ID
active_parabolic = .true.
end if thermalActive
damageActive: if (solver%get_asStr('damage',defaultVal = 'n/a') == 'spectral') then
field = field + 1
ID(field) = FIELD_DAMAGE_ID
active_parabolic = .true.
end if damageActive

!--------------------------------------------------------------------------------------------------
! doing initialization depending on active solvers
call spectral_utilities_init()
call spectral_utilities_init(active_Gamma, active_G, active_parabolic)

do field = 2, nActiveFields
select case (ID(field))
Expand Down
2 changes: 1 addition & 1 deletion src/grid/grid_damage_spectral.f90
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ subroutine grid_damage_spectral_init(num_grid)
CHKERRQ(err_PETSc)
call VecSet(bound_u,1.0_pREAL,err_PETSc)
CHKERRQ(err_PETSc)
call SNESVISetVariableBounds(SNES_damage,bound_l,bound_u,err_PETSc) ! variable bounds for variational inequalities
call SNESVISetVariableBounds(SNES_damage,bound_l,bound_u,err_PETSc) ! variable bounds for variational inequalities
CHKERRQ(err_PETSc)
call DMRestoreGlobalVector(DM_damage,bound_l,err_PETSc)
CHKERRQ(err_PETSc)
Expand Down
2 changes: 1 addition & 1 deletion src/grid/grid_mech_FEM.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module grid_mechanical_FEM
use math
use rotations
use spectral_utilities
use grid_mech_utilities
use grid_utilities
use config
use homogenization
use discretization
Expand Down
Loading

0 comments on commit 46c3009

Please sign in to comment.