From c9a460929032fbff91d133840c36ade829ea3fc4 Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Sat, 22 Sep 2018 12:48:57 +0200 Subject: [PATCH 1/9] reading in BCs correctly --- src/DAMASK_FEM.f90 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/DAMASK_FEM.f90 b/src/DAMASK_FEM.f90 index 98471845e..e31eef7f6 100644 --- a/src/DAMASK_FEM.f90 +++ b/src/DAMASK_FEM.f90 @@ -163,6 +163,16 @@ program DAMASK_FEM case(FIELD_MECH_ID) loadCases(i)%fieldBC(field)%nComponents = dimPlex !< X, Y (, Z) displacements allocate(loadCases(i)%fieldBC(field)%componentBC(loadCases(i)%fieldBC(field)%nComponents)) + do component = 1, loadCases(i)%fieldBC(field)%nComponents + select case (component) + case (1) + loadCases(i)%fieldBC(field)%componentBC(component)%ID = COMPONENT_MECH_X_ID + case (2) + loadCases(i)%fieldBC(field)%componentBC(component)%ID = COMPONENT_MECH_Y_ID + case (3) + loadCases(i)%fieldBC(field)%componentBC(component)%ID = COMPONENT_MECH_Z_ID + end select + enddo end select do component = 1, loadCases(i)%fieldBC(field)%nComponents allocate(loadCases(i)%fieldBC(field)%componentBC(component)%Value(mesh_Nboundaries), source = 0.0_pReal) From e15d1d5945abf38162604e5e62da5b9e1081f710 Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Sat, 22 Sep 2018 12:49:30 +0200 Subject: [PATCH 2/9] reasonable solver options --- examples/FEM/polyXtal/numerics.config | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/FEM/polyXtal/numerics.config b/examples/FEM/polyXtal/numerics.config index 23edd1823..330114825 100644 --- a/examples/FEM/polyXtal/numerics.config +++ b/examples/FEM/polyXtal/numerics.config @@ -1,2 +1,3 @@ residualStiffness 0.001 charLength 0.02 +petsc_options -mech_snes_type newtonls -mech_ksp_type fgmres -mech_pc_type ml -mech_ksp_monitor \ No newline at end of file From 22c1436af672243e6a876825cdb1002c0428fb9c Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Sat, 22 Sep 2018 12:49:56 +0200 Subject: [PATCH 3/9] working with petsc 3.10 --- src/DAMASK_interface.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DAMASK_interface.f90 b/src/DAMASK_interface.f90 index 4321cfaa6..8d62286ee 100644 --- a/src/DAMASK_interface.f90 +++ b/src/DAMASK_interface.f90 @@ -43,7 +43,7 @@ subroutine DAMASK_interface_init() use, intrinsic :: & iso_fortran_env #include -#if PETSC_VERSION_MAJOR!=3 || PETSC_VERSION_MINOR!=9 +#if PETSC_VERSION_MAJOR!=3 || PETSC_VERSION_MINOR!=10 =================================================================================================== 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x 3.9.x =================================================================================================== From 81ced0639396ccc6672953c20acc05f097befd66 Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Sat, 22 Sep 2018 12:51:02 +0200 Subject: [PATCH 4/9] order --> degree --- src/FEM_utilities.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FEM_utilities.f90 b/src/FEM_utilities.f90 index 8f0b88e37..1db950e63 100644 --- a/src/FEM_utilities.f90 +++ b/src/FEM_utilities.f90 @@ -188,7 +188,7 @@ subroutine utilities_init() call PetscOptionsInsertString(PETSC_NULL_OPTIONS,trim(petsc_defaultOptions),ierr) call PetscOptionsInsertString(PETSC_NULL_OPTIONS,trim(petsc_options),ierr) CHKERRQ(ierr) - write(petsc_optionsPhysics,'(a,i0)') '-mechFE_petscspace_order ' , structOrder + write(petsc_optionsPhysics,'(a,i0)') '-mechFE_petscspace_degree ' , structOrder call PetscOptionsInsertString(PETSC_NULL_OPTIONS,trim(petsc_optionsPhysics),ierr) CHKERRQ(ierr) From becd9599134710050fabca189d906b889c195a33 Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Sat, 22 Sep 2018 12:52:29 +0200 Subject: [PATCH 5/9] dmda not needed --- src/FEM_mech.f90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/FEM_mech.f90 b/src/FEM_mech.f90 index 630029ac7..3dd6cfb1e 100644 --- a/src/FEM_mech.f90 +++ b/src/FEM_mech.f90 @@ -7,10 +7,8 @@ module FEM_mech #include #include -#include #include - use PETScdmda use PETScsnes use PETScDM use PETScDMplex From 6c21c60c70bbcb83fe1895d8d35c720ea8fbb5e3 Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Sat, 22 Sep 2018 12:53:02 +0200 Subject: [PATCH 6/9] corrected nbasis --- src/FEM_mech.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/FEM_mech.f90 b/src/FEM_mech.f90 index 3dd6cfb1e..6192a1e49 100644 --- a/src/FEM_mech.f90 +++ b/src/FEM_mech.f90 @@ -140,6 +140,7 @@ subroutine FEM_mech_init(fieldBC) ! Polar decomposition failed in run time call PetscFESetQuadrature(mechFE,mechQuad,ierr); CHKERRQ(ierr) call PetscFEGetDimension(mechFE,nBasis,ierr); CHKERRQ(ierr) + nBasis = nBasis/nc call DMGetDS(mech_mesh,mechDS,ierr); CHKERRQ(ierr) call PetscDSAddDiscretization(mechDS,mechFE,ierr); CHKERRQ(ierr) call PetscDSGetTotalDimension(mechDS,cellDof,ierr); CHKERRQ(ierr) From 4a25520828312c78bea2ac38171884e48697e276 Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Sat, 22 Sep 2018 12:53:33 +0200 Subject: [PATCH 7/9] removed debug write statements --- src/FEM_mech.f90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/FEM_mech.f90 b/src/FEM_mech.f90 index 6192a1e49..6aa6db48d 100644 --- a/src/FEM_mech.f90 +++ b/src/FEM_mech.f90 @@ -242,17 +242,12 @@ subroutine FEM_mech_init(fieldBC) call PetscFEGetDualSpace(mechFE,mechDualSpace,ierr); CHKERRQ(ierr) call DMPlexGetHeightStratum(mech_mesh,0,cellStart,cellEnd,ierr) CHKERRQ(ierr) - write(6,*) 'cellDof', cellDof;flush(6) - write(6,*) 'cell start and end-1',cellStart,cellEnd-1;flush(6) do cell = cellStart, cellEnd-1 !< loop over all elements - write(6,*) 'cell',cell;flush(6) x_scal = 0.0 call DMPlexComputeCellGeometryAffineFEM(mech_mesh,cell,pV0,pCellJ,pInvcellJ,detJ,ierr) CHKERRQ(ierr) cellJMat = reshape(pCellJ,shape=[dimPlex,dimPlex]) do basis = 0, nBasis-1 - write(6,*) 'nBasis-1',nBasis-1;flush(6) - write(6,*) 'basis',basis;flush(6) call PetscDualSpaceGetFunctional(mechDualSpace,basis,functional,ierr) CHKERRQ(ierr) call PetscQuadratureGetData(functional,dimPlex,nc,nNodalPoints,nodalPointsP,nodalWeightsP,ierr) From ffcadc1d865ea06982d9a882c11f14784cdc297e Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Sat, 22 Sep 2018 12:54:45 +0200 Subject: [PATCH 8/9] use displacements instead of coordinates --- src/FEM_mech.f90 | 5 ++++- src/FEM_utilities.f90 | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/FEM_mech.f90 b/src/FEM_mech.f90 index 6aa6db48d..d379a6255 100644 --- a/src/FEM_mech.f90 +++ b/src/FEM_mech.f90 @@ -327,6 +327,7 @@ subroutine FEM_mech_formResidual(dm_local,xx_local,f_local,dummy,ierr) materialpoint_F, & materialpoint_P use math, only: & + math_I3, & math_det33, & math_inv33 use FEsolving, only: & @@ -362,7 +363,8 @@ subroutine FEM_mech_formResidual(dm_local,xx_local,f_local,dummy,ierr) CHKERRQ(ierr) call DMPlexGetHeightStratum(dm_local,0,cellStart,cellEnd,ierr); CHKERRQ(ierr) call DMGetLocalVector(dm_local,x_local,ierr); CHKERRQ(ierr) - call VecWAXPY(x_local,1.0,xx_local,solution_local,ierr); CHKERRQ(ierr) + !call VecWAXPY(x_local,1.0,xx_local,solution_local,ierr); CHKERRQ(ierr) + call VecCopy(xx_local,x_local,ierr); CHKERRQ(ierr) do field = 1, dimPlex; do face = 1, mesh_Nboundaries if (params%fieldBC%componentBC(field)%Mask(face)) then call DMGetStratumSize(dm_local,'Face Sets',mesh_boundaries(face),bcSize,ierr) @@ -395,6 +397,7 @@ subroutine FEM_mech_formResidual(dm_local,xx_local,f_local,dummy,ierr) enddo enddo materialpoint_F(1:dimPlex,1:dimPlex,qPt+1,cell+1) = & + math_I3 + & reshape(matmul(BMat,x_scal),shape=[dimPlex,dimPlex], order=[2,1]) enddo if (BBarStabilisation) then diff --git a/src/FEM_utilities.f90 b/src/FEM_utilities.f90 index 1db950e63..6e2eed2fb 100644 --- a/src/FEM_utilities.f90 +++ b/src/FEM_utilities.f90 @@ -411,7 +411,7 @@ subroutine utilities_projectBCValues(localVec,section,field,comp,bcPointsIS,BCVa call PetscSectionGetFieldOffset(section,bcPoints(point),field,offset,ierr) CHKERRQ(ierr) do dof = offset+comp+1, offset+numDof, numComp - localArray(dof) = localArray(dof) + BCValue + BCDotValue*timeinc + localArray(dof) = BCValue + BCDotValue*timeinc enddo enddo call VecRestoreArrayF90(localVec,localArray,ierr); CHKERRQ(ierr) From d9bdf5362850813a00aa91e27b13fb80a24b45e0 Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Sat, 22 Sep 2018 12:55:23 +0200 Subject: [PATCH 9/9] quadrature weights defined twice for some reason --- src/FEM_mech.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/FEM_mech.f90 b/src/FEM_mech.f90 index d379a6255..c58027bde 100644 --- a/src/FEM_mech.f90 +++ b/src/FEM_mech.f90 @@ -109,7 +109,6 @@ subroutine FEM_mech_init(fieldBC) PetscInt :: cellStart, cellEnd, cell, basis character(len=7) :: prefix = 'mechFE_' PetscErrorCode :: ierr - PetscReal, allocatable, target, dimension(:) :: qWeights write(6,'(/,a)') ' <<<+- FEM_mech init -+>>>' write(6,'(a15,a)') ' Current time: ',IO_timeStamp()