some polishing for single precision version.
Now only prec and mpie_spectral are needed in different versions
This commit is contained in:
parent
ad4706673b
commit
8cae4d609a
|
@ -14,16 +14,12 @@ precision :=double
|
||||||
ifeq ($(precision),single)
|
ifeq ($(precision),single)
|
||||||
cpspectral_single.exe: mpie_spectral_single.o CPFEM.a
|
cpspectral_single.exe: mpie_spectral_single.o CPFEM.a
|
||||||
ifort -openmp -o cpspectral_single.exe mpie_spectral_single.o CPFEM.a libfftw3f_threads.a libfftw3f.a constitutive.a advanced.a basics.a -lpthread
|
ifort -openmp -o cpspectral_single.exe mpie_spectral_single.o CPFEM.a libfftw3f_threads.a libfftw3f.a constitutive.a advanced.a basics.a -lpthread
|
||||||
rm *.mod
|
|
||||||
|
|
||||||
mpie_spectral_single.o: mpie_spectral_single.f90 CPFEM.o
|
mpie_spectral_single.o: mpie_spectral_single.f90 CPFEM.o
|
||||||
ifort -openmp -c -O3 -heap-arrays 500000000 mpie_spectral_single.f90
|
ifort -openmp -c -O3 -heap-arrays 500000000 mpie_spectral_single.f90
|
||||||
|
|
||||||
else
|
else
|
||||||
cpspectral_double.exe: mpie_spectral.o CPFEM.a
|
cpspectral_double.exe: mpie_spectral.o CPFEM.a
|
||||||
ifort -openmp -o cpspectral_double.exe mpie_spectral.o CPFEM.a libfftw3_threads.a libfftw3.a constitutive.a advanced.a basics.a -lpthread
|
ifort -openmp -o cpspectral_double.exe mpie_spectral.o CPFEM.a libfftw3_threads.a libfftw3.a constitutive.a advanced.a basics.a -lpthread
|
||||||
rm *.mod
|
|
||||||
|
|
||||||
mpie_spectral.o: mpie_spectral.f90 CPFEM.o
|
mpie_spectral.o: mpie_spectral.f90 CPFEM.o
|
||||||
ifort -openmp -c -O3 -heap-arrays 500000000 mpie_spectral.f90
|
ifort -openmp -c -O3 -heap-arrays 500000000 mpie_spectral.f90
|
||||||
endif
|
endif
|
||||||
|
@ -66,31 +62,20 @@ constitutive_phenopowerlaw.o: constitutive_phenopowerlaw.f90 basics.a advanced.a
|
||||||
ifort -openmp -c -O3 -heap-arrays 500000000 constitutive_phenopowerlaw.f90
|
ifort -openmp -c -O3 -heap-arrays 500000000 constitutive_phenopowerlaw.f90
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(precision),single)
|
|
||||||
advanced.a: lattice.o
|
|
||||||
ar rc advanced.a FEsolving.o mesh_single.o material.o lattice.o
|
|
||||||
else
|
|
||||||
advanced.a: lattice.o
|
advanced.a: lattice.o
|
||||||
ar rc advanced.a FEsolving.o mesh.o material.o lattice.o
|
ar rc advanced.a FEsolving.o mesh.o material.o lattice.o
|
||||||
endif
|
|
||||||
|
|
||||||
lattice.o: lattice.f90 material.o
|
lattice.o: lattice.f90 material.o
|
||||||
ifort -openmp -c -O3 -heap-arrays 500000000 lattice.f90
|
ifort -openmp -c -O3 -heap-arrays 500000000 lattice.f90
|
||||||
ifeq ($(precision),single)
|
|
||||||
material.o: material.f90 mesh_single.o
|
|
||||||
ifort -openmp -c -O3 -heap-arrays 500000000 material.f90
|
|
||||||
mesh_single.o: mesh_single.f90 FEsolving.o
|
|
||||||
ifort -openmp -c -O3 -heap-arrays 500000000 mesh_single.f90
|
|
||||||
else
|
|
||||||
material.o: material.f90 mesh.o
|
material.o: material.f90 mesh.o
|
||||||
ifort -openmp -c -O3 -heap-arrays 500000000 material.f90
|
ifort -openmp -c -O3 -heap-arrays 500000000 material.f90
|
||||||
mesh.o: mesh.f90 FEsolving.o
|
mesh.o: mesh.f90 FEsolving.o
|
||||||
ifort -openmp -c -O3 -heap-arrays 500000000 mesh.f90
|
ifort -openmp -c -O3 -heap-arrays 500000000 mesh.f90
|
||||||
endif
|
|
||||||
FEsolving.o: FEsolving.f90 basics.a
|
FEsolving.o: FEsolving.f90 basics.a
|
||||||
ifort -openmp -c -O3 -heap-arrays 500000000 FEsolving.f90
|
ifort -openmp -c -O3 -heap-arrays 500000000 FEsolving.f90
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(precision),single)
|
ifeq ($(precision),single)
|
||||||
basics.a: debug.o math.o
|
basics.a: debug.o math.o
|
||||||
ar rc basics.a debug.o math.o numerics.o IO.o mpie_spectral_interface.o prec_single.o
|
ar rc basics.a debug.o math.o numerics.o IO.o mpie_spectral_interface.o prec_single.o
|
||||||
|
@ -101,7 +86,6 @@ endif
|
||||||
|
|
||||||
debug.o: debug.f90 numerics.o
|
debug.o: debug.f90 numerics.o
|
||||||
ifort -openmp -c -O3 debug.f90
|
ifort -openmp -c -O3 debug.f90
|
||||||
|
|
||||||
math.o: math.f90 numerics.o
|
math.o: math.f90 numerics.o
|
||||||
ifort -openmp -c -O3 math.f90
|
ifort -openmp -c -O3 math.f90
|
||||||
|
|
||||||
|
@ -109,6 +93,7 @@ numerics.o: numerics.f90 IO.o
|
||||||
ifort -openmp -c -O3 numerics.f90
|
ifort -openmp -c -O3 numerics.f90
|
||||||
IO.o: IO.f90 mpie_spectral_interface.o
|
IO.o: IO.f90 mpie_spectral_interface.o
|
||||||
ifort -openmp -c -O3 IO.f90
|
ifort -openmp -c -O3 IO.f90
|
||||||
|
|
||||||
ifeq ($(precision),single)
|
ifeq ($(precision),single)
|
||||||
mpie_spectral_interface.o: mpie_spectral_interface.f90 prec_single.o
|
mpie_spectral_interface.o: mpie_spectral_interface.f90 prec_single.o
|
||||||
ifort -openmp -c -O3 mpie_spectral_interface.f90
|
ifort -openmp -c -O3 mpie_spectral_interface.f90
|
||||||
|
@ -124,6 +109,7 @@ endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o
|
rm -rf *.o
|
||||||
|
rm -rf *.mod
|
||||||
rm -rf *.exe
|
rm -rf *.exe
|
||||||
rm -rf basics.a
|
rm -rf basics.a
|
||||||
rm -rf advanced.a
|
rm -rf advanced.a
|
||||||
|
|
|
@ -118,7 +118,7 @@ real(pReal), dimension(4,36), parameter :: math_symOperations = &
|
||||||
!**************************************************************************
|
!**************************************************************************
|
||||||
SUBROUTINE math_init ()
|
SUBROUTINE math_init ()
|
||||||
|
|
||||||
use prec, only: pReal,pInt
|
use prec, only: pReal,pInt,tol_math_check
|
||||||
use numerics, only: fixedSeed
|
use numerics, only: fixedSeed
|
||||||
use IO, only: IO_error
|
use IO, only: IO_error
|
||||||
implicit none
|
implicit none
|
||||||
|
@ -155,28 +155,28 @@ real(pReal), dimension(4,36), parameter :: math_symOperations = &
|
||||||
q = math_qRnd();
|
q = math_qRnd();
|
||||||
axisangle = math_QuaternionToAxisAngle(q);
|
axisangle = math_QuaternionToAxisAngle(q);
|
||||||
q2 = math_AxisAngleToQuaternion(axisangle(1:3),axisangle(4))
|
q2 = math_AxisAngleToQuaternion(axisangle(1:3),axisangle(4))
|
||||||
if ( any(abs( q-q2) > 1.0e-8 ) .and. &
|
if ( any(abs( q-q2) > tol_math_check ) .and. &
|
||||||
any(abs(-q-q2) > 1.0e-8 ) ) &
|
any(abs(-q-q2) > tol_math_check ) ) &
|
||||||
call IO_error(670)
|
call IO_error(670)
|
||||||
|
|
||||||
! +++ q -> R -> q +++
|
! +++ q -> R -> q +++
|
||||||
R = math_QuaternionToR(q);
|
R = math_QuaternionToR(q);
|
||||||
q2 = math_RToQuaternion(R)
|
q2 = math_RToQuaternion(R)
|
||||||
if ( any(abs( q-q2) > 1.0e-8 ) .and. &
|
if ( any(abs( q-q2) > tol_math_check ) .and. &
|
||||||
any(abs(-q-q2) > 1.0e-8 ) ) &
|
any(abs(-q-q2) > tol_math_check ) ) &
|
||||||
call IO_error(671)
|
call IO_error(671)
|
||||||
|
|
||||||
! +++ q -> euler -> q +++
|
! +++ q -> euler -> q +++
|
||||||
Eulers = math_QuaternionToEuler(q);
|
Eulers = math_QuaternionToEuler(q);
|
||||||
q2 = math_EulerToQuaternion(Eulers)
|
q2 = math_EulerToQuaternion(Eulers)
|
||||||
if ( any(abs( q-q2) > 1.0e-8 ) .and. &
|
if ( any(abs( q-q2) > tol_math_check ) .and. &
|
||||||
any(abs(-q-q2) > 1.0e-8 ) ) &
|
any(abs(-q-q2) > tol_math_check ) ) &
|
||||||
call IO_error(672)
|
call IO_error(672)
|
||||||
|
|
||||||
! +++ R -> euler -> R +++
|
! +++ R -> euler -> R +++
|
||||||
Eulers = math_RToEuler(R);
|
Eulers = math_RToEuler(R);
|
||||||
R2 = math_EulerToR(Eulers)
|
R2 = math_EulerToR(Eulers)
|
||||||
if ( any(abs( R-R2) > 1.0e-8 ) ) &
|
if ( any(abs( R-R2) > tol_math_check ) ) &
|
||||||
call IO_error(673)
|
call IO_error(673)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
integer, parameter :: pReal = selected_real_kind(15,300) ! 15 significant digits, up to 1e+-300
|
integer, parameter :: pReal = selected_real_kind(15,300) ! 15 significant digits, up to 1e+-300
|
||||||
integer, parameter :: pInt = selected_int_kind(9) ! up to +- 1e9
|
integer, parameter :: pInt = selected_int_kind(9) ! up to +- 1e9
|
||||||
integer, parameter :: pLongInt = 8 ! should be 64bit
|
integer, parameter :: pLongInt = 8 ! should be 64bit
|
||||||
|
real(pReal), parameter :: tol_math_check = 1.0e-8_pReal
|
||||||
|
real(pReal), parameter :: tol_gravityNodePos = 1.0e-100_pReal
|
||||||
|
|
||||||
type :: p_vec
|
type :: p_vec
|
||||||
real(pReal), dimension(:), pointer :: p
|
real(pReal), dimension(:), pointer :: p
|
||||||
end type p_vec
|
end type p_vec
|
||||||
|
@ -17,6 +19,8 @@
|
||||||
CONTAINS
|
CONTAINS
|
||||||
|
|
||||||
subroutine prec_init
|
subroutine prec_init
|
||||||
|
implicit none
|
||||||
|
|
||||||
write(6,*)
|
write(6,*)
|
||||||
write(6,*) '<<<+- prec init -+>>>'
|
write(6,*) '<<<+- prec init -+>>>'
|
||||||
write(6,*) '$Id$'
|
write(6,*) '$Id$'
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
integer, parameter :: pReal = selected_real_kind(6,37) ! 6 significant digits, up to 1e+-37
|
integer, parameter :: pReal = selected_real_kind(6,37) ! 6 significant digits, up to 1e+-37
|
||||||
integer, parameter :: pInt = selected_int_kind(9) ! up to +- 1e9
|
integer, parameter :: pInt = selected_int_kind(9) ! up to +- 1e9
|
||||||
integer, parameter :: pLongInt = 8 ! should be 64bit
|
integer, parameter :: pLongInt = 8 ! should be 64bit
|
||||||
|
real(pReal), parameter :: tol_math_check = 1.0e-6_pReal
|
||||||
|
real(pReal), parameter :: tol_gravityNodePos = 1.0e-36_pReal
|
||||||
|
|
||||||
type :: p_vec
|
type :: p_vec
|
||||||
real(pReal), dimension(:), pointer :: p
|
real(pReal), dimension(:), pointer :: p
|
||||||
end type p_vec
|
end type p_vec
|
||||||
|
|
|
@ -324,45 +324,15 @@ for i in range(p.N_element_scalars):
|
||||||
c_pos = p.dataOffset + i*8.0 + 4.0
|
c_pos = p.dataOffset + i*8.0 + 4.0
|
||||||
p.file.seek(c_pos)
|
p.file.seek(c_pos)
|
||||||
print(i, struct.unpack('d',p.file.read(8)))
|
print(i, struct.unpack('d',p.file.read(8)))
|
||||||
for i in range(1,2):
|
|
||||||
c_pos = p.dataOffset + i*(p.N_element_scalars*8*p.N_elements + 8) #8 accounts for header&footer
|
|
||||||
defgrad = readTensor(p.resolution,p.file,p.N_element_scalars,c_pos,7)
|
|
||||||
defgrad_av = postprocessingMath.tensor_avg(res_x,res_y,res_z,defgrad)
|
|
||||||
centroids_coord = postprocessingMath.deformed(res_x,res_y,res_z,p.dimension,defgrad,defgrad_av)
|
|
||||||
undeformed = postprocessingMath.mesh(p.resolution[0],p.resolution[1],p.resolution[2],p.dimension,defgrad_av,centroids_coord)
|
|
||||||
#writeVtkAscii(name+'-mesh-undeformed.vtk',undeformed,defgrad[:,:,:,1,2],p.resolution)
|
|
||||||
|
|
||||||
for i in range(240,241):
|
for i in range(200,201): # define here the steps
|
||||||
c_pos = p.dataOffset + i*(p.N_element_scalars*8*p.N_elements + 8) #8 accounts for header&footer
|
c_pos = p.dataOffset + i*(p.N_element_scalars*8*p.N_elements + 8) #8 accounts for header&footer
|
||||||
defgrad = readTensor(p.resolution,p.file,p.N_element_scalars,c_pos,7)
|
defgrad = readTensor(p.resolution,p.file,p.N_element_scalars,c_pos,7) #define here the position of the deformation gradient
|
||||||
|
rotation = readTensor(p.resolution,p.file,p.N_element_scalars,c_pos,7) #define here the position of the tensor
|
||||||
defgrad_av = postprocessingMath.tensor_avg(res_x,res_y,res_z,defgrad)
|
defgrad_av = postprocessingMath.tensor_avg(res_x,res_y,res_z,defgrad)
|
||||||
#defgrad = numpy.zeros([p.resolution[0],p.resolution[1],p.resolution[2],3,3], 'd')
|
centroids_coord = postprocessingMath.deformed_fft(res_x,res_y,res_z,p.dimension,defgrad,defgrad_av,1.0)
|
||||||
#for z in range(p.resolution[2]):
|
|
||||||
# defgrad[:,:,z,1,2] = (2.0*z)/(p.resolution[2]-1.0)+ 3.8*math.sin(z*20.0/(p.resolution[2]-1.0)*2*math.pi)
|
|
||||||
# defgrad[:,:,z,0,2] = (2.0*z)/(p.resolution[2]-1.0)+ 5.0*math.cos(z/(p.resolution[2]-1.0)*2*math.pi)
|
|
||||||
#defgrad[:,:,:,0,0] = 1.0
|
|
||||||
#defgrad[:,:,:,1,1] = 1.0
|
|
||||||
#defgrad[:,:,:,2,2] = 1.0
|
|
||||||
#logstrain = postprocessingMath.logstrain_mat(res_x,res_y,res_z,defgrad)
|
|
||||||
#logstrain2 = postprocessingMath.logstrain_spat(res_x,res_y,res_z,defgrad)
|
|
||||||
#p_stress = readTensor(p.resolution,p.file,p.N_element_scalars,c_pos,52)
|
|
||||||
#c_stress = postprocessingMath.calculate_cauchy(res_x,res_y,res_z,defgrad,p_stress)
|
|
||||||
#vm = postprocessingMath.calculate_mises(res_x,res_y,res_z,c_stress)
|
|
||||||
#defgrad_av = postprocessingMath.tensor_avg(res_x,res_y,res_z,defgrad)
|
|
||||||
#subroutine inverse_reconstruction(res_x,res_y,res_z,reference_configuration,current_configuration,defgrad)
|
|
||||||
centroids_coord = postprocessingMath.deformed(res_x,res_y,res_z,p.dimension,defgrad,defgrad_av)
|
|
||||||
deformed = postprocessingMath.mesh(p.resolution[0],p.resolution[1],p.resolution[2],p.dimension,defgrad_av,centroids_coord)
|
|
||||||
#writeVtkAscii(name+'-mesh-deformed.vtk',deformed,defgrad[:,:,:,1,2],p.resolution)
|
|
||||||
defgrad = postprocessingMath.inverse_reconstruction(res_x,res_y,res_z,undeformed,deformed)
|
|
||||||
defgrad_av = postprocessingMath.tensor_avg(res_x,res_y,res_z,defgrad)
|
|
||||||
centroids_coord = postprocessingMath.deformed(res_x,res_y,res_z,p.dimension,defgrad,defgrad_av)
|
|
||||||
centroids_coord2 = postprocessingMath.deformed_fft(res_x,res_y,res_z,p.dimension,defgrad,defgrad_av,1.0)
|
|
||||||
ms = postprocessingMath.mesh(p.resolution[0],p.resolution[1],p.resolution[2],p.dimension,defgrad_av,centroids_coord)
|
ms = postprocessingMath.mesh(p.resolution[0],p.resolution[1],p.resolution[2],p.dimension,defgrad_av,centroids_coord)
|
||||||
ms2 = postprocessingMath.mesh(p.resolution[0],p.resolution[1],p.resolution[2],p.dimension,defgrad_av,centroids_coord2)
|
writeVtkAscii(name+'-mesh-fft-%s.vtk'%i,ms,defgrad[:,:,:,1,2],p.resolution)
|
||||||
writeVtkAscii(name+'-mesh-usual-%s.vtk'%i,ms,defgrad[:,:,:,1,2],p.resolution)
|
|
||||||
writeVtkAscii(name+'-mesh-fft-%s.vtk'%i,ms2,defgrad[:,:,:,1,2],p.resolution)
|
|
||||||
#writeVtkAsciidefgrad_av(name+'-box-%i.vtk'%i,p.dimension,defgrad_av)
|
|
||||||
#writeVtkAsciiDots(name+'-points-%i.vtk'%i,centroids_coord,grain,p.resolution)
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue