added files for geometry reconstruction from given deformation gradient.
reconstruct.f90 is a fortran source file with comments to use with f2py reconstruct.pyd is the compiled python module test.py is a test file to check if the reconstruction works (unfortunately i does not at the moment, probably because there are type conflicts between fortran and python)
This commit is contained in:
parent
8d6ddcf28b
commit
3b0eeb9956
|
@ -0,0 +1,47 @@
|
||||||
|
! -*- f90 -*-
|
||||||
|
subroutine simple(defgrad,res_x,res_y,res_z,geomdimension,current_configuration)
|
||||||
|
implicit none
|
||||||
|
! *** Precision of real and integer variables ***
|
||||||
|
integer, parameter :: pReal = selected_real_kind(15) ! 15 significant digits, up to 1e+-300
|
||||||
|
integer, parameter :: pInt = selected_int_kind(9) ! up to +- 1e9
|
||||||
|
integer(pInt) i,j,k
|
||||||
|
integer(pInt) res_x, res_y, res_z
|
||||||
|
integer(pInt), dimension(3) :: resolution
|
||||||
|
real(pReal) , dimension(3) :: geomdimension
|
||||||
|
real(pReal) , dimension(3,3) :: temp33_Real
|
||||||
|
real*8 current_configuration(res_x, res_y, res_z,3)
|
||||||
|
real*8 defgrad(res_x, res_y, res_z,3,3)
|
||||||
|
!f2py intent(in) res_x, res_y, res_z
|
||||||
|
!f2py intent(in) geomdimension
|
||||||
|
!f2py intent(out) current_configuration
|
||||||
|
!f2py intent(in) defgrad
|
||||||
|
!f2py depend(res_x, res_y, res_z) current_configuration
|
||||||
|
!f2py depend(res_x, res_y, res_z) defgrad
|
||||||
|
|
||||||
|
resolution(1) = res_x; resolution(2) = res_y; resolution(3) = res_z
|
||||||
|
print*, defgrad
|
||||||
|
do k = 1, resolution(3); do j = 1, resolution(2); do i = 1, resolution(1)
|
||||||
|
if((k==1).and.(j==1).and.(i==1)) then
|
||||||
|
temp33_Real =0.0_pReal
|
||||||
|
else
|
||||||
|
if((j==1).and.(i==1)) then
|
||||||
|
temp33_Real(1,:) = temp33_Real(1,:) + matmul(defgrad(i,j,k,:,:),&
|
||||||
|
(/0.0_pReal,0.0_pReal,(real(resolution(3), pReal)/geomdimension(3))/))
|
||||||
|
temp33_Real(2,:) = temp33_Real(1,:)
|
||||||
|
temp33_Real(3,:) = temp33_Real(1,:)
|
||||||
|
current_configuration(i,j,k,:) = temp33_Real(1,:)
|
||||||
|
else
|
||||||
|
if(i==1) then
|
||||||
|
temp33_Real(2,:) = temp33_Real(2,:) + matmul(defgrad(i,j,k,:,:),&
|
||||||
|
(/0.0_pReal,(real(resolution(2),pReal)/geomdimension(2)),0.0_pReal/))
|
||||||
|
temp33_Real(3,:) = temp33_Real(2,:)
|
||||||
|
current_configuration(i,j,k,:) = temp33_Real(2,:)
|
||||||
|
else
|
||||||
|
temp33_Real(3,:) = temp33_Real(3,:) + matmul(defgrad(i,j,k,:,:),&
|
||||||
|
(/(real(resolution(1), pReal)/geomdimension(1)),0.0_pReal,0.0_pReal/))
|
||||||
|
current_configuration(i,j,k,:) = temp33_Real(3,:)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
enddo; enddo; enddo
|
||||||
|
end subroutine simple
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
||||||
|
import numpy
|
||||||
|
import reconstruct
|
||||||
|
# dummy values for resolution and geomdimension (formerly called meshdimension)
|
||||||
|
resolution=numpy.zeros((3),'i')
|
||||||
|
resolution[0]=2
|
||||||
|
resolution[1]=2
|
||||||
|
resolution[2]=2
|
||||||
|
geomdimension=numpy.zeros((3),'d')
|
||||||
|
geomdimension[0]=1.0
|
||||||
|
geomdimension[1]=1.0
|
||||||
|
geomdimension[2]=1.0
|
||||||
|
defgrad=numpy.zeros((resolution[0],resolution[1],resolution[2],3,3),'d')
|
||||||
|
for i in range (0, resolution[0]):
|
||||||
|
for j in range (0, resolution[1]):
|
||||||
|
for k in range (0, resolution[2]):
|
||||||
|
defgrad[i][j][k][0][0]=1.0
|
||||||
|
defgrad[i][j][k][1][1]=1.0
|
||||||
|
defgrad[i][j][k][2][2]=1.0
|
||||||
|
print defgrad
|
||||||
|
current_configuration=reconstruct.simple(defgrad,resolution[0],resolution[1],resolution[2],geomdimension) # don't know how to pass arrays for the resolution
|
||||||
|
print current_configuration
|
Loading…
Reference in New Issue