Content uploaded by Martin Diehl
Author content
All content in this area was uploaded by Martin Diehl on Feb 05, 2015
Content may be subject to copyright.
Technische Universit¨at M¨unchen
Fakult¨at f¨ur Maschinenwesen
Lehrstuhl f¨ur Werkstoffkunde und Werkstoffmechanik
Prof. Dr. mont. habil. E. Werner
Christian Doppler Laboratorium f¨ur Werkstoffmechanik von Hochleistungslegierungen
Dr.-Ing. C. Krempaszky
Max-Planck-Institut f¨ur Eisenforschung GmbH
Abteilung Mikrostrukturphysik und Umformtechnik
Prof. Dr.-Ing. habil. D. Raabe
A spectral method using fast Fourier transform
to solve elastoviscoplastic mechanical boundary
value problems
Martin Diehl
Diploma thesis
Written by: Martin Diehl
Matriculation No.: 2819862
Supervisor: Prof. Dr. mont. habil. Ewald Werner
Dr.-Ing. Cornelia Schwarz
Dr.-Ing. Christian Krempaszky
Start date: 15.05.2010
Submission date: 15.11.2010
Involved organizations
Technische Universit¨at M¨unchen
Fakult¨at f¨ur Maschinenwesen
Lehrstuhl f¨ur Werkstoffkunde und Werkstoffmechanik
Boltzmannstraße 15
D-85748 Garching
Christian Doppler Laboratorium f¨ur Werkstoffmechanik von Hochleistungslegierungen
Boltzmannstraße 15
D-85748 Garching
Max-Planck-Institut f¨ur Eisenforschung GmbH
Abteilung Mikrostrukturphysik und Umformtechnik
Max-Planck-Straße 1
D-40237 D¨usseldorf
Erkl¨arung
Hiermit erkl¨are ich an Eides statt, dass ich diese Diplomarbeit zum Thema
A spectral method using fast Fourier transform to solve elastoviscoplastic mechanical
boundary value problems
selbstst¨andig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel verwendet
habe.
Garching, den 15.11.2010
Martin Diehl
Martin Diehl
Apfelkammerstraße 13-15
81241 M¨unchen
e-Mail: martin.diehl@mytum.de
Acknowledgements
This diploma thesis was written during my stay at the department for Mikrostrukturphysik und
Umformtechnik of the Max-Planck-Institut f¨ur Eisenforschung GmbH (MPIE ). It would not have
been possible to carry out my work without the academic and technical support of the MPIE staff.
I would like to express my special appreciation to Philip Eisenlohr. Many hours of discussion
and his hints in programming were an invaluable help regarding all aspects of the work. I am also
grateful for his support in writing the thesis and his excellent suggestions for formatting and
expression.
I would like to thank my principal supervisor Cornelia Schwarz from the Lehrstuhl f¨ur
Werkstoffkunde und Werkstoffmechanik,TU M¨unchen for her good advice. Her comments on
the intermediate versions of my work definitely helped me to improve this thesis.
I am most grateful to Ricardo Lebensohn for providing me with his implementation of the
spectral method. His support in integrating the spectral method into the existing MPIE routines
was extremely useful.
I would like to thank Franz Roters for answering my various questions concerning all aspects
of the material subroutines and their underlying physics.
The interesting talks with Christian Krempaszky (Christian Doppler Laboratorium f¨ur Werk-
stoffmechanik von Hochleistungslegierungen,TU M¨unchen) greatly helped to understand the
mathematics of the implemented spectral method.
I am grateful for Lucy Duggan’s comments and suggestions regarding the phrasing. She also
picked up a large amount of spelling errors and made helpful suggestions on how to improve the
readability of the thesis.
For any errors or inadequacies that may remain in this work, of course, the responsibility is
entirely my own.
i
ii
Nomenclature
Latin Letters
Symbol Description Unit
atol abort criterion -
Bbody
bBurger’s vector m
Bleft Cauchy–Green deformation tensor -
Cright Cauchy–Green deformation tensor -
Cstiffness tensor Pa
EYoung’s modulus Pa
E0Green–Lagrange strain tensor -
EtEuler–Almansi strain tensor -
FFourier transform
Fdeformation gradient -
GGreen’s function
HHeaviside function
H0displacement gradient -
Htinverse displacement gradient -
Iidentity, unit matrix
JJacobian determinant of the deformation gradient -
J22nd invariant of the deviatoric part of the Cauchy stress Pa2
kangular frequency 1/s
lside length m
Lvelocity gradient m/s
MTaylor factor
Nnumber of sampling points
P1st Piola–Kirchhoff stress tensor Pa
rmicrostructure parametrization (slip resistance rfor the used models)
Rrotation tensor -
Scompliance tensor Pa-1
S2nd Piola–Kirchhoff stress tensor Pa
sline direction m
udisplacement m
iii
Uright stretch tensor -
Vleft stretch tensor -
xcoordinates in reference configuration m
ycoordinates in current configuration m
Greek Letters
Symbol Description Unit
δunit impulse function
δim Kronecker delta
∆deviation
εCauchy strain tensor -
γshear strain -
Γ-operator for Green’s function
κfrequency Hz
νPoisson ratio -
σCauchy stress tensor, infinitesimal stress tensor Pa
τpolarization field Pa
τshear stress Pa
ωrotation -
Superscripts
Symbol Description
0deviatoric part of a tensor
·derivative with respect to time
˜fluctuating part of a quantity
– average quantity, negative quantity for Miller indices
ˆquantity in Fourier space
αslip system
βtwin system
miteration counter
Subscripts
Symbol Description
0quantity in reference configuration
eelastic part
pplastic part
ref reference value
tquantity in current configuration
vM von Mises equivalent of a tensorial quantity
iv
Contents
Acknowledgements i
Nomenclature iii
1 Introduction 1
2 Continuum mechanics 3
2.1 Configurations.................................... 3
2.2 Deformation and strain measures . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Polardecomposition................................. 7
2.4 Velocitygradient................................... 8
2.5 Stressmeasures ................................... 8
2.6 Constitutiverelation................................. 9
3 Mechanical behavior of crystalline structures 11
3.1 Crystallinestructures ................................ 11
3.2 Elasticresponse ................................... 13
3.3 Plasticresponse ................................... 13
3.3.1 Dislocations ................................. 14
3.3.2 Twinning .................................. 16
3.4 Constitutivemodels ................................. 16
3.4.1 J2-plasticity ................................. 17
3.4.2 Phenomenological powerlaw . . . . . . . . . . . . . . . . . . . . . . . . 18
4 Green’s function method 21
5 Fourier transform 23
5.1 Discrete Fourier transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.2 FastFouriertransform................................ 25
5.3 FFTW ........................................ 26
6 Spectral methods 27
6.1 Basicconcept .................................... 28
6.2 Small strain formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.3 Large strain formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.3.1 Numericalaspects.............................. 33
v
7 Implementation 35
7.1 Problemset-up ................................... 36
7.1.1 Geometry specification . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
7.1.2 Material specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
7.1.3 Load case specification . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7.2 Initialization ..................................... 40
7.2.1 Loadcase .................................. 40
7.2.2 Geometry .................................. 41
7.2.3 FFTW.................................... 41
7.2.4 Wavenumbers and Γ-operator ....................... 41
7.3 Executionloop.................................... 42
7.3.1 Global deformation gradient . . . . . . . . . . . . . . . . . . . . . . . . 42
7.3.2 Local deformation gradient . . . . . . . . . . . . . . . . . . . . . . . . . 43
7.4 Output........................................ 44
7.5 Resultingalgorithm ................................. 44
8 Simulation results 47
8.1 Proof of correct implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 47
8.2 Handling of large deformations . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
8.3 Comparison with FEM solutions . . . . . . . . . . . . . . . . . . . . . . . . . . 54
8.3.1 Planestrain ................................. 55
8.3.2 Uniaxialtension ............................... 57
9 Conclusions and outlook 59
A Sourcecode 61
B Problem set-up example files 85
C License information 89
List of Figures 91
List of Tables 92
Listings 92
Bibliography 93
vi
1 Introduction
Higher requirements on the mechanical properties of construction materials are needed in applica-
tions in all kinds of engineering. The growing demands led to an enormous variety of alloying con-
cepts to produce metallic materials with the desired specifications. The outstanding performance
of recently developed alloys is based on interactions on the scale of the microstructure. Most of the
effects are related to the interaction of different phases, phase changes, dislocation movement and
twinning.
Figure 1.1: Volume element consisting of
50 periodically repeating grains
The mechanical properties of materials are not only
derived from experiments, but also examined using com-
puter assisted simulations. The simulation of mechanical
behavior is often done on a volume element (VE) with a
representative structure for the material. That means, a
representative volume element (RVE) predicts the behav-
ior of a body made out of the material. Usually, periodic
boundary conditions (BCs) are enforced on each side of
the RVE. They expand the volume under consideration
to an infinite body by repeating it infinitely [10]. An ex-
emplary VE consisting of 50 grains is shown in fig. 1.1.
Since interactions in the microstructure are responsi-
ble for the performance of the material, the knowledge
of the underlying physics is becomming more and more
important for the simulation of the mechanical behavior.
For a single-phase alloy, even a simple constitutive law will quite accurately predict results. To
simulate the behavior of a complex material, the underlying effects such as interaction of differ-
ent phases, phase changes, dislocation mobility, twinning etc. have to be considered in order to
produce applicable results [29].
One of the crucial points in using simulations is the time spent on calculations. For a complex
microstructure a very detailed description is needed. Even fast computers take a long time to
complete the calculation. The most commonly used technique for solving partial differential
equations (PDEs) describing the mechanical behavior is the “Finite Element Method”(FEM) [2,
29, 31, 35]. For VEs with periodic BCs the so-called spectral methods are a fast alternative to
the FEM [4, 32].
In this thesis, the implementation of a spectral method using the fast Fourier transform (FFT)
around an existing framework for crystal plasticity FEM (CPFEM) is described. The spectral
method serves as an alternative for the FEM-based solvers to the calculation of VEs with periodic
1
BCs. The framework and the spectral method are written in Fortran.
The general idea of using spectral methods for mechanical boundary value problems was intro-
duced by H. Moulinec and P. Suquet in 1998 [18, 19]. Further development was done by
S. Neumann,K. P. Herrmann and W. H. M¨
uller [6, 22] and R. A. Lebensohn [14].
Extensions capable of handling large strain formulations were presented by N. Lahellec,J. C.
Michel,H. Moulinec, and P. Suquet in 2001 [17].
An implementation of the algorithm was used by R. A. Lebensohn and A. Prakash to
evaluate the performance of the method. The promising results of their study show significantly
decreased computation time compared to a standard FEM. While the results for almost homo-
geneous deformations were close to the results achieved by FEM, the shape update algorithm
presented there is not suitable for locally extremely distorted morphologies [25].
This thesis presents an implementation is shown that overcomes the limits of the former method
concerning the shape update. Moreover, it is integrated in a flexible framework to handle arbitrary
material models. To speed up the calculations, particular care was taken to implement a fast
algorithm. Due to the fast computations, the VE can have a size which is large enough to
be considered as representative for the material. Thus, the simulation can serve as a “virtual
laboratory” to derive the parameters describing the mechanical behavior of a material.
In this work, first a mathematical framework is introduced in chapter 2 to describe deformations
of bodies under load. In chapter 3 the deformation mechanisms of crystal materials are explained
as they are important to derive suitable constitutive laws. A selection of constitutive models are
also presented in this chapter. In chapters 4 and 5 the mathematical background of the spectral
method, Green’s function method and Fourier transform are briefly recapitulated. The basic
concept of spectral methods and their application to mechanical boundary value problems is
outlined in chapter 6. In chapter 7 the details of the implementation are described. Results of
some completed simulations are given in chapter 8. The thesis ends with a summary and the
conclusions drawn from the work. The last chapter, chapter 9, gives an outlook on further work.
2
2 Continuum mechanics
The theory of continuum mechanics describes the global mechanical behavior of solids and fluids.
In continuum mechanics, a hypothetic continuous medium is used to describe the macroscopic
behavior of an object. According to the assumption of a continuous medium, the material of the
object completely fills the space it occupies. It is not possible to model empty spaces, cracks
or discontinuities inside the material. Therefore, the atomic structure of materials cannot be
described. The concept of an continuous medium allows us to describe the behavior of the
material with continuous mathematical functions. In this work, it is used to describe the behavior
of solid materials under external forces and applied displacements.
In this chapter, at first the different configurations of a body under load are shown (section 2.1).
From the configurations, strain (section 2.2) and stress (section 2.5) measures are derived. This
chapter is mainly based on [29, 34].
2.1 Configurations
x
x + dx
dx
y + dy
du
dy
u(x)
u(x + dx) = u(x) + du
q
t
0
p
q
p
0
t
F = grad
(y(x,t))
3
2
1
e
e
e
y =
y(x,t)
Figure 2.1: Continuum body shown in undeformed and
deformed configurations1
A continuous body Bcan be described
as a composition of an infinite number of
material points or particles x, with x∈ B.
The body in the undeformed configura-
tion occupies the region B0. This config-
uration is also called the reference con-
figuration. The reference configuration
does not depend on time. In the time-
dependent deformed state, the body oc-
cupies the region Bt. This configuration
is called the deformed configuration or the
current configuration. The location of the
material points in the undeformed state is
given by the vector xand in a deformed
state by the vector y. Two example con-
figurations are shown in fig. 2.1. In each
configuration a different base with corre-
sponding unit vectors exists. In this work, the same coordinate system with the same unit vectors
1File taken from http://commons.wikimedia.org/wiki/File:Continuum_body_deformation.svg, accessed
14th November 2010. The copyright information can be found in appendix C.
3
is used in both configurations. This allows us to write down the tensors without explicitly notating
the unit vectors.
A deformation can be described in both configurations. In the material description, each particle
belongs to its current spatial location. This is also called Lagrangian description. The spatial
description is also called Eulerian description. In Eulerian description, the location belongs
to the particle. Loosely speaking, the Lagrangian description answers the question “At which
location is the particle?”, while the Eulerian description answers the question “Which particle
is at the location?”. As usual in structural mechanics (and in contrast to fluid mechanics), in this
work a Lagrangian description is used.
2.2 Deformation and strain measures
The displacement uof a material point is the difference vector from a point in reference con-
figuration to the deformed configuration:
u(x, t) = y(x, t)−x(2.1)
umust be a continuous function. For a given time—that is a given deformation state—the
equation reads u(x) = y(x)−x.
A line segment dxin an infinitesimal neighborhood of a material point xin the reference
configuration is transformed into the current configuration by:
y(x)+dy=y(x) + ∂y
∂x·dx+O(dx2)(2.2)
By neglecting terms of higher order, dycan be written as:
dy=∂y
∂x·dx=F·dx(2.3)
where F:= ∂y/∂xis a 2nd order tensor called deformation gradient. It is also denoted grad(y).
The relations between vectors and tensors in the different configurations are graphically shown in
fig. 2.1. The deformation gradient maps the vector dxat xin the reference configuration to the
vector dyat yin the current configuration. The deformation tensor has one base in the reference
configuration and one in the current configuration. It is therefore called a 2-point tensor.
The inverse of the deformation tensor F−1maps an element from the current configuration to
the reference configuration. It is sometimes called the spatial deformation gradient, while Fis
called the material deformation gradient. The spatial line segment dyis called the “push forward”
of the material line segment dx, which in turn can be called the “pull back” (performed by F−1)
of dy.
Inserting eq. (2.1) into eq. (2.3) results in the deformation gradient written as:
F=∂(x+u)
∂x(2.4)
=I+∂u
∂x(2.5)
4
H0:= ∂u/∂xis called the displacement gradient. The tensor Iis the identity or unit matrix.
Displacement gradient and deformation gradient are a means of describing the deformation of a
body. In the same way as Fis called the material deformation gradient, H0is called the material
displacement gradient. The spatial displacement gradient is defined as I−F−1and denoted
as Ht.
Deformation gradient, displacement gradient and their respective inverse are 2-point tensors. It
is also possible to describe the deformation in the reference configuration only by:
dy·dy= (F·dx)·(F·dx)(2.6)
= dx·(FT·F)·dx(2.7)
C:= FT·Fis called the right Cauchy–Green deformation tensor. It is a symmetric tensor
completely in the material (reference) configuration.
The change of length (the strain) under a deformation can be expressed as:
dy·dy−dx·dx= dx·C·dx−dx·dx(2.8)
= dx·(C−I)·dx(2.9)
= dx·(2 E0)·dx(2.10)
E0:= 1
2(C−I) = 1
2(FT·F−I)is called the Green–Lagrange strain tensor. It depends
only on the right Cauchy–Green deformation tensor, and is therefore also completely in the
reference configuration.
A similar transform as in eq. (2.6) can express the deformation in the current configuration:
dx·dx= (F−1·dy)·(F−1·dy)(2.11)
= dy·(F−T·F−1)·dy(2.12)
B−1:= F−T·F−1leads to B=F·FT. The tensor Bis called the left Cauchy–Green
deformation tensor. It is a symmetric tensor completely in the spatial (current) configuration.
The change of length under a deformation can be expressed as:
dy·dy−dx·dx= dy·dy−dy·B−1·dy(2.13)
= dy·(I−B−1)·dy(2.14)
= dy·(2 Et)·dy(2.15)
Et:= 1
2(I−B−1) = 1
2(I−F−T·F−1)is called the Euler–Almansi strain tensor. As a product
of the left Cauchy–Green deformation tensor it is completely in the current configuration.
The push forward and pull back are also defined for the deformation measures. The push forward
of the Green–Lagrange stretch tensor is the Euler–Almansi stretch tensor, while the pull
5
back performs the inverse operation:
Et=F−T·E0·F−1(2.16)
E0=FT·Et·F(2.17)
For small strains, i.e. y−x≈0, the linearization of the Euler–Almansi strain tensor and
the Green–Lagrange strain results in the same strain tensor. It is called the Cauchy strain
tensor ε. It reads as:
εij =1
2(ui,j +uj,i)≈E0,ij ≈Et,ij (2.18)
when using index notation and Einstein convention2. In vector notation it reads as:
ε=1
2(∇u+ (∇u)T)(2.19)
With the nabla-operator ∇and ω:= 1
2(∇u−(∇u)T)denoted the rotation tensor, the displace-
ment gradient can be written in the infinitesimal strain framework as:
∇u=ε+ω.(2.20)
For the one-dimensional case without lateral contraction, the deformation can be described
by two variables: The length in the current configuration ltand the length in the reference
configuration l0. By defining the stretch ratio as λ:= lt/l0the corresponding strain measures
and the limits for infinite tension and infinite compression read as:
Table 2.1: Definition of strain measures and behavior for tension and compression
strain measure definition compression tension
Green–Lagrange strain E0,1dim =1
2(λ2−1) lim
λ→0E0,1dim =−1
2lim
λ→∞ E0,1dim =∞
Euler–Almansi strain Et,1dim =1
2(1 −1
λ2) lim
λ→0Et,1dim =−∞ lim
λ→∞ Et,1dim =1
2
Cauchy strain ε1dim =λ−1 lim
λ→0ε1dim =−1 lim
λ→∞ ε1dim =∞
From tab. 2.1 it can be seen that the measures are not symmetrical and reach different limits
for infinite tension and infinite compression. A measure that overcomes these inconsistencies is
the logarithmic strain εlog = ln(λ). Tension or compression applied at the same rate (section 2.4)
for a given time will result in a logarithmic strain which differs only in the algebraic sign. The
different strain measures for the one-dimensional case are shown in fig. 2.2.
For the spatial and material case, different strain measures with power nof λcan be derived.
Both measures are based on the formula 1/α(1 −λ−α). For the material measures, the exponent
αhas a negative sign, for the spatial measures a positive one. From tab. 2.1 it can be seen that λ
contributes with its second power to the Green–Lagrange and the Euler–Almansi strain.
The strain measure of order 0is the logarithmic strain [34].
2According to Einstein notation or Einstein summation, it is implicitly summed over an index variable that
appears twice in a product.
6
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5
−3.0
−1.5
0.0
1.5
3.0
λλ [−]
strain [−]
E0,1dim
εε1dim
εεlog,1dim
Et,1dim
Figure 2.2: Behavior of different strain measures for tension and compression
In the multidimensional case the calculation of the different strain measures must be conducted
in the principal coordinate system, i.e., in the basis of eigenvectors.
2.3 Polar decomposition
Each tensor can be decomposed into a component of pure stretches and a pure rotation. For
an invertible tensor the decomposition is unique and can be expressed by two forms. For the
deformation gradient, the decomposition reads as:
F=V·R=R·U(2.21)
where Ris the rotation tensor, vis called the left stretch tensor and Uthe right stretch tensor.
It can be shown that U2=Cand V2=Bwith Bbeing the left and Cthe right Cauchy–
Green deformation tensor. While Fis a 2-point tensor, Uis in material configuration and V
in spatial configuration only. They have all the same determinant J, called the Jacobian:
J= det(F) = det(U) = det(V)(2.22)
A pure rotation does not change the shape of the body and should therefore result in zero strain.
The polar decomposition can be used to check whether a strain measure is valid. The framework
for large deformations, also called “finite strain framework” presented here is able to describe
large deformations properly. It can be shown that the small strain formulation (infinitesimal strain
formulation) does not fulfill this requirement for large deformations and is therefore not suitable
to describe them.
A summary of the polar decomposition of the deformation gradient and the derived deformation
tensors is given in tab. 2.3.
7
2.4 Velocity gradient
For a moving body, the position of the material points vary with time. The material velocity field
is defined as:
v=du(x)
dt=˙
u=˙
y(2.23)
˙
u=˙
yholds because the points in the reference configuration do not change their position, i.e.,
dx/dt=0. The spatial gradient of the velocity field is:
L=∂v
∂y=˙
F·F−1(2.24)
Lis called the velocity gradient. Loading a body with a constant velocity gradient will result in
the same rate of deformation independently of the shape in the current configuration.
2.5 Stress measures
Stress is defined as force per area. As introduced in section 2.1, in nonlinear continuum mechanics
a distinction has to be made between the reference and the current configuration. As a result,
different stress measures exist, depending on the configuration in which force and area are defined.
In the current configuration, a force ∆rton an area ∆atwith normal vector ntresults in:
tt(nt) = lim
∆at→0
∆rt
∆at
(2.25)
where ttis called the vector of surface traction or Cauchy traction. The Cauchy stress tensor
or “true stress tensor” σis defined as:
tt(y, t, nt) =: σ(y, t)·nt(2.26)
The Cauchy stress is a 2nd order tensor in spatial coordinates.
The traction ttis defined on the the current area (∆at→0). Scaling it to the area in reference
configuration ∆a0results in the pseudo traction vector t0,t. It is also called nominal or 1st
Piola–Kirchhoff traction vector. It can be determined by looking at an infinitesimal force
drt:
drt=ttdat=t0,tda0(2.27)
The vector notation of the areas in the reference configuration, or the current configuration is
dat=ntdatand da0=n0da0. According to [34] the deformation of an area can be expressed
by dat=JF−T·da0. This allows the transformation of eq. (2.27) and eq. (2.26) into:
t0,t=Jσ·F−T·n0(2.28)
The product of the two 2nd order tensors and the Jacobian is called the 1st Piola–Kirchhoff
stress P:
P=Jσ·F−T(2.29)
8
Like Fit is a 2-point tensor (one base in spatial base and one in material base). It is a non-
symmetric tensor of 2nd order. It relates the force in the deformed configuration to an oriented
area vector in the reference configuration.
To get a stress measure in the current configuration only, the resulting force drtin reference
configuration can be written as:
dr0=F−1·drt=F−1·tt,0da0(2.30)
t0:= F−1·tt,0is called the 2nd Piola–Kirchhoff traction vector. It can be shown that
t0= (JF−1·σ·F−T)·n0. The tensor S:= (JF−1·σ·F−T)is called the 2nd Piola–Kirchhoff
stress tensor. It is a pure material, symmetric tensor of 2nd order. The 2nd Piola–Kirchhoff
stress tensor is the pull back of the Cauchy stress tensor.
The different stress measures and the corresponding strain measures are summarized in tab. 2.2.
All stress measures are tensors of 2nd order. In the three-dimensional case they consist of
nine components, of which all (for non-symmetric tensors) or six (for symmetric tensors) are
independent. Different approaches exist to express the stress state in one variable that can be
compared to uniaxial stress, coming from tensile test for example. The most common approach
is the von Mises equivalent stress σvM. It is based on the hypothesis that the material state is
solely dependent on the change of shape. Or in other words, hydrostatic compression or expansion
of the volume is not important for describing the stress state. Mathematically it can be expressed
by σvM =√3J2, with J2being the 2nd invariant of the deviatoric part σ0of the stress tensor σ.
Experiments have shown that the assumption fits well for ductile materials [15].
2.6 Constitutive relation
A constitutive equation relates the response of a material to an external load. In continuum
mechanics, it usually gives the connection between stress and the resulting deformation. Without
a constitutive equation, the equations describing the mechanical behavior of a material cannot be
solved.
A wide range of constitutive relations exist for describing the relation between stress and strain
in materials. While some of them—called phenomenological laws—are based on measurements
only, others try to describe the underlying physics.
Complex constitutive laws need several variables to characterize the material state and its re-
sponse to the load. Before deriving constitutive laws that are suitable to describe the material
response accurately enough to be used in crystal plasticity, a closer look at the mechanical behavior
of crystalline structures is needed. In the following chapter some fundamentals about deformation
mechanisms in crystalline structures are given. The constitutive models used in this work are
derived from this underlying physics. They are also introduced in chapter 3.
9
Table 2.2: Stress and strain in different configurations
configuration stress ⇔deformation ⇔strain symmetry
current, spatial σ
constitutive relation
B−11
2(I−B−1) = EtEt
Et=F−T·E0·F−1
E0=FT·Et·F
symmetric
mJσ·F−T=P F −T·F−1=B−1
2-point P
F−1I−F−1=HtHt
non-symmetric
F F −I=H0H0
mF−1·P=S F T·F=C
reference, material SC1
2(C−I) = E0E0symmetric
σCauchy stress
P1st Piola–Kirchhoff stress
S2nd Piola–Kirchhoff stress
Bleft Cauchy–Green deformation tensor
F−1inverse deformation gradient
Fdeformation gradient
Cright Cauchy–Green deformation tensor
EtEuler–Almansi strain tensor
Htinverse displacement gradient
E0displacement gradient
E0Green–Lagrange strain tensor
Table 2.3: Polar decomposition
determinant deformation/stretch configuration
J= det(V)V2=Bcurrent, spatial
J= det(F)
F=V·R
2-point
F=R·U
J= det(U)U2=Creference, material
Bleft Cauchy–Green deformation tensor
Fdeformation gradient
Cright Cauchy–Green deformation tensor
Vleft stretch tensor
Rrotation tensor
Uright stretch tensor
JJacobian
10
3 Mechanical behavior of crystalline structures
In chapter 2, a mathematical framework describing deformations of a body was introduced. The
cause of the deformation, a force (or stress), is connected via a constitutive law to the deformation.
The origin of the deformation is so far not included in that framework. In material mechanics, it is
important to take a closer look on the origin of the deformation. In this chapter, the fundamentals
needed to model the mechanical response of crystalline structures are briefly discussed and the
derived constitutive models are introduced.
3.1 Crystalline structures
The binding forces in metallic bonding between metal atoms are undirected. This leads to atomic
arrangements with the maximum filling in space, the tightest dimensional packing. For a pure
metal without any foreign atoms, two closest packages are possible: the face-centered cubic (fcc)
and the hexagonal lattice structure (hcp1, hexagonally closed packed). Both crystal lattices can
be interpreted as a combination of closest packed planes. They differ in the order in which the
close-packed lattice are piled on one another. Coventionally, each plane with the same orientation
is named with the same capital letter, starting from “A”. In that notation, hcp has a ABAB...
stacking order, while fcc is arranged as ABCABC... That means, the difference between hcp and
fcc is the way the different planes are piled. While for hcp, first and third plane have the same
orientation and the second one is translated in plane, an fcc lattice consist of three differently
orientated planes [1]. The different stacking orders and the resulting unit cells of the hcp and the
bcc lattice are shown in fig. 3.1.
A third important lattice structure exist for metals: the body-centered cubic (bcc). It is not a
closest packed lattice, but its volume ratio is close to the highest possible ratio achieved by hcp
and fcc. A bcc lattice is shown in fig. 3.2, an fcc lattice is shown for comparison in fig. 3.3
Directions and planes in crystal structures are usually described using the Miller indices. In this
notation, a lattice direction or plane is determined by three digits in the case of cubic structures
(e.g. bcc and fcc). For hcp a similar notation exist that uses four digits2. All of the following
examples are taken from [36]. The digits are written in square brackets [h k l]for the direction
given by the vector η·(h, k, l), with ηbeing an arbitrary factor. The smallest possible integers are
used, meaning notations like [1/2 0 1] or [2 0 4] are not valid. The correct representation would
1The hexagonally closest packed structure is only a model. Real crystallites have structures with a stacking order
close to hcp. Thus, to be exact, their structure should be named “hex” instead of “hcp”.
2This is only for reasons of convenience. As in three-dimensional space only 3 parameters are independent, the
4 digits are linear depending on each other and can equally be expressed by a set of 3 digits only.
11
B
AA
C
B
A
Figure 3.1: Stacking order of the hcp lattice (left) and the fcc lat-
tice (right)3
a
a
a
Figure 3.2:
Bcc lattice4
a
a
a
Figure 3.3:
Fcc lattice5
be [1 0 2]. This notation ensures that each directions is described by a unique set of integers. A
negative direction is denoted by a bar as in [1 1 0] for direction (−1,0,0). The family of crystal
directions that are equivalent to the direction [h k l]is notated as hh k li(in angle brackets). A
similar scheme exists for planes. The plane orthogonal to the direction η·(u, v, w)is written in
normal brackets: (u v w). The notation {l m n}(in curly brackets) is used for all planes that are
equivalent to (u v w)by the symmetry of the lattice.
The structure of real crystals or crystallites is different from the idealized lattice. The defects
are characterized by their spatial dimension. The following defects exist [1, 36]:
0-dimensional: Vacancies, interstitials, antisite defects, substitutional defects, Frenkel
pairs
1-dimensional: Dislocations
2-dimensional: Grain boundaries, small angle grain boundaries, anti-phase boundaries, stack-
ing faults, twins
3-dimensional: Precipitates, inclusions, cavities
0-dimensional defects are not directly simulated in crystal plasticity. The contribution of disloca-
tions and twinning is used as a parameter in the constitutive laws. Grain boundaries and larger
precipitates can be directly created by specifying the corresponding geometry. Because of the
special importance of dislocations and twins for the derivation of constitutive models, they are
briefly described in section 3.3.
3File taken from http://commons.wikimedia.org/wiki/File:Close_packing.svg, accessed 14th November
2010. The copyright information can be found in appendix C.
4File taken from http://en.wikipedia.org/wiki/File:Lattice_body_centered_cubic.svg, accessed 14th
November 2010. The copyright information can be found in appendix C.
5File taken from http://en.wikipedia.org/wiki/File:Lattice_body_centered_cubic.svg, accessed 14th
November 2010. The copyright information can be found in appendix C.
12
3.2 Elastic response
Elastic deformation occurs when the atoms in the regular lattice are displaced forcefully, but
without changing their neighboring atoms. The bonding between the atoms causes them to fall
back to the initial position in a stress-free configuration. Elastic deformation can be described by
Hooke’s law as a linear relation between stress and strain.
The simplest stress–strain constitutive relation is Hooke’s law. It describes the mechanical
response of a linear elastic material. Hooke’s law reads in the one-dimensional case as σ=E·ε
for small deformations. Eis Young’s modulus and connects linear stress with strain. For the
three-dimensional case, the connection between the 2nd order tensors of stress and strain is a 4th
order tensor, the stiffness tensor C. The equation reads as:
σ=C:ε(3.1)
For an isotropic material, the tensor Cdepends only on Young’s modulus Eand the Poisson
ratio ν.
3.3 Plastic response
While elastic deformation is the reversible part of deformation that is recovered after the force
is removed, plastic deformation remains even when the material is not under loading any more.
Metals usually have a combined elastic–plastic response. For small strains (and short loading
times), the behavior is usually purely elastic and only after reaching the yield stress (or long
holding times), the material starts to deform plastically [31].
The response of a material is not only dependent on the strain, but also on the strain rate. For
faster deformation (i.e. higher rate), the plastic deformation requires higher stress compared to
a lower rate. This time-dependent behavior is described as viscous. The viscous response of the
material must therefore also be modeled to produce applicable results [31].
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
(a) unstrained
reference
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
(b) elastic shear
only
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
(c) plastic shear
only
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
(d) combined elasto-
plastic deformation
Figure 3.4: Elastic and plastic deformation
The difference between plastic and elastic deformation can be explained by the atomic structure
of the material. The atoms in crystals are arranged in a regular three-dimensional order, the crystal
lattice. Metal bonding is based on the interaction between the positively charged metal ions and
free valence electrons. If the change of position exceeds a threshold depending on the radius of
13
the atom, the atoms get a new closest neighbor and the deformation is permanent. The lowest
stress required to do so is called the elastic limit. Fig. 3.4 schematically presents these different
types of deformation.
The stress state depends on the elastic deformation. Plastic deformation might relax stresses
by changing the shape of the stress-free configuration.
The shear stresses needed to deform a crystalline structure plastically are theoretically (calculated
from the atom bonding force) much higher than the measured forces. This can be explained by
the existence of dislocations and twinning. Both mechanisms are briefly outlined in the following.
3.3.1 Dislocations
Dislocations are one-dimensional (line) defects in the lattice (e.g. a line of misorder) that can move
under shear stress. Thereby atoms break their bonds and rebond with other atoms repeatedly. This
leads to a plastic deformation of the material. The energy required to break a single bond is far
less than that required to break all the bonds on an entire plane of atoms at once. Dislocations
contribute significantly to the deformation of crystalline materials, it is said that they are the
carriers of plastic deformation [29, 36].
Dislocations are described by the tangential vector to the line of the dislocation s, and the
Burger’s vector b, measuring length and direction of the dislocation. Depending on the relation
between s b, two types of dislocation exist. They are called screw dislocation and edge dislocation.
A typical representation is shown in fig. 3.5. In the following, the different types of dislocations
are briefly characterized:
Edge dislocation: An edge dislocation is a defect whereby an additional layer of atoms is
inserted into the crystal. In an edge dislocation, the Burger’s vector is perpendicular to
the line direction. In fig. 3.5b, the extra layer of atoms is inserted at the plane (1,2,3,4).
From the fig. it can be seen that the Burger’s vector bis perpendicular to the resulting
line defect sat line (3,4). In the representation, bhas the length of the extra layer.
The stress field of an edge dislocation is complex due to its asymmetry [29].
Screw dislocation: A screw dislocation is a dislocation in which the Burger’s vector is
parallel to the line direction. It can be constructed by cutting along a plane through a
crystal and slipping one side by a lattice vector. If the cut only goes part way through
the crystal, the result is a screw dislocation. In fig. 3.5c, the crystal is cut at the plane
(1,2,3,4). From the fig. it can be seen that the Burger’s vector bis parallel to the
resulting line defect sat line (3,4). As in fig. 3.5b, bhas the length of one atom layer.
Due to its symmetry, the stresses caused by a screw dislocation are less complex than those
of an edge dislocation [29].
Mixed dislocation: In many materials, dislocations are found where the line direction and
Burger’s vector are neither perpendicular nor parallel and these dislocations are called
mixed dislocations, combining the characteristics of both screw and edge dislocation.
In real materials, most dislocations are of the mixed type.
14
s
b
1
2
3
4
1
2
3
4
b
s
1
2
3
4
(a) undistorted lattice
s
b
1
2
3
4
1
2
3
4
b
s
1
2
3
4
(b) edge dislocation
s
b
1
2
3
4
1
2
3
4
b
s
1
2
3
4
(c) screw dislocation
Figure 3.5: Undistorted lattice compared to a lattice with an edge and a screw dislocation
Dislocations can move within the crystallite only in certain ways. Dislocation glide is only possible
on the so-called slip systems. Each slip system contains of a slip plane and a slip direction. A
slip plane is usually a plane with a closest package and a slip direction is a densely packed
direction within the slip plane. In the slip system, the deformation caused by a dislocation is
the smallest possible in the lattice. Thus, minimum energy is needed for the deformation. While
edge dislocations can slip only in the single plane where dislocation and Burger’s vector bare
perpendicular, screw dislocations may slip in the direction of any lattice plane containing the
dislocations line vector s.
Depending on the crystal structure, different planes are densely packed and therefore the pre-
ferred slip planes. For fcc it is usually the {1 1 0}for bcc the {1 1 2}or {1 1 2}and for hcp the
{0 0 0 1}. Typical densely packed directions are h1 1 0ifor fcc and h1 1 1ifor bcc. For hcp usually
h1 1 2 0iis the preferred slip direction.
Edge dislocations—in contrast to screw dislocations—have a second way of moving, called
”dislocation climb”. This is an effect driven by the movement or diffusion of vacancies through a
crystal lattice. As a diffusion dependent effect it is temperature dependent and occurs much more
rapidly at high temperatures than low temperatures. In contrast, slip has only a small dependence
on temperature [1].
Plastic deformation starts in a slip system, where the maximum shear stress is resolved. The
shear stress depends on the tension, the angle between tension and the slip plane normal, and
the angle between tension and slip direction. The factor calculated of the cosines of the angles,
connecting shear stress and tension is known as the Schmid factor [36].
The deformation of crystals leads to an increasing dislocation density, as new dislocations are
generated during deformation. The interaction of the dislocations hampers the further dislocation
motion. If a certain dislocation density is reached or grain rotates due to deformation, another
slip system is in a favorable state to deform. The glide system which is activated later deforms at
higher stress. This causes a hardening of the metal as with increasing deformation. This effect is
known as strain hardening or work hardening. A heat treatment (annealing) causes the defects to
heal and can therefore remove the effect of strain hardening [36].
15
3.3.2 Twinning
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•••
•••
•••
•••
•••
•••
•••
•••
•••
•••
•••
•
•
••
•
••
•
••
•
••
•
••
•
••
•
••
•
••
•
••
•
••
•
•
Figure 3.6: Twinned crystal
A crystal twin consists of two crystals that are separated by a twin
boundary. A twin boundary is a special form of a grain boundary,
in which some lattice planes and directions are not misordered. The
twin boundary can be seen as a lattice plane at which the crystals are
mirrored. The crystal planes that are in plane with the twin boundary
are not distorted. A twinned structure with two twin boundaries
is schematically shown in fig. 3.6. The middle part of the shown
structure sheared due to twinning. As can be seen from the fig., the
twin boundary is the plane at which two crystals are mirrored. Moreover, it can be seen that the
fraction of the sheared part in the crystal is a suitable measure for the deformation of the crystal
if the shear angle is known. This information can be used for the implementation of twinning into
constitutive models.
Twinning is the result of three different mechanisms. Depending on the origin mechanism, the
twins are called:
growth twins
annealing (or transformation) twins
deformation (or gliding) twins
Deformation twins are of special importance as they are the result of stress on the crystal after
the crystal has formed. Deformation induced twinning allows a mode of plastic deformation in
crystalline structures. Deformation twinning occurs if one layer of crystals changes its orientation
under shear stress. Similar to the way in which dislocations move in slip systems, twinning is only
possible in twin systems where a certain shear stress is resolved.
Depending on the crystal structure, temperature and dislocation density, twinning might require
less energy than other deformation modes. Of the three crystal structures, the hcp structure is
most likely to twin. Fcc structures usually will not twin because slip is energetically more favorable.
3.4 Constitutive models
The implemented version of the spectral method is closely integrated into the existing routines
and can handle all material models available for the FEM-based solvers. The various material laws
differ in their complexity and in the effects they take into account.
In general, each constitutive model consists of three parts:
microstructure parameterization
structural evolution rates (hardening)
deformation kinetics (deformation rates)
The microstructure parameterization reflects the degree of simplification, e.g. isotropic versus non-
isotropic behavior or phenomenological slip resistance versus dislocation densities. The structure
16
evolution describes the change of the microstructure parameters during deformation, resulting,
for instance, in hardening. It is a function of the current microstucture and the stress state at
each point. With the microstructure parameters denoted as vector r, the structure evolution is a
function of the current microstructure parameters and the Cauchy stress σ:˙
r=f(r,σ). The
deformation kinetics describe the shear rate (or rates per slip system) at each point. They can
also be described as a function of rand σ:˙γ=f(r,σ). The composition of these three parts
results in a coupled system of ordinary differential equations (ODEs) at each point.
To determine the shear rate, the deformation gradient Fis decomposed in an elastic and a plastic
part. For small deformations, the elasto–plastic decomposition can be calculated additively [31],
while for large deformations a multiplicative decomposition is suitable [29]. For the decomposition,
a virtual intermediate (or relaxed) configuration is introduced. In this configuration, every material
point is elastically unloaded, i.e. only plastically deformed. The transformation from the reference
to the intermediate configuration is characterized by the plastic deformation gradient Fp. The
subsequent transformation from the intermediate to the current configuration is characterized
by the elastic deformation gradient Fe. Therefore, the overall deformation gradient relating the
reference to the current configuration reads for a large strain formulation as:
F=Fe·Fp(3.2)
Eq. (3.2) enables the elasto–plastic decomposition of the velocity gradient. This decomposition
is additively and reads as:
L=Le+Fe·Lp·F−1
e(3.3)
with Lpbeing the plastic and Lethe elastic velocity gradient. The plastic deformation rate
depends, typically rather strongly, on the resolved shear stress and the orientations of the slip
systems or twin systems. The elastic velocity gradient Ledepends on the elastic constants of the
material and the orientation of the lattice and is usually much smaller than Lp.
The models used in the examples presented in chapter 8 are briefly explained in the following
section. A detailed description of the models and their underlying physics can be found in [28, 29].
3.4.1 J2-plasticity
The J2-plasticity model is an isotropic constitutive law. It is based on the von Mises yield
criterion described in chapter 2.5. Isotropy results, since the stress state is only determined by the
2nd invariant J2of the deviatoric part of the stress tensor σ0[15]. For this reason, the orientation
of the grains is not considered. The microstructure is characterized by only one state variable, the
“flow stress” r.
The deformation rate is given by:
˙γ= ˙γref
τ
r
nsign(τ)(3.4)
where τ=σvM/M is the resolved shear stress. The factor Mis called the Taylor factor. It
is the inverse of the Schmid factor (section 3.3.1), depends on the lattice type, and gives the
average of the resolved shear stress in all slip systems for the given von Mises stress σvM . The
17
other variables in eq. (3.4) are a reference shear strain rate ˙γref and a stress exponent n.
The structure evolution reads as:
˙r=|˙γ|href 1−r
r∞ωref
(3.5)
with the saturation value r∞and fitting parameters ωref and href .
The plastic velocity gradient is Lpdetermined by the following equation:
Lp=˙γ
M
σ0
||σ0|| (3.6)
where ˙γ/M determines the velocity and σ0/||σ0|| the tensorial direction of the deformation rate.
3.4.2 Phenomenological powerlaw
The phenomenological powerlaw extends the isotropic J2-plasticity model by considering the ori-
entation of slip systems in the crystal. Twinning is introduced as a second deformation mechanism.
The model is able to predict the response of the crystallite under consideration for various lattices
type and orientations. Depending on the lattice structure, different slip and twin systems are
available. The state variables describing the material condition are “slip resistance” rα, “twin
resistance” rβ, “cumulative shear strain” γα, and “twin volume fraction” vβ. Superscripts αand
βdenote slip respectively twinning.
Shear strain rate due to slip is described in a similar way as for the J2-plasticity model given in
eq. (3.4). Instead of using the value of the von Mises stress to calculate an average resolved
shear stress, the resolved shear stress on each slip system ταis considered. It depends on the
stress σand the so-called Schmid matrix. The Schmid matrix is the product of normalized
Burger’s vector bαand the normalized normal vector nαof the slip system:
τα=σij
bα
i
||bα||
nα
j
||nα|| (3.7)
The shear strain rate ˙γαin each slip system is given by
˙γα= ˙γref
τα
rα
n
sign (τα)(3.8)
Following the same phenomenology, the twin volume fraction rate is described by:
˙vβ=˙γref
γβ
τβ
rβ
n
Hτβ(3.9)
where His the Heaviside function, τβthe resolved shear stress on each twin system, and γβ
the specific shear due to mechanical twinning . The value of γβdepends on the lattice type. In
fcc lattices it is rather large at γβ=√2/2while in hexagonal crystals it depends on the packing
ratio and the exact twin type [7].
The relationship between the evolution of state and kinetic variables is given by a vector equation,
comparable to the scalar eq. (3.10) of the J2-plasticity model. It connects changes in slip and twin
18
resistance of the various slip and twin system with the shear rates on all slip and twin systems:
"˙
rα
˙
rβ#="Mslip−slip Mslip−twin
Mtwin−slip Mtwin−twin #" ˙
γα
γβ·˙
vβ#(3.10)
with the four distinct interaction matrices Mslip−slip,Mslip−twin,Mtwin−slip, and Mtwin−twin.
The matrices depend in detail on the number of slip or twin systems in the crystal structure and
the interactions between these systems.
For more information on the phenomenological powerlaw see [30, 37].
19
20
4 Green’s function method
For the derivation of the spectral method for elastoviscoplastic boundary value problems, the
mathematical fundamentals, Green’s function method and Fourier transform are presented in
this and the following chapter. Green’s function method is derived and explained in detail in
[8, 13].
AGreen’s function G(x, x0)is any solution of the equation1
LG(x, x0) = δ(x−x0)(4.1)
with δbeing the Dirac delta function (unit impulse function) and L=L(x)a linear differential
operator [13, 21].
Green’s function method can be used to solve inhomogeneous linear differential equations like
Lu(x) = f(x)(4.2)
For a translation invariant operator, i.e. when Lhas constant coefficients with respect to x, a
convolution operator G(x−x0)can be used for G(x, x0). Multiplying eq. (4.1) with f(x0)and
integrating over x0results in:
ZLG(x−x0)f(x0)dx0=Zδ(x−x0)f(x0)dx0(4.3)
where the right side equals f(x)by virtue of the properties of the delta function. Inserting into
eq. (4.2) results in
Lu(x) = ZLG(x−x0)f(x0)dx0(4.4)
and, because of L=L(x)does not depend on x0and acts on both sides,
u(x) = ZG(x−x0)f(x0)dx0(4.5)
for a translation invariant operator L(x).
The initial eq. (4.2) is solved by finding G(x−x0)and carrying out the integration [13]. As
the Green’s function is not known a priori, the use of this method is limited to cases where
a technique is applicable to find the corresponding Green’s operator. The method for finding
Green’s operator presented in this thesis uses the Fourier transform. The Fourier transform
and ways to compute it are presented in chapter 5.
1Example taken from http://en.wikipedia.org/wiki/Green%27s_function, accessed 14th November 2010.
21
22
5 Fourier transform
The Fourier transform (FT) Fis an operation that transforms a function from one domain
(f(x)) into another domain ( ˆ
f(k)). The FT is widely used in image and digital signal processing.
It is a useful tool in solving differential equations. In the spectral method presented here, the FT
allows the equations describing the equilibrium state of the VE to be solved quickly.
When the FT is used on a function in time domain, the domain of the new function is frequency.
The FT is therefore also called the frequency domain representation of the original function. The
formula to calculate the FT in angular frequency kand frequency κ=k/2πand in is given by [9]:
F(f(x)) = ˆ
f(k) =
∞
Z
−∞
f(x)ei k xdx(5.1)
F(f(x)) = ˆ
f(κ) =
∞
Z
−∞
f(x)ei2πκ x dx(5.2)
where i2=−1or i=√−1is the imaginary unit.
The inverse transforms are performed via the following two equations [9]:
F−1(ˆ
f(k)) = f(x) = 1
2π
∞
Z
−∞
ˆ
f(k)e−i k xdk(5.3)
F−1(ˆ
f(κ)) = f(x) = Z∞
−∞
ˆ
f(κ)e−i2πκ x dκ(5.4)
One advantage of the FT is the simple way of differentiating and integrating in the frequency
domain. The derivative is simply the original function multiplied by 2πiκ or ik:
Fd
dxf(x)= (i k)·ˆ
f(k) = (i2π κ)·ˆ
f(κ)(5.5)
The FT of the delta function is 1:
F(δ(x)) =
∞
Z
−∞
δ(x)·ei k xdx=e0= 1 (5.6)
The convolution theorem states that for h(x)=(f∗g)(x) =
∞
R
−∞
(f(x)g(x−y))dythe FT
23
F(h(x)) = ˆ
h(k)is the product of the convolved functions:
ˆ
h(k) = ˆ
f(k)·ˆg(k)(5.7)
For further properties of the FT that are not needed in this work, standard literature such as
[3, 9] is available.
5.1 Discrete Fourier transform
It is also possible to apply the FT to discrete data. The discrete Fourier transform (DFT) is a
FT on discrete input functions. It can be used as an approximation of the continuous FT if the
data is properly discretized. The DFT works only if the analyzed segment represents one period
of an infinitely extended periodic function.
For discrete data, the frequency domain is called the wavenumber domain or wavenumber space.
The DFT is shown for frequency κrather than for angular frequency kto avoid factors of 2π.
Each discrete κstands for one wavenumber, where the number of waves equals the number of
points in the input data. With κ=k/2πthe formulas can easily rewritten for angular frequency.
To fulfill the requirement for using the DFT, the space has to be discretized. That is done by
defining discrete points in it (Fourier points, FP) and setting out periodic boundary conditions
(BCs) to the volume element under consideration. The periodic BCs expand the space into an
infinite space, with the space under consideration being exactly one period of the longest wave
[3].
The DFT of a sequence with Ncomplex numbers f(xn)with n= 0, . . . , N −1is the sequence
ˆ
f(κj), with j= 0, . . . , N −1of Nwavenumbers κ0, . . . , κN−1according to:
ˆ
f(κj) =
N−1
X
n=0
f(xn)·ei2π
Njn , j = 0, . . . , N −1(5.8)
The wavenumbers are chosen such that [26]:
κj≡j
∆N, j =−N
2,...,0,...,N
2(5.9)
with ∆being the sampling interval. Note that κjin eq. (5.8) is defined for N+ 1 wavenumbers.
As the extreme values −N/2and N/2give the same result, it does not collide with the definition
given in eq. (5.8).
The inverse DFT is done by [3]:
f(xn) = 1
N
N−1
X
j=0
ˆ
f(κj)e−i2π
Njn , n = 0, . . . , N −1(5.10)
It gives the values at each discrete FP that results from the operations conducted in Fourier
space.
For an input of pure real data, i.e., Im(f(x)) = 0, the transformed data ˆ
f(κ)in wavenumber
domain is the conjugated complex of ˆ
f(−κ):ˆ
f(κ) = Re(ˆ
f(−κ)) −Im(ˆ
f(−κ)). It is symmetric
24
with respect to the origin on the real part and anti-symmetric on the imaginary part. Therefore,
only half of the outputs have to be computed using a DFT algorithm. The other half can be directly
obtained from the transform data of the first half. In the same way, for the inverse transform for
a data set with ˆ
f(κ) = Re(ˆ
f(−κ)) −Im(ˆ
f(−κ)) only half of it is needed to transform to a set
of real data [3, 26].
The DFT was defined for a one-dimensional sequence xn, where ncounts the discrete values
of the variable x. The DFT of a three-dimensional function depending on vector xwith discrete
values nx= 0, . . . , Nx−1; ny= 0, . . . , Ny−1; nz= 0, . . . , Nz−1for the components x;y;zis
a multidimensional DFT. It transforms a three-dimensional function of three discrete variables to
the Fourier space. The result is a discrete function depending on κ= (κ1;κ2;κ3)with discrete
values j1= 0, . . . , Nx−1; j2= 0, . . . , Ny−1; j3= 0, . . . , Nz−1. The three-dimensional DFT
is—according to [22]—defined by:
ˆ
f(κ) =
Nx−1
X
nx=0
Ny−1
X
ny=0
Nz−1
X
nz=0
f(x)ei2πj1nx
Nx+j2ny
Ny+j3nz
Nz(5.11)
The inverse of the multidimensional DFT is, analogous to the one-dimensional case, given by [22]:
f(x) = 1
Nx×Ny×Nz
Nx−1
X
j1=0
Ny−1
X
j2=0
Nz−1
X
j3=0
ˆ
f(κ)e−i2πj1nx
Nx+j2ny
Ny+j3nz
Nz(5.12)
The multidimensional DFT can be computed by composing an algorithm for a one-dimensional
DFT along each dimension. This approach is called a row-column algorithm.
5.2 Fast Fourier transform
The calculation of the DFT as introduced in eq. (5.8) needs O(N2)operations. The computing
time is increasing quadratically with the number of FPs under consideration. The fast-growing
calculation time makes the direct DFT unattractive for use on large data sets. The fast Fourier
transform (FFT) is a group of algorithms that compute the DFT in only O(Nlog N)operations.
The FFT is widely used and enables the effective use of the DFT [3].
The most common type of FFT-algorithms is the Cooley–Tukey algorithm. It is a divide et
impera method, meaning it will divide the whole transformation into smaller parts that are simpler
(and faster) to compute. It is based on the idea of breaking down an FT with N=N1·N2points
into several FTs of N1and N2. The most common implementation is dividing Nrepeatedly by
2, resulting in N1=N2=N/2. Therefore it has the requirement that the number of input data
(FPs) hast to be a power of two. It is called the “radix-2” variant of the algorithm. Other divisions
are also possible, mostly resulting in a loss of performance. Variants of the algorithm using different
factors are called the “mixed-radix” variants. Especially poor performance is achieved for prime
numbers [3, 16].
The speed of the calculations relies heavily on the speed of the employed FFT. Therefore it is
important to implement a FFT with good performance. While proprietary libraries available from
sources such as Intel are limited to certain processor architectures, freely-available implementations
25
are usually not as fast and flexible as their commercial counterparts. Most of them are limited to
a unidimensional array with the input size being a power of two. A free DFT which has shown a
performance comparable with algorithms available under commercial licenses is the Fastest Fourier
Transform in the West (FFTW )1.
5.3 FFTW
The Fastest Fourier Transform in the West (FFTW ) is a library for computing the DFT. It is free
software licensed under the GNU General Public License. The FFTW package is developed at
the Massachusetts Institute of Technology (MIT ) by M. Frigo and S. G. Johnson. It is a C
subroutine library with interfaces to call it from C or Fortran codes. It can compute the DFT in
one or more dimensions. Moreover, it can handle arrays of arbitrary input size and has interface
to compute the DFT of real data. It also has multiprocessor support using the LinuxThreads2
library or Open Multi-Processing (OpenMP)3. For larger problems, an interface called p3dfft4is
available that has shown good performance on cluster computers with up to 32 768 cores.
To use FFTW, it first has to be compiled with options suitable for the computer architecture
on which it should run. The resulting library files are linked to the main program to make the
routines available. Three steps are needed to compute a DFT:
1. initialize FFTW for each call and create a “plan”
2. perform the actual FFT
3. deallocate the data, destroy the plans
The initialization has to be done once for each transform. It is necessary to declare the type
of the DFT and the size of the arrays. Depending on these parameters, FFTW determines the
fastest algorithm available for the specific DFT and stores the respective plan. For the transform
of pure real data to Fourier space the “real to complex” (r2c) interface exists. In the same way,
an inverse transform can be done by a “complex to real” (c2r) interface if the output does not
contain any imaginary part.
The FFT can then be performed for each plan repeatedly, always using the same optimized plan
by passing the variable containing the information about the plan. Depending on the type of
transform, FFTW provides different interfaces to call the FFT. Depending on the plan created,
the calls are slightly different.
When the program is finished and the transforms are no longer needed, the plan and all its
associated data should be deallocated. This is done by calling the interface provided by FFTW
for this task.
More information on FFTW can be found in [16].
1http://www.fftw.org, accessed 14th November 2010.
2http://pauillac.inria.fr/~xleroy/linuxthreads, accessed 14th November 2010.
3http://openmp.org/wp, accessed 14th November 2010.
4http://code.google.com/p/p3dfft, accessed 14th November 2010.
26
6 Spectral methods
A spectral method is a special algorithm to solve partial differential equations (PDEs) numeri-
cally. PDEs describe physical processes in, for instance, thermodynamics, acoustics, or mechanics.
Different variants of the algorithm exist. According to [32] the variants include the Galerkin
approach, the τmethod [24] and the pseudospectral or collocation approach. The Galerkin
approach is also the basis for the FEM. The main difference between the FEM and the spectral
method is the way in which the solution is approximated.
The FEM takes a local approach. It takes its name from the elements on which local ansatz
functions are defined. The ansatz functions are usually polynomials of low degree (p < 3) with
compact support, meaning they are non-zero only in their domain (i.e. in one element). They
equal zero in all other elements. The approximate solution is the result of the assembly of the
single elements into a matrix. The matrix links the discrete input values with the discrete output
values on the sampling points. Thus, the FEM converts PDEs into linear equations. The resulting
matrix is sparse because only a few ansatz functions are non-zero on each point. The FEM is able
to approximate the solution of partial differential equations on arbitrarily shaped domains. In the
three-dimensional case, the elements are typically tetrahedra or hexahedra with edges of arbitrary
lengths and thus can be easily fitted to irregularly-shaped bodies.
The FEM has low accuracy (for a given number of sampling points N) because each ansatz
function is a polynomial of low degree. To achieve greater accuracy, three different modifications
can be used for the FEM [2, 4]:
h-refinement: Subdivide each element to improve resolution over the whole domain.
r-refinement: Subdivide only in regions where high resolution is needed.
p-refinement: Increase the degree of the polynomials in each subdomain.
The different spectral methods can be seen as a variant where p-refinement is applied while the
number of elements is limited to one. Spectral methods use global ansatz functions φn(x)in the
form of polynomials or trigonometric polynomials of high degree p. In contrast to the low-order
shape functions used in the FEM, which are zero outside their respective element, φn(x)are
non-zero over the entire domain (except at their roots). Because of this, the spectral methods
take a global approach [4]. The high order of the ansatz functions gives high accuracy for a given
number of sampling points N. Spectral methods have an “exponential convergence”, meaning
they have the fastest convergence possible.
If the approximation of the PDEs is done by trigonometric polynomials, it can equally be ex-
pressed as a finite Fourier series. The resulting system of ordinary differential equations (ODEs)
27
can easily be solved in the Fourier space. The outstanding performance of this approach is
gained from the fact that the transform can be done using effective FFT algorithms (chapter 5.2).
As the Fourier series requires a periodic function (and so does the FFT), spectral methods using
FFT can only be used for the solution of infinite bodies. Usually periodic BCs are applied to the
domain of interest in order to expand it to an infinite body.
The spectral method for elastoviscoplastic boundary value problems presented here implicitly
uses Fourier series as ansatz functions. Thus, it can only be used for cubic domains with
periodic boundary conditions, which fits well to problem of computing RVE responses. However,
simulating the behavior of engineering parts of arbitrary shape is not possible. The global approach
of spectral methods also has the disadvantage that the convergence is slow if the solution is not
smooth. This is a problem for composite materials with high phase contrasts [4, 5, 17]. Because
the presented method approximates the function exact at each sampling point (but only at the
sampling points, not in between them) it falls into the category of collocation methods [32]. Other
names for this type of spectral methods are “interpolating” or “pseudospectral” approach [4].
In the following section, the approximation of a function by a linear combination of ansatz
functions is shown. In section 6.2 the spectral method for the small strain formulation for elas-
toviscoplastic boundary value problems is derived. Its extension to a large strain formulation
that can be solved in reference configuration by using the 1st Piola–Kirchhoff stress and the
deformation gradient is outlined in section 6.3.
6.1 Basic concept
Spectral methods are used for the solution of partial differential and integral equations. This is
done by writing a function u(x)as a linear combination of global ansatz functions φn(x). If the
number of ansatz functions is limited to N+ 1, the approximation reads as (example taken from
[4]):
u(x)≈
N
X
n=0
anφn(x)(6.1)
This series is then used to find an approximate solution of an equation in the form:
L u(x) = f(x)(6.2)
where Lis the operator of the differential or integral equation and u(x)the unknown function.
Approximate and exact solution differ only by the “residual function” defined as:
R(x;a0, a1, . . . , aN) = L N
X
n=0
anφn(x)!−f(x)(6.3)
The residual function R(x;an)is identically equal to zero for the exact solution. The different
spectral methods have different approaches to minimizing the residual [4].
28
6.2 Small strain formulation
The presented small strain formulation was introduced in [19]. Variants of it are also presented
in [14, 18, 22, 23]. Different improvements where developed, starting from this basic scheme. In
[5, 17] two different formulations are shown that overcome problems associated with high phase
contrasts. One possible extension for using the scheme to solve large strain problems according
to [12] is given in section 6.3.
Starting point for the derivation presented in [19] is the relationship between stress and strain
at the point y. For small strain, it is given as:
σ(y) = C(y) : ε(u(y)) (6.4)
or, when using index notation and Einstein convention:
σij =Cijkl εkl, i, j, k, l = 1,2,3(6.5)
where the Cauchy stress σij is a symmetric (σij =σji) tensor of 2nd order, εkl is the Cauchy-
strain tensor (small strain formulation) and Cijkl is the symmetric fourth order stiffness tensor.
When neglecting body forces, the static equilibrium corresponds to a divergence-free stress field:
div σ(y) = 0(6.6)
The spatial average over the volume under consideration (usually a RVE) of the strain is denoted
as hεi=ε. Periodic BCs are applied to the VE, resulting in a periodic displacement field and a
periodic strain field. Thus, introducing εallows the decomposition of the local strain field into
its average and a periodic fluctuation ˜
ε. By denoting the periodic displacement field as u∗, the
decomposition reads as:
ε(σ(y)) = ε+˜
ε(u∗(y)) = ε+˜
ε(y)(6.7)
The average strain εdepends on the current stress state and is spatially constant. The tractions
on the opposite sides of the VE with periodic BCs must be anti-periodic to fulfill the static
equilibrium.
A homogeneous reference material with stiffness tensor Cis introduced to write eq. (6.4) for an
infinitely expanded and periodic strain field with eq. (6.7) as:
σ(y) = C:˜
ε(y) + C:ε+C(y)−C: [˜
ε(y) + ε]
| {z }
:= τ(y)
(6.8)
The last term in eq. (6.8) is termed fluctuation field and abbreviated as τ(y). With div σ=0
(eq. (6.6)) and, since it does not depend on y,div C:ε=0, one can write:
div C:˜
ε(y)=−div (τ(y)) (6.9)
This equation is called a periodic Lippmann–Schwinger equation.
29
For ˜εkl =1
2(˜uk,l + ˜ul,k)as in small strain theory the equation reads in index notation as:
Cijkl ˜uk,lj (y) = −τij,j (y)(6.10)
This is a differential equation with a linear and translation invariant operator on the left side.
According to [18, 19] it can be solved with given τij,j by means of Green’s function method
(eq. (4.5)) for ˜uk:
˜uk(y) = Z
R3
Gki(y−y0)τij,j (y0) dy0(6.11)
Integration by parts leads to
˜uk(y) = Z
R3
∂
∂sjGki(y−y0)τij (y0)dy0−Z
R3
∂
∂sj
Gki(y−y0)τij (y0)dy0(6.12)
Because lim
s→±∞ Gki = 0 the first integral vanishes. With ∂/∂sjGki(y−y0) = −∂/∂yjGki(y−y0),
the derivative with respect to yof the remaining equation is:
˜uk,l(y) = Z
R3
Gki,jl (y−y0)τij (y0) dy0(6.13)
To solve eq. (6.13), Green’s function is substituted by a Γ-Operator Γijkl (y−y0):
−Γijkl (y−y0) = Gki,jl (y−y0)(6.14)
with—according to [23]—major and minor symmetries. The right hand side of eq. (6.13) is a
convolution. With eq. (6.14), it can be written as:
˜uk,l(y) = ˜εkl(y) = −Z
R3
Γijkl (y−y0)τij (y0)dy0=−(∗τ) (y)(6.15)
As in the convolution each variable interacts with each other variable, the convolution operation
can be seen as a stiffness matrix in FEM in which only single components equal zero. The effective
calculation of the convolution leads to the fast convergence of the spectral method. According
to eq. (5.7), a convolution in real space corresponds to a plain multiplication in Fourier space.
FT applied to the equation, therefore, leads to:
ˆ
˜εkl(k) = −ˆ
Γijkl (k) ˆτij (k)(6.16)
with the caret “ˆ” denoting quantities in Fourier space. The angular frequencies kcorrespond
to yin real space.
To solve the problem iteratively, the given average strain εkl is applied on the VE and we must
assume ˜εm=0
kl (y)=0, i.e. σm=0
ij (y) = Cijkl εkl for the first iteration. The superscript (m) denotes
the current iteration step. Solve eq. (6.16) to get a new value for ˜εm+1
ij (y), assuming:
ˆ
˜εm+1
kl (k) = −ˆ
Γijkl (k) ˆτm
ij (k)(6.17)
30
To solve the equation, ˆ
Γijkl must be known. According to [23], Green’s function is the solution
of the following differential equation:
Cijkl Gk m,lj (y−y0) + δimδ(y−y0)=0 (6.18)
with the Kronecker delta δim and the unit impulse function δ(y−y0). Using FT on eq. (6.18)
with eq. (5.5) and eq. (5.6) leads to:
Cijkl i2klkjˆ
Gkm(k) + δim = 0 (6.19)
Using the substitution rule of the Kronecker delta and with i2=−1, eq. (6.19) reads as:
ˆ
Gki(k) = klkjCij kl−1(6.20)
Kik(k) := klkjCij kl are the components of the acoustic tensor Kof the reference material. The
inverse is defined as Nik := Kik−1∀k6=0.
Applying Fourier transforms on eq. (6.14) results in:
ˆ
Γijkl (k) = klkjˆ
Gki(k)(6.21)
which allows to solve for Γijkl(k)in Fourier space:
ˆ
Γijkl (k) = kjklNik(k)|(ij kl)∀k6=0(6.22)
where |(ijkl)denotes symmetrization with respect to all indices, resulting in major an minor sym-
metries for ˆ
Γijkl (k). The knowledge of Γijkl (k)enables the solution of eq. (6.17) for the strain.
Due to the singularity of Γijkl(k), a solution for k=0is not given. But as k=0has an infinite
wavelength, ˆ
ε(0)is a priori known as the average strain: ˆ
ε(0) = ε.
A new value for the stress is achieved by:
σm+1
kl (y) = Cijkl(y)εij + ˜εm+1
ij (6.23)
where ˜εm+1
ij (y) = F−1ˆ
˜εm+1
ij (k). Using eq. (6.17) and eq. (6.23) as a fix-point algorithm allows
the solution of initial eq. (6.4).
The iterations are stopped if equilibrium is reached. This is done by calculating the divergence
of the stress field in Fourier space. The convergence criterion proposed in [14, 19] reads as:
|k·ˆ
σm(k)|21
2
|ˆ
σm(0)|≤atol (6.24)
which is the average of the divergence in Fourier space normalized by the value of the average
stress (at wavenumber zero). Usually atol = 10−4.
The properties of are well known and described for example in [17]. With:
∗C:ε=˜
ε(6.25)
31
follows:
˜
εm+1(y) = ˜
εm(y)−(y)∗σm(y)(6.26)
For an equilibrated stress field σno correction of the strain field is needed:
∗σ=0(6.27)
The simplified problem can be summarized as:
εm+1(y) = εm(y)− F−1ˆ(k) : F(σm(y))
| {z }
= ∆ˆ
˜εm(k) = ∆ˆ
εm(k)
(6.28)
The corresponding algorithm is especially efficient as there is no need to build the (intermediate)
fluctuation field τ(y). Furthermore, the equilibrium check (eq. (6.24)) can be performed at no
additional cost, since the Fourier transform of the stress field is required in eq. (6.28).
The presented scheme uses the small strain approximation and is therefore not suitable for
the more general case of large strains involving a rotational part. A formulation valid in these
circumstances is presented in the following section.
6.3 Large strain formulation
In [12], two possible methods are presented to extend the small strain formulation to problems
with large deformations. In this thesis, the implementation of the variant using the Lagrangian
description is outlined. Instead of using the Cauchy stress and strain, it is written in terms of the
1st Piola–Kirchhoff stress P(x)and the deformation gradient F(x). As those two quantities
are 2-point tensors, it allows the problem to be solved in the reference configuration only. A shape
update of the FP grid is not needed, as F(x)performs the push forward from the reference to
the current configuration (chapter 2). The deformation gradient F(x)is incrementally calculated
from the former one. The deformed configuration is not needed for the solution by means of the
spectral method. For postprocessing the current configuration can be computed from the local
deformation gradient at each point.
For an arbitrary constitutive law, the stress at each point is a function of the deformation
gradient (or equivalently of the displacement gradient):
P(x) = f(F(x)) (6.29)
P(x) = f(H0(x)) (6.30)
with equilibrium condition in reference configuration
div (P(x)) = 0(6.31)
Eq. (6.29) has a similar form as eq. (6.4). Thus, the problem can be solved in a similar way,
32
resulting in:
Fm+1(x) = Fm(x)− F−1ˆ:F(Pm(x))(6.32)
with
ˆ
Γijkl (k) = Nik(k)kjkl|(ik )(jl)(6.33)
where |(ik)(jl)denotes symmetrization with respect to i, k and j, l only. Thus, in contrast to ˆ
Γijkl
for the small strain formulation, the Γ-operator for the large strain formulation has only the minor
symmetries.
A slightly different method is used to check for equilibrium for the large strain formulation. It
gives comparable results to the criterion used for the small strain formulation, but is easier to
calculate:
maxk|k·ˆ
Pm(k)|
|ˆ
Pm(0)|≤atol.(6.34)
Usually where atol = 10−4.
6.3.1 Numerical aspects
The formulations for small and large strain presented here are solely analytical. As described earlier
in this chapter, spectral methods approximate the solution by a sum of ansatz functions. There is
no need to express the stress or strain field by ansatz functions in real space. A discretization can
implicitly done by using the DFT to approximate the FT, thus approximate the infinite Fourier
series by finite ones. The chosen number of FPs determines the order of the Fourier series, i.e.
the accuracy.
33
34
7 Implementation
At the Max-Planck-Institut f¨ur Eisenforschung GmbH (MPIE ), crystal plasticity finite element
methods (CPFEM) are used to simulate the mechanical response of crystalline materials [29]. A
RVE is used to predict the material answer to certain load cases. Its size depends on the phase
contrasts and the orientation of the single grains under consideration [10].
At the MPIE, several routines have been developed for the calculation of crystal plasticity
phenomena. The routines provide facilities to use several constitutive laws on the grain level—
from simple phenomenological to physics-based models. The routines are included in a flexible
framework with interfaces to commercial FEM solvers like MSC.Marc1or Abaqus2.
In this chapter, it is shown how a spectral method using FFT is closely connected to the existing
material routines. The spectral method is used as an alternative to FEM-based solvers. The
extension to use the spectral method consists of routines to define the question to be solved, a
method to calculate the deformation state fulfilling the given stress BCs, and the implementation
of an FFT code. The use of the existing material routines is also clarified in this chapter. The
resulting algorithm in short form is given at the end of the chapter. Application examples of the
implemented solver are shown in chapter 8.
The CPFEM code and its extension using a spectral method is written in Fortran.Fortran
as the first developed high-level programming language was introduced in 1954. Its name is an
abbreviation of formula translator. Although it is a general-purpose language, it is especially suited
(and widely used) in the field of high-performance scientific computing. Fortran was successively
enhanced, resulting in a number of versions. The new versions largely retain compatibility with
previous versions. The newer versions are named after the year in which they were introduced
[27]. The latest version is Fortran 2003, which is an extension of the widely-used Fortran 90/95.
The version used for this implementation is Fortran 90/95.
The solver using a spectral method is wrapped around the material routines in a similar way to
the FEM solvers. To use the interfaces developed for the FEM solvers, the functionality of the
FEM tools has to be emulated. Each step from setting up the problem to the postprocessing has
to be implemented to get a stand-alone executable. The information how to compile the source
code and link the files in order to obtain an executable file is stored in a “makefile”. The makefile
is given in listing A.4.
1http://www.mscsoftware.com/, accessed 14th November 2010.
2http://www.simulia.com/products/abaqus_fea.html, accessed 14th November 2010.
35
7.1 Problem set-up
The problem to be solved is specified by three files:
1. the geometry specification file *.geom,
2. the material configuration file material.config,
3. the load case file *.load.
The use and the structure of the files is described in the following subsections. Example files
are given in appendix B. The files are designed for the routines developed at the MPIE. They are
modeled for easy readability for humans, rather than being optimized to give small file sizes. All
files can be easily edited by standard text editors.
7.1.1 Geometry specification
To apply the spectral method to elastoviscoplastic boundary value problems, the volume under
examination has to be discretized by a point grid. A VE consisting of 200 grains and discretized
by 64 Fourier points (FPs) in each direction is shown in fig. 7.1. Due to the simple geometry
of the VE (hexahedra) with a regular FFT grid, no complex meshing as for the FEM has to be
carried out. The information about the material at each FP and the discretization of the VE is
stored in the geometry file (file extension .geom). An example geometry file consisting of five
grains that is discretized by three FPs in each direction is shown in listing B.1. The geometry file
is subdivided into a header and a main part.
In the header, the dimension of the geometry and its discretization is specified. The size of
the cuboid VE is described by its three space dimensions. The keyword is dimension, followed
by three pairs of letters and floating point numbers. Each of the letters x,y, and zstands for
one dimension and is followed by the corresponding value. In a similar way, the number of FPs
is specified. The keyword is resolution followed by a,b, and cand the number of FPs in
each direction as an integer value. A “homogenization scheme” can also be used. This is done by
using the keyword homogenization followed by a number referencing to a certain homogenization
scheme3. The order of the keywords is arbitrary as long as they are at the beginning of the file.
The header is followed by the actual information about the geometry. Each row contains the
information for one FP. Counting starts at one and goes up to the total number of FPs. The
points are arranged in a linear list with the component xof the position vector (x;y;z)changing
fastest and zchanging slowest. The single integer in each line stands for the material that is used
at the specified position (referencing a particular microstructure defined in the material.config
file).
To use the existing routines developed for the FEM-based solvers, a structure comparable to the
one used by the FEM has to be emulated. Therefore, a linear element with reduced integration
capacity (called C3D8R by Abaqus) is pretended. The element is displayed in fig. 7.2. This
3Homogenization techniques allows it to determine the average response of a cluster of grains. Homogenization
is used in two-level approaches for the calculation of engineering parts. More information on homogenization
techniques can be found in [29].
36
element is a hexahedra, its shape is specified by the position of the nodes on its eight corners.
For FEM solving, it has one integration point (or Gauß point) in the center of the element. For
the spectral method, this point is the FP. Each face (roman numerals) and each node (arabic
numerals) of the element has a unique number as shown in fig. 7.2. The counting scheme on the
element is basically arbitrary, for compatibility reasons it follows the convention that is used in the
standard FEM codes.
Figure 7.1: Volume element consisting
of 200 grains discretized by 643FPs
2
1
3
4
8
5
6
7
IV
III
II
VI
V
I
Face
Node
FP/IP
Figure 7.2: Hexahedral finite element
with one integration point
Each point in a VE as shown in fig. 7.1 corresponds to one FP shown in fig. 7.2. The VE is built
by generating a numbering scheme for a global grid of nodes and FPs in the VE and connecting
the local numbering of each element with that global scheme. The complete VE consists of
NFP =Nx×Ny×NzFPs and (Nx+ 1) ×(Ny+ 1) ×(Nz+ 1) nodes, where Nx,y,zare the
number of FPs as defined in the geometry file along each of the three dimensions.
x
}}y
z--
lx
ly
lz
Nx
Nx×Ny
Nx×Ny×Nz
Figure 7.3: Assembly of the VE
An intermediate position for each FP and
each node is calculated first for a hypothetic
VE with the side lengths equal the number of
FPs in the corresponding direction. Counting
starts at one and goes op to the number of
FPs for each component of the intermediate
position vector. The positions are equispaced
in each direction. By convention the posi-
tion for the first dimension runs the fastest.
Therefore the FPs with numbers from 1to Nx
are at intermediate positions d(1, . . . , Nx) =
(1, . . . , Nx; 1; 1). Element No. Nx+ 1 is lo-
cated at d(Nx+ 1) = (1; 2; 1) and so on. The
corresponding scheme for numbering the nodes
works the same way, where Nx,y,zis replaced by Nx,y,z+ 1 as there is one node more than FPs in
each dimension.
37
The physical coordinates of nodes and FPs can be calculated from the intermediate position
vector and the length specified for the three dimensions. The calculation is explained for the one-
dimensional case in the following. The length of the side in the example is denoted as lxand the
number of FPs in that direction equals Nx. The first node is located at (d1(1) −1)/Nx×lx= 0,
the second at (d1(2) −1)/Nx×lxand so on. The last node (Nx+ 1) is located at lxand—due to
the periodic BCs—falls together with the first node. The FPs are located in the middle of their
element, therefore the first FP is positioned exactly between the first two nodes, thus at position
(d1(1)−1/2)/Nx×lx. The second FP is in between node two and three and so on. The extension
to the three-dimensional case is straightforward.
As each element has exactly one FP, each element gets the same global number as the associated
FP. All elements have eight nodes that surround the FP. Due to the periodic BCs, each node is
always shared by eight elements. The assembly of the VE is schematically shown in fig. 7.3, where
three elements and their numbers are given exemplary.
The implemented numbering routine is able to handle arbitrarily shaped elements with various
numbers of integration points (used only by FEM-based solvers). It connects each element with
its neighboring elements by providing information as to which nodes and faces are shared by which
elements. The result is a “virtual mesh” that allows the results achieved by the spectral method
to be presented in a compatible way to interfaces developed for the FEM solvers. The routines
for building the virtual mesh are given in listing A.3. The functions named *spectral* were
implemented especially for the spectral method. All other functions in the source code file are
generic. They are also used for the FEM-based solvers. The functions used solely for MSC.Marc
or Abaqus are removed from the appended file in order to reduce the length of the appendix.
7.1.2 Material specification
The specification of the material behavior relies on an existing framework developed at the MPIE.
Details on the CPFEM implementation can be found in [28]. The framework uses a very flexible
material representation that allows the description of single crystals as well as multiphase materials.
To achieve this, all material information is stored in a configuration file named material.config,
which is read during the initialization of the material subroutine. An simple example file describing
two grains is shown in listing 7.1.
The file is divided into several parts. Each part starts with a label of the form <keyword>, where
valid keywords are: homogenization,microstructure,crystallite,phase, and texture.
The parts can hold multiple sections, of which each starts with a label of the form [entryname].
entryname is an arbitrary string. In the model, a material is assigned to an FP by specifying its
homogenization and microstructure. For this purpose, the sections are consecutively numbered so
that they can be indexed by their position within the part. In this way it is possible to use different
materials, even different constitutive laws, within one model. In the following, the keywords are
briefly described:
<homogenization> The homogenization scheme for the whole VE. Since RVEs do typi-
cally not contain more than one phase per material point, a homogenization scheme is not
required. Therefore, a homogenization scheme where the keyword Ngrains is set to 1and
38
type equals isostrain should be used.
<microstructure> Each microstructure specified in this part corresponds to one or more
grains in the VE. Each microstructure consists of one ore more constituents (specified by
(constituents)). The constituents are characterized by their phase, their texture, and
their fraction on the microstructure. The keyword crystallite is used to specify the
desired output variables. The keywords crystallite,phase, and texture refer to the
respective keywords in angle brackets given below.
<crystallite> This part is used to specify which information of each FP should be
recorded. Each output option is specified after a keyword (output).
<phase> After this keyword the information about the mechanical behavior of each phase is
given. The most important entry for each phase is the key constitution. Its value defines
which constitutive model is used for this phase with remaining entries in the section giving
the necessary parameters and output options connected to the constitutive law. Possible
keywords are: j2,phenopowerlaw (the constitutive models used for the examples presented
in chapter 3.4), nonlocal, and dislotwin.
<texture> The orientation (distribution) of the constituent.
Listing 7.1: Example material configuration file
<h o mo g e n iz a t i on >
[ SX ] # ho m o g e n i z a t i o n s ch e me 1
type isostrain
N g r a i n s 1
<m i c r o s t r u c t u r e >
[ G r ai n 00 1 ] # m i c r o s t r u c t u r e 1
crystallite 1
( c o n s t i t u e n t ) p ha s e 1 t e x t u r e 1 f r a c t i o n 1 . 0
[ G r ai n 00 2 ] # m i c r o s t r u c t u r e 2
crystallite 1
( c o n s t i t u e n t ) p ha s e 1 t e x t u r e 1 f r a c t i o n 1 . 0
<crystallite>
[ a l l ] # c r y s t a l l i t e 1
(output) orientation
( o u t p u t ) p # 1 s t P i o l a −K i c h h o f f s t r e s s t e n s o r
<phase>
[ Alu mi num p heno pow er law ] # p has e 1
c o n s t i t u t i o n p he no po w er la w
( o ut p ut ) s h e a r r a t e s l i p
lattice structure fcc
c1 1 1 7 0 . 1 7 e 3
c1 2 1 1 4 . 9 2 e 3
c4 4 6 0 . 9 8 e 3
g d o t 0 s l i p 1 . 0
<texture>
[ G r a i n 0 0 1 ] # t e x t u r e 1
( g a us s ) p h i 1 3 59 . 12 14 5 2 P hi 8 2. 3 19 4 71 P hi 2 3 47 . 72 9 53 5 s c a t t e r 0 f r a c t i o n 1
39
In the example given in listing 7.1, one homogenization scheme named [SX] of the type
isostrain is defined. Thus, in the geometry file *.geom the keyword homogenization should
be set to 1, referring to the only available scheme. Two microstructures, named [Grain001]
and [Grain002], are specified. Since the parameters for both microstructures are identical, refer-
ring to the only available sections in the various parts, both microstructures are identical in their
mechanical behavior.
In listing B.3 the material specification used for the simulations discussed in chapter 8 is given.
For reasons of convenience, only five of the hundred differently oriented grains are defined in the
given example.
7.1.3 Load case specification
The load case file (extension .load) holds information about stress and strain applied to the
VE. Each line defines the BCs to be applied for a particular period of time. A sequence of loads
can thus be specified by additional lines, allowing cyclic loading to be applied, for example. Per
line, the nine components of the velocity gradient (keyword lor velocitygrad) and the stress
(keyword sor stress), the period of time (keyword t,time or delta), and the number of time-
discretizaion steps (keyword n,incs,increments or steps) are given. Since components for
stress and velocity gradient are mutually exclusive, a #should be used for the stress component
where the velocity gradient is given and vice versa.
An example file prescribing the four load cases used for the simulations discussed in chapter 8
is given in listing B.3.
7.2 Initialization
The routine starts with reading in the information from the files specifying the problem under
consideration. The two arguments passed to the compiled executable are the geometry file and
the load case file. The location of the load case file determines the working directory where the
material configuration file material.config is searched for. There is the possibility of giving more
parameters regarding numerics and debugging by putting the optional files numerics.config and
debug.config into that directory. The parameters control the behavior of the different routines
of the subroutines developed at the MPIE. If one of the three mandatory files is not available, the
program will exit and report an error.
7.2.1 Load case
The information about the load case (*.load) is read in first. A sanity check is done to find out
whether all load cases are completely defined, meaning they all have velocity gradient respectively
stress BCs, loading period and steps defined. The program will exit with an error message if one
component of the stress BC and the velocity gradient is doubly or not at all defined.
40
7.2.2 Geometry
For the undeformed reference configuration, the deformation is set to identity. To initialize the
material point model the interface routine CPFEM_general is called. This then reads in the
geometry file, generates the connections between the elements, sets up the constitutive laws, and
returns the elastic stiffness for each material point.
7.2.3 FFTW
The FFT used in the presented implementation is FFTW in version 3.2.2. As described in
chapter 5.3, it has to be initialized by creating a plan. This is done during the initialization
by calling the function provided by FFTW as soon as the information about the FP grid is
available. Each component of the 1st Piola–Kirchhoff stress must be transformed to the
discrete Fourier space (wavenumber space). The result of the operations in wavenumber space
must be inversely transformed to give the change in the deformation gradient.
The quantities used in Fourier space, the Γ-operator, the stress field, and the change of the
deformation gradient at each point, are quantities originated in real space and without an imaginary
part. As described in chapter 5, this allows the use of the efficient “real to complex” (r2c) and
“complex to real” (c2r) interfaces of FFTW for the transformation from real to wavenumber space
and inverse [19]. By using these interfaces, only Nx/2+1 instead of Nxvalues for the first (or
any other) dimension are transformed [26].
Like most of the FFTs, FFTW stores the information in wrap-around order. In first position,
the value of wavenumber (angular frequency) k= 0 is stored. It is followed by the value of the
smallest positive wavenumber, the value of the second smallest one etc., up to the value of the
most positive wavenumber (which is ambiguous with the value of the most negative wavenumber).
Values of negative wavenumbers follow, from the value of the second-most negative wavenumber
up to the value of the wavenumber just below zero.
7.2.4 Wavenumbers and Γ-operator
The wavenumbers are equally distributed and depend on the size of the VE and its discretization.
Each component kiof the wave vector kis a linear sequence from −Ni/2to Ni/2divided by
the size of the VE in direction li[19, 26]. They must be arranged in wrap-around order since the
transformed data is stored as described in section 7.2.3. The wavenumbers are used to calculate
the Γ-operator according to eq. (6.33) and to determine equilibrium in Fourier space as given
in eq. (6.34).
The Γ-operator is directly calculated for each wavenumber as a product of reference stiffness and
wavenumber as described in chapter 6.3. In the implementation presented here, the Γ-Operator
is calculated only for Nx/2+1 wavenumbers in the first dimension, using the symmetry resulting
of the transformation of real-only data to Fourier space4[19]. In combination with the r2c and
c2r FFT this saves half of the computation time and almost half of the memory needed to store
the Γ-operator and the stress field in Fourier space.
4The Γ-operator is easier to compute in Fourier space as shown in chapter 6.2. Nevertheless it is a quantity
originated in real space.
41
The reference stiffness (average stiffness) for the VE is computed by summing up the stiffness
tensor from each FP and dividing it by the total number of FPs:
1
NFP
NFP
X
n=1
dσ(F(n))
dε(n)=1
NFP
NFP
X
n=1
dP(F(n))
dF(n)=C,for F(n) = F=I(7.1)
7.3 Execution loop
By the end of the initialization, the basic information about load cases and geometry is written to
the results file (section 7.4). An outer loop over all load cases is performed. Inside the load case
loop, an inner loop over the steps of the current load case is carried out. Two conditions have to
be fulfilled by the end of each step: the stress BCs and the mechanical equilibrium. The average
stress state is determined by the prescribed average deformation gradient F. The components of
Fthat are not directly given by the prescribed velocity gradient, i.e. the components where a stress
BC is given, have to be adjusted in order to fulfill the applied stress BCs. Mechanical equilibrium
depends on the deformation gradient on each point F(x). For each step, the calculations are
done iteratively until the stress BCs are fulfilled and the mechanical equilibrium is reached within
the given tolerance.
7.3.1 Global deformation gradient
The global deformation gradient F, i.e. the average over the whole VE, is directly calculated from
the prescribed velocity gradient and the time stepping given in the load case file. Components
where a stress BC applies (no velocity gradient given) are skipped at first. These components of
Fhave to be adjusted in order to fulfill the applied stress BCs, as the values of Fleading to a
state fulfilling these BCs is a priori unknown.
The stress on each point is computed by calling CPFEM_general. The input arguments for
the call are the deformation gradient at the end of the former step F0(x) = F0+˜
F0(x), the
newly predicted deformation gradient Fm(x)of the current iteration m, the duration of the
deformation, the element number, the integration point (for the spectral method the FP), and
the temperature. CPFEM_general returns P,σ,dP/dFand dσ/dEtat each point. Only the
1st Piola–Kirchhoff stress tensor Pm(x)is used for now to calculate the average stress Pm
on the VE. With the deviation between Pmand given BC denoted as ∆Pm, evaluating
∆Fm+1 =S: ∆Pm(7.2)
for the components where a stress BC is located gives the correction of the deformation gradient.
The tensor Sis the inverted stiffness Ccalculated during initialization.
The value for the correction of Fcalculated by eq. (7.2) tends to be too strong. For example, if
uniaxial stress is applied, the first guess for the deformation gradient would be strain in the desired
direction while the other directions are unstrained. This results in a volume expansion that leads
to high stresses. The problem is therefore solved iteratively with the value of ∆Fdamped by a
42
factor ρ:
Fm+1 =Fm+ρ∆Fm+1 (7.3)
A simple damping scheme is applied. The algorithm starts with a high damping factor, e.g.
ρ= 0.05, i.e. the value of Fis only corrected by 5% of the value calculated by eq. (7.2). If
the correction of on component ij is too strong, the algorithmic sign of ∆Fm+1
ij differs from
the one of ∆Fm
ij . In this case, a weaker correction is applied on the component for the next
step m+ 2 to prevent oscillations around the correct solution. Similarly, the correction values for
m+ 2 is increased if the previous correction step is to small. While being far from perfect, this
simple algorithm significantly improves the speed of calculation. A more advanced and possibly
more efficient scheme is not introduced so far. However, the described rather time consuming
calculation is only needed for the first step of each load case, when the Fm=1
ij cannot be predicted
from the former steps. On each following step of the load case a continuation along the trajectory
of the two former steps is predicted for the components of the deformation gradient where stress
BCs are applied. This assumption is correct for the linear elastic deformation and almost correct
for plastic deformation as long as the change in slope is not too strong. It significantly improves
the performance of the computation of the global deformation gradient.
Each local deformation gradient is corrected by the change of the average deformation gradient:
Fm+1(x) = Fm(x)+(Fm+1 −Fm)(7.4)
and a new stress field is computed by calling CPFEM_general.
The stress BCs are regarded as fulfilled if the largest deviation is less than 0.8% of the highest
stress component. This relative tolerance considers that at low stress states more accuracy is
needed than at high stress states. The criterion exceeds the desired accuracy by the end of each
step as the calculation of the local deformation gradient is likely to amplify the error.
When a deformation state fulfilling the stress BCs is finally known, the local deformation gradient
is calculated by means of the spectral method in order to achieve the mechanical equilibrium.
7.3.2 Local deformation gradient
At the first step of each load case a homogeneous deformation (i.e., vanishing fluctuation) is
assumed on each FP for the first iteration. That means that the global deformation gradient
is applied at each FP: F1(x) = F1. From the second to the last step of each load case, the
predicted deformation gradient for the first iteration F1(x) = F1+˜
F1(x)is the continuation at
the rate of the former step.
The calculation starts with a call to CPFEM_general to get the 1st Piola–Kirchhoff stress
tensor Pm(x)on each point resulting from the current deformation gradient Fm(x). The stress
field is transformed to Fourier space and multiplied by the Γ-operator. The convergence is
checked in Fourier space according to eq. (6.34). As described in chapter 6.3, the inverse
transform of ˆ(k) : ˆ
Pm(k)results in the change of the deformation gradient ∆˜
Fm+1(x) =
∆Fm+1(x)that leads to mechanical equilibrium. The new average deformation gradient does not
necessarily fulfill the applied BCs. The average part Fm+1(x)on each FP is therefore corrected in
43
a way similar to the one applied in the calculation described in section 7.3.1 during each iteration.
With the new deformation gradient Fm+1(x), a new stress Pm+1(x)is computed. The loop is
performed until convergence is reached within the limits given as tolerance.
The calculation ensures that Fequals the value predicted in the calculation described in sec-
tion 7.3.1. However, as the local fluctuations change the stress state, it does not necessarily lead
to a state where the stress BCs are fulfilled. The average stress Pis therefore calculated during
each iteration and compared to the applied stress BCs. The BCs are regarded as fulfilled if the
largest deviation is less than 1.0% of the amount of largest stress component. This tolerance
for the stress BCs is less accurate than the one of the scheme outlined in section 7.3.1. If the
stress does not fit to the applied BCs, again a correction of Fis accomplished as described in
section 7.3.1.
The different tolerances lead to a situation, where the calculation loops for global and local
deformation gradient are usually employed only once. A switch back from the scheme for the local
deformation gradient to the scheme for the global one is rarely needed, mostly for the first step
of a load case with high applied deformations.
As soon as the equilibrium state is reached while the stress BCs are fulfilled, the results are
written to the output file and the algorithm moves to the next step of the load case (or to the
next load case if the calculated step was the last step of the current load case).
7.4 Output
The results obtained by the material subroutine are stored in the output file results.out in
binary format. The results that can be written out depend on the constitutive model used. They
can be specified in the file material.config. The current configuration of the VE has to be
constructed from the deformation gradient on all FPs F(x). Thus, F(x)should be always chosen
as an output option. The information can be converted to a file that can be viewed in gmsh5.
7.5 Resulting algorithm
The resulting algorithm is implemented in Fortran 90/95. The compiled executable file is called
mpie spectral. Its source code is divided into two files:
mpie_spectral.f90
mpie_spectral_interface.f90
The two files are given in appendix A. The first file contains the information outlined in this
chapter. It is schematically given as pseudocode in listing 7.2. The second file provides the
information for CPFEM_general how to read in the geometry from the geometry file *.geom.
Besides these two source code files, different files containing the source code for the material
models, standard mathematical tasks, etc. must be compiled and linked. Since most of these
files are not altered for the implementation of the spectral method, they are not included in the
5http://geuz.org/gmsh/, accessed 14th November 2010.
44
appendix. Only the code file for the geometry generation (mesh.f90) was heavily modified and
parts of it are given in listing A.3. Only the generic routines (for both, FEM- and spectral method-
based solvers) and the routines especially written for the presented implementation are included
in appendix A. The routines for MSC.Marc and Abaqus as well as the definitions for all elements
except from C3D8R are removed from the file. To use FFTW with multiprocessor support, three
files must be added. The compiled library files libfftw3.a and libfftw3_threads.a are linked
to the compiled routines and the file storing the variable definitions, fftw3.f, is included in the
source code.
The makefile storing the information how to compile and link all necessary files using the Intel
Fortran compiler6is given in listing A.4.
6http://software.intel.com/en-us/articles/intel-composer-xe/, accessed 14th November 2010.
45
Listing 7.2: Summarized algorithm
Data:geometry , material, load cases
Result:S,k,ˆ, n load cases
for j←1to n load cases do // looping over load cases
n steps ←Func(load cases(j)) // with ’Func’ denoting a generic function
for i←1to n steps do // looping over steps of current load case
if i= 1 then // homogeneous guess for first step
F1←Func(load cases(j))
F1(x)←F
else // continue along former trajectory
Fi←(2 ·Fi−1−Fi−2)
Fi(x)←(2 ·Fi−1(x)−Fi−2(x))
calcmode ←1
m←0
while error stress ≥tol or error divergence ≥tol do // convergence loop
switch calcmode do
case 1// global deformation gradient (fulfill stress BCs)
m←m+ 1 // increase number of iterations
Pm(x)←Func(Fm−1(x)) // constitutive law
Pm← |Pm(x)|
Fm←Func(Pm,S)// correct average deformation gradient
error divergence ←(2 ·tol)// equilibrium never fulfilled
error stress ←Func(Pm, load cases(j)) // compare to BCs
if error stress < tol then calcmode ←2
case 2// local deformation gradient (fulfill equilibrium)
m←m+ 1 // increase number of iterations
Pm(x)←Func(Fm−1(x)) // constitutive law
ˆ
Pm(k)←FFT(Pm(x)) // FT of stress field
∆ˆ
Fm(k)←ˆ(k) : ˆ
Pm(k)
Fm(x)←Fm−1(x) + FFT−1(∆Fm(k)) // inverse FT
Pm← |Pm(x)|
error stress ←Func(Pm, load cases(j))
error divergence ←Func(Pm(k),k)// in Fourier space
if error stress ≥tol then calcmode ←1
Result:Pi(x),Fi(x)// store results of converged step
46
8 Simulation results
In order to test the implemented algorithm, several simulations are performed.Three test and
the results achieved are presented in this chapter. The first simulations presented in section 8.1
are used to prove that the implementation works in general.The test conducted to see if large
deformations are handled correctly is shown in section 8.2. The comparison between the solution
achieved by the spectral method and the “de facto standard” FEM is outlined in section 8.3.
8.1 Proof of correct implementation
As a first step to validate the implementation, some results are compared to simulations carried
out with an implementation of the spectral method written by R. Lebensohn. This imple-
mentation is called evp5j. It uses a small strain formulation and a viscoelastic constitutive law
without hardening. A comparable constitutive model available in the routines of the MPIE is the
phenomenological powerlaw (chapter 3.4.2) with the hardening set to zero. The elastic constants
used are chosen in allusion to the values known for copper. The VE is a polycrystal consisting of
100 randomly orientated grains. It is discretized by 32 FPs in each direction.
A velocity gradient with component L33 = 1 s−1is prescribed. The global shear deformations
are set to zero. The stress of the two remaining directions is set to zero (stress BCs). Thus, the
prescribed load case results in a uniaxial stress state. The deformation is applied in 40 steps, each
with a duration of 0.0001 s, resulting in a final strain of ε33 = 0.0004. The load case is given in
the first line of listing B.2.
Three different versions, called mpie spectral v. 0.1, v. 0.2, and v. 0.3 are used for comparison.
Version 0.1 of mpie spectral differs only slightly from evp5j if a similar material model is used.
The most serious differences are the prediction of the fluctuations and the calculation of the error.
While in evp5j a completely homogeneous strain field ε1(y) = εis the prediction at the first
iteration of each step, in mpie spectral v. 0.1 the fluctuations of the last step are stored and only
the additionally prescribed deformation is homogeneous: ε1(y) = ε0(y) + ε−ε0. Superscript 0
denotes the deformation at the end of the last step, i.e. no deformation at the first step. The
abort criterion implemented in evp5j depends on the relative change of the deformation compared
to the last iteration. The criterion implemented in mpie spectral v. 0.1 is based on the divergence
of the fluctuation field that is calculated in Fourier space. The field is said to be divergence
free, thus in the mechanical equilibrium, if
maxk|k·ˆ
P(k)|
|ˆ
P(0)|≤atol = 10−5(8.1)
47
This criterion is more accurate than the value of atol = 10−4proposed in chapter 6.
Version 0.1 of mpie spectral is not optimized. It uses complex-to-complex (c2c) FFTs for the
FT and the inverse FT and makes no educated guess at the displacement. Versions 0.2 and 0.3
are optimized regarding theses points. The difference between versions 0.2 and 0.3 is the handling
of the deformation gradient. As in evp5j, in version 0.2 the deformation gradient is symmetrized.
Thus, the strain measure is the Cauchy strain that is valid only for the small strain formulation.
Version 0.3 of mpie spectral does not symmetrize the deformation gradient. It is the final version,
fully written in terms of the large strain framework introduced in chapter 2.
In tab. 8.1 the properties of the different versions of mpie spectral are compared to evp5j. The
iterations needed to converge for some steps of the applied load case are also given in this table.
Table 8.1: Properties of the different versions of mpie spectral compared to evp5j
implementation evp5j mpie spectral
version n/a 0.1 0.2 0.3
type of the FFT c2c, c2c r2c, c2r
mech. framework small strain large strain
deformation symmetric non-symmetric
predicted deformation fully homog. new homog. step continuation at last rate
iterations needed to converge
step 1: 14 32 23 23
step 2: 16 21 2 2
step 3: 16 24 2 2
step 4: 17 18 2 2
step 5: 17 17 2 2
step 10: 17 13 2 2
step 15: 20 12 4 4
step 20: 20 13 5 5
step 25: 21 16 4 4
step 30: 21 16 3 3
step 35: 21 17 3 3
step 40: 21 17 2 2
It can be seen from tab. 8.1 that for the first step, more than twice the number of iterations are
needed by mpie spectral v. 0.1 when compared to evp5j. This is a result of the different abort
criteria. By using the less strict criterion atol = 10−4for mpie spectral, fewer iterations compared
to evp5j are needed, but the results differ significantly. For the following steps, fewer iterations
are needed due to the better guess at the beginning of each step (homogeneous add-on instead
of fully homogeneous deformation).
At the first step, the prediction is the same for all implementations. That fewer guesses are
needed in version 0.2 and 0.3 compared to v. 0.1 can be explained by the use of the r2c/c2r
interfaces. As the r2c/c2r FFT takes the not existing imaginary part of the quantities in real
space into account, the numerical distortion is much lower. This results in a faster convergence.
Even with the homogeneous add-on, a faster convergence is reached compared to the reference
implementation. With the prediction of the former rate as a guess (mpie spectral v. 0.2 and v.
48
0.3) for the new step the performance is even significantly better.
The stress–strain curves computed by the different version of mpie spectral are identical. In
fig. 8.1 the stress–strain curve of mpie spectral v. 0.3 is shown as an example and compared
to the one computed by evp5j. The small observable deviations can be explained by the slightly
different constitutive laws and by numerical distortions. Also, the small strain formulation in evp5j
does not use a proper velocity gradient but an approximation valid only for small strains. This
can explain that the curves differ more for higher strain.
The von Mises equivalent of the displacement on one side of the VE is shown in figures 8.2
and 8.3. Fig. 8.2 shows the displacement field after the first step (ε33 = 0.00001). Fig. 8.3 shows
it after the last step (ε33 = 0.0004). The fields are shown in undistorted configuration, each
pixel corresponds to one FP. The deformation direction is denoted by arrows on the edges of the
sketched VE in the legend. The perspective of the given view is outlined by double lines in the
legend.
The displacement field computed after the first and last step of the example load case does
not appreciably differ between evp5j and mpie spectral v. 0.1 and v. 0.2. As expected, the
displacement computed by mpie spectral v. 0.3 is slightly different. The reason is that in this
version the deformation gradient is not symmetrized.
The von Mises equivalent of the Cauchy stress tensor after the first and the last step is
shown in figures 8.4 and 8.4. The stress fields computed by evp5j,mpie spectral v. 0.1, and v.
0.2 differ slightly. The deviations can only be seen if they are visualized using image processing
software. There is no difference between the results achieved by mpie spectral v. 0.2 and v. 0.3.
This can be explained by the fact that the symmetrization of the deformation gradient results only
in a rotated stress tensor. The rotation does not affect the von Mises equivalent of the tensor.
In summary, the results show that the integration of the spectral method into the existing
material subroutines of the MPIE is done in such a way that the results do not significantly differ
those results computed with the stand-alone version written by R. Lebensohn.
0e+00 1e−04 2e−04 3e−04 4e−04
0
5
10
15
20
25
εε33 [−]
σσ33 [Pa]
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●evp5j
mpie_spectral v. 0.3
Figure 8.1: Stress–strain curves of evp5j and mpie spectral v. 0.3
49
(a) evp5j (b) mpie spectral v 0.1
(c) mpie spectral v 0.2 (d) mpie spectral v 0.3
min max
•
RL
_
_
•
RL
_
_
•
RL
_
_
•
RL
_
_
◦ •
• •
Figure 8.2: Displacement field H0,vM at ε33 = 0.00001
50
(a) evp5j (b) mpie spectral v 0.1
(c) mpie spectral v 0.2 (d) mpie spectral v 0.3
min max
•
RL
_
_
•
RL
_
_
•
RL
_
_
•
RL
_
_
◦ •
• •
Figure 8.3: Displacement field H0,vM at ε33 = 0.0004
51
(a) evp5j (b) mpie spectral v 0.1
(c) mpie spectral v 0.2 (d) mpie spectral v 0.3
min max
•
RL
_
_
•
RL
_
_
•
RL
_
_
•
RL
_
_
◦ •
• •
Figure 8.4: Stress field σvM at ε33 = 0.00001
52
(a) evp5j (b) mpie spectral v 0.1
(c) mpie spectral v 0.2 (d) mpie spectral v 0.3
min max
•
RL
_
_
•
RL
_
_
•
RL
_
_
•
RL
_
_
◦ •
• •
Figure 8.5: Stress field σvM at ε33 = 0.0004
53
8.2 Handling of large deformations
When using the large strain formulation, rotations must not result in strain or stress. A load case
consisting of a pure rotation is therefore used as a test to see if the implementation handles large
deformations correctly.
The velocity gradient applied has the form of a rotation matrix with the identity subtracted.
The load case results in a rotation through the first axis, thus the polar decomposition reads as:
F=R·I=I·R, i.e. V=Iand U=I. The VE rotates through 90 ◦in 90 steps, i.e. in each
step it rotates through 1◦. Since all components of the velocity gradient are defined, no stress
BCs are applied. The load case is given in the second line of listing B.21.
The VE used for the test is a single crystal. The constitutive model is the isotropic J2-plasticity
model that is outlined in chapter 3.4.1. The parameters are fitted in order to simulate the behavior
of an aluminum alloy. The VE is shown at different rotation angles in fig. 8.6.
1 Pa
0 Pa
(a) 1◦(b) 30 ◦(c) 60 ◦(d) 90 ◦
Figure 8.6: Stress field σvM resulting from pure rotation
From fig. 8.6 it can be seen that the stress is almost zero during the rotation. The small amount
of stress remains constant during the rotation. If the approximation used for the values of the
sines and cosines of the applied rotation is less accurate, the stress is much higher. Thus, the
stress can be seen as a result of numerical inaccuracies. The test proves that the implementation
handles large deformations correctly, i.e. only the stretch and not the rotational part of the applied
deformation gradient results in stress.
8.3 Comparison with FEM solutions
The close integration of the spectral method into the existing framework for CPFEM allows it to
compute the behavior of the same VE using the spectral method and the “de facto standard”
FEM. A comparison between the solution achieved by the commercial FEM solver MSC.Marc
2010 and the solution computed by the spectral method is conducted to see how the results differ
between the FEM and the spectral method. The period of time needed for the calculations is used
to estimate the performance of the spectral method compared to the FEM. Two load cases are
used for the comparison, applying plane strain (section 8.3.1) and uniaxial stress (section 8.3.2).
1The given values are truncated at seven decimal places. For the simulation, the applied values are three times
more accurate.
54
The VE used for both simulations is a polycrystal consisting of 100 grains. It is discretized
by 32 FPs in each direction. The geometry file describing the VE used for the spectral method
is converted to a file format readable by the FEM-based solver. The hexaheral element that is
pretended by the spectral method is also used for the solution by means of the FEM. It is a linear
element with reduced integration capacity. The material model used is the phenomenological
powerlaw (chapter 3.4.2) with parameters set to the values known for an exemplary aluminum
alloy.
8.3.1 Plane strain
The load case used for the plane strain test consists of the stress BC P22 = 0 and a velocity
gradient with L33 =−0.001 s−1. All remaining components of Lare set to zero. The load case is
schematically shown in the legend of fig. 8.7 with a vertical bar denoting no strain in the respective
direction. It description file is given in the third line of listing B.2.
The resulting von Mises equivalent of the Cauchy stress at a strain of εlog,33 =−0.06 (step
62) and εlog,33 =−0.21 (step 208) is given in fig. 8.7. It can be seen that the solutions achieved
by both solvers show good correlation. Two small differences are obvious: the stress computed
by the spectral method is lower in general and its spatial distribution is more inhomogeneous.
Unfortunately, the available postprocessing facilities are likely to amplify the effects. The black
lines denoting the borders of the elements contribute to the darker appearance of the stress field
computed by the FEM solver2. The postprocessing tool of MSC.Marc uses 30 discrete values
for the coloration while gmsh uses a continuous map. This slightly contributes to the more
inhomogeneous appearance of the stress field calculated by means of the spectral method.
The period of time needed for the spectral method to compute the deformation at maximum
strain is approximately 4 h. The period of the simulation is heavily determined by the calculation
of the constitutive law. The FFT and the multiplication in Fourier space, i.e. the actual spectral
method, take only a fraction of the whole runtime. The solution by means of the FEM takes about
6 d. Thus, the spectral method has shown a much better performance compared to the FEM.
Carrying out the simulation with the abort criterion atol = 10−5instead of the standard value
atol = 10−4does not lead to significantly different results. Instead of needing an average of 2-3
iterations for each step, approximately 25 iterations are needed to achieve the higher accuracy.
This results in a time period for calculations that is about ten times higher than for the usual
tolerance.
Applying the load case works only up to a strain of approximately εlog,33 =−0.30. It turns out
that the convergence at high deformation states is not ensured. Until now it was not possible to
undoubtedly identify the reason for this behavior. As the maximum strain at which the solution
converges depend on the parameters of the selected VE, i.e. the phase contrast, this problem
might be related to the fact that the spectral method does not converge for high phase contrasts.
Two possible solutions to overcome this problem are outlined in chapter 9.
2This effect can be seen clearly if the digital version of this thesis is viewed at a small scale.
55
(a) mpie spectral,εlog,33 =−0.06 (b) mpie spectral,εlog,33 =−0.21
(c) MSC.Marc,εlog,33 =−0.06 (d) MSC.Marc,εlog,33 =−0.21
min max
•
_
RL
_
•
_
RL
_
•>
>
>
>
_
RL
_
•>
>
>
>
_
RL
_
◦ •
•>
>
•>
>
>
>
Figure 8.7: Stress field σvM resulting from plane strain
56
8.3.2 Uniaxial tension
The second simulation that is compared to an FEM solution is a “tensile test”. Because the
implementation presented here is not able to handle arbitrary phase contrasts, it is not possible to
model a layer of “air” (i.e. a material with E= 0) around the sample. Thus, necking phenomena
that occur in real tensile tests cannot be examined.
The load case is similar to the one used for the comparison between mpie spectral and evp5j.
The VE deforms at a strain rate of ˙ε33 = 0.001 s−1. The load case is given in the last line of
listing B.2.
As for the plane strain load case, the resulting von Mises equivalent of the Cauchy stress
is used for comparison. In fig. 8.8 the stress field is shown a strain of εlog,33 = 0.06 (step 62)
and εlog,33 = 0.21 (step 208). From fig. 8.8 the same conclusions can be drawn as from fig. 8.8:
the results show good correlation, but the stress computed by the spectral method in general is
slightly lower and its spatial distribution is more inhomogeneous.
The performance of the spectral method is again between one and two orders of magnitude
better compared to FEM.
Again, convergence is not ensured if the deformation reaches a strain larger then εij ≈0.30.
To check whether the discretization has an influence on the convergence, a VE consisting of 100
grains but discretized by 64 FPs in each direction is simulated. With this VE, the convergence is
still not ensured at large strains.
57
(a) mpie spectral,εlog,33 = 0.06 (b) mpie spectral,εlog,33 = 0.21
(c) MSC.Marc,εlog,33 = 0.06 (d) MSC.Marc,εlog,33 = 0.21
min max
•
RL
_
_
•
RL
_
_
•
RL
_
_
•
RL
_
_
◦ •
• •
Figure 8.8: Stress field σvM resulting from uniaxial tension
58
9 Conclusions and outlook
This thesis discusses the implementation of a spectral method as an alternative solver into an
existing framework for crystal plasticity. The framework in combination with the spectral method
is used to examine the mechanical properties of materials by calculating the response of an RVE.
The spectral method implemented has been proven to be a very suitable tool for the solution
of elastoviscoplastic boundary value problems with periodic boundary conditions describing an
RVE. The results achieved compare favorably with the solutions obtained by FEM, while the
performance of the spectral method is much better compared to commercial FEM-based solvers.
For the presented simulations, the spectral method is between one and two orders of magnitude
faster than the FEM-based solver used for comparison. Thus, the spectral method is an excellent
alternative for the examination of RVEs.
To further validate the implementation, more simulations should be carried out. For the com-
parison with FEM solutions more sophisticated postprocessing tools should be implemented to
compare the various results obtained by the material subroutines in detail. Since there are de-
viations compared to solutions achieved by the FEM, not only comparisons to FEM simulations
should be conducted. It would be also important to compare the resulting stress and strain fields
to experimental data. Reading in data obtained by experiments is easy due to the simple data
format used for the geometry description. However, so far it is not possible to use data from
a pre-stressed state since the initial configuration is always stress free. An extended interface
could be implemented to read in information about the stress state on each point to continue
calculations from a pre-stressed configuration.
As outlined in chapter 8, convergence is not achieved for highly deformed configurations. The
reason for this behavior is not identified. It is possible that it is related to the fact that the
spectral method converges slowly for materials with high phase contrasts and does not converge
at all for an infinite phase contrast. Two techniques are suggested to ensure the convergence for
materials with infinite contrasted phases and speed up the rate of convergence in general. The
two methods take totally different approaches. The first approach is the augmented Lagrange
method proposed by J. C. Michel,H. Moulinec and P. Suquet in 2001. The second
improvement is based on the use of a modified Γ-operator. It is proposed by S. Brisard and L.
Dormieux in 2010. It is also possible to implement both methods at the same time, probably
resulting in an even faster convergence.
The augmented Lagrange method is described in [17, 20]. It uses a modified algorithm
consisting of three steps to solve a saddle-point problem describing the mechanical state of the
VE. The first step consists in solving a linear elastic problem, using a similar method to the one
presented in this thesis. An additional second step is required to solve a non-linear problem at each
59
point in the VE. In the third step the Lagrange multiplier that is used to solve the non-linear
problem is updated.
Although their aim is the same, i.e. speeding up the calculation and ensure convergence at infinite
phase contrasts, S. Brisard and L. Dormieux take a different approach [5]. An optimized
Γ–operator is used in an algorithm as simple as the scheme presented in this work. It is derived
from an energy principle, not from the Lippmann–Schwinger equation that is the basis for the
algorithm presented in chapter 6.2.
Both methods are likely to speed up the calculations, even if the Lagrange method takes
longer for one iteration. But as fewer iterations are needed for convergence, the total runtime will
decrease.
60
A Sourcecode
Listing A.1: mpie spectral.f90
0! I d : m p i e sp e c t r a l . f 90 68 3 2 010−10−27 1 7 : 1 5 : 4 9 Z MPIE\m. d i e h l
!
! M a t e r i a l s u b r o u t i n e f o r BVP s o l u t i o n u s i n g s p e c t r a l me th od
!
! w r i t t e n by P. E i s e n l o h r ,
! F . R o te r s ,
! L . H a n t c h e r l i ,
! W.A . C o u nt s
! D . D . T j a h j a n t o
! C. K or d s
10 ! M. D i e h l
! R. Lebensohn
!
! MPI f u e r E i s e n f o r s c h u n g , D u e s s e l d o r f
!
!
! Usa ge :
!−s t a r t p ro gr am w it h m p i e s p e c t r a l P at hT oG eo m Fi le /N ameOfGeom . g eom
! Pa t h T o L oa d F i l e / N am e Of L o ad F il e . l o a d
!−Pa t hT o Lo a dF i le w i l l b e t he w or k in g d i r e c t o r y
20 !−make s u re t h e f i l e ” m a t e r i a l . c o n f i g ” e x i s t s i n t h e w o r ki n g
! directory
!
program m p i e spectral
!
us e mpie interface
us e pr e c , o n l y : p I n t , p R e a l
us e IO
us e mat h
30 us e CPFEM, o n l y : C PFE M ge ner al
us e numerics , o n l y : e r r d i v t o l , e r r d e f g r ad t o l , e r r s t r e s s t o l r e l , it ma x
us e ho m og en iz a ti on , o n l y : m a t e r i a l p o i n t s i z e R e s u l t s , m a t e r i a l p o i n t r e s u l t s
i m p l i c i t n one
i n c l u d e ’ f f t w 3 . f ’ ! h ea d er f i l e f o r f f t w3 ( d e c l a r i n g v a r i a b l e s ) . L i b r a r y f i l e i s a l so n ee d ed
! v a r i a b l e s t o re a d fr o m l o a d c a s e a nd geo m f i l e
r e a l ( p Re a l ) , dimension ( 9 ) : : v a l u e v e c t o r ! s t o r e s i n f o r m a t i o n f ro m l o a d c a s e f i l e
integer( p I n t ) , parameter : : maxNchunksInput=24 ! 4 i d e n t i f i e r s , 2 3 x3 m a tr i ce s , an d 2 s c a l a r s
40 integer( p I n t ) , dimension ( 1+ m ax N ch u nk s I np u t 2 ) : : p o s I n p u t
integer( p I n t ) , parameter : : maxNchunksGeom = 7 ! 4 i d e n t i f i e r s , 3 v a l u es
integer( p I n t ) , dimension ( 1+2 maxN chunk sGeo m ) : : po sGeo m
integer( p I n t ) unit , N l , N s , N t , N n ! n umb er s o f i d e n t i f i e r s
character(len =10 24) p at h , l i n e
logical g o t R e s o l u t i o n , g ot D i me n s io n , g o tH o m o g e ni z a t i on
logical ,dimension (9) : : bc maskvector
! v a r i a b l e s s t o r i n g i n f o r m a t i o n f r om l o a d c a s e f i l e
r e a l ( pR e a l ) ti m e i n c
50 r e a l ( p Re a l ) , dimension ( : ,: ,: ) , allocatable : : bc velocityGrad , &
b c s t r e s s ! v e l o c i t y g r ad i e n t a nd s t r e s s BC
r e a l ( p Re a l ) , dimension ( : ) , allocatable :: bc timeIncrement ! l e n g t h o f i n c r e m e n t
integer( p I n t ) N Lo a d ca s es , s t e p s
integer( p I n t ) , dimension ( : ) , allocatable : : b c s t e p s ! nu mb er o f s t e p s
logical ,dimension ( : , : , : , : ) , allocatable : : b c m as k ! mask of b ou n da r y c o n d i t i o n s
! v a r i a b l e s s t o r i n g i n f o r m a t i o n f r om geo m f i l e
r e a l ( p Re a l ) w gt
r e a l ( p Re a l ) , dimension ( 3 ) : : g e o md i m e ns i o n
60 integer( p I n t ) homo g , p ro d nn
integer( p I n t ) , dimension ( 3 ) : : r e s o l u t i o n
61
! s t r e s s e t c .
r e a l ( p Re a l ) , dimension ( 3 , 3 ) : : on e s , z e r o e s , t e mp 3 3 Re a l , da mp er , &
p s t r e s s , p s t r e s s a v , c s t r e s s a v , d e f gr a d a v ,&
de fg ra dAi m , de fgr ad Ai mO ld , d ef gra dA imC or r ,&
de f g r a d A i m C o r r P re v , m a s k s t r e s s , m a s k d e f g r a d
r e a l ( p Re a l ) , dimension ( 3 , 3 , 3 ) : : te mp 3 3 3 R ea l
r e a l ( p Re a l ) , dimension ( 3 , 3 , 3 , 3 ) : : dPdF , c0 , s0
70 r e a l ( p Re a l ) , dimension ( 6 ) : : c s t r e s s ! c a uc h y s t r e s s i n M an de l n o t a t i o n
r e a l ( p Re a l ) , dimension ( 6 , 6 ) : : ds de , c 06 6 , s 0 6 6
r e a l ( p Re a l ) , dimension ( : ,: ,: ) , allocatable : : d d e f g r a d
r e a l ( p Re a l ) , dimension ( : , : , : , : , : ) , allocatable : : p s t r e s s f i e l d , d e fg r a d , d e f g r a d o l d , c s t r e s s f i e l d
! v a r i a b l e s s t o r i n g i n f o r m a t i o n f o r s p e c t r a l me th od
complex( p Re a l ) , dimension ( : ,: , : , : , : ) , allocatable : : wo r k f f t
complex( p Re a l ) , dimension ( 3 , 3 ) : : te m p3 3 Co m pl e x
r e a l ( p Re a l ) , dimension ( 3 , 3 ) : : xi n o r md y a d
r e a l ( p Re a l ) , dimension ( : , : , : , : , : , : , :) , allocatable : : g amm a h at
80 r e a l ( p Re a l ) , dimension ( : , : , : , : ) , allocatable : : x i
integer( p I n t ) , dimension ( 3 ) : : k s
integer 8 , dimension ( 2 ,3 , 3 ) : : p l a n f f t
! c o n v e r g e n c e e t c .
r e a l ( pR e a l ) e r r d i v , e r r s t r e s s , e r r de f g r a d , e r r d i v te m p , e r r s t r e s s t o l , s ig m a0
integer( p I n t ) i e r r
logical errmatinv
! l o o p v a r i a b l e s e tc .
90 r e a l ( p Re a l ) gu ess mo de ! flip−f l o p to g u es s d ef g r ad f l u c t u a t i o n f i e l d e v o l u t i o n
integer( p I n t ) i , j , k , l , m, n , p
integer( p I n t ) lo a d c a s e , i e le m , i t e r , c a lc m o de , CPFE M mode
r e a l ( pR e a l ) t e m p e r a t u r e ! no t u sed , b ut ne ed ed f o r c a l l t o CP FE M gen er al
! Initializing
bc maskvector = ’ ’
u n i t = 2 34 p I n t
100 o n e s = 1. 0 p R e a l ; z e r o e s = 0 . 0 p R e a l
N l = 0 p I n t ; N s = 0 p I n t
N t = 0 pI n t ; N n = 0 p I n t
r e s o l u t i o n = 1 p I n t ; g e om di me n si on = 0. 0 p R ea l
t e m p e r a t u r e = 3 0 0 . 0 p R e a l
g o t R e s o l u t i o n =. f a l s e . ; g ot D i me n s io n = . f a l s e . ; g ot H o mo g e n iz a t i on = . f a l s e .
110
i f ( I a r g C ( ) /= 2 ) call I O e r r o r (1 0 2 ) ! c he c k f o r c o r r e c t nu mb er o f g i ve n a rg u me nt s
! R e ad in g t h e l o a dc a s e f i l e a nd a s s i g n v a r i a b l e s
path = getLoadcaseName()
print ,’ Lo ad c as e : ’ , t r i m ( p a t h )
print ,’Workingdir : ’ , t r i m ( g e t S o l v e r W o r k i n g D i r e c t o r y N a m e ( ) )
i f ( . n ot . I O o p e n f i l e ( unit , p at h ) ) call I O er r o r ( 4 5 , e x t ms g = pa th )
120 rewind(u n i t )
do
read(unit ,’ ( a 10 24 ) ’ ,END = 10 1) l i n e
i f ( I O is B l a n k ( l i n e ) ) cycle ! s k i p em pty l i n e s
p o sI n p u t = I O s t r i n g P o s ( l i n e , m a xN c hu nk s In p ut )
do i = 1 , maxNchunksInput , 1
s e l e c t c a s e ( I O l c ( I O s t r i n g V a l u e ( l i n e , p o s In p u t , i ) ) )
ca s e (’ l ’ ,’ velocitygrad ’)
N l = N l +1
ca s e (’ s ’ ,’ s t r e s s ’)
130 N s = N s +1
ca s e (’ t ’ ,’ t im e ’ ,’ d e l t a ’ )
N t = N t+1
ca s e (’n ’ ,’ i n c s ’ ,’ i n c r e m e n t s ’ ,’ s t e p s ’ )
N n = N n+1
end select
enddo ! c ou nt a l l i d e n t i f i e r s t o a l l o ca t e me mory an d d o s an i t y c he ck
i f ( ( N l /= N s ) . o r . ( N s /= N t ) . o r . ( N t /= N n)) & ! s a n i t y c he c k
call I O e r r o r ( 4 6 , e x t ms g = pa th ) ! e r r o r m e ss a ge f o r i n c o m p l e t e i n p u t f i l e
enddo
140
10 1 N Lo ad c as es = N l
62
! a l l o c a t e m emory d e pe n di n g on l i n e s i n i n p u t f i l e
allocate ( b c v e l o c i t y G r a d ( 3 , 3 , N Lo a d ca s es ) ) ; b c v e l o c i t y G r a d = 0. 0 p R e al
allocate ( b c s t r e s s ( 3 , 3 , N L oa d ca se s ) ) ; b c s t r e s s = 0. 0 p Re a l
allocate ( b c ma s k ( 3 , 3 , 2 , N L o a dc a s e s ) ) ; bc m as k = . f a l s e .
allocate ( b c ti m e I n c r e m e n t ( N L o a d c as e s ) ) ; b c t i m e I n c r e m e n t = 0 . 0 pR e a l
allocate ( b c s t e p s ( N L o a dc a s es ) ) ; bc s t e p s = 0 p I n t
150 rewind(u n i t )
i = 0 p I n t
do
read(unit ,’ ( a 10 24 ) ’ ,END = 20 0) l i n e
i f ( I O is B l a n k ( l i n e ) ) cycle ! s k i p em pty l i n e s
i=i+1
p o sI n p u t = I O s t r i n g P o s ( l i n e , m a xN c hu nk s In p ut )
do j = 1 , maxNchunksInput , 2
s e l e c t c a s e ( I O l c ( I O s t r i n g V a l u e ( l i n e , p o s In p u t , j ) ) )
ca s e (’ l ’ ,’ velocitygrad ’)
160 va l u e v e c t o r = 0 . 0 pR e a l
f o r a l l ( k = 1: 9 ) b c m a s k v e c t o r ( k ) = I O s t r i n g V a l u e ( l i n e , p o s I n p u t , j +k ) /= ’#’
do k = 1 , 9 ! a s si g n v a l u es f o r t h e v e l o c i t y g r ad i e n t m at r ix
i f ( b c m a s k v e c t o r ( k ) ) v a l u e v e c t o r ( k ) = I O f l o a t V a l u e ( l i n e , p o s I n p u t , j +k )
enddo
bc m a sk ( : , : , 1 , i ) = r e s h a p e ( b c ma s k v e c t o r , ( / 3 , 3 / ) )
b c v e l o c i t y G r a d ( : ,: , i ) = re s h a p e ( v a l u e v e c t o r , ( / 3 , 3 / ) )
ca s e (’ s ’ ,’ s t r e s s ’)
v a l u e v e c t o r = 0. 0 p R e al
f o r a l l ( k = 1: 9 ) b c m a s k v e c t o r ( k ) = I O s t r i n g V a l u e ( l i n e , p o s I n p u t , j +k ) /= ’#’
170 do k = 1 , 9 ! a s s i g n v a l u e s f o r t h e b c s t r e s s m a t r i x
i f ( b c m a s k v e c t o r ( k ) ) v a l u e v e c t o r ( k ) = I O f l o a t V a l u e ( l i n e , p o s I n p u t , j +k )
enddo
bc m a sk ( : , : , 2 , i ) = r e s h a p e ( b c ma s k v e c t o r , ( / 3 , 3 / ) )
b c s t r e s s ( : ,: , i ) = re s h a p e ( v a l u e v e c t o r , ( / 3 , 3 / ) )
ca s e (’ t ’ ,’ t im e ’ ,’ d e l t a ’ )! increment time
b c t i m e I n c r e m e n t ( i ) = I O f l o a t V a l u e ( l i n e , p o s I n p u t , j + 1)
ca s e (’n ’ ,’ i n c s ’ ,’ i n c r e m e n t s ’ ,’ s t e p s ’ )! b c s t e p s
b c s t e p s ( i ) = IO i n t V a l u e ( l i n e , p o s I n pu t , j + 1)
end select
180 enddo ;enddo
20 0 close(u n i t )
do i = 1 , N L oa dc a se s
i f ( a ny ( b c ma sk ( : , : , 1 , i ) == bc m as k ( : , : , 2 , i ) ) ) call I O e r r o r ( 4 7 , i ) ! b c ma sk c o n s i s t e n c y
print ’ ( a , / , 3 ( 3 ( f1 2 . 6 , x ) / ) ) ’ ,’ L ’ , b c v e l o c i t y G r a d ( : , : , i )
print ’ ( a , / , 3 ( 3 ( f1 2 . 6 , x ) / ) ) ’ ,’ b c s t r e s s ’ , b c s t r e s s ( : ,: , i )
print ’ ( a , / , 3 ( 3 ( l , x ) / ) ) ’ ,’ b c ma sk f o r v e l o c i t y g r a d ’ , b c ma sk ( : , : , 1 , i )
print ’ ( a , / , 3 ( 3 ( l , x ) / ) ) ’ ,’ b c ma sk f o r s t r e s s ’ , b c ma sk ( : , : , 2 , i )
print ,’ ti m e ’ , bc timeIncrement( i )
190 print ,’ i n c s ’ , b c s t e p s ( i )
print ,’ ’
enddo
! r e a d h e a d e r o f geo m f i l e t o g e t t h e i n f o r m a t i o n n e ed e d b e f o r e t h e c o m pl e t e geom f i l e i s i n t e p r e t a t e d by me sh . f 9 0
path = getSolverJobName ( )
print ,’JobName : ’ , t r i m ( p a th )
i f ( . n ot . I O o p e n f i l e ( unit , t r i m ( p a th ) / / I n p u t F i l e E x t e n s i o n ) ) call I O e r r o r ( 1 0 1 , e x t m sg = pa t h )
rewind(u n i t )
200 do
read(unit ,’ ( a 10 24 ) ’ ,END = 10 0) l i n e
i f ( I O is B l a n k ( l i n e ) ) cycle ! s k i p em pty l i n e s
pos Geo m = I O st r i n g P o s ( l i n e , ma xNch unk sGe om )
s e l e c t c a s e ( I O l c ( I O S t r i n g V a l u e ( l i n e , pos Geo m , 1 ) ) )
ca s e (’dimension ’ )
go t D i me n s io n = . t r u e .
do i = 2 , 6 , 2
s e l e c t c a s e ( I O l c ( I O s t r i n g V a l u e ( l i n e , po sGe om , i ) ) )
210 ca s e (’x ’ )
ge o md i me n si on ( 1) = I O f l o a t V a l u e ( l i n e , pos Geom , i +1 )
ca s e (’y ’ )
ge o md i me n si on ( 2) = I O f l o a t V a l u e ( l i n e , pos Geom , i +1 )
ca s e (’z ’ )
ge o md i me n si on ( 3) = I O f l o a t V a l u e ( l i n e , pos Geom , i +1 )
end select
enddo
ca s e (’homogenization ’ )
go t H o m o g e n i z a t i o n = . t r u e .
220 homog = I O i n t V a l u e ( l i n e , po sGeo m , 2 )
ca s e (’ r e s o l u t i o n ’ )
g o t R e s o l u t i o n = . t r u e .
do i = 2 , 6 , 2
63
s e l e c t c a s e ( I O l c ( I O s t r i n g V a l u e ( l i n e , po sGe om , i ) ) )
ca s e (’a ’ )
r e s o l u t i o n ( 1 ) = I O i n t V a l u e ( l i n e , po sGe om , i + 1)
ca s e (’b ’ )
r e s o l u t i o n ( 2 ) = I O i n t V a l u e ( l i n e , po sGe om , i + 1)
ca s e (’c ’ )
230 r e s o l u t i o n ( 3 ) = I O i n t V a l u e ( l i n e , po sGe om , i +1 )
end select
enddo
end select
i f ( g o t Di m e ns i o n . an d . g o tH o m o ge n i z at i o n . an d . g o t R e s o l u t i o n ) e x i t
enddo
10 0 close(u n i t )
print ’ ( a , / , i 4 , i 4 , i 4 ) ’ ,’ r e s o l u t i o n a b c ’ , resolution
print ’ (a , / , f6 . 1 , f6 . 1 , f6 . 1 ) ’ ,’ dimension x y z ’ , geomdimension
240 print ,’homogenization ’ , h omog
allocate ( w o r k f ft ( r e s o l u t i o n ( 1) /2 +1 , r e s o l u t i o n ( 2) , r e s o l u t i o n ( 3 ) , 3 , 3 ) ) ; wo r k f f t = 0 . 0 pR e a l
allocate ( ga mma hat ( r e s o l u t i o n ( 1 )/ 2+ 1 , r e s o l u t i o n ( 2 ) , r e s o l u t i o n ( 3 ) , 3 , 3 , 3 , 3 )) ; g amm a hat = 0 . 0 p Re a l
allocate ( x i ( r e s o l u t i o n ( 1) /2 +1 , r e s o l u t i o n ( 2) , r e s o l u t i o n ( 3 ) , 3 ) ) ; x i = 0 . 0 pR e a l
allocate ( p s t r e s s f i e l d ( r e s o l u t i o n ( 1) , r e s o l u t i o n ( 2) , r e s o l u t i o n ( 3 ) , 3 , 3 ) ) ; p s t r e s s f i e l d = 0 .0 p R e al
allocate ( c s t r e s s f i e l d ( r e s o l u t i o n ( 1) , r e s o l u t i o n ( 2) , r e s o l u t i o n ( 3 ) , 3 , 3 ) ) ; c s t r e s s f i e l d = 0 .0 p R e al
allocate ( d e f gr a d ( r e s o l u t i o n ( 1) , r e s o l u t i o n ( 2) , r e s o l u t i o n ( 3 ) , 3 , 3 ) ) ; d e fg r a d = 0 . 0 pR e a l
allocate ( d e f g ra d o l d ( r e s o l u t i o n ( 1) , r e s o l u t i o n ( 2) , r e s o l u t i o n ( 3 ) , 3 , 3 ) ) ; d e f gr a d o l d = 0 . 0 pR e a l
allocate ( d d ef g r ad ( r e s o l u t i o n ( 1 ) , r e s o l u t i o n ( 2 ) , r e s o l u t i o n ( 3 ) ) ) ; d d ef g ra d = 0. 0 p R ea l
250 allocate ( d i s p l a c e m e n t ( r e s o l u t i o n ( 1 ) , r e s o l u t i o n ( 2 ) , r e s o l u t i o n ( 3 ) , 3 ) ) ; d i s p l a c e m e n t = 0 . 0 p R e a l
! I n i t i a l i z a t i o n o f f ft w ( s ee m an ual o n ff t w . o r g f o r mor e d e t a i ls )
call d f f t w i n i t t h r e a d s ( i e r r )
call d f f t w p l a n w i t h nt h r e a d s ( 1 2) ! f o r ma c hi n e w i th 12 c o r e s
do m = 1 , 3 ; do n = 1 , 3
call d f f t w p l a n d f t r2 c 3 d ( p l a n f f t ( 1 , m, n ) , r e s o l u t i o n ( 1 ) , r e s o l u t i o n ( 2 ) , r e s o l u t i o n (3 ) , &
p s t r e s s f i e l d ( : , : ,: ,m, n ) , w o r kf f t ( : ,: , : , m, n ) , FFTW PATIENT)
call d f f t w p l a n d f t c2 r 3 d ( p l a n f f t ( 2 , m, n ) , r e s o l u t i o n ( 1 ) , r e s o l u t i o n ( 2 ) , r e s o l u t i o n (3 ) , &
260 w o r k f f t ( : ,: ,: ,m, n ) , d d e f g r a d ( : , : , : ) , FFTW PATIENT)
enddo ;enddo
pr o dn n = r e s o l u t i o n ( 1) r e s o l u t i o n (2 ) r e s o l u t i o n ( 3 )
wg t = 1 p R e a l / r e a l ( pr od nn , p Re al )
de f gr ad Ai m = m at h I3
defgradAimOld = math I3
d e f g r a d a v = m at h I 3
! I n i t i a l i z a t i o n o f C PF EM ge ne ral (= c o n s t i t u t i v e l aw ) an d o f d e fo r ma t i on g r a d i en t f i e l d
270 i e l e m = 0 p I n t
c0 6 6 = 0 . 0 p R e a l
do k = 1 , r e s o l u t i o n ( 3 ) ; do j = 1 , r e s o l u t i o n ( 2 ) ; d o i = 1 , r e s o l u t i o n ( 1 )
d e f g r a d o l d ( i , j , k , : , : ) = m a t h I3 ! n o d e f o r m a t i o n a t t h e b e g i n n i n g
d e f g r a d ( i , j , k , : , : ) = m a t h I 3
i e l e m = ie l e m +1
call CP F EM g en e ra l ( 2 , m a t h I 3 , m a t h I 3 , t e m p e r a t u r e ,0 . 0 p R e a l , i e l e m , 1 p I n t , c s t r e s s , d s de , p s t r e s s , dP dF )
c0 66 = c 06 6 + ds de
enddo ;enddo ;enddo
c0 66 = c 06 6 wgt
280 c 0 = ma th m an de l6 6 to 33 33 ( c 06 6 )
call m a t h i n v e r t ( 6 , c0 66 , s0 6 6 , i , e r r m a t i n v )
s0 = ma th m an de l6 6t o3 33 3 ( s0 66 )
! c a l c u l a t i o n o f x in or m dy a d ( t o c a l c u l a t e ga mma ha t ) an d x i ( w ave s , f o r p r oo f o f e q u i l i b r i u m )
do k = 1 , r e s o l u t i o n ( 3 )
k s ( 3 ) = k−1
i f ( k >r e s o l u t i o n ( 3) /2 +1 ) k s ( 3 ) = k s (3) −r e s o l u t i o n ( 3 )
do j = 1 , r e s o l u t i o n ( 2)
k s ( 2 ) = j −1
290 i f ( j >r e s o l u t i o n ( 2) /2 +1 ) k s ( 2) = k s (2)−r e s o l u t i o n ( 2 )
do i = 1 , r e s o l u t i o n ( 1) /2 +1
k s ( 1 ) = i−1
x i ( i , j , k , 3 ) = 0 . 0 p R e a l
i f ( r e s o l u t i o n ( 3) >1 ) x i ( i , j , k , 3 ) = r e a l ( k s (3 ) , p Re al )/ ge om di me ns io n (3 )
x i ( i , j , k , 2 ) = re a l ( k s ( 2) , p Re al )/ g eo md im en si on (2 )
x i ( i , j , k , 1 ) = re a l ( k s ( 1) , p Re al )/ g eo md im en si on (1 )
i f ( a n y ( x i ( i , j ,k , : ) /= 0 . 0 p R e a l ) ) th en
do l = 1 , 3 ; do m = 1 ,3
xi no rm dy ad ( l , m) = x i ( i , j , k , l ) x i ( i , j , k , m)/ sum ( x i ( i , j , k , : ) 2)
300 enddo ;enddo
else
xi n o r m dy a d = 0. 0 p R e a l
e n d i f
te m p3 3 R ea l = m a th m ul 33 33 xx 3 3 ( c0 , x i no r md y ad )
64
te m p 3 3 R e a l = ma t h i n v 3 x 3 ( t e m p 3 3 R e a l )
do l =1 , 3; do m= 1 ,3 ; do n = 1 , 3; d o p=1 ,3
ga mma hat ( i , j , k , l , m, n , p ) = −(0 . 5 t e m p3 3 R e a l ( l , n ) +0 . 5 t e m p 33 Re a l ( n , l ) ) &
( 0 . 5 x in o r m d ya d ( m, p ) + 0. 5 xi n o r md y a d ( p , m) )
enddo ;enddo ;enddo ;enddo
310 enddo ;enddo ;enddo
! w r i t e h e a d e r o f o u t p u t f i l e
op en ( 5 3 8 , f i l e =’ r e s u l t s . o ut ’ ,form=’UNFORMATTED’ )
path = getLoadcaseName()
write ( 5 3 8 ) , ’ Loadcase ’ , t r i m ( p a t h )
write ( 5 3 8 ) , ’ W o r k i n g d i r ’ , t r i m ( g e t S o l v e r W o r k i n g D i r e c t o r y N a m e ( ) )
path = getSolverJobName ( )
write ( 5 3 8 ) , ’ JobName ’ , t r i m ( p a th ) / / I n p u t F i l e E x t e n s i o n
write ( 5 3 8 ) , ’ r e s o l u t i o n ’ ,’ a ’ , r e s o l u t i o n ( 1 ) , ’b ’ , r e s o l u t i o n ( 2 ) , ’ c ’ , r e s o l u t i o n (3 )
320 write ( 5 3 8 ) , ’ geomdimension ’ ,’ x ’ , ge o m di m en s i on ( 1 ) , ’ y ’ , g e om d im e n si o n ( 2 ) , ’ z ’ , geomdimension(3 )
write ( 5 3 8 ) , ’ materialpoint sizeResults ’ , materialpoint sizeResults
write ( 5 3 8 ) , ’ t o t a l i n c s ’ , sum ( b c s t e p s )
write (538) materialpoint results (: ,1 ,:)
! I n i t i a l i z a t i o n d one
!
! L oop o v er l o a d c a s e s d e f i n e d i n t h e l o a d c a s e f i l e
do l o a d c a s e = 1 , N Lo a dc a s es
!
330
t i m e i n c = bc ti m e I n c r e m e n t ( l o a d c a s e ) / b c s t e p s ( l o a d c a s e )
gu e ss m o de = 0. 0 p R e a l ! c h a ng e o f l o a d c a s e , h o mo g en e ou s g u e s s f o r t h e f i r s t s t e p
m a s k d e f g r a d = me rg e ( o ne s , z e r o e s , b c ma s k ( : , : , 1 , l o a d c a s e ) )
m a s k s t r e s s = me rg e ( o n es , z e r o es , b c ma sk ( : , : , 2 , l o a d c a s e ) )
da mpe r = o ne s /1 0
!
! l o o p o pe r s t e p s d e f i n e d i n i n p u t f i l e f o r c u r r e n t l o a d c a s e
do s t e p s = 1 , b c st e p s ( l o a d c a s e )
!
340 te m p3 3 Rea l = d ef gr ad Ai m
de f gr ad Ai m = de fg ra d Ai m & ! u p d a t e m a c r o s c o p i c d i s p l a c e m e n t g r a d i e n t ( d e f g r a d BC)
+ g ue ss m od e m a s k s t r e s s ( d e fg r a dA i m −defgradAimOld) &
+ m at h mu l3 3x 33 ( b c ve l o c i t y G r a d ( : ,: , l o a d c a s e ) , d e fg r a dA i m ) t i m e i n c
de f gr ad Ai mO ld = te mp 3 3 Re al
do k = 1 , r e s o l u t i o n ( 3 ) ; do j = 1 , r e s o l u t i o n ( 2 ) ; d o i = 1 , r e s o l u t i o n ( 1 )
te m p 3 3 Re a l = d e f g r a d ( i , j , k , : , : )
d e f g r a d ( i , j , k , : , : ) = d e f g r a d ( i , j , k , : , : ) & ! o l d f l u c t u a t i o n s a s g u es s f o r new s te p
+ g ue s sm o de ( d e f g r a d ( i , j , k , : , : ) −d e f g r a d o l d ( i , j , k , : , : ) ) & ! no f l u c t u a t i o n s f o r ne w lo a d c a se
350 + ( 1 . 0 p R ea l −gu es sm od e ) ma t h mul 3 3x 33 ( b c v e l o c i t y G r a d ( : ,: , l o a d c a s e ) , d e f g r a d o l d ( i , j , k , : , : ) ) t i m ei n c
d e f g r a d o l d ( i , j , k , : , : ) = t e mp 3 3 R ea l
enddo ;enddo ;enddo
gu e ss m o de = 1. 0 p R e a l ! ke e p g u e s s i n g a l o ng f o r m er t r a j e c t o r y d u r in g sa me l o a d c a s e
ca l cm o de = 0 p I n t ! s t a r t c a l c u l a t i o n o f BC f u l f i l l m e n t
CPFEM mode = 1 p I n t ! w i n d i n g f o r w a r d
i t e r = 0 p I n t
e r r d iv = 2 p R ea l e r r d i v t o l ! go i n t o l o o p
d ef g r a d A i m C o r r = 0 . 0 p R e a l ! r e s e t d am pi ng c a l c u l a t i o n
360 dam pe r = d am pe r 0. 9 p R e a l
!
! convergence loop
do w h i l e ( i t e r <= i tm ax . a nd . &
(err div >e r r d i v t o l . o r . &
err stress >e r r s t r e s s t o l . o r . &
err defgrad >err defgrad tol))
i t e r = i t e r + 1
print ’ ( 3 ( A , I 5 . 5 , t r 2 ) ) ’ ,’ Loadcase = ’ , l o a d c a s e , ’ S te p = ’ , s t e p s , ’ I t e r a t i o n = ’ , i t e r
370 !
! a dj us t d ef g ra d t o f u l f i l l BCs
s e l e c t c a s e ( c al cmo de )
ca s e (0 )
print ,’ Up da te S t r e ss F i e ld ( c o n s t i t u t i v e e v a l u a ti o n P (F ) ) ’
i e l e m = 0 p I n t
do k = 1 , r e s o l u t i o n ( 3 ) ; do j = 1 , r e s o l u t i o n ( 2 ) ; d o i = 1 , r e s o l u t i o n ( 1 )
i e l e m = ie l e m + 1
call CP FE M ge ne ra l ( 3 , d e f g r a d o l d ( i , j , k , : ,: ) , d e f g r a d ( i , j , k , : , : ) , &
380 t e m p e r a t u r e , t i m e i n c , i e l e m , 1 p I n t ,&
c s t r e s s , ds de , p s t r e ss , dPd F)
enddo ;enddo ;enddo
i e l e m = 0 p I n t
do k = 1 , r e s o l u t i o n ( 3 ) ; do j = 1 , r e s o l u t i o n ( 2 ) ; d o i = 1 , r e s o l u t i o n ( 1 )
65
i e l e m = ie l e m + 1 pI n t
call CP FE M gen er al ( CPFEM mode, & ! f i r s t e l e m e n t i n f i r s t i t e r a t i o n r e t a i n s CPFEM mode 1 ,
! o t h e r s g e t 2 ( s a v e s w in d i n g f o r w a r d e f f o r t )
d e f g r a d o l d ( i , j , k , : ,: ) , d e f g r a d ( i , j , k , : , : ) , &
390 t e m p e r a t u r e , t i m e i n c , i e l e m , 1 p I n t ,&
c s t r e s s , ds de , p s t r e ss , dPd F)
CPFEM mode = 2 p I n t
p s t r e s s f i e l d ( i , j , k , : , : ) = p s t r es s
c s t r e s s f i e l d ( i , j , k , : , : ) = ma th m an de l6 to 33 ( c s t r e s s )
enddo ;enddo ;enddo
do m = 1 , 3 ; do n = 1 , 3
p s tr e s s av (m, n ) = sum ( p s t r e s s f i e l d ( : , : ,: ,m, n ) ) w gt
c s t r e s s a v (m , n ) = sum ( c s t r e s s f i e l d ( : ,: , : , m, n ) ) w gt
400 de f g r a d a v ( m, n ) = sum( d e f gr a d ( : ,: ,: ,m, n ) ) wg t
enddo ;enddo
e r r s t r e s s = m a xv a l ( a b s ( m a s k s t r e s s ( p s t r e s s a v −b c s t r e s s ( : ,: , l o a d c a s e ) ) ) )
e r r s t r e s s t o l = ma xv al ( ab s ( p s tr e s s a v ) ) e r r s t r e s s t o l r e l
print ,’ C o r r e c t i n g d e f o r m a t i o n g r a d i e n t t o f u l l f i l l B Cs ’
defgradAimCorrPrev=defgradAimCorr
defgradAimCorr =−m a s k s t r e s s m at h mu l 33 3 3x x 33 ( s 0 , ( m a s k s t r e s s ( p s t r e s s a v −b c s t r e s s ( : , : , l o a d c a s e ) ) ) )
410 do m= 1 ,3 ; do n =1 ,3 ! c a l c u l a t e d am per ( c o r r e c t i o n i s f a r t o s t r on g )
i f ( s i g n ( 1 . 0 p R e a l , d e f g r a d A i m Co r r (m, n ) )/ = s i g n ( 1 . 0 p R e a l , d e f g r a d A i m C o r r P r e v (m , n ) ) ) t he n
da mp er (m , n ) = max ( 0 . 0 1 p R e a l , d am pe r (m , n ) 0 . 8 )
else
da mp er ( m, n ) = min ( 1 . 0 p R ea l , da mp er ( m, n ) 1. 2 )
e n d i f
enddo ;enddo
d ef g r a d A i m C o r r = m a s k St r e s s ( d a mp er d e f g r a d A i m C o r r )
de f g r a d A i m = de f g r ad A i m + de f g r a d A i m C o r r
420 do m = 1 , 3 ; do n = 1 , 3 ! a n t i c i p a t e d t a r g e t m in u s c u r r e n t s t a t e
d e f g r a d ( : , : ,: ,m, n ) = d e f g r a d ( : , : , : , m, n ) + ( d e fg r a d Ai m ( m, n ) −d e f g r a d a v (m, n ) )
enddo ;enddo
e r r d iv = 2 e r r d i v t o l
e r r d e f g r a d = ma x v a l ( a b s ( m a s k de f g r a d ( d e f g r a d a v −d ef g ra d Ai m ) ) )
print ’ ( a , / , 3 ( 3 ( f1 2 . 7 , x ) / ) ) ’ ,’ D e f o r ma t i o n G r a d i e n t : ’ , d e f g r a d av ( 1 : 3 , : )
print ’ ( a , / , 3 ( 3 ( f1 0 . 4 , x ) / ) ) ’ ,’ C au chy S t r e s s [ MPa] : ’ , c s t r e s s a v ( 1 : 3 , : ) / 1 . e 6
print ’ ( 2 ( a , E 8 . 2 ) ) ’ ,’ e r r o r s t r e s s ’ , err stress , ’ T ol . = ’ , e r r s t r e s s t o l
print ’ ( 2 ( a , E 8 . 2 ) ) ’ ,’ e r r o r d e f o r m a t i o n g r a d i e n t ’ , err defgrad , ’ T ol . = ’ , e r r d e f g r a d t o l 0 .8
i f ( err stress <e r r s t r e s s t o l 0 .8 ) t he n
430 ca lc mo de = 1
e n d i f
! U s i n g s p e c t r a l me th od to c a l c u l a t e t h e c h a ng e o f d e f o r m a t i o n g r a d i e n t , c h ec k d i v e r g e n c e o f s t r e s s f i e l d
ca s e (1 )
print ,’ Up da te S t r e ss F i e ld ( c o n s t i t u t i v e e v a l u a ti o n P (F ) ) ’
i e l e m = 0 p I n t
do k = 1 , r e s o l u t i o n ( 3 ) ; do j = 1 , r e s o l u t i o n ( 2 ) ; d o i = 1 , r e s o l u t i o n ( 1 )
i e l e m = ie l e m + 1
call CP FE M ge ne ra l ( 3 , d e f g r a d o l d ( i , j , k , : ,: ) , d e f g r a d ( i , j , k , : , : ) , &
440 t e m p e r a t u r e , t i m e i n c , i e l e m , 1 p I n t ,&
c s t r e s s , ds de , p s t r e ss , dPd F)
enddo ;enddo ;enddo
i e l e m = 0 p I n t
do k = 1 , r e s o l u t i o n ( 3 ) ; do j = 1 , r e s o l u t i o n ( 2 ) ; d o i = 1 , r e s o l u t i o n ( 1 )
i e l e m = ie l e m + 1
call CP FE M ge ne ra l (2 , &
d e f g r a d o l d ( i , j , k , : ,: ) , d e f g r a d ( i , j , k , : , : ) , &
t e m p e r a t u r e , t i m e i n c , i e l e m , 1 p I n t ,&
450 c s t r e s s , ds de , p s t r e ss , dPd F)
p s t r e s s f i e l d ( i , j , k , : , : ) = p s t r es s
c s t r e s s f i e l d ( i , j , k , : , : ) = ma th m an de l6 to 33 ( c s t r e s s )
enddo ;enddo ;enddo
print ,’ C a l c u l a t i n g e q u i l i b r i u m u s i n g s p e c t r a l me th od ’
e r r d i v = 0 . 0 p R e a l ; s i g ma 0 = 0. 0 p R e a l
do m = 1 , 3 ; do n = 1 , 3
call d f f t w ex e c u t e d f t r 2 c ( p l a n f f t ( 1 , m, n ) , p s t r e s s f i e l d ( : , : , : ,m, n ) , w o r k f f t ( : , : ,: ,m, n ) )
i f ( n ==3) s i gm a 0 = max( s i gm a0 , s um ( a bs ( w o r k f f t ( 1 , 1 , 1 ,m , : ) ) ) ) ! L i n f i n i t y Norm o f s t r e s s t e n so r
460 enddo ;enddo ! L i n f i n i t y Norm o f d i v ( s t r e s s )
e r r d i v =( ma xv al ( a b s ( m at h mu l 33 x3 c o mp le x ( w o r k f f t ( r e s o l u t i o n ( 1) /2 +1 , r e s o l u t i o n ( 2) /2 +1 ,&
r e s o l u t i o n ( 3) / 2 + 1 , : , :) , x i ( r e s o l u t i o n (1 )/ 2+ 1 , r e s o l u t i o n ( 2) /2 + 1 , r e s o l u t i o n ( 3 ) /2 + 1 , :) ) ) ) )
do k = 1 , r e s o l u t i o n ( 3 ) ; do j = 1 , r e s o l u t i o n ( 2 ) ; d o i = 1 , r e s o l u t i o n (1 )/ 2+ 1
te m p3 3 Co m pl e x = 0 . 0 p R e a l
do m = 1 , 3 ; do n = 1 , 3
te mp 3 3 Co mp le x (m , n ) = sum ( g am ma hat ( i , j , k , m, n , : , : ) w o r k f f t ( i , j , k , : , : ) )
66
enddo ;enddo
w o r k f f t ( i , j , k , : , : ) = t em p3 3 Co mp l ex ( : ,: )
enddo ;enddo ;enddo
470 wo r k f f t ( 1 , 1 , 1 , : , : ) = d e f g r a d a v −math I3
e r r d i v = e r r d i v / si g ma 0 ! w e i g h t i n g o f e r r o r
do m = 1 , 3 ; do n = 1 , 3
call dfftw e x e c u t e df t c 2 r ( p l a n f f t ( 2 , m, n ) , w o r k f f t ( : , : ,: ,m, n ) , d d e fg r a d ( : , : , : ) )
d e f g r a d ( : ,: ,: ,m, n ) = d e f g r a d ( : , : ,: ,m, n ) + d d e f g r a d w gt
p s tr e s s av (m, n ) = sum ( p s t r e s s f i e l d ( : , : ,: ,m, n ) ) wg t
c s t r e s s a v (m , n ) = sum ( c s t r e s s f i e l d ( : ,: , : , m, n )) w gt
d e f g r a d a v (m, n ) = sum( d e f g r ad ( : ,: ,: ,m, n ) ) wg t
480 de f g r a d ( : , : , : ,m, n )= d e f g r a d ( : , : ,: ,m, n ) + &
( de fg ra dA i m (m, n) −d e f g r a d a v (m, n ) ) ! a n t i c i p a t e d t a r g e t mi n us c u r r en t s t a t e
enddo ;enddo
e r r s t r e s s = m a xv a l ( a b s ( m a s k s t r e s s ( p s t r e s s a v −b c s t r e s s ( : ,: , l o a d c a s e ) ) ) )
e r r s t r e s s t o l = ma xv al ( ab s ( p s tr e s s a v ) ) e r r s t r e s s t o l r e l ! a cc e cp t r e l a t i v e r r or
e r r d e f g r a d = ma x v a l ( a b s ( m a s k de f g r a d ( d e f g r a d a v −d ef g ra d Ai m ) ) )
print ’ ( 2 ( a , E 8 . 2 ) ) ’ ,’ e r r o r d i v e r g e n c e ’ , e r r di v , ’ T ol . = ’ , err div tol
print ’ ( 2 ( a , E 8 . 2 ) ) ’ ,’ e r r o r s t r e s s ’ , err stress , ’ T ol . = ’ , e r r s t r e s s t o l
490 print ’ ( 2 ( a , E 8 . 2 ) ) ’ ,’ e r r o r d e f o r m a t i o n g r a d i e n t ’ , err defgrad , ’ T ol . = ’ , err defgrad tol
i f ((err stress >er r s t r e s s t o l . o r . e r r d e f g r a d >e r r d e f g r a d t o l ) . an d . e r r d i v <err div tol ) th en
ca lc mo d e = 0 ! ch a ng e t o c a l c u l a t i o n o f BCs , r e s e t d amp er e t c .
d ef g r a d A i m C o r r = 0 . 0 p R e a l
da mp er = d a mp er 0 . 9 p R e a l
e n d i f
end select
enddo ! e nd l o o p i n g w he n c o n v e r g e n c y i s a c h i e v e d
write (538) materialpoint results (: ,1 ,:) ! w r i t e t o o u t p u t f i l e
500
print ’ ( a , / , 3 ( 3 ( f1 2 . 7 , x ) / ) ) ’ ,’ D e fo rm a ti o n A im : ’ , d e fg ra d Ai m ( 1 : 3 , : )
print ’ ( a , / , 3 ( 3 ( f1 2 . 7 , x ) / ) ) ’ ,’ D e f o r ma t i o n G r a d i e n t : ’ , d e f g r a d av ( 1 : 3 , : )
print ’ ( a , / , 3 ( 3 ( f1 0 . 4 , x ) / ) ) ’ ,’ C au chy S t r e s s [ MPa] : ’ , c s t r e s s a v ( 1 : 3 , : ) / 1 . e6
print ’ (A ) ’ ,’ ’
enddo ! e nd l o o p i n g o v er s t e p s i n c u r r e n t l o a d c a s e
enddo ! e nd l o o p i n g ov e r l o a d c a s e s
close (538)
do i =1 , 2; do m = 1 , 3 ; do n = 1 , 3
510 call d f f t w d e s t r o y p l a n ( p l a n f f t ( i ,m, n ) )
enddo ;enddo ;enddo
en d pro gr am mpie spectral
!
! q u i t s u b r o u t i n e t o s a t i s f y I O er r o r
!
!
subroutine q u i t ( i d )
520 us e p r e c
i m p l i c i t n one
integer( p I n t ) i d
st o p
end subroutine
67
Listing A.2: mpie spectral interface.f90
0! I d : m p i e s p e c t r a l i n t e r f a c e . f 90 65 0 20 10−09−23 0 8 : 0 5 : 5 0 Z MPIE\m. d i e h l
!
MODULE mpie interface
us e pr e c , o n l y : p I n t , p R e a l
character(len =6 4) , parameter : : F E s o l v e r = ’ S p e c t r a l ’
character(len =5 ) , parameter : : InputFileExtension = ’ . g eom ’
CONTAINS
!
10 ! i n i t i a l i z e i n t er f a c e mo dul e
!
subroutine m p i e i n t e r f a c e i n i t ( )
write ( 6 , )
write ( 6 , ) ’<<<+−m p i e s p e c t r a l i n i t −+>>>’
write ( 6 , ) ’ I d : m p i e s p e c t r a l i n t e r f a c e . f 9 0 65 0 2 010−09−23 0 8 : 0 5 : 5 0 Z MPIE\m. d i e h l ’
write ( 6 , )
return
20 endsubroutine
!
! e x t r a ct w o rk i ng d i r e c t o r y f ro m l o a d ca s e f i l e , p o s s i b l y b a se d on c u r re n t w or k in g d i r
!
f u n c t i o n getSolverWorkingDirectoryName ()
i m p l i c i t n one
character(len =10 24 ) cwd , ou tn am e , g e t S o l v e r W o r k i n g D i r e c t o r y N a m e
30 character(len = ) , parameter : : pa t h S e p = a c h a r ( 4 7 ) / / ac h a r ( 9 2 ) ! f o r w a r d s l a s h , b a c k w a r ds l a s h
call g e t a r g ( 2 , o ut na m e ) ! p a th t o l o a d F i l e
i f ( s c an ( o ut nam e , p at hS ep ) == 1 ) th en ! a b s o l u t e p at h g i ve n a s command l i n e a r gu me n t
g e t S o l v e r W o r k i n g D i r ec t o r y N a m e = ou tn am e ( 1 : s c an ( ou tn am e , p at h S ep , ba c k =. t r u e . ) )
else
call ge t cw d ( c wd )
g e t S o l v e r W o r k i n g D i r ec t o r y N a m e = t r i m ( cw d ) // ’ / ’ // o ut na me ( 1 : s ca n ( o ut na me , p a th Se p , b a ck = . t r u e . ) )
e n d i f
40
g e t S o l v e r W o r k i n g D i r ec t o r y N a m e = r e c t i f y P a t h ( g e t S o l v e r W o r k i n g D i r e c t o r y N a m e )
return
endfunction
!
! b ase na me o f ge om e tr y f i l e fr om comma nd l i n e ar g um en ts
!
f u n c t i o n getSolverJobName ( )
50
us e pr e c , o n l y : p I n t
i m p l i c i t n one
character( 1 0 2 4 ) g e tS o l v e r J ob N a m e , o ut Nam e , c wd
character(len = ) , parameter : : pa t h S e p = a c h a r ( 4 7 ) / / ac h a r ( 9 2 ) ! / , \
integer( p I n t ) p o sE x t , p o sS e p
getSolverJobName = ’ ’
60
call g e t a r g ( 1 , o utN ame )
po s E xt = s ca n ( o utNa me , ’ . ’ , b a ck = . t r u e . )
po s Se p = sc a n ( ou tNa me , pa th S ep , ba c k =. t r u e . )
i f ( posExt <= po sS ep ) p os E xt = l e n t r i m ( ou tNa me) +1 ! no e x t e n s i o n p r e s e n t
ge t So l v er J ob N am e = o utNa me ( 1 : po s Ex t −1) ! p at h t o g e om e t ry f i l e ( e x c l . e x t e n s i o n )
i f ( s ca n ( ge tS ol ve rJ ob Na me , pa th Se p ) /= 1) th en ! r e l a t i v e p at h g iv e n a s command l i n e a rg um en t
call ge t cw d ( c wd )
70 g e tS ol v er J ob N am e = r e c t i f y P a t h ( tr i m ( c wd )/ / ’ / ’ // getSolverJobName)
else
getSolverJobName = rect if yPa th ( getSolverJobName)
e n d i f
ge t S o l v er J o b N a m e = m a k e R e l a t i v e P a t h ( g e t S o l v e r W o r k i n g D i r e c t o r y N a m e () , &
getSolverJobName)
return
endfunction
68
!
80 ! r e l a t i v e p a th o f l o a d c a s e f r om comma nd l i n e a r gu m e nt s
!
f u n c t i o n getLoadcaseName ( )
us e pr e c , o n l y : p I n t
i m p l i c i t n one
character(len =10 24) ge tLo ad cas eNa me , out Name , cw d
character(len = ) , parameter : : pa t h S e p = a c h a r ( 4 7 ) / / ac h a r ( 9 2 ) ! / , \
90 integer( p I n t ) p o sE x t , p o sS e p
po s Ex t = 0
call get arg (2 , getLoadcaseName )
po s Ex t = s ca n ( g et Loa dc as eN am e , ’ . ’ , ba c k =. t r u e . )
po s Se p = sc a n ( g e tL oa d ca se Na m e , p a th Se p , b a ck = . t r u e . )
i f ( posExt <= posSe p) getLoadcaseName = trim ( getLoadcaseName )/ /( ’ . lo a d ’)! no e x t e n s i o n p r e s e nt
i f ( s ca n ( g etL oa dc as eN ame , p at hS ep ) /= 1 ) th en ! r e l a t i v e p at h g iv e n a s command l i n e a rg um en t
call ge t cw d ( c wd )
100 g et Lo ad c as eN am e = r e c t i f y P a t h ( t r i m ( cwd ) / / ’ / ’ //getLoadcaseName )
else
getLoadcaseName = rec ti fyP at h (getLoadcaseName )
e n d i f
ge t L oa d ca s e Na m e = ma k e R e l a t i v e P a t h ( g e t S o l v e r W o r k i n g D i r e c t o r y N a m e ( ) , &
getLoadcaseName)
return
endfunction
110
!
! r em ov e . . / an d . / f ro m pa th
!
f u n c t i o n r e c t i f y P a t h ( pa t h )
us e pr e c , o n l y : p I n t
i m p l i c i t n one
120 character(len = ) p at h
character(len=l e n t r i m ( p a th ) ) r e c t i f y P a t h
integer( p I n t ) i , j , k , l
! r e mo ve . / f r om pa t h
l = l e n t r i m ( p a th )
r e c t i f y P a t h = pa th
do i = l ,2 , −1
i f ( r e c t i f y P a t h ( i −1: i ) == ’ . / ’ . an d . r e c t i f y P a t h ( i −2: i −2) /= ’ . ’ ) &
rectifyPath( i−1: l ) = r e c t i f y P a t h ( i + 1: l ) // ’ ’
130 enddo
! r em o ve . . / a nd c o r r e s p o n d i n g d i r e c t o r y f ro m r e c t i f y P a t h
l = l e n t r i m ( r e c t i f y P a t h )
i = i nd e x ( r e c t i f y P a t h ( i : l ) , ’ . . / ’)
j = 0 p I n t
do w h i l e ( i >j )
j = sc a n ( r e c t i f y P a t h ( : i −2) , ’/ ’ , b a ck = . t r u e . )
r e c t i f y P a t h ( j + 1: l ) = r e c t i f y P a t h ( i + 3: l ) // r ep e a t ( ’ ’ , 2+ i−j )
i = j+ i nd e x ( r e c t i f y P a t h ( j + 1: l ) , ’ . . / ’ )
140 enddo
i f ( l e n t r i m ( r e c t i f y P a t h ) == 0) r e c t i f y P a t h = ’ / ’
return
endfunction rectifyPath
!
! r e l a t i v e p a th fr o m a b s o l u t e a t o a b s o l u t e b
!
f u n c t i o n makeRelativePath (a , b)
150
us e pr e c , o n l y : p I n t
i m p l i c i t n one
character (len= ) : : a , b
character (len=1024) :: makeRelativePath
integer( p I n t ) i , po sL a st Co mm o nS la s h , r e m a i n i n g S l a s h e s
posLastCommonSlash = 0
69
160 remainingSlashes = 0
do i = 1 , m in ( 10 2 4 , l e n tr i m ( a ) , l e n t r i m ( b ) )
i f ( a ( i : i ) /= b ( i : i )) exit
i f ( a ( i : i ) == ’/ ’ ) posLastCommonSlash = i
enddo
do i = po sL a st Co mm on Sl as h +1 , l e n t r i m ( a )
i f ( a ( i : i ) == ’/ ’ ) remainingSlashes = remainingSlashes + 1
enddo
makeRelativePath = repeat ( ’ . . / ’ , r e m a i n i n g S l a s h e s ) / / b ( p os La s tC om m on Sl a sh + 1: l e n t r i m ( b ) )
170 return
endfunction makeRelativePath
END MODULE
70
Listing A.3: mesh.f90
0! I d : me sh . f 9 0 6 61 2010−10 −01 1 0 : 4 2 : 1 5 Z MPIE\m. d i e h l
!##############################################################
MODULE mesh
!##############################################################
us e pr e c , o n l y : p R ea l , p I n t
i m p l i c i t n one
! G e n e r i c f u n c t i o n s , u se d i n d e p e n d e n t l y o f t h e c h o se n s o l v e r .
!
10 ! N el e m s : t o t a l nu mb er o f e l e m e n t s i n mes h
! Nc p El e ms : t o t a l nu mb er o f CP e l e m e n t s i n m es h
! Nn o de s : t o t a l nu mbe r o f n od e s i n me sh
! m a xN n od es : max nu mb er o f n o d e s i n a n y CP e l e m e n t
! ma x N i ps : ma x num be r o f I P s i n an y CP e l e m e n t
! m a x N ip N e i g h b o r s : max nu mb er o f I P n e i g h b o r s i n an y CP e l e m e n t
! ma x N sh a r ed E l em s : max nu mb er o f CP el e m e n t s s h a r i n g a no de
!
! e l e me n t : F Ei d , t y p e ( i n t e r n a l r e p r e s e n t a t i o n ) , m a t e ri a l , t e x t ur e , no de i n d i c e s
! n od e : x , y , z c o o r d i n a t e s ( i n i t i a l l y !)
20 ! s h a re d E l em : e n t ry C o u nt an d l i s t o f e l em e n t s c o n t a i n i n g n od e
!
! m ap FE toC Pe le m : [ s o r t e d FE id , c o r r e s p o n d i n g CP id ]
! m ap FEt oC Pn ode : [ s o r t e d F E id , c o r r e s p o n d i n g C Pi d ]
!
! The f o l lo w i n g d e f i n i t i o n s a r e s o l v er −de pe nd en t .
! The d e f i n i t i o n s f o r FEM a r e re mo ve d i n o rd e r t o g et a s m al l a pp en d ix .
! O nl y t he r o u t i n e s t ha t a r e e s p e c i a l l y w r i t te n f o r t h e s p e c t r a l me th od ( name d ’ s p e c t r a l ’ ) a re i n c l u de d .
!
! Nn o d e s : # n od e s i n a s p e c i f i c t y p e o f e l e m e n t ( ho w we u s e i t )
30 ! N o r i g i n a l N o d e s : # no d es i n a s p e c i f i c t yp e o f e l e m e nt ( how i t i s o r i g i n a l l y d e f i n e d by m ar c )
! N i p s : # IP s i n a s p e c i f i c ty p e o f e l e m e n t
! N i p N e i g h b o r s : # IP n e i g h b o r s i n a s p e c i f i c t y pe o f e l e me n t
! i p N e i g h b o r : +x ,−x ,+ y,−y , + z,−z l i s t o f i n t r a −e l e m e n t I P s a nd
! ( n e g a t i v e ) n e i g h b o r f a c e s p e r own IP i n a s p e c i f i c t y p e o f e l e m e n t
! N f a ce N o d e s : # no d e s p e r f a c e i n a s p e c i f i c t y p e o f e l e m e n t
! no d eO n F ac e : l i s t o f no d e i n d i c e s o n e a c h f a c e o f a s p e c i f i c t y p e o f e l e m e n t
! m a xN no de sA tI P : max n um ber o f ( e q u i v a l e n t ) n o de s a t t a c he d t o an I P
! n o d e s A t I P : map I P i n d e x t o tw o no d e i n d i c e s i n a s p e c i f i c t y p e o f e l e m e n t
! i p N e i g h b o r h o o d : 6 o r l e s s n e i g h b o r i n g I P s a s [ el e me n t nu m , I P in d e x ]
40 ! Ns ub No d es : # su bn o d es r e q u i r e d t o f u l l y d e f i n e a l l IP vo l um e s
! or d e r i s +x,−x ,+ y ,−y ,+ z ,−z b ut m ea n in g s t r o n g l y d ep e nd s on E l em ty p e
!−−−−−−−−−−−−−−−−−−−−−−−−−−−
integer( p I n t ) m es h Ne le m s , me sh N cp El em s , m e sh N el e mS e ts , me s h ma x Ne le m In S et
integer( p Int ) mesh Nmaterials
integer( p I n t ) m es h Nn od es , m es h max Nn ode s , m es h ma xN ip s , m e sh m ax N ip N ei g hb o rs , me sh m ax N sh ar e dE le m s , me sh ma xN su bN od es
integer( p I n t ) , dimension ( 2) : : mesh maxValStateVar = 0 p Int
character(len =6 4) , dimension ( : ) , allocatable : : m es h n ame El emS et , & ! nam es o f e l e m e n t S e t
me sh n a me Ma te ri al , & ! na mes o f m a t e r i a l i n s o l i d s e c t i o n
50 mesh mapMaterial ! na me o f e l e m e n t S e t f o r m a t e r i a l
integer( p I n t ) , dimension ( : ,: ) , allocatable : : me sh ma pEl emS et ! l i s t o f e l e m e n t s i n e l e m e n t S e t
integer( p I n t ) , dimension ( : ,: ) , allocatable ,target : : mesh mapFEtoCPelem , mesh mapFEtoCPnode
integer( p I n t ) , dimension ( : ,: ) , allocatable : : m esh e le me nt , me sh s ha re dE l em
integer( p I n t ) , dimension ( : ,: , : ,: ) , allocatable : : mesh ipNeighborhood
r e a l ( p Re a l ) , dimension ( : , : , : ) , allocatable : : mesh subNodeCoord ! c o o r d i n a t e s o f s u bn o d es p er e l em e n t
r e a l ( p Re a l ) , dimension ( : ,: ) , allocatable : : me sh i pV ol um e ! vo l um e a s s o c i a t e d w i th IP
r e a l ( p Re a l ) , dimension ( : , : , : ) , allocatable : : m es h ip Ar ea , & ! a r e a o f i n t e r f a c e t o n e i g h b o r i n g I P
mesh ipCenterOfGravity ! c e n t e r o f g r a v i t y o f IP
60 r e a l ( p Re a l ) , dimension ( : ,: , : ,: ) , allocatable : : mesh ipAreaNormal ! a r e a n o rm a l o f i n t e r f a c e t o n e i g h b o r i n g I P
r e a l ( p Re a l ) , allocatable: : m es h nod e ( : , : )
integer( p I n t ) , dimension ( : ,: , : ) , allocatable : : F E nod es At IP
integer( p I n t ) , dimension ( : ,: , : ) , allocatable :: FE ipNeighbor
integer( p I n t ) , dimension ( : ,: , : ) , allocatable : : FE s ub No de Pa re nt
integer( p I n t ) , dimension ( : ,: , : ,: ) , allocatable : : FE subNodeOnIPFace
integer( p I n t ) : : h y p o e l a s t i c T a b l e S t y l e
integer( pInt) :: initialcondTableStyle
70 integer( p I n t ) , parameter : : FE Nelemtypes = 1
integer( p I n t ) , parameter : : FE maxNnodes = 8
integer( p I n t ) , parameter : : F E m axN subN ode s = 0
integer( p I n t ) , parameter : : F E max Nip s = 1
integer( p I n t ) , parameter : : FE maxNipNeighbors = 6
integer( p I n t ) , parameter : : F E m axm axN nod esA tIP = 8
integer( p I n t ) , parameter : : F E Ni pF ace No de s = 4
71
integer( p I n t ) , dimension (FE Nelemtypes ) , parameter : : FE Nn od es = &
80 ( / 8 , & ! element 117
/)
integer( p I n t ) , dimension (FE Nelemtypes ) , parameter : : F E N o r i g i n a l N o d e s = &
( / 8 , & ! element 117
/)
integer( p I n t ) , dimension (FE Nelemtypes ) , parameter : : F E Nip s = &
( / 1 , & ! element 117
/)
integer( p I n t ) , dimension (FE Nelemtypes ) , parameter : : F E Ni pN ei g hb or s = &
( / 6 , & ! element 117
90 /)
integer( p I n t ) , dimension (FE Nelemtypes ) , parameter : : FE Ns ubN ode s = &
( / 0 , & ! element 117
/)
integer( p I n t ) , dimension ( FE ma xN ip Nei gh bo rs , F E Ne lem ty pes ) , parameter : : FE N fa ce No des = &
r e s h a p e ( (/ &
4 , 4 ,4 , 4 ,4 , 4 , & ! element 117
/ ) , ( / F E m ax N i pN e i gh b o rs , F E Ne l e m ty p e s / ) )
integer( p I n t ) , dimension (FE Nelemtypes ) , parameter : : FE ma xNn od esA tIP = &
( / 8 , & ! element 117
100 /)
integer( p I n t ) , dimension ( FE Ni pFa ceN ode s , FE m ax Ni pNe ig hb ors , FE Ne le mty pe s ) , parameter : : FE nodeOnFace = &
r e s h a p e ( (/ &
1 , 2 , 3 , 4 , & ! element 117
2 , 1 , 5 , 6 , &
3 , 2 , 6 , 7 , &
4 , 3 , 7 , 8 , &
4 , 1 , 5 , 8 , &
8 , 7 , 6 , 5 , &
/ ) , ( / F E Ni p F ac e No d es , FE m a xN i p Ne i g hb o rs , F E Ne l e m ty p e s / ) )
110
CONTAINS
!−−−−−−−−−−−−−−−−−−−−−−−−−−−
! s u b r o u t i n e m e s h i n i t ( )
! f u n c t i o n m es h FE t oC Pe l em en t ( F Ei d )
! function mesh build ipNeighorhood()
!−−−−−−−−−−−−−−−−−−−−−−−−−−−
!
! initialization
120 !
subroutine m e s h i n i t ( i p , e l e m e n t )
us e mpie interface
us e pr e c , o n l y : p I n t
us e IO , o n l y : I O e r r o r , I O op e n I n p u t F i l e
us e F E s o l v i n g , o n l y : p a r a l l e l E x e c u t i o n , F E s o l v i n g ex e c E l e m , F E s o l v i n g ex e c I P , ca l cM o de , l a s t Mo d e
i m p l i c i t n one
130 integer( p I n t ) , parameter : : f i l e U n i t = 2 22
integer( p I n t ) e , e l e me n t , i p
write ( 6 , )
write ( 6 , ) ’<<<+−me sh i n i t −+>>>’
write ( 6 , ) ’ I d : mes h . f 9 0 6 6 1 2 010−10−01 1 0 : 4 2 : 1 5 Z MPIE\m. d i e h l ’
write ( 6 , )
call mesh build FEdata () !−−− g et p r o p e r t i e s o f th e d i f f e r e n t t y pe s o f e l e me n t s
140 i f ( I O o p e n i n p u t F i l e ( f i l e U n i t ) ) th en !−−− p a r s e i n f o f r om i n p u t f i l e . . .
s e l e c t c a s e ( F E s o l v e r )
ca s e (’ S p e c t r a l ’ )
call m e s h s p e c t r a l c o u n t no d e s A n d E l e m e n t s ( f i l e U n i t )
call mesh spectral count cpElements ()
call mesh spectral map elements ()
call m e s h s p e c t r a l m a p no d e s ( )
call m e s h s p e c t r a l c o u n t c p S i z e s ( )
call mesh spectral build nodes ( fil eUni t )
150 call mesh spectral build elements ( fil eUni t )
end select
close (fileUnit )
call m e s h b u i l d sh a r e d E l e m s ( )
call mesh build ipNeighborhood ()
call mesh build subNodeCoords ()
call m e s h b u i l d i p V o l u m e s ( )
call mesh build ipAreas ()
72
160 call m e s h t e l l s t a t i s t i c s ( )
p a r a l l e l E x e c u t i o n = ( p a r a l l e l E x e c u t i o n . a nd . ( m es h Ne le ms == mes h Nc pE le ms ) )
else
call I O e r r o r ( 1 01 ) ! c a n n ot op en i n p u t f i l e
e n d i f
F E s o l v i n g e x e c E l e m = ( /1 , m es h Nc p El em s / )
allocate( F E s o l v i n g e x e c I P ( 2 , m e sh Nc p El em s ) ) ; F E s o l v i n g e x e c I P = 1 pI n t
f o r a l l ( e = 1: m e sh Nc p El em s ) F E s o l v i n g e x e c I P ( 2 , e ) = FE N i ps ( m e s h el e m e nt (2 , e ) )
170
allocate( c a lc M od e ( m e sh ma x Ni ps , m e sh Nc p El em s ) )
write ( 6 , ) ’<<<+−me sh i n i t d on e −+>>>’
ca lc Mo de = . f a l s e . ! p r e te n d t o h av e c o l l e c t e d w hat f i r s t c a l l i s a s k i ng ( F = I )
ca lc M od e ( i p , m es h F Ea sCP ( ’ e le m ’ , e l e m e n t ) ) = . t r u e . ! f i r s t i p , e l n e e ds t o be a l r e a d y p in g po n g ed t o ” c a l c ”
la s t Mo d e = . t r u e . ! an d i t s mode i s a l r e a d y kn own . . .
endsubroutine
!
! m ap pi ng o f FE e le m en t t y pe s t o i n t e r n a l r e p r e s e n t a t i o n
180 !
f u n c t i o n F E map El em typ e ( wh at )
us e IO , o n l y : I O l c
i m p l i c i t n one
character(len = ) , intent(i n ) : : wh at
integer( p I n t ) F E ma pE le mt y pe
190 s e l e c t c a s e ( I O l c ( w ha t ) )
ca s e (’ 117 ’ , &
’ 12 3 ’ , &
’ c 3d 8r ’ )
FE mapElemtype = 8 ! Thr ee−d i m en s i o n al A r b i t r a r i l y D i s t or t e d l i n e a r h ex a h e d ra l w it h r e d uc e d i n t e g r a t i o n
ca s e d e f a u l t
FE mapElemtype = 0 ! unk no wn e l e m e n t −−>s h o u l d r a i s e a n e r r o r u p s tr e a m . . !
endselect
endfunction
200
!
! FE to CP i d m ap pi ng b y b i n a r y s e a r c h t h r u l oo k u p a r r a y
!
! v a l i d q u e s t i o n s a r e ’ e le m ’ , ’ n od e ’
!
f u n c t i o n me sh FE as CP ( w hat , i d )
us e pr e c , o n l y : p I n t
us e IO , o n l y : I O l c
210 i m p l i c i t n one
character(len = ) , intent(i n ) : : wh at
integer( p I n t ) , intent(i n ) : : i d
integer( p I n t ) , dimension ( : ,: ) , pointer : : lookupMap
integer( p I n t ) m es h FEas CP , l o w er , u pp er , c e n t e r
me sh FEa sC P = 0 p I n t
s e l e c t c a s e ( I O l c ( w ha t ( 1 : 4 ) ) )
ca s e (’e le m ’ )
220 lookupMap =>m esh m apF Eto CPe lem
ca s e (’n od e ’ )
lookupMap =>mesh mapFEtoCPnode
ca s e d e f a u l t
return
endselect
l o w e r = 1 p I n t
up p er = size ( lo ok up Map , 2 )
230 ! c h e c k at bo u n d s
i f ( l oo k up Ma p ( 1 , l o w e r ) == i d ) th en
me sh FEa sC P = l oo ku p Ma p ( 2 , l o w e r )
return
elseif ( loo kup Map (1 , u pp er ) == id ) th en
me sh FEa s CP = l oo k up Ma p ( 2 , up p e r )
return
e n d i f
240
73
! b i n a r y s e a r c h i n b e t we e n b ou n ds
do w h i l e ( upper−lower >1)
c e n t e r = ( l o w er +u pp e r ) / 2
i f ( l oo ku pM ap ( 1 , c e n t e r ) <i d ) t he n
l ow e r = c e n t e r
elseif ( lo ok u pM ap ( 1 , c e n t e r ) >id ) th en
up p e r = ce n t e r
else
mesh FE asC P = l oo ku pM ap ( 2 , c e n t e r )
250 exit
e n d i f
enddo
return
endfunction
!
! f i n d f ac e −ma tc h i n g e l e m e n t o f s am e t y p e
!
260 f u n c t i o n m e sh f a ce M a tc h ( e le m , f a c e )
us e pr e c , o n l y : p I n t
i m p l i c i t n one
integer( p I n t ) f a c e , e le m
integer( p I n t ) , dimension ( 2) : : mesh faceMatch ! ma t c hi n g e l em e nt ’ s ID a nd c o r r e s p o n d i n g f a c e ID
integer( p I n t ) , dimension ( F E N fa c e N od e s ( f a c e , m e s h e l e m e nt ( 2 , e l e m ) ) ) : : m y Fa ce No d es ! g l o b a l n od e i d s on my f a c e
integer( p I n t ) minN , N sh a re d El e ms , &
t , lonelyNode , &
270 c an di da te Ty pe , c an di da teE le m , &
i , f ,n
minN = mesh maxNsharedElems+1 ! i n i t to w or s t c as e
mesh faceMatch = 0 p Int ! i n t i a l i z e t o ” no ma tch f ou nd ”
t = m e s h e l e m e nt ( 2 , e l em ) ! f i g u r e e le mT yp e
do n = 1 , F E N fa c e N od e s ( f a c e , t ) ! l o o p o v e r n o d es o n f a c e
my Fa ce No de s ( n ) = me sh FE as CP ( ’ n ode ’ , m e s h e l e m e n t (4+ F E no de O nF a ce ( n , f a c e , t ) , e le m ) ) ! CP i d o f f a c e n od e
Ns h a r e dE l e m s = m e s h s h a re d E l e m ( 1 , m yF a ce No de s ( n ) ) ! f i g u r e # s h a r e d e le m e n t s f o r t h i s n od e
280 i f ( N sh ar ed El ems <min N ) t he n
minN = Ns ha re dE le ms ! re me mb e r min # s h a r e d e l e m s
l o n e l y N o d e = n ! r eme mb er m ost l o n e l y no de
e n d i f
enddo
candidate : d o i = 1 , m inN ! i t e r a t e o v e r l o n e l y N o de ’ s s h a r e d el e m e n t s
c a n d i d a t e E l e m = m e s h s h a r ed E l e m (1 + i , my Fa ce N od es ( l o n e l y N o d e ) ) ! p r e s e n t c a n d i d a t e el e m
i f ( candidateElem == elem) cycle candidate ! my own e l e m e n t ?
290 c a n d i d a t e T y p e = me s h e l e m e n t ( 2 , c a n d i d a t e E l e m ) ! f i g u r e e le m Ty pe o f c a n d i d a t e
candidateFace : d o f = 1 , FE maxNipNeighbors ! c h ec k e a c h f a c e o f c a n d i d a t e
i f ( F E N f ac e N od e s ( f , c a n d i d a t e T y p e ) /= F E Nf a ce N o d es ( fa c e , t ) ) &
cycle candidateFace ! incompatible face
do n = 1 , F E N fa c e No d e s ( f , ca n d i d a t e T y p e ) ! l o o p t h r o u g h n o d e s on f a c e
i f ( a l l ( m yFa ceN ode s /= &
mesh FEasCP ( ’ nod e ’ , &
me s h e l e m e n t (4 +F E no de O nF a ce ( n , f , c a n d i d a t e T y p e ) , ca n d i d a t e E l e m ) ) ) ) &
cycle candidateFace ! o t he r f a c e no d e n ot o n e o f my fa c e n od e s
300 enddo
mesh faceMatch(1) = f
me s h f a c eM a t c h ( 2 ) = c a n d i d a t e E l e m
exit candidate ! f o u nd my m a t ch i n g c a n d i d a t e
enddo candidateFace
enddo candidate
return
endfunction
310
!
! g e t p r o p e r t i e s o f d i f f e r e n t t y pe s o f f i n i t e e l e me n t s
! a s s i gn g l o b a l s :
! F E no de sA tI P , F E ip N ei gh bo r , FE s ub No de Pa re nt , F E sub No deO nI PFa ce
!
subroutine mesh build FEdata ()
us e pr e c , o n l y : p I n t
i m p l i c i t n one
320
allocate( F E n od e sA t IP ( F E max max Nn ode sA tIP , F E max Ni ps , F E N el e mt yp e s ) ) ; F E n od e sA t IP = 0 p I n t
74
allocate( F E i p N e i g h b o r ( F E ma x N ip N e i gh b o rs , FE ma xN i ps , F E N e l e mt y p e s ) ) ; F E i p N e i g h b o r = 0 p I n t
allocate( F E s ub No d eP a re nt ( F E max Ni ps , F E maxN sub No des , F E N el e mt y pe s ) ) ; F E s ub No d eP a re nt = 0 p I n t
allocate( F E sub No de On IPF ac e ( FE N ip Fac eN od es , FE m ax Ni pN ei gh bo rs , FE ma xNi ps , F E N el em ty pe s ) )
FE subNodeOnIPFace=0 pI nt
! f i l l F E nod es At IP w it h da ta
FE n o d es A tI P ( : ,: F E Ni p s ( 8 ) , 8 ) = & ! element 117
r e s h a p e ( (/ &
330 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 &
/ ) , ( / F E max N no de sA tI P ( 8 ) , F E N ip s ( 8 ) / ) )
! f i l l F E i p N e i g h b o r w i t h d a t a
F E i p N e i g h b o r ( : FE Ni p N e i g h bo r s ( 8 ) , : FE N i p s ( 8 ) , 8 ) = & ! element 117
r e s h a p e ( (/ &
−3,−5,−4 ,−2,−6,−1 &
/ ) , ( / FE Ni p Ne i g hb o r s ( 8 ) , F E N ip s ( 8 ) / ) )
! f i l l F E sub Nod eP ar en t wi th d at a
340 ! F E su b N o d eP a r e n t ( : FE N i p s ( 8 ) , : FE Ns ub N od e s ( 8 ) , 8 ) ! e l e m e n t 1 17 h a s n o s u b n o d e s
! f i l l F E sub Nod eOn IPF ace w it h da ta
FE su bN od eO nI PF ac e ( : FE N ip Fa ce N od es , : F E N i pN e ig h b or s ( 8 ) , : F E Ni ps ( 8 ) , 8 ) = & ! element 117
r e s h a p e ( (/ &
2 , 3 , 7 , 6 , & ! 1
1 , 5 , 8 , 4 , &
3 , 4 , 8 , 7 , &
1 , 2 , 6 , 5 , &
5 , 6 , 7 , 8 , &
350 1 , 4 , 3 , 2 &
/ ) , ( / F E Ni p Fa ce N od es , F E N ip N e ig h b o rs ( 8 ) , FE N i ps ( 8 ) / ) )
return
endsubroutine
!
! c o u n t o v e r a l l nu mb er o f n o d es an d e l e m e n t s i n m es h
!
! m esh N ele ms , m esh N nod es
360 !
subroutine mesh spectral count nodesAndElements (u n i t )
us e pr e c , o n l y : p I n t
us e IO
i m p l i c i t n one
integer( p I n t ) , parameter : : maxNchunks = 7
integer( p I n t ) , dimension ( 1+2 ma xNc hu nks ) : : po s
integer( p I n t ) a , b , c , i
370
integer( p I n t ) u n i t
character(len =10 24) l i n e
me sh N no de s = 0 p I n t
me sh N el e ms = 0 p I n t
rewind(u n i t )
do
read(unit ,’ ( a 10 24 ) ’ ,END=1 00) l i n e
380 i f ( I O is B l a n k ( l i n e ) ) cycle ! s k i p em pty l i n e s
po s = I O s t r i n g P o s ( l i n e , m axN ch unk s )
i f ( I O l c ( I O St r i n g V a l u e ( l i n e , p os , 1 ) ) == ’resolution ’)t he n
do i = 2 , 6 , 2
s e l e c t c a s e ( I O l c ( I O s t r i n g V a l u e ( l i n e , p os , i ) ) )
ca s e (’a ’ )
a = I O in t V a l u e ( l i n e , p os , i +1 )
ca s e (’b ’ )
b = I O in t V a l u e ( l i n e , p o s , i + 1)
390 ca s e (’c ’ )
c = I O i n t V a l u e ( l i n e , p os , i + 1)
end select
enddo
me sh N el em s = a b c
me sh Nn ode s = (1 + a ) (1 + b ) (1 + c )
exit
e n d i f
enddo
400 1 00 return
endsubroutine
75
!
! c o un t o v e r a l l n umb er o f c p El em e nt s i n m esh
!
! mesh NcpElems
!
subroutine mesh spectral count cpElements ()
410
us e pr e c , o n l y : p I n t
i m p l i c i t n one
me sh N cpE le ms = me sh Ne le ms
return
endsubroutine
420 !
! map no de s f ro m FE id t o i n t e r n a l ( c o n se c u t i v e ) r e p r e s e n t a t i o n
!
! a l l o c a t e g l o b a l s : m esh map FE toC Pno de
!
subroutine m e s h s p e c t r a l m a p no d e s ( )
us e pr e c , o n l y : p I n t
i m p l i c i t n one
430 integer( p I n t ) i
allocate ( me sh map FEt oC Pno de ( 2 , m es h Nno de s ) ) ; me sh map FE toC Pno de = 0 p I n t
f o r a l l ( i = 1 : m esh N nod es ) &
me sh map FEt oCP no de ( : , i ) = i
return
endsubroutine
440
!
! map el e m en t s f ro m FE i d t o i n t e r n a l ( c o n se c u t i v e ) r e p r e s e n t a t i o n
!
! a l l o c a t e g l o b a l s : m esh ma pFE to CPe lem
!
subroutine mesh spectral map elements ()
us e pr e c , o n l y : p I n t
450 i m p l i c i t n one
integer( p I n t ) i
allocate ( me sh map FE to CPe le m ( 2 , m es h Nc pE le ms ) ) ; me sh ma pFE to CPe le m = 0 pI n t
f o r a l l ( i = 1 : m esh Nc pE lem s ) &
me sh map FEt oC Pel em ( : , i ) = i
return
460 endsubroutine
!
! g e t maxi mum co u n t o f n od e s , I P s , I P n e i g h b o r s , an d su b No d e s
! amo ng cp El e me nt s
!
! m axN nod es , m axN ips , m ax Ni pN ei gh bo rs , m axN subN od es
!
subroutine m e s h s p e c t r a l c o u n t c p S i z e s ( )
470
us e pr e c , o n l y : p I n t
i m p l i c i t n one
integer( p I n t ) t
t = F E map El emt yp e ( ’ C3D8R ’ )! f a k e 3D h e x a h e d r a l 8 n od e 1 IP e l e m e n t
me sh max Nno des = F E N no des ( t )
me sh ma xNi ps = FE N ip s ( t )
480 m es h ma xNi pN ei gh bo rs = F E N ip Ne ig hb or s ( t )
me sh max Nsu bNod es = FE Nsu bN ode s( t )
endsubroutine
76
!
! s t o r e x , y , z c o o r d i n a t e s o f a l l n o d es i n me sh
!
! a l l o c a t e g l o b a l s :
! no d e
!
490 subroutine mesh spectral build nodes (u n i t )
us e pr e c , o n l y : p I n t
us e IO
i m p l i c i t n one
integer( p I n t ) , parameter : : maxNchunks = 7
integer( p I n t ) , dimension ( 1+2 ma xNc hu nks ) : : po s
integer( p I n t ) a , b , c , n , i
r e a l ( p Re al ) x , y , z
500 logical g o t R e s o l u t i o n , g o tD i m e ns i o n
integer( p I n t ) u n i t
character(len =64) t ag
character(len =10 24) l i n e
allocate ( m es h no de ( 3 , m es h Nn od es ) ) ; m es h no de = 0 p I n t
a = 1 pI n t
b = 1 pI n t
c = 1 p I n t
510 x = 1. 0 p R e a l
y = 1 . 0 p R e a l
z = 1 . 0 p R e a l
g o t R e s o l u t i o n = . f a l s e .
go t Di me n si on = . f a l s e .
rewind(u n i t )
do
read(unit ,’ ( a 10 24 ) ’ ,END=1 00) l i n e
i f ( I O is B l a n k ( l i n e ) ) cycle ! s k i p em pty l i n e s
520 p os = I O st r i n g P o s ( l i n e , m ax Nch un ks )
s e l e c t c a s e ( I O l c ( I O S t r i n g V a l u e ( l i n e , p os , 1 ) ) )
ca s e (’ r e s o l u t i o n ’ )
g o t R e s o l u t i o n = . t r u e .
do i = 2 , 6 , 2
ta g = I O lc ( I O s t r i n g V a l u e ( l i n e , po s , i ) )
s e l e c t c a s e ( t ag )
ca s e (’a ’ )
a = 1 + I O in t V a l u e ( l i n e , p os , i + 1)
530 ca s e (’b ’ )
b = 1 + I O i n t V a l u e ( l i n e , p os , i +1 )
ca s e (’c ’ )
c = 1 + I O in t V a l u e ( l i n e , p os , i +1 )
end select
enddo
ca s e (’dimension ’ )
go t D i me n s io n = . t r u e .
do i = 2 , 6 , 2
ta g = I O lc ( I O s t r i n g V a l u e ( l i n e , po s , i ) )
540 s e l e c t c a s e ( t ag )
ca s e (’x ’ )
x = I O f l o a t V a l u e ( l i n e , p os , i + 1)
ca s e (’y ’ )
y = I O f l o a t V a l u e ( l i n e , p os , i + 1)
ca s e (’z ’ )
z = I O f l o a t V a l u e ( l i n e , po s , i +1 )
end select
enddo
end select
550 i f ( g o t Di m e ns i o n . an d . g o t R e s o l u t i o n ) e x i t
enddo
!−−− s a n i t y c he c k s −−−
i f ( . n ot . g o t D im e n si o n . o r . . n o t . g o t R e s o l u t i o n ) call I O e r r o r ( 4 2 )
i f ( a <2 . or . b <2 . o r . c <2) call I O er r o r ( 4 3)
i f ( x <= 0 . 0 p R e a l . o r . y <= 0 . 0 p R e a l . o r . z <= 0 . 0 p R e a l ) call I O e r r o r ( 4 4 )
f o r a l l ( n = 0 : mes h Nno des −1)
me s h no de ( 1 , n +1) = x d b l e ( mod ( n , a ) / ( a −1 .0 pR e a l ) )
560 m es h n od e ( 2 , n +1) = y db l e ( mod( n / a , b ) / ( b−1 .0 pR e a l ) )
me s h no de ( 3 , n +1) = z d b l e ( mod ( n / a/ b , c ) / ( c −1 .0 pR e a l ) )
end forall
10 0 return
endsubroutine
77
!
! s t o r e FE i d , t y p e , mat , t e x , an d no d e l i s t p e r e l e m e n t
!
! a l l o c a t e g l o b a l s :
! e l e m e n t
570 !
subroutine mesh spectral build elements (u n i t )
us e pr e c , o n l y : p I n t
us e IO
i m p l i c i t n one
integer( p I n t ) , parameter : : maxNchunks = 7
integer( p I n t ) , dimension ( 1+2 ma xNc hu nks ) : : po s
integer( p I n t ) a , b , c , e , i ,h omog
580 logical g o t R e s o l u t i o n , g ot D i me n s io n , g o tH o m o g e ni z a t i on
integer( p I n t ) u n i t
character(len =10 24) l i n e
a = 1 pI n t
b = 1 pI n t
c = 1 p I n t
g o t R e s o l u t i o n = . f a l s e .
go t Di me n si on = . f a l s e .
go t H o m o g e n i z a t i o n = . f a l s e .
590
rewind(u n i t )
do
read(unit ,’ ( a 10 24 ) ’ ,END=1 00) l i n e
i f ( I O is B l a n k ( l i n e ) ) cycle ! s k i p em pty l i n e s
po s = I O s t r i n g P o s ( l i n e , m axN ch unk s )
s e l e c t c a s e ( I O l c ( I O S t r i n g V a l u e ( l i n e , p os , 1 ) ) )
ca s e (’dimension ’ )
go t D i me n s io n = . t r u e .
600 ca s e (’homogenization ’ )
go t H o m o g e n i z a t i o n = . t r u e .
homo g = I O i n t V a l u e ( l i n e , p os , 2 )
ca s e (’ r e s o l u t i o n ’ )
g o t R e s o l u t i o n = . t r u e .
do i = 2 , 6 , 2
s e l e c t c a s e ( I O l c ( I O s t r i n g V a l u e ( l i n e , p os , i ) ) )
ca s e (’a ’ )
a = I O in t V a l u e ( l i n e , p os , i +1 )
ca s e (’b ’ )
610 b = IO i n t V a l u e ( l i n e , p os , i +1 )
ca s e (’c ’ )
c = I O i n t V a l u e ( l i n e , p os , i + 1)
end select
enddo
end select
i f ( g o t Di m e ns i o n . an d . g o tH o m o ge n i z at i o n . an d . g o t R e s o l u t i o n ) e x i t
enddo
10 0 allocate ( me s h e le m en t (4+ me sh ma xN nod es , m e sh Nc pE le ms ) ) ; m e sh e l em e n t = 0 p I n t
620
e = 0 p I n t
do w h i l e ( e <mesh NcpElems)
read(unit ,’ ( a 10 24 ) ’ ,END=1 10) l i n e
i f ( I O is B l a n k ( l i n e ) ) cycle ! s k i p em pty l i n e s
po s ( 1 :1 + 2 1) = I O st r i n g P o s ( l i n e , 1 )
e = e+1 ! v a l i d e l e m e n t e n t r y
me s h el e me nt ( 1 , e ) = e ! FE i d
me s h el e me nt ( 2 , e ) = FE ma pE lem ty pe ( ’ C3D8R ’ )! el e m t y p e
630 m e sh e le m en t ( 3 , e ) = homog ! homogenization
me s h e l em e n t ( 4 , e ) = I O I n t V a l u e ( l i n e , p o s , 1 ) ! microstructure
me s h el e me nt ( 5 , e ) = e + ( e −1)/a + ( e −1)/ a /b ( a +1) ! ba s e nod e
me s h el e me nt ( 6 , e ) = me s h el e me nt ( 5 , e ) + 1
me s h el e me nt ( 7 , e ) = me s h el e me nt ( 5 , e ) + ( a+1 ) + 1
me s h el e me nt ( 8 , e ) = me s h el e me nt ( 5 , e ) + ( a+1 )
me s h el e me nt ( 9 , e ) = me s h el e me nt ( 5 , e ) + ( a+ 1) (b +1) ! se c on d f l o o r b as e n ode
me s h el e me nt ( 10 , e ) = m e sh e l em en t ( 9 , e ) + 1
me s h el e me nt ( 11 , e ) = m e sh e l em en t ( 9 , e ) + ( a +1) + 1
me s h el e me nt ( 12 , e ) = m e sh e l em en t ( 9 , e ) + ( a +1)
640 m e sh m a x Va l S ta t eV a r ( 1 ) = max( m e s h ma x V al S t at e Va r ( 1 ) , m e s h e le m e n t ( 3 , e ) ) ! n ee de d f o r s t a t i s t i c s
me s h m ax V a lS t at e V ar ( 2 ) = max ( m e sh m a x Va l S ta t e Va r ( 2 ) , m e s h e le m e n t ( 4 , e ) )
enddo
11 0 return
endsubroutine
78
!
! g e t maxi mum co u n t o f s h a r e d e l e m e n t s amo ng c p E le m e n t s a nd
! b u i l d l i s t o f e l e m e n t s s h a r e d b y ea c h n od e i n me sh
!
650 ! ma xN sh ar ed El em s
! sharedElem
!
subroutine m e s h b u i l d s h a r e d E l e m s ( )
us e pr e c , o n l y : p I n t
us e IO
i m p l i c i t n one
integer( p i n t ) e , t , n , j
660 integer( p I n t ) , dimension ( m e sh N n od e s ) : : n o d e c o u n t
integer( p I n t ) , dimension ( : ) , allocatable : : n o d e se e n
allocate( n o d e s e e n ( m a xv a l ( F E Nn o de s ) ) )
n o d e c o u n t = 0 p I n t
do e = 1, mesh NcpElems
t = m e s h e l e m e nt ( 2 , e ) ! my t y p e
n o d e s e e n = 0 p I n t ! r e s e t n od e d u p l i c a t e s
670 do j = 1 , FE Nn ode s ( t ) ! c h e c k e a c h n o de o f e l e m e n t
n = mesh FEasCP( ’ n ode ’ , m e s h e l em e n t (4+ j , e ) )
i f ( a l l ( n o d e s e e n /= n ) ) n o d e c o u n t ( n ) = no d e c o u n t ( n ) + 1 p I n t ! i f FE no de no t y e t en c o u n t e r e d −>c ou nt i t
n o d e s e e n ( j ) = n ! rem em be r t h i s n od e t o be co u n te d a l r e a d y
enddo
enddo
me s h ma x N sh a r ed E l em s = ma x va l ( n o d e co u n t ) ! mo st s h a r e d n od e
680 allocate ( m es h sh a re dE le m ( 1+me sh ma xN sh ar ed Ele ms , me sh Nn od es ) )
me s h sh a re d E le m = 0 p I n t
do e = 1, mesh NcpElems
n o d e s e e n = 0 p I n t
do j = 1 , F E Nn od e s ( m e s h e l em e n t ( 2 , e ) )
n = mesh FEasCP( ’ n ode ’ , m e s h e l em e n t (4+ j , e ) )
i f ( a l l ( n o d e se e n /= n ) ) t he n
me s h s h a r ed E l e m ( 1 , n ) = me s h s h ar e d E l e m ( 1 , n ) + 1 ! c o u n t f o r e a c h n od e t h e c o n n e c t e d e l e m e n t s
me s h sh a re dE l em (1+ m e sh s ha r ed E le m ( 1 , n ) , n ) = e ! s t o r e t h e r e s p e c t i v e e l e m e n t i d
690 e n d i f
n o d e s e e n ( j ) = n
enddo
enddo
d e a l l o c a t e ( no d e se e n )
return
endsubroutine
700
!
! b u i l d up o f I P n e i g h b o r h o o d
!
! a l l o c a t e g l o b a l s
! ipNeighborhood
!
subroutine mesh build ipNeighborhood ()
us e pr e c , o n l y : p I n t
710 i m p l i c i t n one
integer( p I n t ) e , t , i , j , k , l , m, n , a , a n c ho r , n e i g h b o r T y p e
integer( p I n t ) n e i g h b o r , n e i g h b o r i n g E l e m , n e i g h b o r i n g I P
integer( p I n t ) , dimension ( 2) :: matchingElem ! f a c e an d i d o f m at c hi n g e le m
integer( p I n t ) , dimension ( F E max ma xN no d es At IP ) : : l i n k e d N o d e s , &
matchingNodes
l i n k e d N o d e s = 0 p I n t
720 allocate( me s h ip N e i g h b o r h o o d ( 2 , m e sh m a x N ip N e i g hb o r s , m e sh m ax N ip s , m e sh N cp E le m s ) ) ; m e s h i p N e i g h b o r h o o d = 0 p I n t
do e = 1, mesh NcpElems ! l o o p o v e r cp E l em s
t = m e s h e l e m e nt ( 2 , e ) ! g e t el e mT y p e
do i = 1 , F E Nip s ( t ) ! l o o p o v e r I P s o f e l em
do n = 1 , F E Ni pN ei gh bo rs ( t ) ! l o o p o v e r n e i g h b o r s o f IP
n e i g h b o r = F E i p N e i g h b o r ( n , i , t )
79
i f ( neighbor >0) t hen ! i n t r a −element IP
neighboringElem = e
neighboringIP = neighbor
730 else ! n e i g h b o r i n g e l em e n t ’ s IP
neighboringElem = 0 p Int
neighboringIP = 0 p Int
ma t ch in g El e m = m es h f ac e Ma t ch ( e ,−neighbor ) ! g e t f a c e an d CP el e m i d o f f a c e m at ch
i f ( matchingElem (2) >0 p I n t ) t he n ! fo u n d m at ch ?
ne i g h b o r T y p e = m e s h e l e me n t ( 2 , m a t c hi n g E l em ( 2 ) )
l = 0 p I n t
do a = 1 , F E max Nn od esA tI P ( t ) ! f i g u r e my an c h o r n o de s o n c o n n e c t i n g f a c e
an c h o r = F E n od e s At I P ( a , i , t )
i f ( a ny ( F E nod eO nF ac e (: , −n e i g h b o r , t ) == a n c h o r ) ) t he n ! i p a n ch o r s i t s o n f a c e ?
740 l = l +1 p I n t
l i n k e d N o d e s ( l ) = m e s h e l em e n t (4+ a n c ho r , e ) ! FE i d o f an c h o r n od e
e n d i f
enddo
neighborIP : d o j = 1 , F E N i p s ( n e i g h b o r T y p e ) ! l o o p o v e r n e i g h b o r i n g i p s
m = 0 p I n t
matchingNodes = 0 p Int
do a = 1 , F E ma xN n od e sA t IP ( n e i g h b o r T y p e ) ! c h e ck ea c h a n c h o r no d e o f t h a t i p
an c h o r = FE n o d e s A t I P ( a , j , ne i g h b o r T y p e )
750 i f ( a nc h or /= 0 p I n t . a nd . & ! v a l i d a nc h or n od e
an y ( F E no d eO n Fa c e ( : , m at c h i n gE l e m ( 1 ) , n e i g h b o r T y p e ) == an c h o r ) ) t he n
m = m+1 p I n t
ma t ch i ng N o de s (m) = m es h e l em e n t (4+ a nc h o r , m a tc h in g El e m ( 2 ) ) ! FE i d o f n e i g h b o r ’ s a n c h o r n o de
e n d i f
enddo
i f (m /= l ) cycle neighborIP ! t h i s i p h as w r on g c o u n t o f a n c h o r s o n f a c e
do a = 1 , l
i f ( a l l ( m a tc h i ng N o de s /= l i n k e d N o d e s ( a ) ) ) cycle neighborIP
enddo
760 n e i g h b o r i n g E l e m = ma t ch i n gE l e m ( 2 ) ! s u r v i v a l o f t h e f i t t e s t
neighboringIP = j
e x i t neighborIP
enddo neighborIP
e n d i f ! e nd o f v a l i d e x t e r n a l m at ch i ng
e n d i f ! e nd o f i n t e r n a l / e x t e r n a l m at ch i ng
me s h ip N e i g h b o r h o o d ( 1 , n , i , e ) = ne i g h b o r i n g E l e m
me s h ip N e i g h b o r h o o d ( 2 , n , i , e ) = n e i g h b o r i n g I P
enddo
enddo
770 enddo
return
endsubroutine
!
! a s s i gn m e n t o f c o o r d i n a t e s f o r s u bn o d es i n ea c h cp el e m en t
!
! a l l o c a t e g l o b a l s
! subNodeCoord
780 !
subroutine mesh build subNodeCoords ()
us e pr e c , o n l y : p I n t , p R e a l
i m p l i c i t n one
integer( p I n t ) e , t , n , p
allocate( m e sh s u bN o de C oo r d ( 3 , m es h max N no de s+me sh ma xN su bN od es , m e sh Nc p El e ms ) ) ; me s h su b No d eC o or d = 0. 0 p R e a l
790 do e = 1, mesh NcpElems ! l o o p o v e r cp E l em s
t = m e s h e l e m e nt ( 2 , e ) ! g e t el e mT y pe
do n = 1 , F E Nno de s ( t ) ! l o o p o v e r n o d es o f t h i s e l e m e n t t y p e
me sh s ub No de Co or d ( : , n , e ) = me sh n od e ( : , m esh FE as CP ( ’ no de ’ , m e sh e l em e n t( 4+n , e ) ) )
enddo
do n = 1 , FE Ns ubN ode s ( t ) ! n ow f o r t h e t r u e s u b n o d e s
do p = 1 , F E Nip s ( t ) ! l o o p th r o u g h p o s s i b l e p a r e n t n o d es
i f ( F E s ub N o de P a re n t ( p , n , t ) >0 ) & ! v a l i d p a r e n t no d e
me sh s ub No de Co or d ( : , n+FE Nn ode s ( t ) , e ) = &
me sh s ub No de Co or d ( : , n+FE Nn ode s ( t ) , e ) + &
800 me sh n od e ( : , me sh FEa sCP ( ’ n od e ’ , m e sh el em e n t (4+ FE s u bN o de Pa r en t ( p , n , t ) , e ) ) ) ! a dd up p a r e n t s
enddo
me sh s ub No de Co or d ( : , n+FE Nn ode s ( t ) , e )= me sh su b No de Co or d ( : , n+FE N no des ( t ) , e ) / c ou nt ( F E su bN od e Pa re nt ( : , n , t )>0 )
enddo
enddo
return
endsubroutine
80
!
! c a l c u l a t i o n o f I P vo lu me
810 !
! a l l o c a t e g l o b a l s
! ip V ol um e
!
subroutine m e s h b u i l d i p V o l u m e s ( )
us e pr e c , o n l y : p I n t
us e math , o n l y : math volTetrahedron
i m p l i c i t n one
820 integer( p I n t ) e , f , t , i , j , k , n
integer( p I n t ) , parameter : : N t r i a n g l e s = FE Ni pF a ce No de s−2! ea c h i n t e r f a c e i s m ade u p o f t h i s many t r i a n g l e s
logical( p I n t ) , dimension ( m es h max Nn o de s+me sh ma xN su bN od es ) : : g r a v i t y N o d e ! f l a g L i s t to f i n d s u b n od e s d e t e r m i n i n g CoG
r e a l ( p Re a l ) , dimension ( 3 , m es h max N no de s+me sh ma x Ns ub N od es ) : : g r a v i t y N o d e P o s ! co o r d . o f s u bn o d e s d e t e r m i n i n g CoG
r e a l ( p Re a l ) , dimension ( 3 , F E N ip F ac e N od e s ) : : n Po s ! c o o rd . o f n o d es o n IP f a c e
r e a l ( p Re a l ) , dimension( N t r i a n g l e s , F E Ni pF a ce No d es ) : : v ol u me ! v ol u me s o f p o s s i b l e t e t r a h e d r a
r e a l ( p Re a l ) , dimension (3) :: centerOfGravity
allocate( m e s h ip V o lu m e ( m e sh ma x Ni ps , me sh N cp E le m s ) ) ; me s h ip V o lu m e = 0. 0 p R e a l
allocate( m e s h i p C e n t e r O f G r a v i t y ( 3 , m e sh ma x Ni ps , m e sh N cp El e ms ) ) ; m e s h i p C e n t e r O f G r a v i t y = 0 . 0 pR e a l
830
do e = 1, mesh NcpElems ! l o o p o v e r c p El e m s
t = m e s h e l e m e nt ( 2 , e ) ! g e t el e mT y p e
do i = 1 , F E Nip s ( t ) ! l o o p o v e r I P s o f e le m
g r a v i t y N o d e = . f a l s e . ! r e s et f l a g L i s t
g r a v i t y N o d e P o s = 0. 0 p R e a l ! r e s e t c o o r d i n a t e s
do f = 1 , FE N ip N ei gh bo rs ( t ) ! l oo p o ve r i n t e r f a c e s o f I P
do n = 1 , F E Ni pF ace No de s ! l o o p o v er n od es o n i n t e r f a c e
g r a v i t y N o d e ( F E su bN o de O nI PF a ce ( n , f , i , t ) ) = . t r u e .
g r a v i t y N o d e P o s ( : , FE su b No d eO n IP F ac e ( n , f , i , t ) ) = m e s h su bN o d eC o or d ( : , F E su b No d eO n IP F ac e ( n , f , i , t ) , e )
840 enddo
enddo
do j = 1 , me sh ma xN nod es+me sh max Ns ubN od es−1! w a l k t h r o u g h e n t i r e f l a g L i s t e x c e p t l a s t
i f ( g r a v i t y N o d e ( j ) ) t he n ! v a l i d n od e i n d e x
do k = j +1 , m es h ma xN no d es+m es h max Ns u bN od e s ! w a lk th r o ug h r e m ai n d e r o f l i s t to f i n d d u p l i c a t e s
i f ( g r a v i t y N o d e ( k ) . a n d . a l l ( a b s ( gr a v i t y N o d e P o s ( : , j ) −g r a v i t y N o d e P o s ( : , k ) ) <1 . 0 e −100 p R e a l ) ) t he n
g r a v i t y N o d e ( j ) = . f a l s e . ! d e l e t e f i r s t i n s t a n c e
g r a v i t y N o d e P o s ( : , j ) = 0 . 0 p R e a l
exit ! c o n t i n u e w i t h n e x t s u s p e c t
850 e n d i f
enddo
e n d i f
enddo
c e n t e r O f G r a v i t y = sum ( g r a v it y N od e P o s , 2 ) / c o u nt ( g r av i t y N o d e )
do f = 1 , FE N ip N ei gh bo rs ( t ) ! l oo p o ve r i n t e r f a c e s o f I P an d add t e tr a h e d ra w hi ch c on n ec t t o CoG
f o r a l l ( n = 1 : FE N ipF ac eN od es ) nP os ( : , n ) = me sh su bN od eCo or d ( : , F E sub No deO nI PFa ce ( n , f , i , t ) , e )
f o r a l l ( n = 1 : F E Ni pF ac e No de s , j = 1 : N t r i a n g l e s ) &
! s t a r t a t ea c h i n t e r f a c e n ode a nd b u i ld v a l i d t r i a n g l e s to c o ve r i n t e r f a c e
860 vo l um e ( j ,n ) = ma t h vo l T e t r a h e d r o n ( n Po s ( : , n ) , & ! c a l c v ol um e o f r e s p e c t i v e t e t r a h e d r o n t o CoG
nP os ( : , 1 + mod( n+j −1 , F E Ni p F ac e N od e s ) ) , &
nP os ( : , 1 + mod( n+j −0 , F E Ni p F ac e N od e s ) ) , &
centerOfGravity)
me sh i pV o lu me ( i , e ) = m es h ip Vo lu me ( i , e ) + sum ( vo lu me ) ! a dd c o n t r i b u t i o n f ro m t h i s i n t e r f a c e
enddo
me sh i pV o lu me ( i , e ) = m es h ip Vo lu me ( i , e ) / F E Ni pF ac eN od es ! r e n o r m a l i z e w it h in t e rf a ce N o de N um du e
m e sh i pC e n t e r O f G r av i t y ( : , i , e ) = c e n t e r O f G r a v i t y ! t o l o o p o v e r t he m
enddo
enddo
870 return
endsubroutine
!
! c a l c u l a t i o n o f I P i n t e r f a c e a r ea s
!
! a l l o c a t e g l o b a l s
! i p A r e a , i p A r e a N o r m a l
!
880 subroutine mesh build ipAreas ()
us e pr e c , o n l y : p I n t , p R e a l
us e mat h
i m p l i c i t n one
integer( p I n t ) e , f , t , i , j , n
integer( p I n t ) , parameter : : N t r i a n g l e s = FE N ip Fa ce No d es −2! ea c h i n t e r f a c e i s m ade up o f t h i s man y t r i a n g l e s
r e a l ( p Re a l ) , dimension ( 3 , F E Ni p F ac e N od e s ) : : n Po s ! c o o r d i n a t e s o f n od e s on I P f a c e
81
r e a l ( p Re a l ) , dimension ( 3 , N t r i a n g l e s , F E Ni pF a ce No d es ) : : n o rm a l
890 r e a l ( p Re a l ) , dimension ( N t r i a n g l e s , F E Ni p Fa ce N od e s ) : : a r e a
allocate( me s h ip A r e a ( m e s h ma x N i p Ne i g h b or s , me s h max N ip s , m e sh N c pE l em s ) ) ; me s h i p A r e a = 0. 0 p R e a l
allocate( me s h i p Ar e a N o rm a l ( 3 , m e s h ma x Ni p N ei g h bo r s , m e sh ma x Ni ps , me sh N cp E le m s ) ) ; m e s h i pA r e a N or m a l = 0. 0 p R e a l
do e = 1, mesh NcpElems ! l o o p o v e r cp E l em s
t = m e s h e l e m e nt ( 2 , e ) ! g e t e l em T yp e
do i = 1 , F E Nip s ( t ) ! l o o p o v e r I P s o f e le m
do f = 1 , FE N ip N ei gh bo rs ( t ) ! l o o p o v er i n t e r f a c e s o f I P
f o r a l l ( n = 1 : FE N ipF ac eN od es ) nP os ( : , n ) = me sh su bN od eCo or d ( : , F E sub No deO nI PFa ce ( n , f , i , t ) , e )
900 f o r a l l ( n = 1 : F E Ni pF ac e No de s , j = 1 : N t r i a n g l e s )
! s t a r t a t ea c h i n t e r f a c e n ode a nd b u i ld v a l i d t r i a n g l e s to c o ve r i n t e r f a c e
no r m a l ( : , j , n )= m a t h v e c t o r p r o d u c t ( n Po s ( : , 1 + mod( n+j −1 , FE N i p Fa c e N od e s )) −nP os ( : , n ) ,&
nP os ( : , 1 + mod( n+j −0 , F E Ni p F ac e N o de s )) −nP os ( : , n ) ) ! c a l c t h e i r n o rm a l v e c t o r s
a re a ( j , n ) = d s q r t ( su m( no r ma l ( : , j ,n ) n or m al ( : , j , n ) ) ) ! a nd a r e a
end forall
f o r a l l ( n = 1 : F E Ni pF a ce No d es , j = 1 : N t r i a n g l e s , a r e a ( j ,n ) >0 . 0 p R e a l ) &
no r m a l ( : , j , n ) = no r m a l ( : , j , n ) / a r e a ( j , n ) ! make u n i t n o rm a l
me s h i p A r e a ( f , i , e ) = sum ( a r e a ) / ( F E N ip F a c eN o d e s 2. 0 p R e a l ) ! a r ea o f p a r a l l e l o g r a m s i n s t e a d o f t r i a n g l e s
910 m es h i p A r ea N o r m al ( : , f , i , e ) = sum( s um ( n o rm a l , 3 ) , 2 ) / c ou n t ( a r e a >0 . 0 p R e a l ) ! a v e r a g e o f a l l v a l i d n o r m a l s
enddo
enddo
enddo
return
endsubroutine
!
! w r i t e s t a t i s t i c s r e g a r d i n g i n p u t f i l e p a r s i n g
920 ! t o t h e o u t p u t f i l e
!
!
subroutine m e s h t e l l s t a t i s t i c s ( )
us e pr e c , o n l y : p I n t
us e math , o n l y : ma t h ra ng e
us e IO , o n l y : I O e r r o r
us e debug , o n l y : verboseDebugger
930 i m p l i c i t n one
integer( p I n t ) , dimension ( : ,: ) , allocatable : : m esh Ho mog Mic ro
character(len =64) f mt
integer( p I n t ) i , e , n , f , t
i f ( mesh maxValStateVar(1) <1 p I n t ) call I O e r r o r (1 1 0 ) ! n o h o m o g e n i z a t i o n s p e c i f i e d
i f ( mesh maxValStateVar(2) <1 p I n t ) call I O e r r o r (1 2 0 ) ! n o m i c r o s t r u c t u r e s p e c i f i e d
allocate ( me sh Hom ogM ic ro ( m es h ma x Va lS ta t eV ar ( 1) , m e sh m ax Va l St at eV a r ( 2 ) ) ) ; me sh Hom og Mic ro = 0 p I n t
940 do e = 1, mesh NcpElems
i f ( m e s h e l e m e n t ( 3 , e ) <1 p I n t ) call I O e r r o r ( 1 10 , e ) ! n o h o m o g e n i z a t i o n s p e c i f i e d
i f ( m e s h e l e m e n t ( 4 , e ) <1 p I n t ) call I O e r r o r ( 1 20 , e ) ! n o h o m o g e n i z a t i o n s p e c i f i e d
me sh Ho mo gM ic ro ( m e s h e l e m e nt ( 3 , e ) , m e s h e l e m e nt ( 4 , e ) ) = &
me sh Ho mo gM ic ro ( m e s h e l e m e nt ( 3 , e ) , m e s h e l e m e nt ( 4 , e ) )+ 1 ! c ou n t c o m b in a t i o ns o f hom og . an d m i c r o s t r u c t u r e
enddo
i f ( verboseDebugger) t hen
! OMP CRIT ICAL ( w r i t e 2 o u t )
write ( 6 , )
950 write ( 6 , ) ’ I n p u t P a r s e r : I P COORDINATES’
write ( 6 , ’ ( a 5 , x , a5 , 3 ( x , a 12 ) ) ’ )’ e le m ’ ,’ I P ’ ,’ x ’ ,’ y ’ ,’ z ’
do e = 1, mesh NcpElems
do i = 1 , F E Nip s ( m es h el em en t ( 2 , e ) )
write ( 6 , ’ ( i 5 ,x , i 5 ,3 ( x , f 1 2 . 8 ) ) ’) e , i , m e s h ip C e n t e r O f G r a v i t y ( : , i , e )
enddo
enddo
write ( 6 , )
write ( 6 , ) ” I n p u t P a r s e r : I P NEIGHBORHOOD”
write ( 6 , )
960 write ( 6 , ” ( a10 , x , a1 0 , x , a10 , x , a3 , x , a13 , x , a1 3) ” )”e le m ” ,” IP ” ,”neighbor” ,” ” ,”elemNeighbor” ,”ipNeighbor ”
do e = 1, mesh NcpElems ! l o o p o v e r c p E le m s
t = m e s h e l e m e nt ( 2 , e ) ! g e t e le m T yp e
do i = 1 , F E Nip s ( t ) ! l o o p ov e r I P s o f e le m
do n = 1 , F E Ni pN ei gh bo rs ( t ) ! l o o p o v e r n e i g h b o r s o f IP
write ( 6 , ” ( i1 0 , x , i 10 , x , i 10 , x , a3 , x , i1 3 , x , i 1 3 )” ) e , i , n , ’−−>’,&
mesh ipNeighborhood(1 ,n , i , e ) , mesh ipNeighborhood(2 , n , i ,e )
enddo
enddo
enddo
82
970 write ( 6 , )
write ( 6 , ) ” I n p u t P a r s e r : ELEMENT VOLUME”
write ( 6 , )
write ( 6 , ” ( a 13 , x , e 15 . 8 ) ” )” t o t a l v ol um e ” , sum ( m e s h ip V ol u m e )
write ( 6 , )
write ( 6 , ” ( a5 , x , a5 , x , a15 , x , a5 , x , a15 , x , a1 6) ” )”e l em ” ,” IP ” ,”volume” ,” f a c e ” ,” a r e a ” ,”−− n or ma l −−”
do e = 1, mesh NcpElems
do i = 1 , F E N i p s ( m e s h e l e m e nt ( 2 , e ) )
write ( 6 , ” ( i 5 ,x , i 5 , x , e 1 5 . 8 ) ” ) e , i , mes h IP vo lu me ( i , e )
do f = 1 , FE Ni pN ei gh bo r s ( me sh e le me nt ( 2 , e ) )
980 write ( 6 , ” ( i3 3 , x , e 15 . 8 , x , 3 ( f 6 . 3 , x ) ) ” ) f , m e s h ip A r e a ( f , i , e ) , m e s h i p Ar e a N o r m a l ( : , f , i , e )
enddo
enddo
enddo
write ( 6 , )
write ( 6 , ) ” I n p u t P a r s e r : SUBNODE COORDINATES”
write ( 6 , )
write ( 6 , ’ ( a5 , x , a5 , x , a15 , x , a15 , x , a20 , 3 ( x , a12 ) ) ’ )’ el em ’ ,’ IP ’ ,’ I P n e i g h b o r ’ ,’ I PF ac eN od es ’ ,’ &
subNodeOnIPFace ’ ,’ x ’ ,’ y ’ ,’ z ’
do e = 1, mesh NcpElems ! l o o p o v e r c p E le m s
990 t = m e s h e l e m e nt ( 2 , e ) ! g e t el e mT y pe
do i = 1 , F E Nip s ( t ) ! l o o p ov e r I P s o f e le m
do f = 1 , FE N ip N ei gh bo rs ( t ) ! l oo p o ve r i n t e r f a c e s o f I P
do n = 1 , F E Ni pF ace No de s ! l o op o v er no d es o n i n t e r f a c e
write ( 6 , ’ ( i5 ,x , i 5 , x , i 15 , x , i 15 , x , i 20 , 3 ( x , f1 2 . 8) ) ’ ) e , i , f , n , F E s ub Nod eOn IP Fac e (n , f , i , t ) ,&
me s h su b No d eC o o rd ( 1 , F E su b No d eO n IP F ac e ( n , f , i , t ) , e ) , &
me s h su b No d eC o o rd ( 2 , F E su b No d eO n IP F ac e ( n , f , i , t ) , e ) , &
me s h su b No d eC o o rd ( 3 , F E su b No d eO n IP F ac e ( n , f , i , t ) , e )
enddo
enddo
1000 enddo
enddo
! OMP END CRIT ICA L ( w r i t e 2 o u t )
e n d i f
! OMP CRIT ICAL ( w r i t e 2 o u t )
write ( 6 , )
write ( 6 , ) ” I n p u t P a r s e r : ST ATIS TIC S”
write ( 6 , )
1010 write ( 6 , ) me s h Ne le m s , ” : t o t a l nu mb er o f e l e m e n t s i n m es h”
write ( 6 , ) me sh N cp El e ms , ” : t o t a l nu mb er o f CP el e m e n t s i n mes h ”
write ( 6 , ) me s h Nno d es , ” : t o t a l nu mb er o f n o de s i n m esh ”
write (6 , ) mesh maxNnodes , ” : max nu mb er o f n o d e s i n a n y CP e l e m e n t ”
write ( 6 , ) me s h max N ip s , ” : max num b er o f I P s i n an y CP e l e m e n t ”
write ( 6 , ) m es h m a xN i p Ne i g hb o r s , ” : m ax num be r o f IP n e i g h b o r s i n a ny CP e l e m e n t ”
write ( 6 , ) me sh ma xN su bN od es , ” : max num be r of ( a d d i t i o n a l ) s ub n od es i n an y CP el e me n t ”
write ( 6 , ) me s h ma xN s h ar e dE l em s , ” : max num be r o f CP e l e m e n t s s h a r i n g a no de ”
write ( 6 , )
write ( 6 , ) ” I n p u t P a r s e r : HOMOGENIZATION/MICROSTRUCTURE”
1020 write ( 6 , )
write (6 , ) mesh maxValStateVar (1 ) , ” : maximum h o m o g e n i z a t i o n i n d e x ”
write (6 , ) mesh maxValStateVar (2 ) , ” : maximum m i c r o s t r u c t u r e i n d e x ”
write ( 6 , )
write (fmt ,” ( a , i 5 , a ) ” )” ( 9 ( x ) , a2 , x , ” , mesh maxValStateVar ( 2) , ” ( i 8 ) ) ”
write ( 6 , f mt )”+−”, m a th ra ng e ( m e s h ma x Va l St a t eV a r ( 2 ) )
write (fmt ,” ( a , i 5 , a ) ” )” ( i 8 , x , a2 , x , ” , mesh maxValStateVar ( 2) , ” ( i 8 ) ) ”
do i =1,mesh maxValStateVar(1) ! l o o p o v e r a l l ( p o s s i b l y a s s i g n e d ) h o m o g e n i z a t i o n s
write ( 6 , f mt ) i ,”|”, m es h Homo gM icr o ( i , : ) ! l o op o v e r a l l ( p o s s i b l y a s s i g n e d ) m i c r o s t r c u t u r e s
enddo
1030 write ( 6 , )
call f l u s h ( 6 )
! OMP END CRIT ICA L ( w r i t e 2 o u t )
d e a l l o c a t e ( m es h H om ogM ic ro )
return
endsubroutine
END MODULE mes h
83
Listing A.4: makefile
c p s p e c t r a l . o u t : m p i e s p e c t r a l . o CPFEM. a
ifort −o c p s p e c t r a l . o u t m p i e s p e c t r a l . o CPFEM . a l i b f f t w 3 t h r e a d s . a\
l i b f f t w 3 . a c o n s t i t u t i v e . a a dv an ce d . a b a s i c s . a −l p t h r e a d
m p i e s p e c t r a l . o : m p i e s p e c t r a l . f 90 CPFEM. o
ifort −c−O3 −hea p−a r r a y s 5 00 00 00 0 0 m p i e s p e c t r a l . f 9 0
CPFEM . a : CPFEM . o
a r r c CPFEM. a h o m og e n iz a t io n . o h om o ge n iz at i on R G C . o h o m o g e n i z a t i o n is o s t r a i n . o \
c r y s t a l l i t e . o CPFEM. o c o n s t i t u t i v e . o
CPFEM . o : CPFEM . f 9 0 h o m o g e n i z a t i o n . o
ifort −c−O3 −hea p−a r r a y s 5 00 00 0 00 0 CPFEM . f9 0
h o m o g e n i z a t i o n . o : h o m o g e n i z a t i o n . f 9 0 h o m o g e n i z a t i o n i s o s t r a i n . o h o m o ge n i z a ti o n R G C . o c r y s t a l l i t e .o
ifort −c−O3 −hea p−a r r a y s 50 0 0 00 0 0 0 h o m o g e n i z a t i o n . f 9 0
ho m og en iz at i on R GC . o : ho m og en iz a ti on R GC . f 9 0 c o n s t i t u t i v e . a
ifort −c−O3 −hea p−a r r a y s 5 00 00 0 00 0 ho m og e ni z at i on R GC . f 9 0
h o m o g e n i z a t i o n i s o s t r a i n . o : h o m o g e n i z a t i o n is o s t r a i n . f 9 0 b a s i c s . a a d va n ce d . a
ifort −c−O3 −hea p−a r r a y s 5 00 00 00 0 0 h o m o g e n i z a t i o n i s o s t r a i n . f 9 0
c r y s t a l l i t e . o : c r y s t a l l i t e . f9 0 c o n st i t u t iv e . a
ifort −c−O3 −hea p−a rr a ys 5 00 000 00 0 c r y s t a l l i t e . f 90
constitutive .a: constitutive .o
a r r c c o n s t i t u t i v e . a c o n s t i t u t i v e . o c o n s t i t u t iv e t i t a n mo d . o c o n s t i t u t i v e n o n l o c a l . o \
c o n s t i t u t i v e d i s l o t w i n . o c o n s t i t u t i v e j 2 . o c o n s t i t u t i v e p h e n o p o w e r l a w . o b a s i c s . a a d va n ce d . a
c o n s t i t u t i v e . o : c o n s t i t u t i v e . f 90 c o n s t i t u t i ve t i t a n mo d . o c o n s t i t u t i v e n o n l o c a l . o\
c o n s t i t u t i v e d i s l o t w i n . o c o n s t i t u t i v e j 2 . o c o n s t i t u t i v e p h e n o p o w e r l a w . o
ifort −c−O3 −hea p−a rr a y s 50 00 00 00 0 c o n s t i t u t i v e . f 90
constitutive titanmod. o: constitutive titanmod .f90 basics .a advanced .a
ifort −c−O3 −hea p−a r r ay s 5 00 00 00 00 c o n s t i t u t i v e t i t a n m o d . f 9 0
c o n s t i t u t i v e n o n l o c a l . o : c o n s t i t u t i v e n o n l o c a l . f 9 0 b a s i c s . a a dv an c ed . a
ifort −c−O3 −hea p−a rr a y s 50 00 00 00 0 c o n s t i t u t i v e n o n l o c a l . f 90
c o n s t i t u t i v e d i s l o t w i n . o : c o n s t i t u t i v e d i s l o t w i n . f 90 b a s i c s . a a d va nc ed . a
ifort −c−O3 −hea p−a rr a y s 5 00 00 00 00 c o n s t i t u t i v e d i s l o t w i n . f9 0
c o n s t i t u t i v e j 2 . o : c o n s t i t u t i v e j 2 . f 90 b a s i c s . a a d va nc ed . a
ifort −c−O3 −hea p−a rr a y s 5 00 00 00 00 c o n s t i t u t i v e j 2 . f 9 0
c o n s t i t u t i v e p h e n o p o w e r l a w . o : c o n s t i t u t i v e p h e n o p o w e r l a w . f 90 b a s i c s . a a d v an c ed . a
ifort −c−O3 −hea p−a r r a y s 5 0 00 00 0 00 c o n s t i t u t i v e p h e n o p o w e r l a w . f 90
ad va nc e d . a : l a t t i c e . o
a r r c a dv a n ce d . a F E s o l v i n g . o me sh . o m a t e r i a l . o l a t t i c e .o
l a t t i c e . o : l a t t i c e . f9 0 m at e r i al . o
ifort −c−O3 −hea p−a r r a y s 5 00 00 0 00 0 l a t t i c e . f 9 0
m a t e r i a l . o : m a t e r i a l . f9 0 m esh . o
ifort −c−O3 −hea p−a r r a y s 5 00 00 0 00 0 m a t e r i a l . f 90
mes h . o : me sh . f 90 F E s o l v i n g . o
ifort −c−O3 −hea p−a r r a y s 5 00 00 0 00 0 mes h . f 9 0
F E s o l v i n g . o : F E s o l v i n g . f 9 0 b a s i c s . a
ifort −c−O3 −hea p−a r r a y s 50 0 00 0 00 0 F E s o l v i n g . f 9 0
b a s i c s . a : d eb ug . o ma th . o
a r r c b a s i c s . a de b u g . o mat h . o nu m e r i c s . o IO . o m p i e s p e c t r a l i n t e r f a c e . o p re c . o
de b ug . o : d eb u g . f9 0 n u m e r i c s . o
ifort −c−O3 d e bu g . f 9 0
mat h . o : m at h . f 9 0 n u m e r i c s . o
ifort −c−O3 ma th . f 9 0
n u m e r i c s . o : n u m e r i c s . f9 0 IO . o
ifort −c−O3 nu m e r i c s . f 9 0
IO . o : IO . f 9 0 m p i e s p e c t r a l i n t e r f a c e . o
ifort −c−O3 I O . f 9 0
m p i e s p e c t r a l i n t e r f a c e . o : m p i e s p e c t r a l i n t e r f a c e . f 90 p r ec . o
ifort −c−O3 m p i e s p e c t r a l i n t e r f a c e . f 90
p r e c . o : p r e c . f 90
ifort −c−O3 pr e c . f 9 0
84
B Problem set-up example files
Listing B.1: 3x3x3x5.geom
r e s o l u t i o n a 3 b 3 c 3
d i m e n s i o n x 1 . 5 y 1 . 0 z 2 . 0
homogenization 1
1
1
3
1
2
3
4
4
4
5
5
1
1
2
2
4
2
2
1
3
3
1
3
3
5
5
2
Listing B.2: example loadcase.load
v e l o c i t y g r a d # .0 . 0 . 0 # . 0 . 0 . 0 1 . s t r e s s . 0 # # # .0 # # # # t i me 0 .0 0 0 4 s t e p s 40
l . 0 . 0 . 0 . 0 −1.5230484 e−4−0 .0 17 45 24 . 0 0 . 0 17 4 5 2 4 −1.5230484 e−4 s # # # # # # # # # t 9 0 . n 9 0
v e l o c i t y g r a d 0 . 0 . 0 . 0 # . 0 . 0 . 0 −.00 1 s # # # # . 0 # # # # t 3 0 0. i n c s 30 0
v e l o c i t y g r a d # .0 . 0 . 0 # . 0 . 0 . 0 . 0 01 s . 0 # # # . 0 # # # # d e lt a 3 0 0 . i n c re m e n ts 30 0
85
Listing B.3: material.config
#−−−−−−−−−−−−−−−−−−−#
<ho m og en i za ti on >
#−−−−−−−−−−−−−−−−−−−#
[ SX ]
type isostrain
N g r a i n s 1
#−−−−−−−−−−−−−−−−−−−#
<m i c r o s t r u c t u r e >
#−−−−−−−−−−−−−−−−−−−#
[ G r a in 0 0 1 ] # m i c r o s t r u c t u r e 1
crystallite 1
( c o n s t i t u e n t ) p ha s e 1 t e x t u r e 1 f r a c t i o n 1 . 0 # on e c o n s t i t u e n t w i th f r a c t i o n = 100%
[ G r a in 0 0 2 ] # m i c r o s t r u c t u r e 2
crystallite 1
( c o n s t i t u e n t ) p ha s e 1 t e x t u r e 2 f r a c t i o n 1 . 0
[ G r a i n 0 0 3 ]
crystallite 1
( c o n s t i t u e n t ) p ha s e 1 t e x t u r e 3 f r a c t i o n 1 . 0
[ G r a i n 0 0 4 ]
crystallite 1
( c o n s t i t u e n t ) p ha s e 2 t e x t u r e 4 f r a c t i o n 1 . 0
[ G r a i n 0 0 5 ]
crystallite 1
( c o n s t i t u e n t ) p ha s e 2 t e x t u r e 5 f r a c t i o n 1 . 0
#−−−−−−−−−−−−−−−−−−−#
<crystallite>
#−−−−−−−−−−−−−−−−−−−#
[ a l l ]
( o u t p u t ) p h a s e
( o u t p u t ) vo l u m e
(output) orientation
( o ut p u t ) e u l e r a n g l e s
( o ut p u t ) g r a i n r o t a t i o n # d e vi a t i o n f ro m i n i t i a l o r i e n t a t i o n a s a x i s (1 −3) an d a n g l e i n d e g r e e ( 4 )
( o u t p u t ) f # de f o r m a t i o n g r a d i e n t t e n s o r ; sy n on y ms : ” d e f g r a d ”
( o u t p u t ) f e # e l a s t i c d e f o r m a t i o n g r a d i e n t t e n s o r
( o u t p u t ) f p # p l a s t i c d e f o r m a t i o n g r a d i e n t t e n s o r
( o ut p ut ) e e # e l a s t i c s t r a i n a s Gr ee n−La g ra n g e t e n s o r
( o u t p u t ) p # f i r s t P i o l a −K i c h h o f f s t r e s s t e n s o r ; sy n on ym s : ” f i r s t p i o l a ” , ” 1 s t p i o l a ”
( o u t p u t ) s # s e c o n d P i o l a −K i c h h o f f s t r e s s t e n s o r ; s y no n ym s : ” t s t a r ” , ” s e c o n d p i o l a ” , ” 2 n d p i o l a ”
#−−−−−−−−−−−−−−−−−−−#
<phase>
#−−−−−−−−−−−−−−−−−−−#
[ A lu m in um p he n op ow er l aw ] # p h as e 1 , g r a i n s 1 , 2 , an d 3 c o n s i s t o f t h i s p h as e
# s l i p o n l y
c o n s t i t u t i o n ph en op ow e rl aw # p he no po we rl a w , u s ed f o r s i m u l a t io n s 8 . 1 an d 8 . 3
( o ut pu t ) r e s i s t a n c e s l i p
( o ut p ut ) s h e a r r a t e s l i p
( o ut pu t ) r e s o l v e d s t r e s s s l i p
( o ut p u t ) t o t a l s h e a r
( o ut p ut ) r e s i s t a n c e t w i n
( o u tp u t ) s h e a r r a t e t w i n
(output) resolvedstress twin
( o ut p ut ) t o t a l v o l f r a c
lattice structure fcc
N s l i p 12 0 0 0 # pe r f a m i l y
Nt wi n 0 0 0 0 # pe r f a m i l y
c1 1 17 0. 1 7 e3 # c op p er v a r i a b l e s
c1 2 11 4 . 9 2 e 3
c4 4 60 . 9 8 e 3
gdot0 slip 1.0
n s l i p 10
t a u 0 s l i p 1 0. 0 # p er f a m i l y
t a u s a t s l i p 63 e6 # pe r f a mi l y
w 0 s l i p 2 . 2 5
g d o t 0 t w i n 0 . 0 0 1
n t w i n 20
t a u 0 t w i n 31 e 6 # p e r f a m i l y
s p r 0 # p us h−up f a c t o r f o r s l i p s a t u r a t i o n du e t o t w i nn i n g
86
t w i n b 0
t w i n c 0
t w i n d 0
t w i n e 0
h0 slipslip 0
h0 sliptwin 0
h0 twinslip 0
h0 twintwin 0
i n t e r a c t i o n s l i p s l i p 1 1 1 .4 1 .4 1 .4 1 .4
i n t e r a c t io n s l i p t w i n 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
i n t e r a c t io n t w i n s l i p 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
i n t e r a c t i o n tw i n t w i n 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
relevantResistance 1
[ A l u m i n u m J2 i s o t r o p i c ] # p ha s e 2 , g r a i n s 4 and 5 c o n s i s t o f t h i s p h a se
c o n s t i t u t i o n j2 # J2 p l a s t i c i t y , u se d f o r s i m ul a t i o n 8 .2
( o ut p ut ) f l o w s t r e s s
( o ut p ut ) s t r a i n r a t e
c1 1 11 0 . 9 e 9
c1 2 58 . 3 4 e 9
taylorfactor 3
ta u 0 31 e 6
gd o t 0 0 . 0 0 1
n 20
h0 7 5 e6
t a u s a t 63e 6
w0 2 . 2 5
atol resistance 1
#−−−−−−−−−−−−−−−−−−−#
<texture>
#−−−−−−−−−−−−−−−−−−−#
[ G r a i n 0 0 1 ] # na me s a r e a r b i t r a r y , b u t as e ac h g r a i n h a s i t s own t e x t u r e t h e s am e nam es a r e us e d
( g a us s ) p h i 1 3 59 . 12 1 45 2 P h i 8 2 .3 19 4 71 P hi 2 3 47 . 72 9 53 5 s c a t t e r 0 f r a c t i o n 1
[ G r a i n 0 0 2 ] # te x t u r e 2
( g au s s ) p h i1 2 69 . 25 39 6 7 P hi 10 5 .3 7 99 19 P hi 2 1 73 . 02 92 8 4 s c a t t e r 0 f r a c t i o n 1
[ G r a i n 0 0 3 ]
( g a us s ) p h i 1 2 6 .5 5 15 3 5 P hi 1 71 .6 0 67 5 2 P hi 2 1 24 . 94 9 26 4 s c a t t e r 0 f r a c t i o n 1
[ G r a i n 0 0 4 ]
( g a us s ) p h i 1 1 23 . 20 7 77 4 P h i 12 4 .3 3 95 7 7 P hi 2 4 7. 93 7 74 8 s c a t t e r 0 f r a c t i o n 1
[ G r a i n 0 0 5 ]
( g au s s ) p h i1 3 24 . 18 88 2 5 P hi 10 3 .0 8 92 16 P hi 2 1 60 . 37 36 2 4 s c a t t e r 0 f r a c t i o n 1
87
88
C License information
The copyright of all figures in this work belongs to author or the involved organization, except of
the figures mentioned below. All files were accessed on 14th November 2010.
Fig. 2.1:
File is licensed under the Creative Commons Attribution 3.0 unported license. You are free:
to share - to copy, distribute and transmit the work
to remix - to adapt the work
Under the following conditions:
attribution - You must attribute the work in the manner specified by the author or licensor
(but not in any way that suggests that they endorse you or your use of the work).
The license can be found at: http://creativecommons.org/licenses/by/3.0/deed.en
Source: http://commons.wikimedia.org/wiki/File:Continuum_body_deformation.svg
Fig. 3.1:
File is public domain.
Source: http://commons.wikimedia.org/wiki/File:Close_packing.svg
Fig. 3.2 and fig. 3.2:
Copyright belongs to the uploader, Baszoetekouw, all rights reserved. Redistribution and use in
source and binary forms, with or without modification, are permitted provided that the following
conditions are met:
Redistributions of source code must retain the above copyright notice, with the name of the
uploader, and this list of conditions;
Redistributions in binary form must reproduce the above copyright notice, with the name
of the uploader, and this list of conditions in the documentation and/or other materials
provided with the distribution;
Neither the name of the uploader nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.
Source: http://en.wikipedia.org/wiki/File:Lattice_body_centered_cubic.svg
Source: http://en.wikipedia.org/wiki/File:Lattice_body_centered_cubic.svg
89
90
List of Figures
1.1 Volume element consisting of 50 periodically repeating grains . . . . . . . . . . . 1
2.1 Continuum body shown in undeformed and a deformed configuration . . . . . . . 3
2.2 Behavior of different strain measures for tension and compression . . . . . . . . . 7
3.1 Stacking order of the hcp and the fcc lattice . . . . . . . . . . . . . . . . . . . . 12
3.2 Bcclattice...................................... 12
3.3 Fcclattice ...................................... 12
3.4 Elastic and plastic deformation . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.5 Undistorted lattice compared to a lattice with an edge and a screw dislocation . 15
3.6 Twinnedcrystal ................................... 16
7.1 Volume element consisting of 200 grains discretized by 643FPs ......... 37
7.2 Hexahedral finite element with one integration point . . . . . . . . . . . . . . . 37
7.3 AssemblyoftheVE ................................. 37
8.1 Stress–strain curves of evp5j and mpie spectral v.0.3............... 49
8.2 Displacement field H0,vM at ε33 = 0.00001 .................... 50
8.3 Displacement field H0,vM at ε33 = 0.0004 ..................... 51
8.4 Stress field σvM at ε33 = 0.00001 .......................... 52
8.5 Stress field σvM at ε33 = 0.0004 .......................... 53
8.6 Stress field σvM resulting from pure rotation . . . . . . . . . . . . . . . . . . . . 54
8.7 Stress field σvM resulting from plane strain . . . . . . . . . . . . . . . . . . . . . 56
8.8 Stress field σvM resulting from uniaxial tension . . . . . . . . . . . . . . . . . . 58
91
List of Tables
2.1 Definition of strain measures and behavior for tension and compression . . . . . . 6
2.2 Stress and strain in different configurations . . . . . . . . . . . . . . . . . . . . 10
2.3 Polardecomposition................................. 10
8.1 Properties of the different versions of mpie spectral compared to evp5j ..... 48
Listings
7.1 Example material configuration file . . . . . . . . . . . . . . . . . . . . . . . . . 39
7.2 Summarizedalgorithm................................ 46
A.1 mpie spectral.f90 ................................ 61
A.2 mpie spectral interface.f90 .......................... 68
A.3 mesh.f90 ...................................... 71
A.4 makefile ...................................... 84
B.1 3x3x3x5.geom .................................... 85
B.2 example loadcase.load .............................. 85
B.3 material.config ................................. 86
92
Bibliography
[1] H.-J. Bargel and G. Schulze. Werkstoffkunde. Springer Verlag, Berlin, 7th edition, 2000.
[2] K.-J. Bathe. Finite-Elemente-Methoden. Aus dem Englischen von Peter Zimmermann.
Springer Verlag, Berlin, 2nd edition, 2002.
[3] T. Beth. Verfahren der schnellen Fourier-Transformation. B. G. Teubner, Stuttgart, 1984.
[4] J. P. Boyd. Chebyshev and Fourier spectral methods. Dover, New York, 2001.
[5] S. Brisard and L. Dormieux. FFT-based methods for the mechanics of composites: A general
variational framework. Comp. Mater. Sci., 49:663–671, 2010.
[6] C. M. Brown, W. Dreyer, and W. H. M¨uller. Discrete Fourier transforms and their ap-
plication to stress–strain problems in composite mechanics. A convergence study. Proc. R.
Soc. Lond. A, 458:1967–1987, 2002.
[7] J. W. Christian and S. Mahajan. Deformation twinning. Progress in Materials Science, 39:
1–157, 1995.
[8] S¸. S. Bayin. Mathematical methods in science and engineering. Wiley-Interscience, Hoboken,
2006.
[9] O. F¨ollinger. Laplace- und Fourier-Transformation. H¨uthig, Heidelberg, 1986.
[10] T. Kanit. Notion of representative volume element for heterogeneous materials: Statistical
and numerical approach. PhD thesis, Ecole des mines de Paris, May 2003.
[11] J. K. Knowles. On the representation of the elasticity tensor for isotropic materials. Journal
of elasticity, 39:175–180, 1995.
[12] N. Lahellec, J. C. Michel, H. Moulinec, and P. Suquet. Analysis of inhomogeneous materials
at large strains using fast Fourier transforms. In C. Miehe, editor, IUTAM symposium on
computational mechanics of solid materials at large strains, pages 247–258. Kluwer Academic
Publishers, Dordrecht, 2001.
[13] C. Lanczos. Linear differential operators. D. van Nostrand company limited, London, 1961.
[14] R. A. Lebensohn. N-site modeling of a 3D viscoplastic polycrystal using fast Fourier
transforms. Acta Materalia, 49:2723–2737, 2001.
93
[15] H. Lippman. Mechanik des plastischen Fließens. Springer Verlag, Berlin, 1981.
[16] F. Matteo and S. G. Johnson. The design and implementation of FFTW 3. Proceedings of
the IEEE, 93(2):216–231, 2005. Special issue on “Program generation, optimization, and
platform adaptation”.
[17] J. C. Michel, H. Moulinec, and P. Suquet. A computational scheme for linear and non-linear
composites with arbitrary phase contrast. Int. J. Numer. Meth. Engng., 52:139–160, 2001.
[18] J.C. Michel, H. Moulinec, and P. Suquet. Effective properties of composite materials with
periodic microstructure. A computational approach. Comput. Methods Appl. Mech. Engrg.,
172:109–143, 1999.
[19] H. Moulinec and P. Suquet. A numerical method for computing the overall response of
nonlinear composites with complex microstructure. Comput. Methods Appl. Mech. Engrg.,
157:69–94, 1998.
[20] H. Moulinec and P. Suquet. Comparison of FFT-based methods for computing the response
of composites with highly contrasted mechanical properties. Physica B, 338:58–60, 2003.
[21] T. Mura. Micromechanics of defects in solids. Kluwer Academic Publishers, Dordrecht, 2nd
edition, 1987.
[22] S. Neumann, K. P. Herrmann, and W. H. M¨uller. Fourier transforms - An alternative
to finite elements for elastic–plastic stress–strain analyses of heterogeneous materials. Acta
Mechanica, 149:149–160, 2001.
[23] T. K. Nguyen, K. Sab, and G. Bonnet. Green’s operator for a periodic medium with
traction-free boundary conditions and computation of the effective properties of thin plates.
Int. J. of Solids and Structures, 45:6518–6534, 2008.
[24] E. L. Ortiz. The τmethod. SIAM Journal on Numerical Analysis, 6(2):480–492, 1969.
[25] A. Prakash and R. A. Lebensohn. Simulation of micromechanical behavior of polycrystals:
Finite elements versus fast Fourier transforms. Modelling Simul. Mater. Sci. Eng., 17(6),
2009.
[26] W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery. Numerical recipes in
Fortran 77. The art of scientific computing. Cambridge University Press, Cambridge, 2nd
edition, 1992.
[27] D. Rabenstein. Fortran 90 Lehrbuch. Carl Hanser Verlag, M¨unchen/Wien, 1995.
[28] F. Roters. Advanced material models for the crystal plasticity finite element method. Handed
in November 2010, presumably published in 2011. Habilitationsschrift RWTH Aachen.
[29] F. Roters, P. Eisenlohr, T. R. Bieler, and D. Raabe. Crystal plasticity finite element methods
in material science and engineering. Wiley-VCH, Weinheim, 2010.
94
[30] A.A. Salem, S.R. Kalidindi, and S.L. Semiatin. Strain hardening due to deformation twinning
in α-titanium: Constitutive relations and crystal-plasticity modeling. Acta Materialia, 53
(12):3495–3502, 2005.
[31] R. Sedl´aˇcek. Finite Elemente in der Werkstoffmechanik. Verlag Dr. Hut, M¨unchen, 2009.
[32] L. N. Trefethen. Finite difference and spectral methods for ordinary and partial differential
equations. Unpublished text, 1996. URL http://web.comlab.ox.ac.uk/people/Nick.
Trefethen/pdetext.html.
[33] V. Vinogradov and G. W. Milton. An accelerated FFT algorithm for thermoelastic and
nonlinear composites. Int. J. Numer. Meth. Engng., 67(11):1678–1695, 2009.
[34] W. A. Wall and B. Bornemann. Vorlesungsbegleitendes Skript ”Grundlagenfach Mechanik:
Nichtlineare Kontinuumsmechanik“. TU M¨unchen, WS 2007.
[35] W. A. Wall, L. Wiechert, and S. Tinkl. Vorlesungsbegleitendes Skript ”Nichtlineare Finite-
Element-Methoden“. TU M¨unchen, SS 2009.
[36] E. Werner. Vorlesungsbegleitendes Skript ”Werkstoffkunde 1“. TU M¨unchen, WS 2007.
[37] X. Wu, S. R. Kalidindi, C. Necker, and A. A. Salem. Prediction of crystallographic texture
evolution and anisotropic stress–strain curves during large plastic strains in high purity α-
titanium using a taylor-type crystal plasticity model. Acta Materialia, 55(2):423–432, 2007.
95