analysis of holes and spot weld joints using sub …1029663/fulltext02.pdfthrough a script, using an...
TRANSCRIPT
MASTER’S THESIS2010:179 CIV
Universitetstryckeriet, Luleå
Viktor Larsson
Analysis of holes and spot weld joints using sub models and superelements
MASTER OF SCIENCE PROGRAMME Mechanical Engineering
Luleå University of TechnologyDepartment of Applied Physics and Mechanical Engineering
Division of Solid Mechanics
2010:179 CIV • ISSN: 1402 - 1617 • ISRN: LTU - EX - - 10/179 - - SE
ABSTRACT
Components of press hardened boron steel joined by spot welds can show a brittle behavior during
certain load cases which may lead to crack initiation. To capture cracks in a FEM simulation, the
mesh must be very detailed and if the fully detailed system is modeled it will lead to long and
expensive simulations. The approach to solve this is using a global/local method where the part is
divided into two models. First a coarse mesh is created of the components excluding the small
details and this model is called the global model. The other model is called the local model and
contains a fine mesh of the small details. After simulating the global model one step, displacements
from the global model are transferred to the local. Then the local model is simulated applying these
displacements as boundary conditions during the simulation. In the next step the global model is
updated with the reduced stiffness matrix of the local model, which is returned to the global model
through a superelement.
To develop the method, a simpler model of a component with a hole is used, instead of creating a
model of a spot weld. This model is used to develop a routine to capture cracks near the edge of the
hole. The routine reduces the stiffness matrix of the local model, to get all the stiffness information
of the local model to the nodes shared with the global model, which are called master nodes. This is
done through a series of simulations using the definition of the stiffness matrix coefficients to
retrieve the reduced stiffness matrix; the stiffness coefficient with index ij, is equal to the force at
degree of freedom i, due to the unit displacement of degree of freedom j. In the simulations all
boundary degree of freedoms are constrained not to move except one master node’s degree of
freedom, which is constrained to move a small distance. Also the boundary nodes between this
master node and the surrounding ones are constrained to move. Their displacements are linearly
interpolated from the surrounding master nodes’ displacements.
The tangential stiffness is obtained by calculating the difference in force, before and after the
perturbation of the master node and dividing with the prescribed displacement of the master node.
However, the boundary nodes between the master nodes also have a prescribed displacement and
therefore they will affect the master nodes. The equivalent force is derived by calculating the work
these nodes will perform on the master nodes. The result is that the equivalent force is equal to the
reaction force of the master node multiplied with the interpolation constants from the interpolated
displacement. These equivalent forces are added to the master node’s forces when calculating the
tangential stiffness. The function used to import the superelement into the global model treats the
superelement linearly and this means that the reaction force from the superelement will not be the
correct one. By calculating the difference in the reaction force used and the one that should be used,
it can be compensated by applying external forces equal to this difference.
The results show that that the routine needs to be further tested and developed before it can be
used as a structural mechanics simulation tool for systems with small holes. Especially when the
response of the local model is non-linear, the reduction of the stiffness matrix works poorly. The
method using LS-DYNA to return the local model properties through a superelement is verified
through a script, using an elastic model and decreasing the stiffness in the middle of the simulation.
2
PREFACE
This is the report of my master thesis: “Analysis of holes and spot weld joints using sub models and
superelements”. It has been performed at Luleå University of Technology at the division of Solid
Mechanics. The thesis is part of a research cooperation within the Faste laboratory, between the
division of Solid Mechanics at Luleå University of Technology and Gestamp Hardtech.
I am most grateful I’ve been given the opportunity to do this project, which has been most
interesting and instructive and I hope my work will be useful in future research.
I would like to thank Mats Oldenburg, my supervisor and examiner at the division of Solid
Mechanics, LTU, for his guidance and support through this project. I would also like to thank Göran
Lindkvist at the division of Solid Mechanics, for his aid with all computer-related problems and his
support with LS-DYNA.
3
INDEX 1 INTRODUCTION ............................................................................................................................... 5
1.1 Background ............................................................................................................................. 5
1.2 Recent studies ......................................................................................................................... 5
1.3 Gestamp Hardtech – The Company ........................................................................................ 5
1.4 Scope ....................................................................................................................................... 6
1.5 Restrictions ............................................................................................................................. 6
1.6 Definitions ............................................................................................................................... 6
2 FRAME OF REFERENCE .................................................................................................................... 8
2.1 Fundamentals of the finite element method.......................................................................... 8
2.2 Coon’s Patch............................................................................................................................ 9
2.3 Multiscale analysis ................................................................................................................ 11
2.4 Static condensation ............................................................................................................... 11
2.5 Stiffness calculation in LS-DYNA ........................................................................................... 12
2.6 Boundary nodes .................................................................................................................... 12
2.7 Restarts in LS-DYNA .............................................................................................................. 14
2.8 Superelements ...................................................................................................................... 14
2.9 Substructuring ....................................................................................................................... 14
2.10 Macroelements ..................................................................................................................... 15
2.11 Direct Matrix Input ................................................................................................................ 15
3 METHOD ........................................................................................................................................ 16
3.1 Generate mesh ...................................................................................................................... 16
3.2 Transfer boundary conditions to local model ....................................................................... 17
3.3 Compute stiffness matrix of local model .............................................................................. 17
3.4 Return stiffness matrix to global model ............................................................................... 17
4 RESULTS......................................................................................................................................... 18
4.1 The FEM model ..................................................................................................................... 18
4.2 The mesh of the local model ................................................................................................. 18
4.3 Applying boundary conditions to the local model ................................................................ 19
4.4 Computation of the tangential stiffness matrix of the local model ...................................... 19
4.5 Verification of the theory ...................................................................................................... 20
4.6 Verification of the routine .................................................................................................... 21
4.7 Manual to the script .............................................................................................................. 24
4.8 Flow chart of the script ......................................................................................................... 25
4
5 DISCUSSION ................................................................................................................................... 26
6 CONCLUSIONS AND FUTURE WORK ............................................................................................. 27
7 REFERENCES .................................................................................................................................. 28
APPENDIX A ........................................................................................................................................... 29
APPENDIX B ........................................................................................................................................... 36
5
1 INTRODUCTION Simulating crash-tests with computers is done more frequently due to the large expenses in
manufacturing prototypes to use in experimental crash-tests. The simulation software uses the finite
element method to numerically compute the differential equations in structural problems and
produces therefore approximate solutions. When complex structures are simulated in detail, the
simulation model must be very detailed to capture the behavior during loading.
1.1 Background
Welded joints, like spot welds, are commonly used in the vehicle industry to join components into
larger structures. They are known to be difficult to model and can lead to unreliable results during
simulation. Dimensioning of these joints is often controlled by the load due to crashes and is
therefore a critical parameter to ensure a safety component’s properties. Effective simulation of a
weld joint’s properties is important to do early in the development stage, in order to optimize the
properties of the product.
Spot welds are very small in relation to the components they join together and the physical
properties of the material changes through the spot weld, which makes them very complex to
analyze. The most relevant properties to capture in the simulations are the weakening in the heat
affected zone and the risk of crack initiation.
The weakening is a result of the welding operation. When the material is melted, phase
transformations take place outside the weld plug which leads to a reduced initial yield stress. During
loading this zone is a critical area, with the highest risk of crack initiation. To be able to capture the
crack initiation in a simulation model, the mesh has to be very detailed. Thus, with several spot
welds present, the number of finite elements will be very high. This will lead to long simulation times
and unacceptable increases in costs.
1.2 Recent studies
This thesis is based on an earlier thesis made at Gestamp Hardtech where a sub-model of the spot
weld was developed by Löveborn, [1], using a global/local template. In the global/local method a
coarse mesh is first created of the components excluding the small details. This is called the global
model. Then another model, the local model, is constructed using only a fine mesh of the small
detail. They are connected by transferring either nodal displacements or forces from the global to
the local model. This sub-model is used in post processing without returning any properties to the
global model, in order to evaluate when the weld begins to fail.
There is much work done in the field of spot welds but not with the use of macroelements. This
technique is most often used in FEM analysis of materials with complex microstructure, where the
microstructure is assembled into macroelements by reducing their interior degree of freedoms. For
example Wierer, Šejnoha and Zeman used it to analyze complex wound composite tubes [2] and
Whitcomb and Woo used it to formulate continuum finite elements for textile composites [3].
1.3 Gestamp Hardtech – The Company
Gestamp Hardtech develops press-hardened safety components in hardened boron steel for the
vehicle industry including side impact padding, bumpers and body components. Gestamp Hardtech
is a competence centre for Gestamp press-hardening group, with manufacturing in Luleå, Sweden,
6
Haynrode, Germany, Mason, USA, Kunshan, China and Bilbao, Spain. The development environment
consists mainly of the CAD software I-DEAS and the explicit finite element software LS-DYNA.
1.4 Scope
In the thesis made by Löveborn, [1], the results are only transferred one way, from the global to the
local model, using the results from the global simulation to analyze the effect on the local model.
This is called an uncoupled approach by Wierer, Šejnoha and Zeman in [2]. The effects on the global
model from the local details are often not considered, because the assumption is made that they are
so small they can be neglected.
In this thesis a study will be made to see if it is possible to make a two way connection, also
transferring information from the local model to the global using a superelement. This is called a
coupled approach. It will be done to see if the coupled approach gives more reliable results, while
keeping the simulation time within reasonable limits.
In the coupled approach, the tangential stiffness of the local model is computed using multipoint
constraints and implemented into the global model as a superelement. If the effect on the
component is large, it may not be possible to use the sub-model developed earlier without returning
any information to the global model.
1.5 Restrictions
A simpler model of a hole is used, instead of a spot weld, to develop a method that later also can be
used for models with spot welds. The model can then be used to predict failure and crack
propagation near the edge of the hole.
Another simplification is that only shell elements can be used with the developed routine. Also the
routine to calculate the stiffness matrix of the local model is simplified, using LS-DYNA instead of a
numerical method.
1.6 Definitions
To make the report easier to read, some expressions that are used through the report are briefly
explained.
FEM – finite element method
It is the computational method using numerical approximations to calculate problems in solid
mechanics.
DOF – degrees of freedom
In Cartesian coordinates an object has six degrees of freedom; three translational and three
rotational degrees of freedom in the x-, y- and z-directions. In FEM software, objects can be
constrained not to move in chosen DOFs. This resembles the real world where, for example, one side
of an object can move freely while the other side is clamped on a wall.
Global/local model
In global/local analysis the component analyzed is divided into two simulation models. The global
model is a coarse mesh of the whole component but excludes small details that are deemed not to
affect the overall result too much. The local model contains only a fine mesh of the small details.
7
Sub-model
A sub-model is a complete model that uses the results from the global simulation to analyze the
local model in post-processing.
Superelement
Superelements are a kind of elements that are composed from other elements. They are called
differently depending how they are composed and two types are substructures and macroelements.
Substructure
When the superelements are large parts of a complete structure they are called substructures.
Macroelement
Macroelements are superelements that are composed of smaller simpler elements and can be used
in a mesh like ordinary elements.
Master nodes
The boundary nodes in the local model that have corresponding nodes in the global model are called
master nodes.
Slaved boundary nodes
These are the boundary nodes of the local model that are not master nodes and whose displacements have to be interpolated from the surrounding master nodes’ displacements.
2 FRAME OF REFERENCEHere fundamental theory is explained
holes. The first chapter contains
local model is explained in detail
reduce the stiffness matrix of the local model is derived and how to do restarts in LS
Finally the technique to return the results from the local model to the global model using
superelements is explained.
2.1 Fundamentals of the finite element method
FEM is a computational technique used to obtain approximate solutions of boundary
in engineering. A boundary value problem is a mathematical problem where one or more dependent
variables must satisfy a differential equation everywhere in a known domain of independent
variables and satisfy specific conditions on the boundary of the
physical structure divided into finite elements. The resulting discrete model is called a mesh and
dependent variable of interest is computed
rule that usually can be applied if all the boundary conditions are applied correctly is; the more
nodes used in the domain, the more accurate solution.
A finite element is a discrete volume or surface where specific functions describes, e.g. displacement
or temperature inside the element. The function values are determined using the already computed
values at the nodes. There are several different types of element formulations and they
developed to be more accurate in certain load cases etc
a book with fundamental FEM theory
There are different types of elements developed for different geometries of the domain. The most
common ones are the three node triangular element, the four node quadrilateral element, the four
node tetrahedral element and the hexahedral element consisting of eight nodes, see
Figure 1. From left to right; triangular element, quadrilateral element, node tetrahedral element, hexahedral element.
In FEM software boundary constraints can be applied to the nodes and material
models can be chosen. The material of the simulation model is determined by
e.g. density, young’s modulus and poisons ratio
for a simple elastic model, but with a more advanced material model
material must be assigned.
In FEM-software there are two different time integration algorithms; explicit
integration. In the explicit method internal and external forces are summed at each point and a
nodal acceleration is computed by dividing with the nodal mass. Then the acceleration is integrated
in time to get velocity and displacement
integration scheme is limited to the shortest time it takes a wave to propagate between two nodes
8
FRAME OF REFERENCE Here fundamental theory is explained needed to develop the routine used to analyze
contains fundamentals of FEM and then the procedure used to create the
local model is explained in detail, using Coon’s Patch and the global/local method.
reduce the stiffness matrix of the local model is derived and how to do restarts in LS
ally the technique to return the results from the local model to the global model using
Fundamentals of the finite element method
is a computational technique used to obtain approximate solutions of boundary
A boundary value problem is a mathematical problem where one or more dependent
variables must satisfy a differential equation everywhere in a known domain of independent
variables and satisfy specific conditions on the boundary of the domain. The domain is often a
divided into finite elements. The resulting discrete model is called a mesh and
dependent variable of interest is computed at the element corner points, which are called nodes.
applied if all the boundary conditions are applied correctly is; the more
nodes used in the domain, the more accurate solution.
volume or surface where specific functions describes, e.g. displacement
or temperature inside the element. The function values are determined using the already computed
There are several different types of element formulations and they
developed to be more accurate in certain load cases etc. More detailed information can be found in
book with fundamental FEM theory, like [4] by Hutton.
There are different types of elements developed for different geometries of the domain. The most
common ones are the three node triangular element, the four node quadrilateral element, the four
node tetrahedral element and the hexahedral element consisting of eight nodes, see
rom left to right; triangular element, quadrilateral element, node tetrahedral element, hexahedral element.
n FEM software boundary constraints can be applied to the nodes and material-
models can be chosen. The material of the simulation model is determined by material parameters,
density, young’s modulus and poisons ratio for an isotropic and elastic material
but with a more advanced material model more characteristics of the
software there are two different time integration algorithms; explicit- and implicit time
egration. In the explicit method internal and external forces are summed at each point and a
nodal acceleration is computed by dividing with the nodal mass. Then the acceleration is integrated
displacement. The maximum time step size used with the explicit
integration scheme is limited to the shortest time it takes a wave to propagate between two nodes
needed to develop the routine used to analyze models with
procedure used to create the
using Coon’s Patch and the global/local method. The technique to
reduce the stiffness matrix of the local model is derived and how to do restarts in LS-DYNA is shown.
ally the technique to return the results from the local model to the global model using
is a computational technique used to obtain approximate solutions of boundary value problems
A boundary value problem is a mathematical problem where one or more dependent
variables must satisfy a differential equation everywhere in a known domain of independent
The domain is often a
divided into finite elements. The resulting discrete model is called a mesh and the
at the element corner points, which are called nodes. A
applied if all the boundary conditions are applied correctly is; the more
volume or surface where specific functions describes, e.g. displacement
or temperature inside the element. The function values are determined using the already computed
There are several different types of element formulations and they are
. More detailed information can be found in
There are different types of elements developed for different geometries of the domain. The most
common ones are the three node triangular element, the four node quadrilateral element, the four
node tetrahedral element and the hexahedral element consisting of eight nodes, see Figure 1.
rom left to right; triangular element, quadrilateral element, node tetrahedral element, hexahedral element.
- and damage
material parameters,
lastic material. That is enough
characteristics of the
and implicit time
egration. In the explicit method internal and external forces are summed at each point and a
nodal acceleration is computed by dividing with the nodal mass. Then the acceleration is integrated
size used with the explicit
integration scheme is limited to the shortest time it takes a wave to propagate between two nodes
9
in the model. This is called the Courant condition and because of it, explicit time integration requires
many but quickly solved time steps.
The implicit method assembles the global stiffness matrix, inverts it and multiplies it to the nodal
forces to get the displacements. The advantage of this approach is that the time step can be user
defined. It is not tied to Courant’s criteria but must be small enough for the iterative algorithm to
converge. The disadvantage is the numerical effort it takes to assemble, invert and store the
stiffness matrix. Implicit simulations therefore often consist of a small number of time steps, each
time step demanding a large computational effort.
Explicit analysis is well suited for dynamic simulations such as impact and crash analysis, but for long
duration analyses the implicit method is a better choice.
2.2 Coon’s Patch
Coon’s patch is used to interpolate a surface between four points and in order to use it curves must
be interpolated between the four points, see the lecture material in [5].
A cubic spline is often used to interpolate a curve between two points in space, point A and point B.
The cubic spline is created by adapting a parametric cubic polynomial, as can be seen in equation (1),
between the two points A and B,
� � ���� � ���� � ��� � �. (1)
The function has four unknowns; a1, a2, a3 and a4 and four equations are needed to solve the system
of equations. Therefore it is not enough to use only the point coordinates, but the point derivatives
have to be used as well. The points next to point A and B are used to calculate the derivative using
the central difference method,
�� � �′ � 3���� � 2��� � ��. (2)
The parametric values at the points have to be defined and usually you use discrete values and in
this case the value at point A is set to be μ=0 and at point B: μ=1. These values are put into equation
(1) and (2) for the point coordinates and derivatives and give the four equations:
�� � �. ��′ � ��. �� � �� � �� � �� � �. (3) ��′ � 3�� � 2�� � ��.
The system of equations in equation (3) is expressed in matrix form,
�1 0 00 1 01 1 1 001 0 1 2 3� �� ������� � � ����′����′
�. (4)
To solve for the constants, the matrix in equation (4) is inverted,
10
�� ������� � � 1 0 0 0 1 0 �3 �2 3 0 0�1 2 1 �2 1� � ����′����′
�. (5)
This formulation represents four equations for each dimension and in the three dimensional case it
therefore represents twelve equations. When the constants are solved with the matrix calculation in
equation (5), they are put into the parametric cubic polynomial in equation (1) which gives the
parametric curve between the two points.
Coon’s Patch is a well used and relatively easy way to define a formulation for an interpolated
surface. It is using four curves as boundaries to a closed patch and along these, two parametric
variables have to be defined, for example µ and ν, and the curves have to be orthogonal in the
parameter space. Figure 2 is an example of a surface patch in parameter space and it can be seen
that one parameter is kept constant and the other is varied along each curve.
Figure 2. Four curves defining a surface patch.
At the four corner points the parameter values have to be defined,
P(0,0), P(0,1), P(1,0), P(1,1). (6)
Then curves are created between the points and equation (7) defines which curve that spans
between which points.
P(0, ν) between P(0,0) and P(0,1).
P(1, ν) between P(1,0) and P(1,1). (7)
P(µ, 0) between P(0,0) and P(1,0).
P(µ, 1) between P(0,1) and P(1,1).
To get a formulation for the surface, Coon’s Patch in equation (8) is used where a linear surface
interpolation is made between the curves,
��μ, �� � ��μ, 0��1 � �� � P�μ, 1�� � P�0, ν��1 � μ� � P�1, ν�μ � (8) ��0,0��1 � μ��1 � �� � ��0,1��1 � μ�� � ��1,0�μ�1 � �� � ��1,1�μ�.
11
2.3 Multiscale analysis
Complex structures can often be simplified using multiscale analysis which can reduce the simulation
time. First the whole system, called the global model, is analyzed discarding small details that are
deemed to not affect the overall behavior of the system and a coarser mesh can then be used. In the
next step the small details, called local models, are analyzed separately with a fine mesh using the
results from the global simulation as boundary conditions. This can be done in several steps but if
the analysis consists of two steps it is called global/local analysis in FEM literature, explained by
Felippa in [6].
The boundary conditions applied on the local model from the global simulation results can be of two
different kinds; either displacement- or force boundary conditions. If the displacement method is
used, displacements are interpolated from the global solution. If the force method is used, internal
forces or stresses from the global solution are converted to nodal forces acting on the boundary
nodes of the local model.
2.4 Static condensation
Static condensation is the process of eliminating the internal degrees of freedom of a substructure,
meaning that the stiffness matrices of a substructure are reduced and the master nodes will include
the information of the whole model. This is explained in detail by Raghu in [7]. Equation (9) shows
the relation between displacement and force,
!"#$%& � $'&. (9)
First equation (9) is partitioned into two sets, m (master) set whose DOFs are to be kept in the
reduction process, and the s (slave) set that are reduced,
(")) ")*"*) "** + ,%)%* - � ,')'* -. (10)
Then the slave set can be reduced through some matrix calculations. The lower partition of equation
(10) is
!"*)#$%)& � !"**#$%*& � $'*&. (11)
In equation (11) $%*& is isolated,
$%*& � !"**#.��$'*& � !"*)#$%)&�. (12)
The upper partition of equation (10) is
!"))#$%)& � !")*#$%*& � $')&. (13)
Substituting equation (12) into equation (13) gives
!"))#$%)& � !")*#!"**#.��$'*& � !"*)#$%)&� � $')&. (14)
Equation (14) can be expressed as
�!"))# � !")*#!"**#.�!"*)#�$%)& � $')& � !")*#!"**#.�$'*&. (15)
12
This can be rewritten to its final form
!"/#$%)& � $'/&. (16)
The condensed substructure stiffness matrix !"/# in equation (16) is equal to
!"/# � �!"))# � !")*#!"**#.�!"*)#�.
The associated load vector $'/& in equation (16) is equal to (17)
$'/& � $')& � !")*#!"**#.�$'*&. (18)
When using static condensation in FEM applications the inverse of !"**# isn’t calculated but other
matrix solution methods are used, such as partial factorization and forward reduction. This is due to
the large amount of computer power that is needed to compute a matrix inverse.
2.5 Stiffness calculation in LS-DYNA
Another way to compute the stiffness matrix is using the formal definition of the stiffness coefficient
in equation (19).
Kij=force at DOF i due to unit displacement at DOF j. (19)
The stiffness matrix of the local model is obtained by perturbing the master DOFs, one at a time,
while keeping the others fixed. Each perturbation gives a set of forces at the boundary DOFs that
constitute one column in the stiffness matrix, corresponding to the perturbed DOF. This can be
considered as a numerical application of the direct stiffness method for calculating stiffness
matrices. There is a function in LS-DYNA that uses this technique. It is the card “control implicit
modes”, see the LS-DYNA keyword user’s manual in [8], but it can only be used in linear problems.
To be able to remove interior DOFs in non-linear problems, a routine has to be developed.
To use these methods in non-linear FEM the difference in force, ∆f� and displacement, ∆% between
two time steps must be used to compute the current (tangential) stiffness matrix. Equation (20)
shows the perturbation of %� to get the first column in the stiffness matrix.
2"�� "�� "��"�� "�� "��"�� "�� "��3 4∆%00 5 � 4∆f�∆f�∆f�5 6 "�� � ∆f�/∆%"�� � ∆f�/∆%"�� � ∆f�/∆%. (20)
2.6 Boundary nodes
If there are nodes on the boundary in the local model whose DOFs cannot be retained a special
approach to remove their DOFs is needed, explained by Whitcomb and Woo in [3]. They cannot be
removed with the direct stiffness approach because it would yield an incorrect result. These nodes
have to be removed using interpolation constraints. This is called the enhanced direct stiffness
method, which considers the work done by the boundary nodal forces during displacement due to
the interpolation constraints. It is derived below with subscript m meaning master DOFs to be
retained in the reduced stiffness matrix, subscript s meaning boundary nodes that are slaved to the
master DOFs and will be reduced from the stiffness matrix, u is the displacement and f the force
corresponding to u. The work done by the boundary nodal forces in a linear elastic model is
13
8 � �� �')%) � '*%*�; m=1, number of master DOFs; s=1, number of slaved DOFs. (21)
%* are slaved to %) with interpolation constants T:; expressed in equation (22),
%* � T:;%). (22)
The interpolation equation (22) is inserted into equation (21) expressing the work,
8 � �� �')%) � '*T:;%)�. (23)
The stiffness matrix can be expressed as
"<= � >?@>AB>AC. (24)
But for linear models U=W, which gives
"<= � >?D>AB>AC. (25)
The stiffness relation in equation (25) is inserted into equation (23) that expresses the work done by
the nodes,
"<= � �� E>FB>AC � >FC>AB � >FG>AC H*< � >FG>AB H*=I. (26)
Now the work done by the boundary forces '* is set equal to the work done by equivalent forces J)
at the master DOFs,
�� '*%* � �� J)%). (27)
Then the interpolation relation in equation (22) is inserted into equation (27),
'*T:;%) � J)%). (28)
Equation (28) shows that the equivalent nodal forces are
J) � '*T:; K '* � LMNOP. (29)
The expression for the forces in equation (29) is inserted in the third and fourth terms of the
stiffness relation in equation (26),
>LB>AC � >LC>AB. (30)
From the Maxwell-Betti reciprocity theorem the terms in equation (30) are equal and also the first
two terms in equation (26) are equal due to the same theorem. Therefore equation (26) can be
expressed as
"<= � >FB>AC � >LB>AC . (31)
14
Equation (31) expresses the stiffness matrix in only the partial derivatives of the equivalent slaved
boundary nodal forces working on the master nodes and the master nodal forces, with respect to
the displacement of the master node.
2.7 Restarts in LS-DYNA
There is a restart capability in LS-DYNA allowing analyses to be broken down in stages, see [8]. After
each simulation a restart dump file is created containing all information needed to continue the
analysis. This is useful for many reasons; it makes it possible to post-process the output databases to
discover incorrect simulations in an early stage or finding problems with the model. It can also be
used to modify the analysis; changing boundary conditions, deleting elements, adding or removing
contact surfaces and much more.
There are three different types of restarts in LS-DYNA. A simple restart is when no modifications are
made to the model and is used to continue an analysis made earlier. In a small restart, minor
modifications to the model can be made; boundary conditions can be added, elements or parts can
be deleted and termination time or output frequencies can be changed. These changes are written
into a restart input file to be read along with the restart dump file. The third option is to do a full
restart if many modifications to the model have to be done. Then the full model information needs
to be added to the restart input file, but the new nodal coordinates don’t need to be updated
because the deformation state is extracted from the restart dump file. An extra keyword; “stress
initialization”, needs to be added to the input file and it’s used to choose which parts to be
initialized.
To do a simple restart of stage nn, LS-DYNA R=d3dumpnn is written on the command line, for a small
and full restart i=restart input file is added. To update the stiffness- and mass matrix of the
superelement in the global model a full restart has to be done.
2.8 Superelements
Superelements is a combination of several elements and when assembled may be considered as one
element. There are two different views regarding superelements; “bottom up” or “top down”
explained by Felippa in [6]. In the bottom up view the superelement is built from simpler elements
and used as building blocks like ordinary elements, while the top down view thinks of superelements
as large parts of a complete structure. A superelement built from simpler elements, using the
bottom up view, is called a macroelement and if it is instead a complex assembly of elements
building a part of a structure, using the top down view, it is called a substructure.
2.9 Substructuring
Substructuring was invented by the aerospace industry in the early 1960s to be able to break down
complex systems to smaller components, to make it possible to analyze the system with the limited
computer power they had. It is now most often used in two different contexts. One is when there
are different groups in a company specialized in different components of a system. Substructuring
makes it possible for each group to work on refining, improving or verifying the simulation model of
their part (the interface between the parts must stay reasonably unchanged). Another area of usage
is if there are several identical (or nearly identical) units in a structure which makes it possible to use
one model for those units and save computational time.
15
2.10 Macroelements
Macroelements were invented in the mid 1960s for user convenience, after they are assembled they
are easier to use. They can be used, for example, to model complex materials that are not
homogenous but have periodic patterns. Then only a part of the microstructure needs to be meshed
and a macroelement can be constructed from that part. A larger part of the material can then be
meshed from several macroelements.
2.11 Direct Matrix Input
When the reduced stiffness matrix of the local model has been calculated, it must be implemented
into the global model. It is done writing the stiffness matrix into a file of DMIG format compatible
with NASTRAN, see [9], which is read by a “Direct Matrix Input” keyword which exists in LS-DYNA,
see [8]. This element consisting only of the stiffness- and mass matrix is called a superelement. It is
assumed that LS-DYNA treats the superelement as a linear element, which means that the imported
stiffness is treated as an elastic stiffness, shown in Figure 3.
If the local tangential stiffness matrix is calculated at a point where the displacements are ur, then
the reaction forces applied to the global model from the local model will be -Kt u. That will lead to a
drastic change in displacement because the FEM program will update the displacements in the next
time step as if the stiffness of the superelement always had been Kt.
To compensate for that change in reaction force, an outer load of magnitude – F (ur) + Kt ur must be
applied to the nodes in the global model to balance this change. Then the reaction forces affecting
the nodes due to the stiffness of the local model will be -F (ur) - Kt(u-ur), which are the forces that
would have been applied, if the stiffness of the superelement had been treated as a tangential
stiffness.
Tangential stiffness treated as elastic
stiffness Kt ur
F (ur)
ur
F
u
Tangential stiffness
(K )
Figure 3. The figure shows a sketch of the relation between deformation and force of a material.
3 METHOD In this chapter the process of developing the routine is described, dividing the work in
shown in Figure 4. Every step has been preceded by literature
program written in FORTRAN and Python.
Figure 4. A flowchart of the process to create the final program
3.1 Generate mesh
It is decided to generate the mesh wi
in the global model with the superelement containing the local model
use Coon’s patch as the interpolation method
method and the resulting mesh follows the rest of the
first derivative in the corner points.
either using coon’s patch to interpolate
the surface. The idea to project a circle
interpolate points using Coon’s patch already are
Due to the hole the geometry cannot be divided into areas
requirement of using Coon’s Patch. A different approach has to be made in order to get surface
patches with four edges. It is done by dividing the geometry into four or e
Figure 5.
The curve defining the edge becomes more exact the more nodes you have to inter
therefore the alternative to divide the geometry into eight surface patches is used to get a more
exact representation of the hole.
Figure 5. The figure shows two different ways to
geometry including a hole. The circles represent master nodes.
16
of developing the routine is described, dividing the work in
step has been preceded by literature studies and the final product is the
program written in FORTRAN and Python.
flowchart of the process to create the final program.
decided to generate the mesh with a program created in FORTRAN and to replace four elements
in the global model with the superelement containing the local model. Then the decision
use Coon’s patch as the interpolation method, to create the local mesh. That is because
method and the resulting mesh follows the rest of the structure nicely, due to the continuity of the
first derivative in the corner points. The hole can then be created using the middle node as center,
g coon’s patch to interpolate points along the edge of the hole or projecting
The idea to project a circle is discarded, to simplify the program as the routines to
ints using Coon’s patch already are written.
the hole the geometry cannot be divided into areas closed by four edges
requirement of using Coon’s Patch. A different approach has to be made in order to get surface
patches with four edges. It is done by dividing the geometry into four or eight surface patches as in
The curve defining the edge becomes more exact the more nodes you have to inter
therefore the alternative to divide the geometry into eight surface patches is used to get a more
xact representation of the hole.
wo different ways to create surface patches defined by four edges of a
geometry including a hole. The circles represent master nodes.
of developing the routine is described, dividing the work in different steps
studies and the final product is the
th a program created in FORTRAN and to replace four elements
Then the decision is made to
because it is a basic
nicely, due to the continuity of the
The hole can then be created using the middle node as center,
edge of the hole or projecting a circle on
to simplify the program as the routines to
closed by four edges which is the
requirement of using Coon’s Patch. A different approach has to be made in order to get surface
ight surface patches as in
The curve defining the edge becomes more exact the more nodes you have to interpolate with and
therefore the alternative to divide the geometry into eight surface patches is used to get a more
of a
17
3.2 Transfer boundary conditions to local model
As described in the theory section, there are two different ways of transferring boundary conditions
to the local model. Either displacements are interpolated from the global solution or internal forces
are converted to nodal forces acting on the boundary nodes of the local model. The force method is
a little more reliable in some cases but the displacement method is easier to use and it is that
method that is chosen to apply boundary conditions on the local model.
3.3 Compute stiffness matrix of local model
There are several methods that can be used to compute the stiffness matrix. Static condensation is
not used since it may only be applied on linear problems and while there are numerical methods to
compute the tangential stiffness it is decided to use LS-DYNA, since it is a simple and reliable
method.
3.4 Return stiffness matrix to global model
There are two solutions to return the stiffness matrix to the global model using LS-DYNA. The first is
to use “User Defined Elements”, which is a function in LS-DYNA described in the LS-DYNA keyword
user’s manual in [8]. It is a more general way to tailor an element to be used in a mesh. The other
option is to use a function in LS-DYNA called “Direct Matrix Input” where the stiffness- and mass
matrix may be assigned to a superelement in a mesh. That is the method used in this thesis due to
its simplicity.
18
4 RESULTS First the routine is described in detail and then a simple two step simulation with a superelement is
made, where the stiffness is updated half way through. This is done to see how LS-DYNA behaves
when updating the superelement and try to verify the assumption that LS-DYNA treats the
superelement as an elastic element. During this verification, the function in LS-DYNA is used to
reduce the stiffness matrix of the local model and use it as a superelement in the global model. Then
the routine developed in this thesis is used to calculate the reduced stiffness matrix, to verify if it will
match the one extracted using the function in LS-DYNA. Finally, the script is explained in detail.
4.1 The FEM model
In this thesis shell elements are used as 3D quadrilaterals to create the mesh. An elasto-plastic
material model is used where the plastic behavior is specified through the change of effective plastic
strain due to the change in effective stress. This relation is set in a table with point data and in [8],
detailed information of the material model used in LS-DYNA is covered.
It is decided to use both time integration schemes in the simulations. In the global simulations an
explicit scheme is used, because it is better with dynamic simulations such as crash simulations. In
the local simulations however, an implicit scheme is used to increase the accuracy of the solution.
The time steps are more time consuming with the implicit method but since the local mesh will be
relatively small, it is possible to use this method.
4.2 The mesh of the local model
The nodes on the edge of the hole are created by first creating curves between the middle node and
the boundary nodes. Along those curves, new nodes are created on the edge of the hole, a distance
from the middle node equal to the radius of the hole. To create more nodes along the edge of the
hole, a curve has to be interpolated along the edge and it is done using the nodes already created on
the edge.
The nodes are generated using Coon’s Patch in a FORTRAN routine, see Appendix A, and in the same
routine the nodes are connected to each other anti clockwise defining elements. The node
coordinates and numbering and the element numbering are then written into a file of the LS-DYNA
keyword format. A mesh created with Coon’s Patch can be seen in Figure 6.
Figure 6. A mesh with a small hole created with Coon’s Patch.
19
4.3 Applying boundary conditions to the local model
The local model has eight master nodes, nodes at the same positions as the boundary nodes of the
four global elements. In a python script, see Appendix B, the displacements of the master nodes are
extracted from the global solution and written to lists that are applied to the master nodes in the
local model.
There must be boundary conditions applied to all boundary nodes of the local model and the
displacements applied to the slaved boundary nodes are interpolated from the master nodes’
displacements. This is done using a function in LS-DYNA called “constrained interpolation”, see [8],
where each slave node’s displacement is connected to the two surrounding master nodes’
displacements with weighting factors. The DOFs to be controlled by the constraint are then chosen
in the same function. Figure 7 shows the deformed local- and global model connected through the
displacements of the master nodes and the linear interpolations of the slaved boundary nodes.
Figure 7. The figure shows the global and local model together to demonstrate that the local model is connected to the
global model via the extracted displacements.
4.4 Computation of the tangential stiffness matrix of the local model
In a LS-DYNA keyword file a small displacement is assigned to one master node DOF at a time with
the keyword “boundary prescribed motion”, described in [8]. At the same time the other DOFs of
the perturbed node and all DOFs of the other master nodes are constrained not to move with
“boundary prescribed motion” keywords. But the only way to output both moment and forces for all
DOFs is to constrain all DOFs with single point constraints using the keyword “boundary spc”
described in [8]. Therefore the boundary prescribed motions are killed after one time step and at the
same time single point constrains are birthed on those DOFs. A simulation is carried out for each
DOF because if all perturbations were assigned in the same simulation, it would generate a wrong
result for a non-linear analysis.
Equivalent forces from the slaved boundary nodes are added to the master nodes’ forces in the
stiffness calculation routine to reduce the slaved boundary nodes from the stiffness matrix, before
calculating the tangential stiffness.
20
4.5 Verification of the theory
To see if it is possible to use LS-DYNA to make these kinds of simulations and to verify the
assumption that LS-DYNA treats the superelement as an elastic element, a script is created using an
elastic model loaded in the z-direction. Four of the elements are removed and the middle node is
reduced through static condensation to get the superelement stiffness matrix of the four elements
and then imported with “Direct Matrix Input”. Halfway through, the simulation is stopped and the
elastic modulus of both superelement and cylinder is decreased by half. The stiffness is in linear
problems linearly dependent of the elastic modulus. The simulation is restarted with the updated
elastic modulus and the behavior of the displacements is analyzed. An implicit integration scheme is
used with a time step of 1e-3 seconds.
The plot in Figure 8 shows how the displacements are updated when performing a simulation with a
superelement but without applying balance forces. The graph shows that during the first time step
LS-DYNA compensates the change in stiffness by updating the displacement.
Figure 8. The graph shows the behavior of the displacement when changing the stiffness of a model with a superelement
and not applying any balance forces.
Figure 9 shows the displacement behavior when applying balance forces and in the graph no
compensation of displacement can be seen.
21
Figure 9. The graph shows the behavior of the displacement when changing the stiffness of a model with a superelement
and applying balance forces.
Figure 10 is a plot from a simulation without a superelement to compare the results. The result
shown in the previous graph correlates well with the result in this.
Figure 10. The plot is from a simulation of a model without a superelement and where the stiffness is changed halfway
through the simulation.
4.6 Verification of the routine
A script similar to the one used in the previous paragraph is used, but instead using the developed
routine to calculate the reduced stiffness matrix. The FEM model is a plate loaded in the y-direction
with applied balance forces and the result is shown in Figure 11 where a decrease in stiffness is
apparent. The transition between the two different stiffness cases seems to go smooth.
22
Figure 11. The graph shows the stress dependent of the displacement in the y-direction from a simulation where the
stiffness is changed halfway through the simulation and where the stiffness calculation routine is used.
In Table 1 the calculated stiffness coefficients is compared with the extracted stiffness coefficients
using LS-DYNA’s static condensation. The coefficients for the translational DOFs correlate rather well
except when the coefficients are very small (close to zero). In those cases the calculated coefficients
differ with several orders of magnitude. The calculated rotational stiffness coefficients also differ
from the coefficients extracted with LS-DYNA. Sometimes there is a small error and sometimes a
larger error.
23
Table 1. In the table calculated stiffness coefficients are compared to LS-DYNA extracted stiffness coefficients.
LS-DYNA stiffness
coefficients
Calculated stiffness
coeficients
LS-DYNA stiffness
coefficients
Calculated stiffness
coeficients
STIF 415 1 1 STIF 415 5 5
435 1 -1,485887E+07 -1,486614E+07 435 1 -6,363126E+04 -6,972859E+04
435 2 5,081115E+06 5,079661E+06 435 2 3,220082E+04 3,005286E+04
435 3 -1,223857E+06 -1,225350E+06 435 3 -3,804217E+01 -3,170000E+03
435 4 3,961190E+04 3,954728E+04 435 4 1,606890E+02 9,572425E+01
435 5 7,813514E+04 7,800278E+04 435 5 3,153753E+02 1,866487E+02
435 6 1,570049E+04 1,543949E+04 435 6 -6,372453E-01 -2,637073E+02
415 1 5,375683E+07 5,370351E+07 415 1 -4,568988E-11 -5,846326E+04
STIF 415 2 2 415 2 2,248815E-11 2,669592E+04
435 1 4,794713E+06 4,789148E+06 415 3 -1,395178E+02 -5,561000E+01
435 2 -8,379117E+06 -8,381899E+06 415 4 3,209735E+02 2,426939E+02
435 3 -3,013864E+06 -3,013810E+06 415 5 6,455989E+02 4,895719E+02
435 4 -2,070345E+04 -2,076716E+04 STIF 415 6 6
435 5 -3,986593E+04 -3,999325E+04 435 1 2,712493E+03 -3,387124E+03
435 6 -7,243082E+03 -7,507552E+03 435 2 3,909003E+03 1,762203E+03
415 1 1,070421E+07 1,064430E+07 435 3 3,084223E+03 -5,000000E+01
415 2 6,870746E+07 6,873775E+07 435 4 2,470235E+01 -4,026862E+01
STIF 415 3 3 435 5 4,848191E+01 -8,025656E+01
435 1 2,207678E+06 2,201227E+06 435 6 9,201322E+01 -1,710529E+02
435 2 4,232344E+06 4,229454E+06 415 1 6,236575E+04 3,908890E+03
435 3 -4,296588E+07 -4,296903E+07 415 2 -2,873214E+04 -2,039520E+03
435 4 -1,023668E+02 -1,673391E+02 415 3 -2,449724E-12 8,391000E+01
435 5 -2,009097E+02 -3,296504E+02 415 4 -1,473746E-14 -7,828860E+01
435 6 -1,354694E+00 -2,643389E+02 415 5 -7,797796E-15 -1,560444E+02
415 1 1,330816E-09 -5,921406E+04 415 6 3,714478E+02 4,347983E+01
415 2 9,483270E-09 2,516760E+04
415 3 1,152544E+08 1,152485E+08
STIF 415 4 4
435 1 -3,220366E+04 -3,830139E+04
435 2 1,683383E+04 1,468606E+04
435 3 6,204233E+01 -3,070000E+03
435 4 8,187378E+01 1,690675E+01
435 5 1,606891E+02 3,195825E+01
435 6 -3,246869E-01 -2,633947E+02
415 1 -2,134323E-11 -5,846328E+04
415 2 1,059119E-11 2,669592E+04
415 3 -7,395509E+02 -6,556700E+02
415 4 1,791839E+02 1,009005E+02
24
4.7 Manual to the script
First a LS-DYNA input file of the global model must be created without any information of output of
data and termination time. It is moved into an optional working folder together with the FORTRAN-
and Python scripts and a script used to start the simulations.
The node identities within four elements from the global model, where the hole should be situated,
are written into a list in the Python script but excluding the middle node identity. Into another list
the node identities from the four elements together with node identities from the adjacent
elements are written. The node identities must be written into the lists, in the same order as in
Figure 12.
The middle node identity is written to a variable and the global LS-DYNA filename is specified in
another variable. This is used to extract the node positions from the global model to create the local
mesh. Furthermore the variables “nmy” and “nnu” must be assigned in the FORTRAN routine to
control the number of elements created in the local model. The material model of the local model
must be changed to match the one in the global model.
When the local mesh has been created, the mass- and stiffness matrices are extracted using static
condensation in LS-DYNA. After this, the script consists of three parts. The first part adds small
displacements to the master node DOFs, to calculate the reduced stiffness matrix. The next part is
the global simulation, which imports the stiffness- and mass matrix using the restart routine. The last
part assigns displacements to the master nodes in the local model extracted from the global
simulation.
To specify how often the global simulation will stop to update the stiffness matrix of the
superelement, some values have to be assigned to variables. The total simulation time, the output
frequency and an interval will control the update frequency and number of times the three main
parts of the script will be looped. The full scripts are in the appendices and in the next section an
overview of the script is made through a flow chart.
5 1 2 3 4
10 6 7 8 9
15 11 12 13 14
20 16 17 19 18
25 21 22 23 24
Figure 12. The figure shows in which order the node identity numbers should be written into the lists.
4.8 Flow chart of the script
1
• A mesh of the local model is created from the master node coordinates extracted from four elements in the global LSfile.
2• A simulation is carried out of the local model to get the reduced mass
and stiffness matrices through static condensation in LS
3• The mass- and stiffness matrices are used as a superelement in a
global simulation.
4
• A simulation of the local model is carried out in LSdisplacements of the master nodes from the result of the global simulation and interpolated displacements on the other boundary nodes. The forces and deformations are saved to compute the tangential stiffness matrix.
5
• LS-DYNA simulations of the local model are initiated where small displacements are assigned to all DOFs of the master nodes in the local model, one simulation per DOF. The forces and moments are written into a text file. The tangential stiffness matrix is calculated from the difference of the forces in this step and from the previous step, divided with the small added displacement.
6
• A superelement is created in the global model with the calculated stiffness matrix and the saved mass matrix from step 2. Calculated balance forces are applied on the master nodes. A full restart of the global simulation is started and the displacements of the master nodes are saved.
7• The script restarts at point 4 until the final termination time is
reached.
25
of the script
A mesh of the local model is created from the master node coordinates extracted from four elements in the global LS-DYNA input
A simulation is carried out of the local model to get the reduced massand stiffness matrices through static condensation in LS-DYNA.
and stiffness matrices are used as a superelement in a global simulation.
A simulation of the local model is carried out in LS-DYNA, with applied displacements of the master nodes from the result of the global simulation and interpolated displacements on the other boundary nodes. The forces and deformations are saved to compute the tangential stiffness matrix.
DYNA simulations of the local model are initiated where small displacements are assigned to all DOFs of the master nodes in the local model, one simulation per DOF. The forces and moments are written into a text file. The tangential stiffness matrix is calculated from the difference of the forces in this step and from the previous step, divided with the small added displacement.
A superelement is created in the global model with the calculated stiffness matrix and the saved mass matrix from step 2. Calculated balance forces are applied on the master nodes. A full restart of the global simulation is started and the displacements of the master nodes are saved.
The script restarts at point 4 until the final termination time is
A mesh of the local model is created from the master node DYNA input
A simulation is carried out of the local model to get the reduced mass-DYNA.
and stiffness matrices are used as a superelement in a
DYNA, with applied displacements of the master nodes from the result of the global simulation and interpolated displacements on the other boundary nodes. The forces and deformations are saved to compute the
DYNA simulations of the local model are initiated where small displacements are assigned to all DOFs of the master nodes in the local model, one simulation per DOF. The forces and moments are written into a text file. The tangential stiffness matrix is calculated from the difference of the forces in this step and from the previous
A superelement is created in the global model with the calculated stiffness matrix and the saved mass matrix from step 2. Calculated balance forces are applied on the master nodes. A full restart of the global simulation is started and the displacements of the master
The script restarts at point 4 until the final termination time is
26
5 DISCUSSION The routine with LS-DYNA failed when the material started to plasticize and there are several factors
that may have introduced errors in the simulation routine. One source of error is the problems to
reduce the stiffness matrix. Another source of error may be the inexactness of the stiffness
calculation. When perturbing each DOF with a small displacement, the largest displacement used
was 1 µm, the difference in forces before and after will be small. However the small assigned
displacement has to be small to get an exact stiffness matrix. The largest number of decimals that
could be extracted from LS-DYNA, using output files, were six and that led to inexact calculations of
the stiffness matrix. Sometimes the change in force was so small that the difference became zero
due to the low number of decimals.
Another source of error may be the interpolation routine. To get the mass matrix, LS-DYNA’s static
condensation routine (the “control implicit modes” keyword) was used and the keyword
“constrained interpolation” was used to interpolate the boundary nodes between the master nodes.
But that keyword did not interpolate rotation and due to the use of the resulting mass matrix from
the static condensation, the rotations could not be interpolated. If they were to be interpolated
through a routine created by the user, a new mass matrix has to be assembled as well.
To get hold of the moments, single point constraints had to be used in the simulations and then it is
not possible to use the restart routine. The reason for this is that once the rotation DOFs are
constrained, they cannot be unconstrained in LS-DYNA. Therefore all displacements, for each time
step (or specified frequency), must be added to a vector and each simulation of the local model
must start from the beginning. This leads to longer and longer simulations times in each step, to
assemble the reduced stiffness matrix of the local model.
This routine uses four elements to build the superelement, which leads to eight master nodes with
forty-eight DOFs. To assemble the reduced stiffness matrix in each step forty-eight simulation has to
be done and the result of this is very long simulation times.
27
6 CONCLUSIONS AND FUTURE WORK The verification of the theory shows that is possible to use LS-DYNA for this method to simulate
structural components with holes or spot welds. When using the routine to reduce the stiffness
matrix the results aren’t the ones expected. To be able to use this routine to calculate the tangent
stiffness of a model, the routine must be further developed and tested.
It was decided to try to use LS-DYNA to assemble the reduced stiffness matrix of the local model for
simplicity, only to try the method but not as a long term solution. If LS-DYNA is to be used for this in
the future, a way to extract the forces more accurately is a necessity. Also a routine to assemble the
mass matrix has to be added to be able to interpolate rotations. Otherwise a new routine, using
numerical methods to assemble the reduced stiffness matrix of the local model has to be developed.
In the future it would be much more effective to make a specific numerical program that solves the
simulations of the local model instead of using LS-DYNA.
28
7 REFERENCES 1. Löveborn, S., (2006). Improved Simulation of Spot Weld Joints in Vehicle Components.
Luleå: Department of Applied Physics and Mechanical Engineering, Luleå University of
Technology.
2. Wierer, M., Šejnoha, M. and Zeman J, (2005). Multiscale analysis of woven composites –
scale transistion via macroelement. Building Research Journal, 53 (2-3), 93-110.
3. Whitcomb, J.D. and Woo, K., (1994). Enhanced direct stiffness method for finite element
analysis of textile composites. Composite structures, 28, 385-390.
4. Hutton, D.V., (2004). Fundamentals of Finite Element Analysis.
New York: McGraw-Hill.
5. Lecture material, Third year MSc Interactive Computer Graphics Course.
London: Department of Computing, Imperial College London.
6. Felippa, Carlos A., (2004). Introduction to finite element methods.
Boulder: Department of Aerospace Engineering Sciences and Center for Aerospace Structures, University of Colorado Boulder.
7. Raghu ,Engr S., (2009). Finite Element Modeling Techniques in MSC.NASTRAN and LS/DYNA,
second edition.
London: Ove Arup & Partners International Ltd
8. Livermore Software Technology Corporation, (2009). LS-DYNA keyword user’s manual
Volume 1, Version 971/Release 4 Beta.
9. MSC.Software Corporation, (2004). MSC.Nastran 2003, Linear Static Analysis User’s Guide.
29
APPENDIX A c Program creating the local mesh from the global nodes by creating 8 surfaces c consisting of 1 diagonal, 1 vertical, 1 horizontal edge and 1 arc (an eighth c of a circle). c First the lines are created by cubic spline interpolation and then the c surfaces are created using Coon's Patch PROGRAM mesh character*8 stat*3,eid,pid,n1,n2,n3,n4 logical x integer h(10,10),nmy,nnu,elnr,nod1,nod2,nod3,nod4,totnu real p(25,3),r,pc1(3),pc2(3),pc3(3),pc4(3),wdis,fdis,mnod(8,3) real pc5(3),pc6(3),pc7(3),pc8(3),sl1312(100,3),sl1307(100,3) real sl1308(100,3),sl1309(100,3),sl1314(100,3),sl1319(100,3) real sl1318(100,3),sl1317(100,3),sl1207(100,3),sl0708(100,3) real sl0809(100,3),sl0914(100,3),sl1419(100,3),sl1918(100,3) real sl1817(100,3),sl1712(100,3),cl12(100,3),cl23(100,3) real cl34(100,3),cl45(100,3),cl56(100,3),cl67(100,3),cl78(100,3) real cl81(100,3),pc(10,3) c specifies how many nodes to be used along each edge. nmy is the number of c nodes along the inner edges and nnu is the number of nodes along the arcs and c outer edges nmy=6 nnu=4 c writes number of nodes along each edge to file inquire(file='number_nodes.dat',exist=x) if (x)then stat='old' else stat='new' endif open(1,file="number_nodes.dat",status=stat) write(1,'(I2)') nmy write(1,'(I2)') nnu close(1) c opens the file containing original global nodedata open(1,file="masternodes_global.dat",status="old") c nodedata contains data in the order x,y,z. Sort them into different columns in c the variabel p do i = 1, 25 do j = 1, 3 read(1,*) p(i,j) enddo enddo close(1) c creates the inverted equationmatrix needed to compute the constants in the c cubic spline eq. h(1,1) = 1 h(1,2) = 0 h(1,3) = 0 h(1,4) = 0 h(2,1) = 0
30
h(2,2) = 1 h(2,3) = 0 h(2,4) = 0 h(3,1) = -3 h(3,2) = -2 h(3,3) = 3 h(3,4) = -1 h(4,1) = 2 h(4,2) = 1 h(4,3) = -2 h(4,4) = 1 c create lines of global nodedata to create the local mesh call CLine(nmy,13,12,p,h,sl1312,pc1) call Line(nnu,12,7,p,h,sl1207) call CLine(nmy,13,7,p,h,sl1307,pc2) call Line(nnu,7,8,p,h,sl0708) call CLine(nmy,13,8,p,h,sl1308,pc3) call Line(nnu,8,9,p,h,sl0809) call CLine(nmy,13,9,p,h,sl1309,pc4) call Line(nnu,9,14,p,h,sl0914) call CLine(nmy,13,14,p,h,sl1314,pc5) call Line(nnu,14,19,p,h,sl1419) call CLine(nmy,13,19,p,h,sl1319,pc6) call Line(nnu,19,18,p,h,sl1918) call CLine(nmy,13,18,p,h,sl1318,pc7) call Line(nnu,18,17,p,h,sl1817) call CLine(nmy,13,17,p,h,sl1317,pc8) call Line(nnu,17,12,p,h,sl1712) c sorts the points on the hole edge into a matrix do i=1,3 pc(1,i)=pc1(i) pc(2,i)=pc2(i) pc(3,i)=pc3(i) pc(4,i)=pc4(i) pc(5,i)=pc5(i) pc(6,i)=pc6(i) pc(7,i)=pc7(i) pc(8,i)=pc8(i) pc(9,i)=pc1(i) pc(10,i)=pc2(i) enddo c interpolates lines at the hole edge call Cir(1,nnu,p,pc,h,cl12) call Cir(2,nnu,p,pc,h,cl23) call Cir(3,nnu,p,pc,h,cl34) call Cir(4,nnu,p,pc,h,cl45) call Cir(5,nnu,p,pc,h,cl56) call Cir(6,nnu,p,pc,h,cl67) call Cir(7,nnu,p,pc,h,cl78) call Cir(8,nnu,p,pc,h,cl81) c opens file for writing interpolated surface node data inquire(file='local_mesh',exist=x) if (x)then
31
stat='old' else stat='new' endif open(1,file="local_mesh",status=stat) write(1,'(A)') '*NODE' write(1,'(A)') '$# nid x y $ z tc rc' c interpolates surface between splines call Sur(0,nmy,nnu,p,pc,sl1312,sl1207,sl1307,cl12,1,12,7,2) call Sur(1,nmy,nnu,p,pc,sl1307,sl0708,sl1308,cl23,2,7,8,3) call Sur(2,nmy,nnu,p,pc,sl1308,sl0809,sl1309,cl34,3,8,9,4) call Sur(3,nmy,nnu,p,pc,sl1309,sl0914,sl1314,cl45,4,9,14,5) call Sur(4,nmy,nnu,p,pc,sl1314,sl1419,sl1319,cl56,5,14,19,6) call Sur(5,nmy,nnu,p,pc,sl1319,sl1918,sl1318,cl67,6,19,18,7) call Sur(6,nmy,nnu,p,pc,sl1318,sl1817,sl1317,cl78,7,18,17,8) call Sur(7,nmy,nnu,p,pc,sl1317,sl1712,sl1312,cl81,8,17,12,1) write(1,'(A)') '*ELEMENT_SHELL\n$# eid pid n1 n2 $ n3 n4 n5 n6 n7 n8' elnr=0 totnu=8*(nnu-1) do i=1,totnu do j=2,nmy elnr=elnr+1 if(i .ne. totnu)then nod1=i*nmy+j nod2=(i-1)*nmy+j nod3=(i-1)*nmy+j-1 nod4=i*nmy+j-1 else nod1=j nod2=(i-1)*nmy+j nod3=(i-1)*nmy+j-1 nod4=j-1 endif write(eid,'(I8)') elnr write(pid,'(I8)') 1 write(n1,'(I8)') nod1 write(n2,'(I8)') nod2 write(n3,'(I8)') nod3 write(n4,'(I8)') nod4 write(1,'(A,A,A,A,A,A)') eid,pid,n1,n2,n3,n4 enddo enddo close(1) END c subroutine interpolating surface between splines and writing interpolated c nodedata to file. Snr is the number of the surface to be interpolated, nmy is c the number of nodes to be created at direction my, nnu is the number of nodes c to be created in direction nu, P is the global nodedata, pc the nodes c interpolated at the hole edge, lmyo=P(my,0),l1nu=P(1,nu), c lmy1=P(my,1),l0nu=P(0,nu),pc(p1)=P(0,0),p(p2)=P(1,0),p(p3)=P(1,1)pc(p4)=P(0,1) c My is defined defined 0 at the hole edge and 1 at the outer edge. If you look c at the surface to be interpolated from the hole edge to the outer edge, nu is
32
c defined 0 at the left inner edge and 1 at the right inner edge. SUBROUTINE Sur(snr,nmy,nnu,p,pc,lmy0,l1nu,lmy1,l0nu,p1,p2,p3,p4) character*16 x,y,z character*8 nid,tc,rc integer p1,p2,p3,p4,nmy,nnu,nodnr,snr real lmy0(100,3),lmy1(100,3),l0nu(100,3),l1nu(100,3),p00(3) real p01(3),p10(3),p11(3),f(100,100,3),pc(10,3),p(25,3),my,nu do i=1,3 p00(i)=pc(p1,i) p10(i)=p(p2,i) p11(i)=p(p3,i) p01(i)=pc(p4,i) enddo c creating a surface interpolation function between the created splines and c writing nodevalues to file nodnr=snr*nmy*(nnu-1) nu=0 do i=1,nnu-1 my=0 do j=1,nmy do k=1,3 f(i,j,k) = lmy0(j,k)*(1-nu) + lmy1(j,k)*nu + $ l0nu(i,k)*(1-my) + l1nu(i,k)*my - $ p00(k)*(1-my)*(1-nu) - p01(k)*(1-my)*nu - $ p10(k)*my*(1-nu) - p11(k)*my*nu enddo nodnr=nodnr+1 write(nid,'(I8)') nodnr write(x,'(F16.7)') f(i,j,1) write(y,'(F16.7)') f(i,j,2) write(z,'(F16.7)') f(i,j,3) write(tc,'(I8)') 0 write(rc,'(I8)') 0 write(1,'(A,A,A,A,A,A)') nid,x,y,z,tc,rc my=my+1.0/(nmy-1) enddo nu=nu+1.0/(nnu-1) enddo END c subroutine interpolating a cubic spline between the points p1 and p2 where p1 c is the point at nu=0 and p2 at nu=1 SUBROUTINE Line(nnu,p1,p2,p,h,l) integer p1,p2,h(10,10),n,nnu real p(25,3),l(100,3),v(10,10),nu,a(10,10) c creates the matrix consisting of two points and their derivatives n=p1-p2 do i = 1, 3 v(1,i)=p(p1,i) v(2,i)=(p(p1-n,i)-p(p1+n,i))/2 v(3,i)=p(p2,i) v(4,i)=(p(p2-n,i)-p(p2+n,i))/2 enddo c calculates the constants in the spline equation and then points on the
33
c interpolated line call MatrixMultiplication(4,4,3,h,v,a) nu=0 do i=1,nnu do j=1,3 l(i,j)=a(4,j)*nu**3+a(3,j)*nu**2+a(2,j)*nu+a(1,j) enddo nu=nu+1.0/(nnu-1) enddo END c subroutine interpolating a cubic spline between the points p1 and p2 where p1 c is the point at my=0 and p2 at my=1. Calculates the point on the hole edge at c that line and then a new line is interpolated from the point on the hole edge c to p2. SUBROUTINE CLine(nmy,p1,p2,p,h,l,pc) integer p1,p2,h(10,10),n,nmy,imax real p(25,3),l(100,3),v(10,10),my,pc(3),a(10,10),b(10,10) real av, rad c creates the matrix consisting of two points and their derivatives n=p1-p2 do i = 1,3 v(1,i)=p(p1,i) v(2,i)=(p(p1-n,i)-p(p1+n,i))/2 v(3,i)=p(p2,i) v(4,i)=(p(p2-n,i)-p(p2+n,i))/2 enddo c calculates the constants in the spline equation call MatrixMultiplication(4,4,3,h,v,a) c interpolating point on hole edge where the spline intersects the hole edge. If c the point isn't found then the spline is interpolated with more points. For c now the radius is set 10 a tenth of a element side length imax=1000 50 my=0 rad=sqrt((p(12,3)-p(13,3))**2+(p(12,2)-p(13,2))**2+ $ (p(12,1)-p(13,1))**2)/10 do i=1,imax+1 do j=1,3 pc(j)=a(4,j)*my**3+a(3,j)*my**2+a(2,j)*my+a(1,j) enddo av=sqrt((pc(3)-p(13,3))**2+(pc(2)-p(13,2))**2+ $ (pc(1)-p(13,1))**2) if(av .gt. (rad-rad/100) .and. av .lt. (rad+rad/100))then goto 100 endif if(i .eq. imax+1)then imax=imax*10 goto 50 endif my=my+1.0/imax enddo c creates new matrix from the points at the hole edge and outer edge 100 do i = 1, 3 v(1,i)=pc(i)
34
v(2,i)=(p(p1-n,i)-p(p1,i))/2 v(3,i)=p(p2,i) v(4,i)=(p(p2-n,i)-pc(i))/2 enddo c calculates the constants in the spline equation and then points on the c interpolated line call MatrixMultiplication(4,4,3,h,v,b) my=0 do i=1,nmy do j=1,3 l(i,j)=b(4,j)*my**3+b(3,j)*my**2+b(2,j)*my+b(1,j) enddo my=my+1.0/(nmy-1) enddo END c subroutine interpolating lines on the hole edge, p1 is the point at nu=0 SUBROUTINE Cir(p1,nnu,p,pc,h,l) integer nnu,p1,h(10,10) real p(25,3),pc(10,3),v(10,10),l(100,3),nu,a(10,10) c creates the vector consisting of two points and their derivatives do i = 1,3 if(p1 .eq. 1)then v(1,i)=pc(p1,i) v(2,i)=(pc(p1+1,i)-pc(8,i))/2 v(3,i)=pc(p1+1,i) v(4,i)=(pc(p1+2,i)-pc(p1,i))/2 else v(1,i)=pc(p1,i) v(2,i)=(pc(p1+1,i)-pc(p1-1,i))/2 v(3,i)=pc(p1+1,i) v(4,i)=(pc(p1+2,i)-pc(p1,i))/2 endif enddo c calculates the constants in the spline equation and then z-coordinates on the c interpolated line call MatrixMultiplication(4,4,3,h,v,a) nu=0 do i=1,nnu do k = 1,3 l(i,k)=a(4,k)*nu**3+a(3,k)*nu**2+a(2,k)*nu+a(1,k) enddo nu=nu+1.0/(nnu-1) enddo END c subroutine for creating matrices consisting of zeros. r is the number of rows, c k the number of columns. v is the resulting zeromatrix. SUBROUTINE Zeros(r, k, v) integer r, k real v(r,k) do i=1,k do j=1,r v(j,i)=0.0 enddo
35
enddo END c subroutine for multiplying matrices. e,f are the number of rows and columns in c the first matrix. g is the number of columns in the second matrix (the number c of rows in the second matrix must be equal to the number of columns in the c first matrix. v is the resulting matrix [h][a]=[v] SUBROUTINE MatrixMultiplication(e,f,g,h,a,v) integer h(10,10),e,f,g real a(10,10), v(10,10) call Zeros(10,10,v) do i=1,e do k=1,g do j=1,f v(i,k)=v(i,k)+h(i,j)*a(j,k) enddo enddo enddo END
36
APPENDIX B #!/usr/bin/python import os import sys import math # Function that creates an a*b*c matrix. def matrix(a,b,c): k=range(a) for i in range(a): if b == 1: k[i]=0.0 elif c == 1: k[i]=[] for j in range(b): k[i][j:j]=[0.0] else: k[i]=[] for j in range(b): k[i][j:j]=[[]] for l in range(c): k[i][j][l:l]=[0.0] return k # MAIN PROGRAM # The name of the global LS-DYNA file. The file shall contain everything but # output data and control termination. gbfile="global_plate.k" # Put the global master node identities in a list except the middle node. They must be # in matrix order. pg=[181,200,220,201,241,222,242,261] # Put the global master node identities and the surrounding nodes that are needed to # generate the mesh in a list. They must be in matrix order. P=[145,162,180,199,219,163,181,200,220,240, 182,201,221,241,260,202,222,242,261,279, 223,243,262,280,297] # The node identity of the node in the middle. midnode=221 # Writing current working directory to wd. wd=os.getcwd() # Creates directories for LS-DYNA input and output files. try: os.mkdir(wd+"/Global") print "Creates folder for global simulations!\n" except OSError: print "Folder already exists!" try: os.mkdir(wd+"/Localstif") print "Creates folder for simulations to calculate stiffness matrix!\n" except OSError: print "Folder already exists!"
37
try: os.mkdir(wd+"/Localdef") print "Creates folder for local displacement simulations!\n" except OSError: print "Folder already exists!" try: os.mkdir(wd+"/Localstat") print "Creates folder for static condensation!\n" except OSError: print "Folder already exists!" # Finds where the node card begins in the global LS-DYNA input file. f=open(gbfile,"r") i=0 while True: i=i+1 text=f.readline() if text == "*NODE\n": break elif i == 100000: print "Didn't find node card" break else: continue # Searches the LS-DYNA input file until the global node identity is found. Then the # coordinates are written to Masternodes_global.dat and starts searching again # at the start of the node card for the next master node id. When all identities in the # list are found the loop stops. i=0 j=0 text=f.readline() row=f.tell() new=open("masternodes_global.dat","w") while True: i=i+1 text=f.readline() if int(text[0:8]) == P[j]: try: val=float(text[8:24]) new.write(str(val)) new.write("\n") except ValueError: new.write("0.0") new.write("\n") try: val=float(text[24:40]) new.write(str(val)) new.write("\n") except ValueError: new.write("0.0") new.write("\n") try: val=float(text[40:56]) new.write(str(val)) except ValueError: new.write("0.0")
38
if j < len(P)-1: new.write("\n") j=j+1 f.seek(row) if j == len(P): break elif i == 1000000: print "Didn't find global nodes" break else: continue f.close() new.close() # Creates a new global file "global_superelement.k" without the four elements # and the middle node to be replaced with a superelement. Searches the global # file until all elements with the middle node are found. f=open(gbfile,"r") text=f.readlines() f.close() for i in range(len(text)): if text[i] == "*NODE\n": n=i+1 break el=range(5) el[4]=29342578545675 count=0 for i in range(len(text)): if text[i] == "*ELEMENT_SHELL\n": j=i+1 while True: j=j+1 if int(text[j][16:24]) == midnode or int(text[j][24:32]) == midnode or int(text[j][32:40]) == midnode or int(text[j][40:48]) == midnode: el[count]=j count=count+1 if count == 4: break break os.chdir(wd+"/Global") f=open("global_superelement.k","w") count=0 for i in range(len(text)-1): if i == n+midnode: continue elif i == el[count]: count=count+1 else: f.write(text[i]) f.close() # Runs the fortran program that creates the mesh from the coordinates in the # Masternodes_global.dat file. It writes the nodes and elements cards into # local_mesh and the number of nodes into the file number_nodes.dat. os.chdir(wd) os.system("g77 -o run 8mesh.f") os.system("./run")
39
test=True w=0 while test: w=w+1 if w == 10000000: print "Not finding file! Breaking script after %d iterations" % (w) sys.exit() try: temp=open("local_mesh","r") temp.close() print w for b in range(10000000): pass test=False except IOError: test=True # Opens file containing number of rows radial and tangential from circle # and calculates the local master node identities and puts them into a list in the same # order as in the global master node list. nnod=open("number_nodes.dat","r") nmy=int(nnod.readline()) nnu=int(nnod.readline()) nnod.close() pl=range(8) pl[3]=nmy pl[4]=nmy*nnu+3*nmy*(nnu-1) for i in range(1,4): pl[i-1]=nmy*nnu+(i-1)*nmy*(nnu-1) pl[i+4]=nmy*nnu+(7-i)*nmy*(nnu-1) os.remove("number_nodes.dat") # Creates the start keyword file for the local displacement analysis. dt defines # the implicit time step and the frequence to output displacements and forces, # dtnr is the current timestep, interval is the number of timesteps before doing # a new stiffness calculation.finaltime is the final termination time, the # variable count counts the cycles, endtime is the termination time of each # cycle. du is the small displacement added to each DOF, the difference between # newforce and oldforce divided with du gives the tangent stiffness stif, u are # the global displacements used in the local simulations, fout are the external # forces added to the master nodes in the global simulation. dt=1e-4 finaltime=1e-2 interval=20 du=1e-6 dtnr=1 steptime=dt*interval count=0 endtime=0.0 oldforce=matrix(48*(nnu-1),1,1) newforce=matrix(48*(nnu-1),1,1) stif=matrix(48,48,1) oldstif=matrix(48,48,1) u=matrix(48,int(finaltime/dt),1) fout=matrix(48,int(finaltime/steptime),1)
40
# Writing the start of the local LS-DYNA input file with mesh-, part-, element-, node-, material- and timestep data. f=open("local_start","w") f.write("*KEYWORD\n*TITLE\n$# title\nLocal model\n") f.write("*CONTROL_IMPLICIT_GENERAL\n$# imflag dt0 imform nsbs igs cnstn form zero_v\n") f.write(" 1 %9.3e 2 1 2 0 0 1\n" % (dt)) f.write("*CONTROL_HOURGLASS\n$# IHQ QH\n 5\n") f.write("*DATABASE_SPCFORC\n$# dt\n%10.3e%10d\n" % (dt,3)) f.write("*DATABASE_NODOUT\n$# dt\n%10.3e%10d\n" % (dt,3)) f.write("*DATABASE_HISTORY_NODE_SET\n") f.write("$# nid1 nid2 nid3 nid4 nid5 nid6 nid7 nid8\n%10d\n" % (1)) f.write("*PART\n$# title\nLocal model with hole\n$# pid secid mid eosid hgid grav adpopt tmid\n") f.write(" 1 1 1 0 0 0 0 0\n") f.write("*SECTION_SHELL_TITLE\nSECTION_SHELL1\n$# SECID ELFORM SHRF NIP PROPT QR/IRID ICOMP SETYP\n") f.write("$# secid elform shrf nip propt qr/irid icomp setyp\n") f.write(" 1 16 1.000000 2 0.0 0.0 0 1\n$# t1 t2 t3 t4 nloc marea idof edgset\n") f.write(" 0.001000 0.001000 0.001000 0.001000 0.000 0.000 1.000000 0\n") f.write("*MAT_PIECEWISE_LINEAR_PLASTICITY_TITLE\nBoron 02\n$# mid ro e pr sigy etan fail tdel\n") f.write(" 1 7850.00002.1000E+11 0.300000 4.2000E+8 0.0001.0000E+21\n$# c p lcss lcsr vp\n") f.write(" 0.000 0.000 1000\n$# eps1 eps2 eps3 eps4 eps5 eps6 eps7 eps8\n") f.write(" 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000\n$# es1 es2 es3 es4 es5 es6 es7 es8\n") f.write(" 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000\n") f.write("*DEFINE_CURVE_TITLE\nMaterial curve\n$# lcid sidr sfa sfo offa offo dattyp\n 1000 0 1.000000 1.000000\n") f.write("$# a1 o1\n 0.000 4.2000000e+08\n 3.9999999e-04 8.0000000e+08\n 0.0013000 1.0100000e+09\n") f.write(" 0.0072000 1.3800000e+09\n 0.0300000 1.6100000e+09\n") f.write(" 0.0800000 1.6600000e+09\n 0.1500000 1.6900000e+09\n 0.4900000 1.8000000e+09\n") mesh=open("local_mesh","r") f.write(mesh.read()) mesh.close() f.close() # Renumbers the nodes of the local model so that the master node identities corresponds # to the global numbering and then performs a static condensation of the local # model with LS-DYNA to get the elastic stiffness matrix and mass matrix that # can be used in the first simulation step of the global model. os.chdir(wd+"/Localstat") f=open(wd+"/local_start","r") text=f.readlines() text2=range(len(text)) f.close() for i in range(len(text)): text2[i]=text[i] if text[i] == "*NODE\n": n=i+1 text2[n]=text[n] break for nid in range(1,1+(nnu-1)*nmy*8):
41
test=False for i in range(8): if nid == pl[i]: test=True break if test == True: text2[n+nid]="%8d" % (pg[i]) text2[n+nid]=text2[n+nid]+text[n+nid][8:len(text[n+nid])] else: text2[n+nid]="%8d" % (100000+nid) text2[n+nid]=text2[n+nid]+text[n+nid][8:len(text[n+nid])] e=n+3+(nnu-1)*nmy*8 text2[e-1]=text[e-1] text2[e-2]=text[e-2] i=0 while True: test1=False test2=False test3=False test4=False try: text2[e+i]=text[e+i][0:16] except IndexError: break for j in range(8): if int(text[e+i][16:24]) == pl[j] and test1 == False: textsnutt1="%8d" % (pg[j]) test1=True if int(text[e+i][24:32]) == pl[j] and test2 == False: textsnutt2="%8d" % (pg[j]) test2=True if int(text[e+i][32:40]) == pl[j] and test3 == False: textsnutt3="%8d" % (pg[j]) test3=True if int(text[e+i][40:48]) == pl[j] and test4 == False: textsnutt4="%8d" % (pg[j]) test4=True if test1 == False: textsnutt1="%8d" % (100000+int(text[e+i][16:24])) if test2 == False: textsnutt2="%8d" % (100000+int(text[e+i][24:32])) if test3 == False: textsnutt3="%8d" % (100000+int(text[e+i][32:40])) if test4 == False: textsnutt4="%8d" % (100000+int(text[e+i][40:48])) text2[e+i]=text2[e+i]+textsnutt1+textsnutt2+textsnutt3+textsnutt4 +text[e+i][48:len(text[e+i])] i=i+1 local=open("local_final.k","w") local.writelines(text2) # Creates a card to interpolate slavenodes (boundary nodes not master nodes) and # in order to do so smoothly the global master node identities are arranged in a # different order. inid=range(9) inid[0]=pg[3] inid[1]=pg[0]
42
inid[2]=pg[1] inid[3]=pg[2] inid[4]=pg[4] inid[5]=pg[7] inid[6]=pg[6] inid[7]=pg[5] inid[8]=pg[3] icid=0 for i in range(1,9): for j in range(2,nnu): icid=icid+1 co1=(nnu-j)/(nnu-1.0) co2=(j-1)/(nnu-1.0) dnid=(i-1)*nmy*(nnu-1)+j*nmy local.write('*CONSTRAINED_INTERPOLATION\n$# icid dnid ddof cidd\n') local.write('%10d %9d %9d\n' % (icid, 100000+dnid,123456)) local.write('$# inid idof twghtx twghty twghtz rwghtx rwghty rwghtz\n') local.write('%10d %9d %9.6f\n' % (inid[i-1],123456,co1)) local.write('%10d %9d %9.6f\n' % (inid[i],123456,co2)) # Creates a node list with all global master node identities in the local model. local.write("*SET_NODE_LIST_TITLE\nGlobal master node identities the local model\n$# sid DA1\n %9d\n" % (1)) local.write("$# nid1 nid2 nid3 nid4 nid5 nid6 nid7 nid8\n") for nn in pg: local.write("%10d" % (nn)) local.write("\n") local.write("*CONTROL_TERMINATION\n$# endtim endcyc dtmin endeng endmas\n %9.5f\n" % (dt)) local.write("*CONTROL_IMPLICIT_MODES\n 1 0 0 0 MASS STIF\n supel\n") local.write("*END") local.close() # Runs the local static condensation simulation. old=open(wd+"/lsdstart.sh","r") text=old.read() old.close() new=open("lsd.sh","w") new.write(text[0:len(text)-1]+" i=local_final.k") new.close() os.system("qsub -d $PWD lsd.sh") # Waits until the superelement input file is found before continuing, thus # certain the simulation is finished. test=True w=0 while test: w=w+1 if w == 10000000: print "Not finding file! Breaking script after % d iterations" % (w) sys.exit() try: temp=open("supel","r") temp.close() print w for b in range(10000000): pass
43
test=False except IOError: test=True # Copies the superelement file to the global folder and writes the mass matrix into another file # and writes the stiffness matrix into the variable "stif". f=open("supel","r") text=f.readlines() copy=open(wd+"/Global/supel","w") copy.writelines(text) copy.close() f.close() os.remove("supel") for i in range(len(text)): if text[i] == "DMIG* MASS 0 6 2 * \n": break f=open(wd+"/mass","w") f.writelines(text[i:len(text)]) f.close() row=3 for i in range(48): for j in range(48): stif[j][i]=float(text[row][40:56]) if i == j: row=row+3 break stif[i][j]=float(text[row][40:56]) row=row+1 # The local master node identities are arranged in a different order. inid=range(9) inid[0]=pl[3] inid[1]=pl[0] inid[2]=pl[1] inid[3]=pl[2] inid[4]=pl[4] inid[5]=pl[7] inid[6]=pl[6] inid[7]=pl[5] inid[8]=pl[3] # Looping cycles until finaltime is reached. Each cycle is interval*dt long and # consists of: # 1) A local model is created where small displacements are set to the master # nodes to calculate the stiffness of the local model. # 2) The global model is updated with the calculated stiffness, the simulation # is run and the output are the displacements at the masternodes. # 3) The local model is updated with the displacements and solved. while endtime+dt < finaltime: endtime=(count+1)*interval*dt time=count*interval*dt os.chdir(wd+"/Localstif") if count != 0: i=0 for nid in pl: j=0
44
for dof in range(1,4)+range(5,8): final=open("local_final.k","w") start=open(wd+"/local_start","r") final.write(start.read()) start.close() final.write("*CONTROL_TERMINATION\n$# endtim endcyc dtmin endeng endmas\n %9.5f\n" % (time+dt)) # Creates a node list with all boundary nodes in the local # model. final.write("*SET_NODE_LIST_TITLE\nLocal boundary node ids\n$# sid DA1\n %9d\n" % (1)) final.write("$# nid1 nid2 nid3 nid4 nid5 nid6 nid7 nid8\n") for nn in range(nmy,8*nmy*(nnu-1)+1,nmy): final.write("%10d" % (nn)) if (nn/nmy)%8 == 0 or nn == 8*nmy*(nnu-1): final.write("\n") # Writes a card to interpolate slavenodes. icid=0 for k in range(1,9): for l in range(2,nnu): icid=icid+1 co1=(nnu-l)/(nnu-1.0) co2=(l-1)/(nnu-1.0) dnid=(k-1)*nmy*(nnu-1)+l*nmy final.write('*CONSTRAINED_INTERPOLATION\n$# icid dnid ddof cidd\n') final.write('%10d %9d %9d\n' % (icid, dnid, 123456)) final.write('$# inid idof twghtx twghty twghtz rwghtx rwghty rwghtz\n') final.write('%10d %9d %9.6f\n' % (inid[k-1],123456,co1)) final.write('%10d %9d %9.6f\n' % (inid[k],123456,co2)) # Creates the cards *BOUNDARY_PRESCRIBED_MOTION to the local # model to add a small displacement at one DOF at one master # node at a time while it's used to constrain the other master # DOFs not to move and runs the simulation to get the stiffness # matrix expressed only in the master nodes to be used in the # global model. k=0 lcid=1 for nn in pl: l=0 for nd in range(1,4)+range(5,8): if nn == nid and nd == dof: final.write("*DEFINE_CURVE_TITLE\nDisplacement curve\n$# lcid sidr sfa sfo offa offo dattyp\n") final.write("%10d 0 1.000000 1.000000 0.000 0.000 0\n" % (lcid)) final.write("$# a1 o1\n") for m in range(dtnr): final.write("%20.7e %19.7e\n" % (m*dt,u[k*6+l][m])) final.write("%20.7e %19.7e\n" %
45
(time+dt,u[k*6+l][m]+du)) final.write("*BOUNDARY_PRESCRIBED_MOTION_NODE\n$# nid dof vad lcid sf vid death birth\n") final.write("%10d %9d %9d %9d %9.6f %9d%10.4e\n" % (nn,nd,2,lcid,1.0,0,time+dt)) lcid=lcid+1 else: final.write("*DEFINE_CURVE_TITLE\nDisplacement curve\n$# lcid sidr sfa sfo offa offo dattyp\n") final.write("%10d 0 1.000000 1.000000 0.000 0.000 0\n" % (lcid)) final.write("$# a1 o1\n") for m in range(dtnr): final.write("%20.7e %19.7e\n" % (m*dt,u[k*6+l][m])) final.write("%20.7e %19.7e\n" % (time+dt,u[k*6+l][m])) final.write("*BOUNDARY_PRESCRIBED_MOTION_NODE\n$# nid dof vad lcid sf vid death birth\n") final.write("%10d %9d %9d %9d %9.6f %9d%10.4e\n" % (nn,nd,2,lcid,1.0,0,time+dt)) lcid=lcid+1 l=l+1 k=k+1 # *BOUNDARY_SPC is used to get forces and moment in the end of # the simulation. final.write("*BOUNDARY_SPC_SET_BIRTH_DEATH\n$# nsid cid dofx dofy dofz dofrx dofry dofrz\n") final.write("%10d %19d %9d %9d %9d %9d %9d\n" % (1,1,1,1,1,1,1)) final.write("$# birth death\n%10.4e\n" % (time+dt)) final.write("*END") final.close() # Runs the local simulation with the added displacement. # In lsdstart.sh everything is present except the filename. #Creates lsd.sh with the added filename and runs the simulation. old=open(wd+"/lsdstart.sh","r") text=old.read() old.close() new=open("lsd.sh","w") new.write(text[0:len(text)-1]+" i=local_final.k") new.close() os.system("qsub -d $PWD lsd.sh") # Waits until the d3dump file is found before continuing, thus # certain the simulation is finished. test=True w=0 while test: w=w+1 if w == 10000000: print "Not finding file! Breaking script after % d iterations" % (w)
46
sys.exit() try: os.rename("d3dump01","d3dump01") print w for b in range(10000000): pass test=False except OSError: test=True os.remove("d3dump01") # Saving the forces and moment at the last timestep to be used # in the stiffness calculations. temp=open("spcforc.cfile","w") temp.write('binaski init;\nbinaski load binout\nbinaski fileswitch binout;\nbinaski loadblock /spcforc\n') temp.write('binaski plot "binout" spcforc %d 6 ' % (8*(nnu-1))) for nn in range(nmy,8*nmy*(nnu-1)+1,nmy): temp.write('%d ' % (nn)) temp.write('x_force y_force z_force x_moment y_moment z_moment;\n') temp.write('xyplot 1 savefile curve_file "forza" %d all\n' % (count*interval+1)) temp.close()
pid=os.spawnv(os.P_WAIT,"/software/lstc/lsprepost2_4/lsprepost2_4_linux64_centos46",["lsp24","spcforc.cfile","-nographics"])
if pid != 0: print "Error in reading binout for localstif simulation at cycle number %d! Breaking script." % (count) sys.exit() temp=open("forza","r") text=temp.readlines() temp.close() for l in range(6): for k in range(8*(nnu-1)): newforce[k*6+l]=float(text[9+l*48*(nnu-1)+k*6][27:40]) os.remove("binout") os.remove("spcforc") # Calculates the stiffness matrix from the difference of the old # forces and moments and the new ones # and adding the contributions from the slaved boundary nodes. h=-1 for nn in pl: h=h+1 m=nn/nmy-1 for n in range(6): totforce=newforce[m*6+n]-oldforce[m*6+n] if n < 3: if nn == nmy: for l in range(1,nnu-1): co=(nnu-1-l)/(nnu-1.0) totforce=totforce+co*(newforce[(m+l)*6+n]- oldforce[(m+l)*6+n])+co*(newforce[(8*(nnu- 1)-l)*6+n]-oldforce[(8*(nnu-1)-l)*6+n]) else: for l in range(1,nnu-1):
47
co=(nnu-1-l)/(nnu-1.0) totforce=totforce+co*(newforce[(m+l)*6+n]- oldforce[(m+l)*6+n])+co*(newforce[(m- l)*6+n]-oldforce[(m-l)*6+n]) stif[h*6+n][i*6+j]=totforce/du # If the stiffness coefficient is computed to zero it # may be due to inaccuracy and is therefore set to it's # former value if stif[h*6+n][i*6+j] == 0.0: stif[h*6+n][i*6+j]=oldstif[h*6+n][i*6+j] j=j+1 i=i+1 # Global simulation. os.chdir(wd+"/Global") if count == 0: f=open("restartdeck.inf","w") glob=open("global_superelement.k","r") f.write(glob.read()) glob.close() f.write("*CONTROL_IMPLICIT_GENERAL\n$# imflag dt0 imform nsbs igs cnstn form zero_v\n") f.write(" 1 %9.3e 2 1 2 0 0 1\n" % (dt)) f.write("*CONTROL_HOURGLASS\n$# IHQ QH\n 5\n") f.write("*DATABASE_BINARY_D3PLOT\n$# dt lcdt beam npltc psetid\n %9.3e\n$# ioopt\n 0\n" % (dt)) f.write("*DATABASE_NODOUT\n$# dt\n%10.3e%10d\n" % (dt,3)) f.write("*CONTROL_TERMINATION\n$# endtim endcyc dtmin endeng endmas\n %9.6f\n" % (endtime)) f.write("*SET_NODE_LIST_TITLE\nGlobal master node identities the global model\n$# sid DA1\n %9d\n" % (3)) f.write("$# nid1 nid2 nid3 nid4 nid5 nid6 nid7 nid8\n") for nn in pg: f.write("%10d" % (nn)) f.write("\n") f.write("*DATABASE_HISTORY_NODE_SET\n") f.write("$# nid1 nid2 nid3 nid4 nid5 nid6 nid7 nid8\n%10d\n" % (3)) f.write("*ELEMENT_DIRECT_MATRIX_INPUT\n$# eid ifrmt\n 1 0\n$# filename\nsupel\n") f.write("$# mass damp stif inert\n MASS STIF\n") f.write("*END") f.close() # In lsdstart.sh everything is present except the filename. Creates # lsd.sh with the added filename and runs the simulation. old=open(wd+"/lsdstart.sh","r") text=old.read() old.close() new=open("lsd.sh","w") new.write(text[0:len(text)-1]+" i=restartdeck.inf") new.close() os.system("qsub -d $PWD lsd.sh")
48
# Waits until the d3dump file is found before continuing, thus certain # the simulation is finished. test=True w=0 while test: w=w+1 if w == 100000000: print "Not finding file! Breaking script after % d iterations" % (w) sys.exit() try: os.rename("d3dump01","d3dump01") print w for b in range(10000000): pass test=False except OSError: test=True # Saves the displacements of the master node dofs to use in the local # model. temp=open("nodout.cfile","w") temp.write('binaski init;\nbinaski load binout\nbinaski fileswitch binout;\nbinaski loadblock /nodout;\n') temp.write('binaski plot "binout" nodout 8 6 ') for nn in pg: temp.write('%d ' % (nn)) temp.write('x_displacement y_displacement z_displacement rx_displacement ry_displacement rz_displacement;\n') temp.write('xyplot 1 savefile curve_file "nodedef" %d all' % (1)) temp.close()
pid=os.spawnv(os.P_WAIT,"/software/lstc/lsprepost2_4/lsprepost2_4_linux64_centos46",["lsp24","nodout.cfile","-nographics"])
if pid != 0: print "Error in reading binout for global simulation at cycle number %d! Breaking script." % (count) sys.exit() temp=open("nodedef","r") text=temp.readlines() temp.close() for l in range(6): for k in range(8): for dtnr in range(interval+1): u[k*6+l][dtnr]=float(text[8+dtnr+l*(5+interval)*8+k*(5+interval)][27:40]) os.remove("binout") os.remove("nodout") dtnr=dtnr+1 else: # Writes the stiffness in a file and the mass matrix is added. f=open("supel","w") f.write("DMIG* STIF %27d %15d %15d*\n*\n" % (0,6,2)) for i in range(8): for j in range(6): k=-1
49
f.write("DMIG* STIF %27s %15d %16s\n" % (pg[i],j+1,'*')) for nn in pg: k=k+1 for l in range(6): f.write("*%23d %15d%16.9e %16s\n" % (nn,l+1,stif[k*6+l][i*6+j],'*')) if i*6+j == k*6+l: f.write("*\n") k=-1 break if k == -1: break mass=open(wd+"/mass","r") f.write(mass.read()) mass.close() f.close() f=open("restartdeck.inf","w") glob=open("global_superelement.k","r") f.write(glob.read()) glob.close() # Calculates external loads to be added at the master nodes to # compensate for the fact that # LS-DYNA uses the stiffness matrix of the superelement as an elastic # stiffness matrix instead # of a tangential stiffness matrix. lcid=3 i=0 for nid in pg: j=0 for dof in range(1,4)+range(5,8): fout[i*6+j][count]=-oldforce[(pl[i]/nmy-1)*6+j] for k in range(8):
for l in range(6): fout[i*6+j][count]=fout[i*6+j][count]+stif[i*6+j][k*6+l]*u[k*6+l][dtnr-1]
f.write("*DEFINE_CURVE_TITLE\nDisplacement curve\n$# lcid sidr sfa sfo offa offo dattyp\n")
f.write("%10d 0 1.000000 1.000000 0.000 0.000 0\n" % (lcid)) f.write("$# a1 o1\n") if count == 1: f.write("%20.7e %19.7e\n" % (time,0.0)) else: f.write("%20.7e %19.7e\n" % (time,fout[i*6+j][count-1])) f.write("%20.7e %19.7e\n" % (time+dt,fout[i*6+j][count])) f.write("%20.7e %19.7e\n" % (endtime,fout[i*6+j][count])) f.write("*LOAD_NODE_POINT\n$# nid dof lcid\n%10d%10d%10d\n" % (nid,dof,lcid)) lcid=lcid+1 j=j+1 i=i+1 f.write("*STRESS_INITIALIZATION\n$# pido pidn\n %9d %9d\n" % (1,1)) f.write("*CONTROL_IMPLICIT_GENERAL\n$# imflag dt0 imform nsbs igs cnstn form zero_v\n") f.write(" 1 %9.3e 2 1 2 0 0 1\n" % (dt)) f.write("*CONTROL_HOURGLASS\n$# IHQ QH\n 5\n")
50
f.write("*DATABASE_BINARY_D3PLOT\n$# dt lcdt beam npltc psetid\n %9.3e\n$# ioopt\n 0\n" % (dt)) f.write("*DATABASE_NODOUT\n$# dt\n%10.4e%10d\n" % (dt,3)) f.write("*CONTROL_TERMINATION\n$# endtim endcyc dtmin endeng endmas\n %9.6f\n" % (endtime)) f.write("*SET_NODE_LIST_TITLE\nGlobal master node identities the global model\n$# sid DA1\n %9d\n" % (3)) f.write("$# nid1 nid2 nid3 nid4 nid5 nid6 nid7 nid8\n") for nn in pg: f.write("%10d" % (nn)) f.write("\n") f.write("*DATABASE_HISTORY_NODE_SET\n") f.write("$# nid1 nid2 nid3 nid4 nid5 nid6 nid7 nid8\n%10d\n" % (3)) f.write("*ELEMENT_DIRECT_MATRIX_INPUT\n$# eid ifrmt\n 1 0\n$# filename\nsupel\n") f.write("$# mass damp stif inert\n MASS STIF\n") f.write("*END") f.close() # In lsdstart.sh everything is present except the filename. Creates # lsd.sh with the added filename and runs the simulation. old=open(wd+"/lsdstart.sh","r") text=old.read() old.close() new=open("lsd.sh","w") if count < 10: new.write(text[0:len(text)-1]+" i=restartdeck.inf"+" R=d3dump0"+str(count)) else: new.write(text[0:len(text)-1]+" i=restartdeck.inf"+" R=d3dump"+str(count)) new.close() os.system("qsub -d $PWD lsd.sh") # Waits until the d3dump file is found before continuing, thus certain # the simulation is finished. test=True w=0 while test: w=w+1 if w == 100000000: print "Not finding file! Breaking script after % d iterations" % (w) sys.exit() try: if count+1 < 10: os.rename("d3dump0"+str(count+1),"d3dump0"+str(count+1)) else: os.rename("d3dump"+str(count+1),"d3dump"+str(count+1)) print w for b in range(10000000): pass test=False except OSError:
51
test=True if count < 10: os.remove("d3dump0"+str(count)) else: os.remove("d3dump"+str(count)) if endtime != finaltime: # Saving the displacements of the master node dofs to use in the # local model. temp=open("nodout.cfile","w") temp.write('binaski init;\nbinaski load binout\nbinaski fileswitch binout;\nbinaski loadblock /nodout;\n') temp.write('binaski plot "binout" nodout 8 6 ') for nn in pg: temp.write('%d ' % (nn)) temp.write('x_displacement y_displacement z_displacement rx_displacement ry_displacement rz_displacement;\n') temp.write('xyplot 1 savefile curve_file "nodedef" %d all' % (1)) temp.close() pid=os.spawnv(os.P_WAIT,"/software/lstc/lsprepost2_4/lsprepost2_4_linux64_ centos46",["lsp24","nodout.cfile","-nographics"]) if pid != 0: print "Error in reading binout for global simulation! Breaking script." sys.exit() temp=open("nodedef","r") text=temp.readlines() temp.close() for l in range(6): for k in range(8): for p in range(interval): u[k*6+l][count*interval+1+p]=float(text [8+p+l*(4+interval)*8+k*(4+in terval)][27:40]) dtnr=(count+1)*interval+1 os.remove("binout") os.remove("nodout") if endtime == finaltime: break # Saves the old stiffness matrix. for i in range(48): for j in range(48): oldstif[i][j]=stif[i][j] # Creates the cards "BOUNDARY PRESCRIBED MOTION" and "DEFINE CURVE" to the # local model for the displacements from the global model at the master nodes # and then runs the simulation of the local model to get the initial forces. os.chdir(wd+"/Localdef") final=open("local_final.k","w") start=open(wd+"/local_start","r") final.write(start.read()) start.close() final.write("*CONTROL_TERMINATION\n$# endtim endcyc dtmin endeng endmas\n %9.5f\n" % (endtime))
52
final.write("*DATABASE_BINARY_D3PLOT\n$# dt lcdt beam npltc psetid\n %9.3e\n$# ioopt\n 0\n" % (dt)) # Creates a node list with all boundary nodes in the local model. final.write("*SET_NODE_LIST_TITLE\nLocal boundary node ids\n$# sid DA1\n %9d\n" % (1)) final.write("$# nid1 nid2 nid3 nid4 nid5 nid6 nid7 nid8\n") for nn in range(nmy,8*nmy*(nnu-1)+1,nmy): final.write("%10d" % (nn)) if (nn/nmy)%8 == 0 or nn == 8*nmy*(nnu-1): final.write("\n") final.write("*BOUNDARY_SPC_SET_BIRTH_DEATH\n$# nsid cid dofx dofy dofz dofrx dofry dofrz\n") final.write("%10d %19d %9d %9d %9d %9d %9d\n" % (1,1,1,1,1,1,1)) final.write("$# birth death\n%10.4e\n" % (endtime)) icid=0 for i in range(1,9): for j in range(2,nnu): icid=icid+1 co1=(nnu-j)/(nnu-1.0) co2=(j-1)/(nnu-1.0) dnid=(i-1)*nmy*(nnu-1)+j*nmy final.write('*CONSTRAINED_INTERPOLATION\n$# icid dnid ddof cidd\n') final.write('%10d %9d %9d\n' % (icid, dnid, 123456)) final.write('$# inid idof twghtx twghty twghtz rwghtx rwghty rwghtz\n') final.write('%10d %9d %9.6f\n' % (inid[i-1],123456,co1)) final.write('%10d %9d %9.6f\n' % (inid[i],123456,co2)) lcid=1 i=0 for nid in pl: j=0 for dof in range(1,4)+range(5,8): final.write("*BOUNDARY_PRESCRIBED_MOTION_NODE\n$# nid dof vad lcid sf vid death birth\n") final.write("%10d %9d %9d %9d %9.5f %9d%10.4e%10.4e\n" % (nid,dof,2,lcid,1.0,0,endtime,0.0)) final.write("*DEFINE_CURVE_TITLE\nDisplacement curve\n$# lcid sidr sfa sfo offa offo dattyp\n") final.write("%10d 0 1.000000 1.000000 0.000 0.000 0\n" % (lcid)) final.write("$# a1 o1\n") for k in range(dtnr): final.write("%20.7e %19.7e\n" % (k*dt,u[i*6+j][k])) lcid=lcid+1 j=j+1 i=i+1 final.write("*END") final.close() # Runs the local simulation old=open(wd+"/lsdstart.sh","r") text=old.read() old.close() new=open("lsd.sh","w")
53
new.write(text[0:len(text)-1]+" i=local_final.k") new.close() os.system("qsub -d $PWD lsd.sh") # Waits until the d3dump file is found before continuing, thus certain the # simulation is finished. test=True w=0 while test: w=w+1 if w == 10000000: print "Not finding file! Breaking script after % d iterations" % (w) sys.exit() try: os.rename("d3dump01","d3dump01") print w for b in range(10000000): pass test=False except OSError: test=True os.remove("d3dump01") # Saves the displacements to use in the prescribed motions for the stiffness # calculations. temp=open("nodout.cfile","w") temp.write('binaski init;\nbinaski load binout\nbinaski fileswitch binout;\nbinaski loadblock /nodout;\n') temp.write('binaski plot "binout" nodout %d 6 ' % (8)) for nn in pl: temp.write('%d ' % (nn)) temp.write('x_displacement y_displacement z_displacement rx_displacement ry_displacement rz_displacement;\n') temp.write('xyplot 1 savefile curve_file "nodedef" %d all' % (1)) temp.close() pid=os.spawnv(os.P_WAIT,"/software/lstc/lsprepost2_4/lsprepost2_4_linux64_ centos46",["lsp24","nodout.cfile","-nographics"]) if pid != 0: print "Error in reading binout for localdef simulation at cycle number %d! Breaking script." % (count) sys.exit() temp=open("nodedef","r") text=temp.readlines() temp.close() for l in range(6): for k in range(8): for p in range(dtnr): u[k*6+l][p]=float(text[8+p+l*(4+dtnr)*8+k*(4+dtnr)][27:40]) os.remove("nodout") # Saves the force and moment at the last timestep to use in the stiffness # calculations. temp=open("spcforc.cfile","w") temp.write('binaski init;\nbinaski load binout;\nbinaski fileswitch binout;\nbinaski loadblock /spcforc;\n') temp.write('binaski plot "binout" spcforc %d 6 ' % (8*(nnu-1))) for nn in range(nmy,8*nmy*(nnu-1)+1,nmy):
54
temp.write('%d ' % (nn)) temp.write('x_force y_force z_force x_moment y_moment z_moment;\n') temp.write('xyplot 1 savefile curve_file "forza" %d all' % ((count+1)*interval)) temp.close() pid=os.spawnv(os.P_WAIT,"/software/lstc/lsprepost2_4/lsprepost2_4_linux64_ centos46",["lsp24","spcforc.cfile","-nographics"]) if pid != 0: print "Error in reading binout for localdef simulation at cycle number %d! Breaking script." % (count) sys.exit() temp=open("forza","r") text=temp.readlines() temp.close() for l in range(6): for k in range(8*(nnu-1)): oldforce[k*6+l]=float(text[9+l*48*(nnu-1)+k*6][27:40]) os.remove("binout") os.remove("spcforc") count=count+1