• No results found

Manual and program listings of the multibody optimization program Mecopt

N/A
N/A
Protected

Academic year: 2021

Share "Manual and program listings of the multibody optimization program Mecopt"

Copied!
48
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

Manual and program listings of the multibody optimization

program Mecopt

Citation for published version (APA):

Thijssen, E. J. R. W. (1993). Manual and program listings of the multibody optimization program Mecopt. (DCT

rapporten; Vol. 1993.153). Technische Universiteit Eindhoven.

Document status and date:

Published: 01/01/1993

Document Version:

Publisher’s PDF, also known as Version of Record (includes final page, issue and volume numbers)

Please check the document version of this publication:

• A submitted manuscript is the version of the article upon submission and before peer-review. There can be

important differences between the submitted version and the official published version of record. People

interested in the research are advised to contact the author for the final version of the publication, or visit the

DOI to the publisher's website.

• The final author version and the galley proof are versions of the publication after peer review.

• The final published version features the final layout of the paper including the volume, issue and page

numbers.

Link to publication

General rights

Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain

• You may freely distribute the URL identifying the publication in the public portal.

If the publication is distributed under the terms of Article 25fa of the Dutch Copyright Act, indicated by the “Taverne” license above, please follow below link for the End User Agreement:

www.tue.nl/taverne Take down policy

If you believe that this document breaches copyright please contact us at: openaccess@tue.nl

(2)

Manual

and program

listings

of

the

multibody

optimization program

Mecopa.

E.J.R.W. Thijssen

(3)

Manual and program listings of the

multibody optimization program Mecopt

I

November

1993

Author: Edwin Thijssen

Eindhoven University

of

Technology

Department

of

Mechanical Engineering

Computational and Experimental Mechanics Group

(4)

Contents

contents

1. Detailed explanation of the multibody optimization program Mecopt

1.1. Explanation of the programs

1.2. Flow diagrams

1.3.

File

listings

2.

How

to

use MecQpt

2.1. The file 'banquedat'

2.2. The file 'demar.dat'

2.3. The file 'common'

2.4. The file 'func4ion.f

25. The file

'0bjcons.f'

2.6. The file 'n0eud.f'

2.7. A Mecopt

run

2.8. A M m p t

m

on

background

3.

Use

of the hp2 network station

3

4

4

11

14

36

36

37

38

38

39

41

43

45

47

(5)

Chapter

1

Detailed explanation of the multibody optimization

p q p m

Mecopt

This chapter explains the detailed features

of

the multibody optimization program Mecopt.

The program Mecopt calls several sub-programs, which

are explained successively in this chapter.

They are explained with the use of the listings and for the more comprehensive programs a flow-

diagram

is

added.

1.1. Exghnation

of the programs

Mecopt

script-file and a structured flow-diagram

can

be seen in sections 1.3 and 1.2, respectively.

Line(s):

3-4:

Set the name of the problem and the

directory

in which the Samcef software can be found.

6-8:

Remove some files, if they still exist

from

an

earlier

run.

11:

Calls the sub-program

Zink2. This program links and compiles all the fortran written

routines. The control of the linking process

is

written to the file 'linkdat'.

12-14:

These lines appear several times

in

the script-file. They check

if

an

error occurred

in

the

previous runned program and if

so,

an error is printed

on the

screen and the script-file

stops his

run.

17

Initializes the input by way of the program hithdke, this program can also be seen in the

flow-diagram of the script-file.

23:

Defines the optimization loop.

The

command states the following:

"If the file 'converg.dat'

does not exist, then the program continues". The end of the loop can be found on line 115.

24:

This line denotes a label. From another point of the program

can

be jumped to this label.

26:

Runs the program

save. This program creates a file 'savedatdat', which contains all the

data

needed by Samcef-Mecano for storing the correct response functions.

30-33:

Check if the program h&zZke or

save found an error in one of the intputfiles.

38-50:

Execute a Memo-run in the design point, which also

is

denoted in the flow-diagram. The

inputs of the pré- and post-processing

runs are

given within the blocks

ZabeZl and

ZabeZ2,

respectively.

The output of the Samcef-runs that are usually

written

to

the

screen is now

printed in the file 'runsdat'.

(6)

55:

Calls

the first

part

of the optimization process, namely the program

optimizationl.

The

flow-diagram shows that this part consists of printing previously computed results

on the

screen and of checking the convergence of the optimization process.

60-67:

Check some options that

can

OCCUT

in the program

opiimimtionl. For example, if

optimizafionl

detects convergence in the optimization process it will create a file

'convergdat' that

is

also recognized by the script-file 'mecopt'.

73:

Defines the variation loop that ends

on line 101. The loop is controlled by the file

'stopdat', which will be created if all design variables have been varied.

79:

The variation process is executed by the program

variuíion.

83-95:

Every time a design variable

has

been varied, a

M m o - r u n is made for computing the

response functions of the varied design. This

can

also be seen in the flow-diagram.

97:

Defines the end of the variation loop.

104

Executes the second part of the optimization process by way of the program

optUnizatiOn2.

This program computes the linear approximation models and computes a new, more

optimal design. These steps are also denoted in the flow-diagram.

Defines the end of the optimization loop.

111:

i n i t i d k

The program

initialize

is constructed out of four routines, namely: The main routine

'initvar' and

three

subroutines 'noeud',

'rncc' and 'resale'. The three subroutines are user

programmable subroutines, they are explained in chapter 2. The program

initialize makes

a check

on

various errors and appends the values of the design variables from the optimization inputfile

'desvar.dat' to the

Mecano inputfile 'banque.dat'. The structure of these files is also explained

in

chapter 2.

Line(s):

30-46:

Read the design variables from the

file 'desvardat'. Lines

35-37

read the first

7

comment

lines.

b e s 38-40 read the design variables. If the number of design variables in the file

'desvar.dat' is lower than N, then an error is printed by line 42 and the file 'error.dat'

is

created.

49:

Rescales the design variables for

use

in a

Mecano-run.

58-72

Check the inputfile 'banqueht'

on errors. Line 59 checks the existence of the block

'.exl'. If that block can not be

found, then an error is detected. If '.exl' exists, then there

is

checked if the command 'exit' exists. If

not, the program

is

continued at line 79, else an

error is detected.

79-90:

Append the scaled design variables to the file 'banqueht'. The subroutines 'noeud' and

'rncc'

can

be used for appending parameters to the file 'banqueht' that depend

on the

design variables. The use of these

two

subroutines is explained in chapter

2.

104

Stops the program

inirialize.

(7)

and the subroutine 'function'. The structure of the file 'functi0n.f is

also

explained in chapter 2.

Save

reaás all the data from subroutine 'function' and checks it on errors. With the use of that data

a file 'savedatdat' is created, which will be

used by the post-procesSing

run

of Samcef for saving

the response results in the file 'result O.dat'.

Line(s):

20-32 Read the data necessary for Mecano to save the response functions and checks the data

on

errors. If an error

is

detected, then the file 'errordat' is created.

35-52 Create the file 'savedatdat' with its specific information.

69:

Stops the program

save.

variation

The program

variation

is

constructed

out of five routines, namely: The main routine 'vary'

and the four subroutines 'function', 'noeud', 'mcc' and 'rescale'.

Variation

takes care of the

sensitivity analysis in the context of the SLP-method. The place of this program in the script-file

can

be seen in the flow-diagram of the file 'mecopt'. The program varies a certain design with

respect to all design variables and creates for every varied design a new file 'savedatdat' for

storing all varied response functions. After having varied one design variable the program stops

computation the program is sîarteú again and varies the next design variable.

20-38:

41-56:

59:

6 2

66-91:

and

2

Samw€-Mmo

rn

is made

in

order to mmpuk

the

r e p n s h & o n s . After this

Line@):

Create a file 'varnum.dat' if it does not exist already. This file stores the number of the

design variables that have been varied.

Read the design variables from the file 'desvar.dat'.

Varies just one design variable relative to its value.

Rescales the design variable for use in a Mmo-run.

Create a file 'banquel.dat' that is the inputfile for the sensitivity analysis, that are the

analysis of the varied design.

Lines 76-78 copy the file 'banquedat' to the file

'banqueldat'. Luies

81-88

append the varied design to the file 'banquelht'.

Calls the subroutine 'makesave' that

is

included in

this

file from line 124 to the end of

the file. The working of this subroutine is almost the same

as

the program

save.

The

difference is that the result-file gets a name, which is slightly different from the name

given in the program

save.

102-109: Create a

file

'stop.dat' if every design variable has been varied. That file

is

interpreted by

the saipt-file 'mecopt' as to stop the variation loop.

119

Stops the program

variafion.

97:

optimization1

The program opfimiurtionl is constructeú out of twelve routines

,

namely: The main

routine 'optiml' and eleven subroutines 'objcons', 'readfunc', 'parse', 'function', 'printres',

'interpol',

'readold', 'writeold', 'noeud',

'mw'

and

' r d e ' . The program

optbnkzcationl

just

takes

(8)

-

computing the objective function and constraint values

in

the design

point,

-

printing these and all previously gathered results on the screen,

- checking the convergence of the optimization process,

- accepting or rejecting a new obtained design.

The place of this program in the script-file is shown

in

the flow diagram

of that file. The

communication of this optimization program with

opfimizafion2

is obtained by using several data

files, for example: 'optimal.dat', 'x.dat' and 'f.dat'. The structure of the program is visualized by

the flow-diagram in section

1.2.

Line@):

7 2

Reads the data that are used for the

communication

with the program

optUnization2.

The

subroutine 'readold' will not be explained, because it

is

easy to understand.

76-87

Read the design variables from the file 'desvardat'.

92-99:

Initializes the values of objective function, constraints and side-constraints.

104-113: Read the objective function, constraints and sideconstraints from subroutine 'objcons'.

Also

is

checked if the value

of

NCLTN

is set correctly. If

not, a file 'convergdat'

is

created, which is interpreted by the program mecopf

as

to

stop.

'objcons'

This

cd1

of the subrouthe

'objam' mmputes the value of

the

objective

function, constraints and the bounds in the

design

point.

Also

the value of NCLIN is set.

On

line

42 of '0bjcons.f' the Subroutine 'readfunc' is called. The use of the subroutine

'0bjcons.f' is explained in chapter

2.

'readfunc'

Also

there are some checks on errors.

Lhe(s):

34:

Reads the information

of the response functions from subroutine

'function'.

41:

Reads some parameters from the

Mecano inputfile 'banque.dat'. The

subroutine 'parse' is not

written

by the author of this report and is not

explained.

42-48: Determine whether IA19

is a multiple

or

not. If this

is

true,

then the

discrete response functions have an equally divided time grid.

50-51: Compute the size of the time step of the response functions, DTFU".

52-56: Check if the maximum number of time steps for the response functions

is lower than 1001. This is necessary for the declaration of the

matrices.

6 0

Creates the name

of

the file in which the response functions are stored.

The name is createú by way of writing to

an

internal file (character).

64-97 Read the response functions from the files 'result ?.dat'. Line 68

describes

a loop for every response function. L.he 70 reads a h e

from

This subroutine reads the response functions from the files 'result ?.dat'.

(9)

file

STRING1.

Line

72

detects

if the line read from the file

contains

a

function value. If

not, goto line 84-85 and read a new line

from

the

file, line 70. If a function value

is

found, then the complete function is

read. When reading the function by lines

73-83, there has to be a check

at every line when the last value of the

function is read.

If one

complete function

is read, then line 68 starts with the following

response function. Finally, lines 90-96 make checks on errors in the

result files.

116:

Calls the subroutine 'printres'. This subroutine makes

some

computations

on

the gathered

results and finally prints them on the screen and stores them in a file.

'printres9

The interpretation

of

the information that is printed

on

the screen by this

subroutine

is

explained in chapter

2.

35:

38-42

51-92

94-106:

~

comgutes

the value of NCi'O-

which is the

total

number of design variables

and constraints.

Detemine the flag M U C i ' Q , which is true if at least one move limit is active.

EO4MBF that

is

used in the program

opfimiZatbn2.

Jmportant values of the

matrix

entities are:

Tf?e

ISTATE

OUQU~

Q€

the

N A G - f Q m - E b r q SUbrQUthe

1

- Indicates that the move limit is active at its lower bound.

2

-

Indicates that the move limit is active at its upper bound.

Transform all two-sided constraints, denoted by

GO,

into two one-sided

constraints, denoted by GSC, which are active if the constraint value is zero.

This is also carried out for the approximated constraint values, denoted by

GBENO. The transformation described here

is

used

in order to get comparable

values for the constraints.

Determine

the maximum value, denoted by GMAXO, of all relative constraints.

107-110 Determine whether the maximum value

is

of

the upper or lower bound of the

115-127 Determine the maximum relative error in the approximations,

denoted

by

128-130 Determine whether the maximum value is of the upper or lower bound of the

133-145: Store

all results

from

this optimization cycle and previous ones in matrices.

148-179: Print the results

on

the

screen

and stores them in a file 'outputdat'. Lines

157-

166

use the matrix ISTATE

for

determining the

state of the approximated

constraints.

Lines

167-176 actually write the results to the screen and stores

them in a file.

two-sided constraint, denoted by GNOO.

GERRO. Only constraints that have a value

greater

than

-0.5

are considered.

two-sided constraint, denoted by

GERRNOO.

120-137

Check

the convergence of the optimization cycles.

Line 123 computes the rate of

(10)

140-165:

control the execution of the optimization program. One

can

choose

for accepting the

design

point,

or rejecting it and start again with the previous design. It

is

also possible to

stop the program immediately.

Writes the data that are used for the communication with

ophniZahn2.

'desvar.dat'.

Rescales the variables for

use

in a Mecano-m.

168:

172-183:

Write the new (or previous, if the new is not accepted) design point to the file

186:

189-208:

Append the scaled design variables to the file 'banque-dat'.

222

Stops the progam

ophniZatiOnl.

op

timiza tion2

The program

optimitation2

is constructed out of thirteen routines, namely: The main

routine '0ptM' and twelve subroutines 'objcons', 'readfunc', 'parse', 'apprfunc', 'movelim',

'apprcons', 'function', 'readold', 'writeold', 'noeud', 'mcc' and 'rescale'. The program takes care

of

the second part

of

the

optimization

process, that is:

- computing the approximation models with move limits,

-

optimizing the design with the use of the approximation models.

The stmcku-e of

the

p r o p m can

~ S

be

Q

seea

in

the

flsw-&agmm in m t i ~ n

1.2.

Line(s):

50:

54-65:

72-76:

80-88:

Read the objective function,

constraints

and side-constraints

from the subroutine

91:

Calls the subroutine 'apprfunc'.

Reads the data used for communication with

optimizationl.

Read the design variables from the file 'desvardat'.

Check if the previous design was not excepted.

'objcons'. This is carried out for all the varied designs.

'apprfunc'

and the constraints.

25-26: Check if the previous design was not accepted.

If

so,

almost the complete

subroutine

can

be skipped.

30-35:

Compute the derivatives of the objective function and constraints.

39-48:

compute

the constants in the approximation models.

51-56:

compute

the new bounds of the

constraints.

The bounds change due to the

constants

computed

on

lines

39-48.

The

constants

are put

in

the bounds, because

the simplex algoritm of the NAG-library cannot deal with constants in a function.

This subroutine computes the approximation functions of the objective function

Lines(s)

(11)

'movelim

'

limits on the design variables.

Line@):

33-36: Check if the move limits in

tñe

previous optimization cycle were active. If

not,

then a propition for the new move limit

is

made.

41-52 Determine the direction of the design in the design space.

If this direction is the

opposite of the previous design direction, then a proposition for the move limit is

made.

This

subroutine

reads

the new value of the move limit and computes the move

61-62

Read the vaíue of the move limit from the keyboard.

69,71,73: Choose the move limit absolute, relative to the bounds and relative to the

design variable, respectively.

74-76: Print a warning on the screen, if the design variable becomes to small.

77-78: Compute the local bounds on

the

design variables.

79-88: Check if the local bounds of the design variables exceed the global bounds of the

design space.

93-94 Print the move limit negative, if the previous design was rejected.

98:

101-115: Make some checks on output mors of the subroutine E04MBF.

118:

Calls

the subroutine 'apprcons'.

Performs the

real

optimization process. The process

is

carries

out by a simplex

routhe

from the NAG-fortran-library, namely

EO4MBF.

'apprcons'

constraints.

Line(s):

19-22: Compute the approximated value of the objective function.

23-28:

Compute the approximated value of the constraints.

This

subroutine computes the approximated values of the objective function and

121:

125-136: Write the new design point to the file 'desvar.dat'.

139

142-161: Append the

scaled

design variables to the file 'banqueht'.

168:

Stops the program.

Writes the

data

that are used for communication with

ophiZatiOnl to a file.

Rescales the design variables for use in a Mecano-nin.

(12)

1,2.

Flow

diagrams

I\

I 4

I

This

section contains flow-diagrams of

the programs mecopt, optimization1

and

optimization2.

...

\7

:

§mc%f-Mwains

...

:

X

~

W

-1

‘i

I I .

...

w

i

I

Mecano-run in the

I

i

design

point

...

I

1

:

optimization1

print resuhs

on the screen

i

convergence

stop

i

Samcef-Mecano

...

1

...

... :

optimization2

I j

I I :

compute the linear

I : I I I

Ijl

input the

I

,

*

1

,

;

move limit

I

I

compute the new

1

i

I

desib, E04MBF

1

I - l i I ...

I

I I

Figure D.l. The flow-diagram of the program meapt.

(13)

read design point file

=

'desvar.dat'

I

'

4;

sbjcoiìs read objective function,

i

(side-) constrainis

Fl

e,

print results on

screen

I

n

input

l

write old

data

file

=

'desvar.dat'

call rescale rescales the design variables

write design

data

to inputfile for

Mecano

c

file

=

'banque.dat'

(14)

call readold read old data

call

apprcons

computes approximated constraint values

I

wid design point

I

file = ’desvar.dat’

STOP

print message on meen ’no feasible design

Point is found’ read objective functions,

(side-) comtrainîs in the varied design point

input call mwelirn move limit SQqWes &e = o w h i t s

call NAG-E04MBF computes the optimum

l

write old data

write design point file

=

’desvar.dat’

write design data to

inputñle for M m o file ’banqueht’

I

(15)

13.

File listings

'mecopt'

1 2 3 4 5 6 7 8 9 10 11 i2 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 13 74 75 76 71 78 ~ #l/bin/csh #

clear; echo "Enter the problem

set SAMCEF = /users/hp2/samcef

i 6

name..."; set prob = $<

('rm' link.dát:'rmr runs.dat;'rm' stop.dat: 'rm' varnum.dat) »&rm.dat

( , x m r converg.dat;'rm' optimal.dat;'rm' noacc.dat) >>&rm.dat

('rm' error.dat;'rm'

*:*)

»&m.dat: 'rm' rm.dat

#

echo "Compiling and linking of the programs..." link2 >>&link.dat

if ($status) tien endif

#

# The initialization of the optimization process

initialize if ($status) then

banner 'run-ERROR' ;banner 'initialize ; break

endif

#

#Testing for the end of the convergence-loop

while ( i -e converg.dat)

('rm' runS.dat) >>&rm.dat: ,amr m.dat

# The file 'savedat.dat' is created

save

if ($status) then endif

if (-e error.dat) then

endif

#

. . . .

echo "";echo "The SAMCEF-run in the design point, <return>";$<

banner 'link-ERROR'; break

banner 'run-ERR0R';banner 'save,; break

echo "";echo "The pi'sgraa will be stopped" break

echo "PRE-PROCESSING"

$SAMCEF/samcef ba $prob n 1 >>&runa.dat

<<

labell banque

.

dat

input. ex1

.fin 1 labell echo "WECANO"

$SMCEF/aamcef $prob n 1 »&runs.dat

echo "POST-PROCESSING"

$SAMCEF/samcef ba $prob n 1 »&runa.dat << label2

savedat.dat input. fun label2 ('rm'

*:*)

>>&rm.dat; 'rm' rm.dat +====-====-e--

--

__==e==-=-==__-=== #

echo "";echo "The first part of the optimization process, <return>";$<;clear optimization1

if ($status) then endif

#

if (-e converg.dat) then

endif

if (-e noacc.dat) then

endif #

+===Il====-===---

-echo "";-echo "The SAMCEF-run in the varied design points, <return>";$<

banner 'run-ERR0R';banner 'optimiz. .l'; break

echo "";echo "The program will be stopped" break

# The design point is not accepted

got0 labeloptim2

----i_II---i--~--==--i=-========I==

#Testing for the end of the variation-loop

while ( i -e stop.dat)

if (-e varnum.dat) then else

endif

cat varnum.dat echo

"

1"

(16)

79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 10% 109 110 111 112 113 114 li5 116 variation if ($status) then

banner 'run-ERR0R';banner 'variation'; break

endif

echo "PRE-PROCESSING"

$SAMCEF/samcef ba $prob n 1 »&runS.dat

<<

label3

banquel.dat

input. ex1

.fin 1 label3

echo 'MECANO'

$SAnCEF/aaatcef ?pe $prob n 1 »&rans.dat

echo 'POST-PROCESSING"

$SAUCEF/samcef ba $prob n 1 »&runS.dat << label4

savedat.dat input. fun label4 end 'rm' atop.dat 'rm8 varnum.dat x==---=~-======I==-ii=========i=====-=-============-==~==-=====~~==~ #

['re'

*,*)

>>LXE.d&tf 'rs' m.de+,

labeloptin2 :

echo "";echo "The second part of the optimization process, <return>";$< optimization2

if ($status) then endif

'rm' noacc.dat »&Prn.dat; 'PP' Prn.dat

#

# end of the (while(!-e converg.dat)) loop

end

('rmt initia1ize;'rm' save; 'rm' variation;'rm' ogtinizationl) »&rin.dat

('rm' 0ptimization2;~m' savedat.dat) »&rm.dat

('rm' converg.dat;trml result??.dat;'rm' banwel.dat) »&m.dat

( u r m e error.datj »hrm.dat; .rm' rm.dat

echo "THIS IS THE END"

banner 'run-ERROR' ;banner 'optimiz.. 2

'

; break

'link2'

1 #!/bin/csh

2 #

3 echo

"

";echo "*****linking of the program initial*****"

4 f77 -o initialize initvar.f n0eud.f resca1e.f

5 if ($status) then

6 banner

'

link-ERROR' ; break

7 endif

8 #

9 echo

"

";echo "*****linking of the program save******

10 f77 -o save makesave.f functi0n.f

11 if ($status) then

12 banner 'link-ERROR'; break

13 endif

14 #

15 echo

"

";echo "*****linking of the program variation*****"

16 f77 -o variation vary.f functi0n.f n0eud.f resca1e.f

17 if ($status) then

18 banner 'link-ERROR'; break

19 endif 20 # 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 #

set module = optim1.f

set exec = optimization1

echo

"

";echo

"*****

Linken van de module $module

**********"

f77 -o $exec $module \ 0bjcons.f \ readfunc. f \ parse. f \ functi0n.f \ printres.f \ interpo1.f \ reado1d.f \ writeo1d.f \ noeud

.

f \ resca1e.f \ if ($status) then -1nag ; ! I

(17)

40 41 42 43 44 45 46 41 48 49 50 51 52 53 54 55 56 51 58 59 60 61 62 63 endif #

set nodule = optim2.f

set exec = optimization2

echo

"

";echo

"*****

Linken van de nodule $module

***********

fll -o $exec $module \ 0bjcons.f \ readfunc. f \ par8e.f \ apprfunc.f \ movelim. f \ apprc0ns.f \ functi0n.f \ readold. f \ writeo1d.f \ noeud

.

f \ resca1e.f \ if ($status) then endif # 'rm' *.O -1nag banner

'

link-ERROR'

banner 'in link2'; break

1 2 3

4

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 0 21 22 23 24 25 26 2 1 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 41 48 49 50 51 52 53 54 C C C C C

*

C C C C C C C C C C C C C PROGRAM INI'PJAR

This program checks the inputdata and the inputfile on some errors.

The initial design is copied from the file 'desvar.dat' to the file 'banque.dat'. PHPLPCIT NONE INCLUDE 'common *

..

Local Scalars

..

INTEGER 1,10s10,10s20

..

Local Arrays

..

DOUBLE PRECISION XOPT(N)

INTEGER GROUP (N) ,NUMBER( N)

CHARACTER LINE*79,ELEM(N)*6,CODE(N)*6

XOPT ; design variables.

NUMBER ; numbers of the design variables.

GROUP ; in case of NOEUD: number of the node.

in case of MCC : number of the group.

ELEM ; NOEUD: character NOE.

MCC : name of the element (in Samcef code) to which the

design variable belongs.

CODE ; NOEüD: X, Y or Z. The character represents the degree of

freedom that is treated as design variable. design variable.

MCC : character (in Samcef code), which represents the

-

----=-==E===========3== -------I

C=--

C...The design variables are read from the file 'desvar.dat*

OPEN (UNIT=2O,FILE='desvar.dat~,IOSTAT=IOS2O,STATUS=~OLD8) IF (IOS20.NE.O) THEN 5 6 8 9 C

PRINT

*

,

'Error by opening the inputf ile desvar. dat :

'

,

IOS2 O

STOP END IF DO 5 I = 1,l CONTINUE DO 6 I p: l,N CONTINUE GOT0 9 WRITE (6,1130) I-1,N (20,*)

READ (20,1000,ENû=8) NUKBER(I),GROUP(I),ELEM(I),CODE(I),XOPT(I)

(5,*)

OPEN (UNIT=24,FILE='error.dat')

CLOSE (24) CLOSE( 2 O )

C...The design is rescaled before writing it into the file 'banque.dat'

C

CW RESCALE(X0PT)

OPEN (UNIT=lO,FILE='banque.dat', IOSTAT=IOSlO,STATIJS='OLD' )

IF (IOSlO.NE.0) THEN

PRINT

*,

'Error by opening the outputfile banque.dat:',IOSlO

(18)

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 89 90 9 i 92 93 94 95 96 97 98 99 100 101 102 103 104 105 a5 END IF C

C...The file 'banque.dat' is checked on two specific errors

IF ILINE.EQ.'.exl' .OR. LINE.EQ.'.EXl') GOT0 20

10 READ (lO,'(A),,END=50) LINE

20

50

C

G O T 0 1 0 ~

READ

(iO,'(A)',END=óO) LINE

IF (LINE.EQ.'exit' .OR. LINE.EQ.'EXIT') THEN

WRITE (6,1100) LINE OPEN (UNIT=Q4,FILE='error.dat') CLOSE ( 2 4 ) (51*) END IF GOTO 20 WRITE (6,1110) OPEN (UNIT=24,FILE='error.datt) ( 5 , * ) CLOSE

[ a r )

C...The design point is appended to the file 'banque.dat'

C...The subroutine NOEUD is used when a degree of freedom of a node

C... is used as design variable, because there may be another node which

C...is related to that node. The sane holds for the subroutine MCC

C...when two material properties are related to each other.

60 DO 30 I=l,N IF (ELEM(I).EQ.'NOE'.OR.ELEH(I).EQ.'n~'.OR. CALL NOEUD(lO,I,GROUP,ELEM,CODE,XOPT) WRITE (10,1010) GROUP(I),ELEPP(I),CODE(I),XOPT(I) CALL b(CC(lO,I,C;ROUP,~~,C~DE,X<PPT) ELEM(I).EQ.'NOEUD'.OR.ELEM(I).EQ.'n~ud') THEN ELSE ENû IF 30 CONTINUE WRITE (10,1020) CLOSE (10) C c 1000 FORMAT (5X,I2,5X,12,5X,A6,5X,A6,5XrD13.6) 1010 FORMAT ('.UCC',3X,'GROUP',1X,I2,ZX,A6,2X,A6,1X,D13.6)

1020 FORMAT ('.UCC/.MCE SAVE')

1100 FORMAT (/,'ERROR: The com~and~,X,A4,X,~is used after opening the b

+lock .exl/.EXl in the filer,/,7X,*banque.dat, this is not allowed. +',/,'<return>')

1110 FORMAT (/,'ERROR: There is no block named .exl, or .EX1 defined in

+

the file banque.dat.*,/,*<return>')

1130 FORMAT (/,'ERROR: The number of design variables defined in the fi

+le desvar.dat is',XrIZ,/,7X,'This is less than declared in the fil

+e common,r,X,12,/,'<return>') c-=====-- . . . STOP END

'ma

kesave.

f

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 0 21 22 23 24 25 C C C C C C C C C C C PRoGRAn EIARESAVE

A file named 'savedat.dat' is created. This file possesses all the

data needed €or saving the respons functions of the computation in the design point. The file *savedat.dat' is used in a Samcef-Mecano run.

IMPLICIT NONE INTEGER

DIMENSION FUNCN(3,25),FUNCM(3,25)

NFUNCN ; number of node respons functions

NFUNCM ; number of element respons functions

FUNCN ; matrix with node respons functions

FUNCU ; matrix with element respons functions

NFUNCN, NFUNCM, FUNCN, FUNCU, IOS23, I

C==---Ee======EE=-~==1====iIii--i---~---

C...The function definitions are read from the subroutine FUNCTION.

C...A warning is printed if the number of functions is not set, or if

C...the maximum number of functions is exceeded.

NFUNCN = -1

NFUNCM = -1

IF (NFUNCN-EQa-1) WRITE (6,1100)

IF (NFUNCM.EQ.-l) WRITE (6,1110)

CW FUNCTION (NFUNCN, NFUNCM, FUNCN, FUNCM)

(19)

28 29 30 31 32 33 34 35 36 37 3% 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 65 65 66 67 68 69 70 + T H E N (5**) OPEN (UNIT=24,FILE=*error.dat*) CLOSE (24) END IF C

C...The file 'savedat.dat' is opened and all data will be written in it.

OPEN(UNIT=23,FILE='savedat.dat',IOSTAT=IOS23,STATUS='UNKNOW")

IF (IOS23.NE.O) THEN

PRINT

*,

'Error by opening the outputfile gavedat.dat:*, IOS23

STOP

IF (NFUNCN .NE. O) THEN

DO 10 I=l,NFUNCN WRITE (23

,

10 P O

CONTINUE

10 FUNCN( 1

,

I)

,

FUNCN( 2

,

i), FUNCN( 3, I)

Em PF

IF (NFUNCM .NE. O) THEN

DO 20 I=l,NFiINCM CONTINUE END IF WRITE(23,1030) CLOSE( 23 ) 20 WRITE(23,1020) FUNCM(l,I),FUNCM(2,I),FUNCM(3,1) C

1000 FORMAT ('.INIT',/,'MODE T1 O 0 4125 ECHO',/,'EXIT',/,'.FUN',/,

+

+

/,'AFFICHE NUMERO FONCTION')

'.VIP NOWEAU FAC*,/,'ASSIGN UNITE 22 BANQUE="result O.dat"',

1010 FORMAT ('NOEUD 'p138' CODE ',13,' CoKP ',I3,' SUPnzSOSE')

1020 FORMAT ('ILAILLE 'F13F' CODE 'o13,' Co" ' s 1 3 , ' SUPERPOSE')

1030 FORMAT ('VI',/,'SAUVE BANQUE UNITE 22',/,'.STOP')

1100 FORMAT (/,'ERROR: NFUNCN is not defined in subroutine FUNCTION',/, 1110 FORMAT (/,'ERROR: NFUNCM is not defined in subroutine FUNCTION',/,

1120 FORMAT (/,'ERROi3: The aaseinuli niliiippez of ?mde-fumctionS is greater

1130 FORMAT (/,'ERROR: The maximum number of element-functions is great

+

'<return>')

+

'<return>')

+than 25, NFUNCN = ',12,/,'<return>') +er than 25, NFUNCM = ',IZ,/,'<return>')

---=--- 1---1--__ STOP ENn

'vary.P

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 PROûRAM VARY

This program takes care of the variation process that is needed for the computation of the derivatives of the objective function and the constraints with respect to the design variables.

The whole inputfile for Samcef-Mecano (banque.dat) is copied to a file

'banquel.dat'. Finally, the varied design variables are appended to that file.

IMPLICIT NONE

INCLUDE 'common'

DOUBLE PRECISION XOPT(N)

LOGICAL LEXIST

INTEGER

CHARACTER LINE1*79,ELEM(N)*6,CODE(N)*6

IOc10, IOS11, IOS20

,

IOS2 1

,

IOS22 ,VARNUM, I, NUMBER( N)

,

GROUP (N)

C========-s===ill=o=~---=====i5--- --I-----

-C...The file 'varnum.dat' stores the number of the design variable that

C...must be varied in this run.

INQUIRE (FILE='varnuP.dat',EXIST=LEXIST) IF (.NOT.LEXIST) THEN

VARNUM = 1

OPEN (UNIT=21,FILE='varnum.dat*,IOSTAT=IOS2l,STATUS="EW')

IF (IOS21.NE.O) THEN

PRINT

*,

'Error by opening the outputfile varnum.dat:*,IOSZl

STOP END IF

OPEN ( U N I T - ~ ~ , F I L E = ' V ~ ~ ~ ~ ~ . ~ ~ ~ * , I O S T A T = I O S ~ ~ , S T A T U S = ~ O L D ' ) IF (IOS21.NE.O) THEN

ELSE

PRINT * # 'Error by opening the inputfile varnum.dat:',IOS21

STOP END IF

READ

(21,*) VARNlJM

REWIND (21)

(20)

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 END IF WRITE (21,*) (VARNUII+1) CLOSE ( 2 1 ) I c;

C...The new design point (XOPT) is read from the file 'desvar.dat'.

OPEN (UNIT=2O,FILE=8desvar.dat',IOSTAT=IOS2O,STATUS='OLD') IF (IOS20.NE.O) THEN

PRINT

*,

'Error by opening the inputfile desvar.dat:',IOSZO

STOP END IF DO 30 I = 1,7 READ 120.*) 30 4 0 C

.- .

,

CO~FPINUE

DO 40 I = 1,N READ (20,1000) NüMB~(I),GRWP(I),E.LEM(I),CODE(I),XOPT(I) IF [XOPT[I).EQ.OI THEN ÜRITE(lÓ3O;'(A)') wEAB ( s 8 * i END IF CONTINUE CLOSE (2 O )

C...The design variable is varied.

C

C...The design point is scaled before saving it in the file 'banque.dat'.

C

C...The file *banque.dat* is copied to the file *banquel.dat*. The varied

C...desian Doint is amended to that file.

XOPT(VARNUM) = XOPT(VARNUEI)*(l+ALFA)

CALL RESCALE(X0PT)

60

OPÉN

1

lO,FILE-.'l>-anque.dat* aOS~AT=IOS10,8~ATUS='OLD' )

IF (IOSIO.NE.0) THEN

PRINT

*,

'Error by opening the inputfile banque.dat:',IOSlO

STOP END IF

OPEN (11,FILE='banquel.dat',IOSTAT=IOS11,STATUS=*UNïíNOW")

PF (POSll.#E.O) THEH

PRINT

*,

'Error by opening the outputfile banquel.dat:',IOSll

STOP END IF

READ (10,'(A)',END=70) LINE1

WRITE (ll,'(A)') LINE1

GOT0 60

C...Check if the design variable is a degree of freedom of a node or

C...a parameter of a materialgroup.

70 IF (ELEM(VARNUM).EQ.8NOE'.OR.ELEM(VARHUn).EQ.'noe'.OR.

ELEM(VARNUM) .EQ. 'NOEUD'.OR.ELEM(VARNUM) .EQ. 'noeud') THEN

CALL NOEUD(1I8VARNUM,GR0UP,ELEM,C0DE,XOPT)

WRITE (11,1010) ûRWP(VARNUM) ,ELEM(VARNUM) ,CODE(VARNUM),

CALL MCC( ll,VARNUM,GROüP,ELEM,CODE,XOPT) ELSE XOPT (VARWUI) END IF CLOSE ( 1 O ) WRITE( 11,1020) CLOSE ( 11 ) C

C...The file *savedat.dat' for the varied design is created. That file is

C...used in a Samcef-Mecano run for saving the respons functions in a file

C...'result ?.dat* in which the question mark is the number of the design-

C...variable that has been varied.

C

C...The file 'stop.dat' will be created if every design variable has been

C...varied. If that file exists, the unix script-file knows that all the

C...variables have been varied.

CALL MA.KESAVE(VARNUM)

IF IVARNUM.GE.INì) THEN

OPEN (22

,

FIiE;;stop.dat', 1OSTAT=IOS22

,

STATUS="EW' )

IF (IOS22.NE.O) THEN

PRINT

*,

'Error by opening the outputfile stop.dat:',IOS22

STOP END IF CLOSE ( 22 ) END IF C 1000 FORMAT (5X,I2,5X,I2,5X,A6,5X,A6,5X,Dl3.6) 1010 FORMAT (*.MCC',3X,'GROUP',1X8I2,2X,A6,2X,A6,lX,D13.6)

1020 FORMAT ('.MCC/.MCE SAVE')

1030 FORMAT ('ERROR: The value of design variabïe*,XrI2,X,*is zero. A p

+roblem occurs in the1,/,7X,'variation process. Try to scale the de +sign variable that it ~i11',/,7X,~not get zero during the optimiza +tion proceas:,/,'<return>')

----

---_-

(21)

12

o

121 122 123 124 125 126 127 12 8 129 130 131 132 133 134 135 136 i37 138 139 14 O 141 142 143 144 145 146 14 7 148 153 154 155 156 157 158 159 160 161 162 163 164 165 166 END C C C % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % C

C A file named 'savedat.dat' is created. That file possesses all the C data needed for saving the respons functions of the computation in C the design point. The file 'savedat.dat* is used in a Samcef-Mecano run. C

SUBROUTINE MAKESAVE(FILNUM)

IMPLICIT NONE

INTEGER NFUNCNI NFUNCMs FUNCN, FUNCEa, 1-23 1, FILMUH

DIMENSION FUNCN( 3,8), FUNCM( 3,8 )

C C---=.---

-_----

-

-s--=-====- C 10 20 C 1000

CALL FUNCTION (NFUNCN, NFUNCM, FUNCN, FüNCM)

~iPEa~j~PT523,P~'savedat.dat',IOSTAT=IOs23,STATUS='W"BWbil8! IF (IOS23.NE.O) THEN

PRINT

*,

'Error by opening the outputfile savedat.dat:', IOS23

STOP END IF

WRITE(23,lOOO)

WRITE(23,1010) FILNUM WRITE(23,1020)

IF (NFUNCN .NE. O) THEN

DO 10 J=l,NFUNCN CONTINUE

WRITE(23,1030) FUNCN(l,I),FUNCN(Z,I),FUNCN(3,1) END IF

IF- (NFUNCM .NE. O) THEN

DO 20 I=l,NFUNCM WRITE(23.1040) ~NCM(l,I).FUNCM(2,I),FUNCM(3,I) . . CONTINUE- END IF WRITE(23,1050) CLOSE( 23

1

FORMAT ('.INIT',/,'MODE TI O G 4125 ECHO',/,'EXIT',/,'.FUN',/,

+

'

.VIP NOWEAU PAC' )

1010 FORMAT ('ASSIGN UNITE 22 ~QUE="result',I2,'.dat*')

1020 FORMAT ('AFFICHE NUMERO FONCTION')

1030 FORMAT('N0END ',13,' CODE *,13,' C O W ',13,' SUPERPOSE')

1040 FORMAT('MAïLLE ',I3,' CODE ',13,' C O W ',13,' SUPERPOSE')

1050 FORMAT ('VI',/,'SAUVE BANQUE UNITE 22',/,'.STOP')

C = - = ~ = = = = ~ = = = = ~ ~ = = - = - - -i-=====3===5=3 END

'optim1.P

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 PROGRAII OPTIM1 C

C This program ie the first of two programs that control the optimization C process.

C This program reads all the results of previous computations from datafiles

C and computes the objective function and constraints in the design point. It

C prints all the results on the screen and there is a check for convergence. C When a new design is computed there is the possibility of accepting or C rejecting the design point. It is also possible to stop the program. C

IMPLICIT NONE

INCLUDE 'common'

INTEGER I,J,L,R,NCONV,IOS10,I0S20,NCLIN

DOUBLE PRECISION FO,FBENO,CF,DFO,MLO

CHARACTER ACC*3

DOUBLE PRECISION XOPT(N),BL(NCTOTLIIAX),BU(NCTOTLMAX),

*

..

Local Scalars

..

..

Local Arrays

..

+

DF(N),GO(NCLINMAX),GBENO(NCLINMAX),

+

CG(NCLINMAX),DG(NCLINMAX,N),

+

X(1000,N),F(1000),FBEN(1000),G(1000),

+

GERR(10OO),HL(1000)

+

GERRISO(1000),MLACT(1000)

+

CODE(N)*6 INTEGER CIIARACTER LINE(2O)*79,LINFS(1000)*79,ELEn(N)*6,

ISTATE (NCTOTLMAX), GROW (N) ,NUMBER( N)

,

GNO( 1000) I

C

C L ; number of the last optimization cycle

C N

:

number of design variables (common)

C NCLIN ; number of linear constraints

C XOPT ; design variables (desvar.dat)

(22)

32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 43 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 C BL ; C BU ;

c

NUMBER;

c

GROUP ; C c E L E M ; C C C CODE ; C C C C FO ; C GO ; C FBENO ; C GBENO ; C CF ;

c

Ce; ; C DF ; C C DG ; C M L O ; C MLACT ; C

lower bounds of the design variables and the constraints (0bjcons.f) upper bounds of the design variables and the constraints (0bjcons.f) numbers of the design variables (0bjcons.f)

in case of NOEUD: number of the node (0bjcons.f)

in case of UCC : number of the group (0bjcona.f)

NOEUD: character NOE (ob jcons. f )

UCC : name of the element (in Samcef code) to which the

design variable belongs (0bjcons.f)

NOEUD: X, Y or X. The character represents the degree of

freedom that is treated as design variable (0bjcons.f)

UCC : character (in Samcef code), which represents the

design variable (0bjcons.f)

value of the objective function in the design point idem for the constraints

value of the approximated objective function in the design point idem for the constraints

constant of the approximation function of the objective function

idem

Íor

tne constraints

derivatives of the objective function with respect to the design variables

idem for the constraints

value of the move limit (move1im.f)

True if at least one move limit is active after optimization False if not ~~

C DFO ; convergence criterium: relative change in the objective function

C NCONV ; counter for the number of convergence that occured

C EPSCOW; the limit for which convergence is obtained (common) C ISTATE; status of the design variables and the constraints after the

C optimization process, see the manual of the NAG-library

c x

g matrix with designs of a11 previous optimization cycles

C F ; idem for the objective function

C FBEN ; idem for the approximated objective function

C G ; idem for the maximum constraint value

C GNO ; idem for the constraint number for which G is computed

C GERR ; idem for the maximum relative error for the approximated constraints

C -0; idem for the constraint for which GERR is computed

C Ma, ; 6 d e ~ fox &&e aove limit

C

C==-a==-=----

----

C...A11 the results from previous computations are read from file.

-Is=======

-

-_I---

-CW READOLD (L, NCLIN, X, F, FO

,

FBEN, FBENO

,

DF, CF, Gr GNO, GO

,

GERR,

+

GERRNO,GBENO,DG,CG,MLO,ML,KGACT,NCOW,ISTATE)

C

C...The new design point (XOPT) is read from the file *desvar.dat'.

OPEN (UNIT=2O,FILE=~desvar.dat',IOCTAT=IOS2O,STATUS='OLD') IF (IOS20.NE.O) THEN

PRINT

*,

'Error by opening the inputfile desvar.dat:*,IOSZO

STOP END IF DO 10 R = 1,7 READ ( Z O , ' ( A ) ' ) LINE(R) 10 CONTINUE DO 20 I = l.N

READ (20 1000 ) NUMBER( I)

,

GROüP ( I)

,

ELEM(

I)

,

CODE( I), XOPT( I)

20 CONTINUE

CLOSE ( 20 )

C

C...The objective function, the constraints and the bounds are

C...initialized. 3 0 L = L + 1 PO = O DO 40 J=l,NCLINMAX DO 50 I=l,N GO(J) = O 40 CONTINUE BL ( I) =O BU ( I) =O 50 CONTINUE C

C...The objective function, constraints and the bounds are read from

C...the subroutine OBJCONS.

C...A warning is printed if the number of constraints is not set.

IF (L.EQ.1) NCLIN -1

CALL OBJCONS(O,XOPT,FO,GO,BL,BU,NCLIN)

IF (NCLIN.LT.0 .OR. NCLIN.ûT.NCLINMAX) THEN IF (NCLIN.EQ.-1) WRITE (6,1100)

IF (NCLiN.GT.NCL1NWx.X) WRITE (6,1120) NCLIN,NCLINMAX READ (5,*)

OPEN (UNIT==21rPILE='converg.dat~) CLOSE (21)

GOT0 2000 END IF

Referenties

GERELATEERDE DOCUMENTEN

Because particularly the social functioning of the participants turns out to have a predictive value for successful participation in the ETS-Cova program, it is important to

Findings of note are that agreements reached before the opening of formal insolvency proceedings may be shielded from recovery on the basis of fraudulent conveyance (actio

The third hypothesis of this study was that after taking part in the JOBS program, participants from the experimental group will report higher levels of self-esteem, compared to

When it is not we check if #1 is present in the list of files to be processed. If not we add it and initialize list of output files for that input and list of output files that

In that case a dialog is started that asks you for the font characteristics in NFSS notation, i.e., first for the encoding scheme (default T1), then for the family name (default

The \tab and \untab commands are defined to have no effect while outside a program environ- ment, hence a single-line program can be typeset in maths mode without the

• A submitted manuscript is the version of the article upon submission and before peer-review. There can be important differences between the submitted version and the

keferences.. Top view of the LrRIISforl1ler wi th winding cOIulecl.iuns. Example of measured input voltage. EX&lt;-tmple of spectrum of input voltage. Example of