3 Library of Fish Functions
3 Library of Fish Functions
3 Library of Fish Functions
This section contains a library of FISH functions that have been written for general application in
FLAC 3D analysis. The functions can be used for various aspects of model generation and solution,
including mesh generation, plotting, assigning material properties and solution control.
The FISH function files are contained in the “\FISH\Library” directory.
The general procedure to implement these FISH functions is performed in three steps.
1. The FISH file is first called by the FLAC 3D data file with the command
call filename.fis
2. Next, FISH variables, if given at the top of the function file, must be set in the data file
with the command
set var1 = value var2 = value ...
where var1, var2, etc. are the variable names that must be set to specified values.
3. Finally, the FISH function is invoked by entering the function name that follows directly
after the DEF command in the FISH file. The name does not have to be given if a fishcall
is used within the file.
The FISH functions interact with FLAC 3D in various ways. You should turn to Section 2.4 for a
description of the different types of linkages between FISH and FLAC 3D.
1
P0 = ∗ (|f0 |)2 (1)
N2
1
Pk = ∗ [(|fk |)2 + (|fN −k |)2 ] (2)
N2
1
PN = ∗ (|f N |)2 (3)
2 N2 2
Note that an array, worka, is used to manipulate the table data. The array dimension (FISH variable
n point) is defined from the following conditions: (1) to be greater than the number of elements
in the input table; and (2) to be a power of 2. (The array dimension need not be declared manually.)
The fft algorithm requires input data with a constant timestep. So, a timestep is calculated, and
the data are interpolated from the table and stored into the array for processing.
The following example verifies the fft FISH function. The history input is the sum of a sine wave
at 1 Hz and an amplitude of 1, a cosine wave at 5 Hz and an amplitude of 2, and a sine wave at 10 Hz
and an amplitude of 3. The combined history input is calculated by the FISH function cr tab.
The input is plotted in Figure 1. The power spectrum shown in Figure 2 consists of three sharp
peaks at 1, 5 and 10 Hz, with increasing peak values.
Reference
Press, W. H., B. P. Flannery, S. A. Teukolsky and W. T. Vetterling. Numerical Recipes in C.
Cambridge: Cambridge University Press, 1992.
def cr tab
i = 1
p2 = 2.*pi
loop while i <= num point
xx=end time*float(i)/float(num point)
i = i+1
yy = sin(xx*p2/per1)+2.*cos(5.*xx*p2/per1)+3.*sin(10.*xx*p2/per1)
table(1,xx) = yy
end loop
end
cr tab
FLAC3D 3.00
13:18:18 Fri Mar 25 2005 5.0
Table
1 UnNamed
Linestyle 4.0
-5.381e+000 <-> 5.467e+000
3.0
2.0
1.0
0.0
-1.0
-2.0
-3.0
-4.0
-5.0
FLAC3D 3.00
13:18:45 Fri Mar 25 2005
Table
2 UnNamed 7.0
Linestyle
0.000e+000 <-> 7.837e+000
6.0
5.0
4.0
3.0
2.0
1.0
0.0
0.0 0.5 1.0 1.5 2.0
Itasca Consulting Group, Inc. x10^1
Minneapolis, MN USA
After all digits are found up to a precision limit of “precision limit + 1,” the last digit is rounded
off, depending on whether its value is greater than or equal to 5. Thus the result will be a floating
point number with user-defined precision stored as a string. The digits are then output as a string
value with an exponent of “k.”
Note: If the user does not specify a precision limit, the FISH function assumes a precision limit of
7 digits.
The data file “NUMTEST.DAT” illustrates how to print numbers with a user-specified precision
limit of 10 digits. In this example, 20 numbers are generated randomly and their values are output
with 10 digits of precision.
Data File “NUMTEST.DAT”
; Exercise the Number functions
call number.fis
set digits=10
def qqq
loop n (1,20)
power = int((urand - 0.5) * 40.0)
Given = urandˆ power
oo = out(’ input = ’+string(Given)+’ output = ’+Number)
endLoop
end
qqq
def cr tab
i = 0
p2 = 2.*pi
loop while i <= num point
xx=end time*float(i)/float(num point)
i = i+1
yy = sin(xx*p2/per1)
table(1,xx) = yy
end loop
end
cr tab
ca spec.fis
set pmin = 0.5
set pmax = 2.
set dmp = 0.
set acc in = 1
set sd out = 2
set sv out = 3
set sa out = 4
set n point = 50
spectra
;
table 1 name ’input acceleration’
;
table 2 name ’displacement response spectrum’
;
table 3 name ’pseudo-velocity spectrum’
;
table 4 name ’pseudo-acceleration spectrum’
;
ret
x10^-1
FLAC3D 3.00
13:19:30 Fri Mar 25 2005
Table 8.0
1 input acceleration
Linestyle
-9.999e-001 <-> 9.999e-001
6.0
4.0
2.0
0.0
-2.0
-4.0
-6.0
-8.0
x10^-1
FLAC3D 3.00
13:19:53 Fri Mar 25 2005 2.4
Table
2 displacement response spectrum 2.2
Linestyle
1.097e-002 <-> 2.476e-001
2.0
1.8
1.6
1.4
1.2
1.0
0.8
0.6
0.4
0.2
FLAC3D 3.00
13:20:18 Fri Mar 25 2005
1.4
Table
3 pseudo-velocity spectrum
Linestyle
1.378e-001 <-> 1.505e+000
1.2
1.0
0.8
0.6
0.4
0.2
FLAC3D 3.00
13:20:34 Fri Mar 25 2005
9.0
Table
4 pseudo-acceleration spectrum
Linestyle
1.333e+000 <-> 9.460e+000
8.0
7.0
6.0
5.0
4.0
3.0
2.0
config gpextra 1
def contour map
pnt=gp head
loop while pnt # null
gp extra(pnt,1)=gp zpos(pnt)
pnt=gp next(pnt)
end loop
end
contour map
; Table 2 @ y = 80
table 2 0 910
table 2 20 925
table 2 50 925
table 2 110 900
table 2 180 900
table 2 215 925
table 2 248 950
table 2 276 950
table 2 306 925
table 2 337 900
table 2 365 875
table 2 376 875
table 2 400 900
; Table 3 @ y = 120
table 3 0 890
table 3 122 875
table 3 158 875
table 3 185 900
table 3 245 925
table 3 287 925
table 3 308 900
table 3 365 875
table 3 392 900
table 3 400 910
; Table 4 @ y = 160
table 4 0 910
table 4 8 900
table 4 42 875
table 4 125 850
table 4 162 850
table 4 191 875
table 4 270 875
table 4 325 850
table 4 357 850
table 4 385 875
table 4 400 880
; Table 5 @ y = 200
table 5 0 890
table 5 50 875
table 5 82 850
table 5 105 825
table 5 138 825
table 5 203 850
table 5 289 850
table 5 314 825
table 5 339 825
table 5 375 850
table 5 400 865
; Table 6 @ y = 240
table 6 0 860
table 6 73 850
table 6 106 825
table 6 134 800
table 6 157 800
table 6 243 825
table 6 296 825
table 6 350 825
table 6 400 850
; Table 7 @ y = 280
table 7 0 840
table 7 85 825
table 7 130 800
table 7 146 775
table 7 179 775
table 7 318 800
table 7 351 825
table 7 400 830
; Table 8 @ y = 320
table 8 0 852
table 8 10 850
table 8 45 825
table 8 80 800
table 8 137 775
table 8 180 750
table 8 192 750
table 8 308 775
table 8 357 800
table 8 400 825
; Table 9 @ y = 360
table 9 0 870
table 9 32 850
table 9 57 825
table 9 102 800
table 9 132 775
table 9 166 750
table 9 255 750
table 9 293 775
table 9 323 800
table 9 364 825
table 9 389 850
table 9 400 860
; Table 10 @ y = 400
table 10 0 870
table 10 42 850
table 10 62 825
table 10 98 800
table 10 140 775
table 10 176 750
table 10 206 725
table 10 242 725
table 10 266 750
table 10 296 775
table 10 314 800
table 10 380 825
table 10 400 835
; Table 11 @ y = 440
table 11 0 860
table 11 23 850
table 11 46 825
table 11 72 800
FLAC3D 3.00
Settings: Model Projection
13:21:56 Fri Mar 25 2005
Center: Rotation:
X: 2.000e+002 X: 90.000
Y: 2.000e+002 Y: 0.000
Z: 7.250e+002 Z: 0.000
Dist: 1.331e+003 Size: 5.295e+002
Z elevation
Magfac = 0.000e+000
7.0357e+002 to 7.2500e+002
7.2500e+002 to 7.5000e+002
7.5000e+002 to 7.7500e+002
7.7500e+002 to 8.0000e+002
8.0000e+002 to 8.2500e+002
8.2500e+002 to 8.5000e+002
8.5000e+002 to 8.7500e+002
8.7500e+002 to 9.0000e+002
9.0000e+002 to 9.2500e+002
9.2500e+002 to 9.5000e+002
9.5000e+002 to 9.5000e+002
Interval = 2.5e+001
FLAC3D 3.00
Settings: Model Perspective
13:22:44 Fri Mar 25 2005
Center: Rotation:
X: 2.000e+002 X: 29.851
Y: 2.000e+002 Y: 358.272
Z: 7.250e+002 Z: 150.149
Dist: 2.169e+003 Mag.: 1.25
Ang.: 22.500