cleaned up core modul
This commit is contained in:
parent
004375cc79
commit
8a30021202
|
@ -107,28 +107,6 @@ python module core ! in
|
||||||
! function definition
|
! function definition
|
||||||
real*8 dimension(3,3), :: math_tensorAvg
|
real*8 dimension(3,3), :: math_tensorAvg
|
||||||
end function math_tensorAvg
|
end function math_tensorAvg
|
||||||
|
|
||||||
function math_logstrainSpat(F) ! in :math:math.f90
|
|
||||||
! input variables
|
|
||||||
real*8, dimension(:,:,:,:,:), intent(in) :: F
|
|
||||||
! output variables
|
|
||||||
real*8, dimension(3,3,size(F,3),size(F,4),size(F,5)), depend(F) :: math_logstrainSpat
|
|
||||||
end function math_logstrainSpat
|
|
||||||
|
|
||||||
function math_logstrainMat(F) ! in :math:math.f90
|
|
||||||
! input variables
|
|
||||||
real*8, dimension(:,:,:,:,:), intent(in) :: F
|
|
||||||
! function
|
|
||||||
real*8, dimension(3,3,size(F,3),size(F,4),size(F,5)), depend(F) :: math_logstrainMat
|
|
||||||
end function math_logstrainMat
|
|
||||||
|
|
||||||
function math_cauchy(F,P) ! in :math:math.f90
|
|
||||||
! input variables
|
|
||||||
real*8, dimension(:,:,:,:,:), intent(in) :: F
|
|
||||||
real*8, dimension(:,:,:,:,:), intent(in) :: P
|
|
||||||
! function
|
|
||||||
real*8, dimension(3,3,size(F,3),size(F,4),size(F,5)), depend(F) :: math_cauchy
|
|
||||||
end function math_cauchy
|
|
||||||
|
|
||||||
end module math
|
end module math
|
||||||
|
|
||||||
|
@ -158,14 +136,6 @@ python module core ! in
|
||||||
real*8, dimension(3,size(centres,2)+1,size(centres,3)+1,size(centres,4)+1), depend(centres) :: wrappedCentres
|
real*8, dimension(3,size(centres,2)+1,size(centres,3)+1,size(centres,4)+1), depend(centres) :: wrappedCentres
|
||||||
end function mesh_nodesAroundCentres
|
end function mesh_nodesAroundCentres
|
||||||
|
|
||||||
function mesh_deformedCoordsLinear(gDim,F,FavgIn) ! in :mesh:mesh.f90
|
|
||||||
real*8, dimension(:,:,:,:,:), intent(in) :: F
|
|
||||||
real*8, dimension(3), intent(in) :: gDim
|
|
||||||
real*8, dimension(3,3), intent(in), optional :: FavgIn = -1.0
|
|
||||||
real*8, dimension(3,size(F,3),size(F,4),size(F,5)), depend(F) :: mesh_deformedCoordsLinear
|
|
||||||
real*8, dimension(3,0:size(F,3)-1,0:size(F,4)-1,0:size(F,5)-1,0:7), depend(F) :: coordsAvgOrder
|
|
||||||
end function mesh_deformedCoordsLinear
|
|
||||||
|
|
||||||
function mesh_deformedCoordsFFT(gDim,F,FavgIn,scalingIn) ! in :mesh:mesh.f90
|
function mesh_deformedCoordsFFT(gDim,F,FavgIn,scalingIn) ! in :mesh:mesh.f90
|
||||||
real*8, dimension(:,:,:,:,:), intent(in) :: F
|
real*8, dimension(:,:,:,:,:), intent(in) :: F
|
||||||
real*8, dimension(3), intent(in) :: gDim
|
real*8, dimension(3), intent(in) :: gDim
|
||||||
|
|
170
code/mesh.f90
170
code/mesh.f90
|
@ -422,7 +422,6 @@ module mesh
|
||||||
mesh_regrid, &
|
mesh_regrid, &
|
||||||
mesh_nodesAroundCentres, &
|
mesh_nodesAroundCentres, &
|
||||||
mesh_deformedCoordsFFT, &
|
mesh_deformedCoordsFFT, &
|
||||||
mesh_deformedCoordsLinear, &
|
|
||||||
mesh_volumeMismatch, &
|
mesh_volumeMismatch, &
|
||||||
mesh_shapeMismatch
|
mesh_shapeMismatch
|
||||||
#endif
|
#endif
|
||||||
|
@ -2033,175 +2032,6 @@ function mesh_nodesAroundCentres(gDim,Favg,centres) result(nodes)
|
||||||
end function mesh_nodesAroundCentres
|
end function mesh_nodesAroundCentres
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief calculate coordinates in current configuration for given defgrad using linear
|
|
||||||
! interpolation
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
function mesh_deformedCoordsLinear(gDim,F,FavgIn) result(coords)
|
|
||||||
use debug, only: &
|
|
||||||
debug_mesh, &
|
|
||||||
debug_level, &
|
|
||||||
debug_levelBasic
|
|
||||||
use math, only: &
|
|
||||||
math_mul33x3
|
|
||||||
|
|
||||||
implicit none
|
|
||||||
real(pReal), intent(in), dimension(:,:,:,:,:) :: &
|
|
||||||
F
|
|
||||||
real(pReal), dimension(3,size(F,3),size(F,4),size(F,5)) :: &
|
|
||||||
coords
|
|
||||||
real(pReal), intent(in), dimension(3) :: &
|
|
||||||
gDim
|
|
||||||
real(pReal), intent(in), dimension(3,3), optional :: &
|
|
||||||
FavgIn
|
|
||||||
real(pReal), dimension(3,0:size(F,3)-1,0:size(F,4)-1,0:size(F,5)-1,0:7) :: &
|
|
||||||
coordsAvgOrder
|
|
||||||
integer(pInt), parameter, dimension(3) :: &
|
|
||||||
iOnes = 1_pInt
|
|
||||||
real(pReal), parameter, dimension(3) :: &
|
|
||||||
fOnes = 1.0_pReal
|
|
||||||
real(pReal), dimension(3) :: &
|
|
||||||
myStep, &
|
|
||||||
negative, &
|
|
||||||
positive, &
|
|
||||||
offsetCoords, &
|
|
||||||
parameterCoords, &
|
|
||||||
stepLength, &
|
|
||||||
fRes
|
|
||||||
real(pReal), dimension(3,3) :: &
|
|
||||||
Favg
|
|
||||||
integer(pInt), dimension(3) :: &
|
|
||||||
rear, &
|
|
||||||
init, &
|
|
||||||
oppo, &
|
|
||||||
me, &
|
|
||||||
smallRes, &
|
|
||||||
iRes
|
|
||||||
integer(pInt) :: &
|
|
||||||
i, j, k, s, o
|
|
||||||
integer(pInt), parameter, dimension(3,0:7) :: &
|
|
||||||
corner = reshape([ &
|
|
||||||
0_pInt, 0_pInt, 0_pInt,&
|
|
||||||
1_pInt, 0_pInt, 0_pInt,&
|
|
||||||
1_pInt, 1_pInt, 0_pInt,&
|
|
||||||
0_pInt, 1_pInt, 0_pInt,&
|
|
||||||
1_pInt, 1_pInt, 1_pInt,&
|
|
||||||
0_pInt, 1_pInt, 1_pInt,&
|
|
||||||
0_pInt, 0_pInt, 1_pInt,&
|
|
||||||
1_pInt, 0_pInt, 1_pInt &
|
|
||||||
],[3,8]), &
|
|
||||||
step = reshape([&
|
|
||||||
1_pInt, 1_pInt, 1_pInt,&
|
|
||||||
-1_pInt, 1_pInt, 1_pInt,&
|
|
||||||
-1_pInt,-1_pInt, 1_pInt,&
|
|
||||||
1_pInt,-1_pInt, 1_pInt,&
|
|
||||||
-1_pInt,-1_pInt,-1_pInt,&
|
|
||||||
1_pInt,-1_pInt,-1_pInt,&
|
|
||||||
1_pInt, 1_pInt,-1_pInt,&
|
|
||||||
-1_pInt, 1_pInt,-1_pInt &
|
|
||||||
], [3,8])
|
|
||||||
integer(pInt), parameter, dimension(3,6) :: &
|
|
||||||
order = reshape([ &
|
|
||||||
1_pInt, 2_pInt, 3_pInt,&
|
|
||||||
1_pInt, 3_pInt, 2_pInt,&
|
|
||||||
2_pInt, 1_pInt, 3_pInt,&
|
|
||||||
2_pInt, 3_pInt, 1_pInt,&
|
|
||||||
3_pInt, 1_pInt, 2_pInt,&
|
|
||||||
3_pInt, 2_pInt, 1_pInt &
|
|
||||||
], [3,6])
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! initializing variables
|
|
||||||
iRes = [size(F,3),size(F,4),size(F,5)]
|
|
||||||
fRes = real(iRes,pReal)
|
|
||||||
smallRes = iRes - 1_pInt
|
|
||||||
coordsAvgOrder = 0.0_pReal
|
|
||||||
stepLength = gDim/fRes
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! report
|
|
||||||
if (iand(debug_level(debug_mesh),debug_levelBasic) /= 0_pInt) then
|
|
||||||
write(6,'(a)') ' Restore geometry using linear integration'
|
|
||||||
write(6,'(a,3(i12 ))') ' grid a b c: ', iRes
|
|
||||||
write(6,'(a,3(es12.5))') ' size x y z: ', gDim
|
|
||||||
endif
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! determine average deformation gradient
|
|
||||||
if (present(FavgIn)) then
|
|
||||||
if (all(FavgIn < 0.0_pReal)) then ! the f2py way to tell it is not present
|
|
||||||
Favg = sum(sum(sum(F,dim=5),dim=4),dim=3) / product(fRes)
|
|
||||||
else
|
|
||||||
Favg = FavgIn
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
Favg = sum(sum(sum(F,dim=5),dim=4),dim=3) / product(fRes)
|
|
||||||
endif
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! loop over starting corners (from 0 to 7)
|
|
||||||
cornerLooping: do s = 0_pInt, 7_pInt
|
|
||||||
init = corner(1:3,s) * smallRes + iOnes
|
|
||||||
oppo = corner(1:3,mod((s+4_pInt),8_pInt)) * smallRes + iOnes
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! permutation of ways on each corner
|
|
||||||
permutationLooping: do o = 1_pInt,6_pInt
|
|
||||||
coords = 0.0_pReal
|
|
||||||
do k = init(order(3,o)), oppo(order(3,o)), step(order(3,o),s)
|
|
||||||
rear(order(2,o)) = init(order(2,o))
|
|
||||||
do j = init(order(2,o)), oppo(order(2,o)), step(order(2,o),s)
|
|
||||||
rear(order(1,o)) = init(order(1,o))
|
|
||||||
do i = init(order(1,o)), oppo(order(1,o)), step(order(1,o),s)
|
|
||||||
me(order(1:3,o)) = [i,j,k]
|
|
||||||
if ( all(me == init)) then
|
|
||||||
coords(1:3,me(1),me(2),me(3)) = gDim*( math_mul33x3(Favg,real(corner(1:3,s),pReal)) &
|
|
||||||
+math_mul33x3(F(1:3,1:3,me(1),me(2),me(3)), &
|
|
||||||
0.5_pReal*real(step(1:3,s)/iRes,pReal)))
|
|
||||||
else
|
|
||||||
myStep = (me-rear)*stepLength
|
|
||||||
coords(1:3,me(1),me(2),me(3)) = coords(1:3,rear(1),rear(2),rear(3)) + &
|
|
||||||
0.5_pReal*math_mul33x3(F(1:3,1:3,me(1),me(2),me(3)) + &
|
|
||||||
F(1:3,1:3,rear(1),rear(2),rear(3)),myStep)
|
|
||||||
endif
|
|
||||||
rear = me
|
|
||||||
enddo; enddo; enddo
|
|
||||||
coordsAvgOrder(1:3,0:smallRes(1),0:smallRes(2),0:smallRes(3),s) = &
|
|
||||||
coordsAvgOrder(1:3,0:smallRes(1),0:smallRes(2),0:smallRes(3),s) + coords/6.0_pReal
|
|
||||||
enddo permutationLooping
|
|
||||||
offsetCoords = coordsAvgOrder(1:3,0,0,0,s)
|
|
||||||
do k = 0_pInt, smallRes(3); do j = 0_pInt, smallRes(2); do i = 0_pInt, smallRes(1)
|
|
||||||
coordsAvgOrder(1:3,i,j,k,s) = coordsAvgOrder(1:3,i,j,k,s) - offsetCoords
|
|
||||||
enddo; enddo; enddo
|
|
||||||
enddo cornerLooping
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! linear interpolation starting at each corner (comparable to linear shape function FEM)
|
|
||||||
do k = 0_pInt, smallRes(3); do j = 0_pInt, smallRes(2); do i = 0_pInt, smallRes(1)
|
|
||||||
parameterCoords = (2.0_pReal*real([i,j,k]+1,pReal)-fRes)/fRes
|
|
||||||
positive = fones + parameterCoords
|
|
||||||
negative = fones - parameterCoords
|
|
||||||
coords(1:3,i+1_pInt,j+1_pInt,k+1_pInt) &
|
|
||||||
=(coordsAvgOrder(1:3,i,j,k,0) *negative(1)*negative(2)*negative(3)&
|
|
||||||
+ coordsAvgOrder(1:3,i,j,k,1) *positive(1)*negative(2)*negative(3)&
|
|
||||||
+ coordsAvgOrder(1:3,i,j,k,2) *positive(1)*positive(2)*negative(3)&
|
|
||||||
+ coordsAvgOrder(1:3,i,j,k,3) *negative(1)*positive(2)*negative(3)&
|
|
||||||
+ coordsAvgOrder(1:3,i,j,k,4) *positive(1)*positive(2)*positive(3)&
|
|
||||||
+ coordsAvgOrder(1:3,i,j,k,5) *negative(1)*positive(2)*positive(3)&
|
|
||||||
+ coordsAvgOrder(1:3,i,j,k,6) *negative(1)*negative(2)*positive(3)&
|
|
||||||
+ coordsAvgOrder(1:3,i,j,k,7) *positive(1)*negative(2)*positive(3))*0.125_pReal
|
|
||||||
enddo; enddo; enddo
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! setting base node to (0,0,0)
|
|
||||||
offsetCoords = math_mul33x3(F(1:3,1:3,1,1,1),stepLength/2.0_pReal) - coords(1:3,1,1,1)
|
|
||||||
do k = 1_pInt, iRes(3); do j = 1_pInt, iRes(2); do i = 1_pInt, iRes(1)
|
|
||||||
coords(1:3,i,j,k) = coords(1:3,i,j,k) + offsetCoords
|
|
||||||
enddo; enddo; enddo
|
|
||||||
|
|
||||||
end function mesh_deformedCoordsLinear
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief calculate coordinates in current configuration for given defgrad
|
!> @brief calculate coordinates in current configuration for given defgrad
|
||||||
! using integration in Fourier space
|
! using integration in Fourier space
|
||||||
|
|
|
@ -36,14 +36,10 @@ try:
|
||||||
core.math.periodicNearestNeighbor = core.math.math_periodicNearestNeighbor
|
core.math.periodicNearestNeighbor = core.math.math_periodicNearestNeighbor
|
||||||
core.math.periodicNearestNeighborDistances = core.math.math_periodicNearestNeighborDistances
|
core.math.periodicNearestNeighborDistances = core.math.math_periodicNearestNeighborDistances
|
||||||
core.math.tensorAvg = core.math.math_tensorAvg
|
core.math.tensorAvg = core.math.math_tensorAvg
|
||||||
core.math.logstrainSpat = core.math.math_logstrainSpat
|
|
||||||
core.math.logstrainMat = core.math.math_logstrainMat
|
|
||||||
core.math.cauchy = core.math.math_cauchy
|
|
||||||
core.FEsolving.init = core.FEsolving.FE_init
|
core.FEsolving.init = core.FEsolving.FE_init
|
||||||
core.mesh.init = core.mesh.mesh_init
|
core.mesh.init = core.mesh.mesh_init
|
||||||
core.mesh.regrid = core.mesh.mesh_regrid
|
core.mesh.regrid = core.mesh.mesh_regrid
|
||||||
core.mesh.nodesAroundCentres = core.mesh.mesh_nodesAroundCentres
|
core.mesh.nodesAroundCentres = core.mesh.mesh_nodesAroundCentres
|
||||||
core.mesh.deformedCoordsLinear = core.mesh.mesh_deformedCoordsLinear
|
|
||||||
core.mesh.deformedCoordsFFT = core.mesh.mesh_deformedCoordsFFT
|
core.mesh.deformedCoordsFFT = core.mesh.mesh_deformedCoordsFFT
|
||||||
core.mesh.volumeMismatch = core.mesh.mesh_volumeMismatch
|
core.mesh.volumeMismatch = core.mesh.mesh_volumeMismatch
|
||||||
core.mesh.shapeMismatch = core.mesh.mesh_shapeMismatch
|
core.mesh.shapeMismatch = core.mesh.mesh_shapeMismatch
|
||||||
|
|
|
@ -191,8 +191,6 @@ parser.add_option('--filenodalcoords', dest='filenodalcoords', metavar = 'string
|
||||||
help='ASCII table containing nodal coords')
|
help='ASCII table containing nodal coords')
|
||||||
parser.add_option('--labelnodalcoords', dest='labelnodalcoords', nargs=3,
|
parser.add_option('--labelnodalcoords', dest='labelnodalcoords', nargs=3,
|
||||||
help='labels of nodal coords in ASCII table %default', metavar = 'string string string')
|
help='labels of nodal coords in ASCII table %default', metavar = 'string string string')
|
||||||
parser.add_option('-l', '--linear', dest='linearreconstruction', action='store_true',
|
|
||||||
help='use linear reconstruction of geometry [%default]')
|
|
||||||
|
|
||||||
parser.set_defaults(defgrad = 'f')
|
parser.set_defaults(defgrad = 'f')
|
||||||
parser.set_defaults(separator = 't')
|
parser.set_defaults(separator = 't')
|
||||||
|
@ -210,7 +208,6 @@ parser.set_defaults(unitlength = 0.0)
|
||||||
parser.set_defaults(cell = True)
|
parser.set_defaults(cell = True)
|
||||||
parser.set_defaults(filenodalcoords = '')
|
parser.set_defaults(filenodalcoords = '')
|
||||||
parser.set_defaults(labelnodalcoords = ('coord.x','coord.y','coord.z'))
|
parser.set_defaults(labelnodalcoords = ('coord.x','coord.y','coord.z'))
|
||||||
parser.set_defaults(linearreconstruction = False)
|
|
||||||
|
|
||||||
sep = {'n': '\n', 't': '\t', 's': ' '}
|
sep = {'n': '\n', 't': '\t', 's': ' '}
|
||||||
|
|
||||||
|
@ -219,7 +216,6 @@ sep = {'n': '\n', 't': '\t', 's': ' '}
|
||||||
options.scaling += [1.0 for i in xrange(max(0,3-len(options.scaling)))]
|
options.scaling += [1.0 for i in xrange(max(0,3-len(options.scaling)))]
|
||||||
options.scaling = map(float, options.scaling)
|
options.scaling = map(float, options.scaling)
|
||||||
|
|
||||||
if np.any(options.scaling != 1.0) and options.linearreconstruction: print 'cannot scale for linear reconstruction'
|
|
||||||
if np.any(options.scaling != 1.0) and options.filenodalcoords != '': print 'cannot scale when reading coordinate from file'
|
if np.any(options.scaling != 1.0) and options.filenodalcoords != '': print 'cannot scale when reading coordinate from file'
|
||||||
|
|
||||||
for filename in args:
|
for filename in args:
|
||||||
|
@ -329,10 +325,7 @@ for filename in args:
|
||||||
F = np.reshape(np.transpose(values[:,column['tensor'][options.defgrad]:
|
F = np.reshape(np.transpose(values[:,column['tensor'][options.defgrad]:
|
||||||
column['tensor'][options.defgrad]+9]),
|
column['tensor'][options.defgrad]+9]),
|
||||||
(3,3,grid[0],grid[1],grid[2]))
|
(3,3,grid[0],grid[1],grid[2]))
|
||||||
if options.linearreconstruction:
|
centroids = damask.core.mesh.deformedCoordsFFT(dim,F,Favg,options.scaling)
|
||||||
centroids = damask.core.mesh.deformedCoordsLinear(dim,F,Favg)
|
|
||||||
else:
|
|
||||||
centroids = damask.core.mesh.deformedCoordsFFT(dim,F,Favg,options.scaling)
|
|
||||||
nodes = damask.core.mesh.nodesAroundCentres(dim,Favg,centroids)
|
nodes = damask.core.mesh.nodesAroundCentres(dim,Favg,centroids)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue