Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tutorials
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
conveks
tutorials
Commits
241e73fc
Commit
241e73fc
authored
6 years ago
by
Erin Kuci
Browse files
Options
Downloads
Patches
Plain Diff
up
parent
0dd84bda
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Lbracket/topo.py
+2
-25
2 additions, 25 deletions
Lbracket/topo.py
Team25/shape.pro
+3
-5
3 additions, 5 deletions
Team25/shape.pro
with
5 additions
and
30 deletions
Lbracket/topo.py
+
2
−
25
View file @
241e73fc
...
...
@@ -78,28 +78,6 @@ def setElementTable(var, ele, val):
data
=
np
.
insert
(
data
,
0
,
numElements
)
c
.
setNumber
(
var
,
values
=
data
,
visible
=
0
)
# The following function evaluates the optimization problem
# at point `point' in the design space, i.e.
# - the objective function,
# - the constraints,
# - the derivatives of the objective function w.r.t. the design variables,
# - the derivatives of the constraints w.r.t. the design variables.
def
myOptimizationProblem
(
point
=
None
):
#objective = c.getNumber('Optimization/Results/Energy')
objective
=
c
.
getNumber
(
'
Optimization/Results/pnorm of Von-Mises
'
)
tmp
=
[
c
.
getNumber
(
'
Optimization/Results/VolumeDomain
'
)
\
/
(
0.5
*
c
.
getNumber
(
'
Optimization/Results/VolumeDomainFull
'
))
-
1.0
]
constraints
=
np
.
array
(
tmp
)
#grad_objective = np.array(c.getNumbers('Optimization/Results/GradOfCompliance')[2::2])
grad_objective
=
np
.
array
(
c
.
getNumbers
(
'
Optimization/Results/GradOfVonMises
'
)[
2
::
2
])
tmp
=
list
(
np
.
asarray
(
c
.
getNumbers
(
'
Optimization/Results/GradOfVolume
'
)[
2
::
2
])
\
/
(
0.5
*
c
.
getNumber
(
'
Optimization/Results/VolumeDomainFull
'
)))
grad_constraints
=
np
.
array
(
tmp
)
return
objective
,
constraints
,
grad_objective
,
grad_constraints
# number of design variables and number of constraints
numVariables
=
len
(
x
)
...
...
@@ -149,7 +127,6 @@ while change > maxChange and it <= maxIter and c.getString('topo/Action') != 'st
# get the value of the objective function and of the constraints
# as well as their sensitivity with respect to design variables at `x'
objective
,
constraints
,
grad_objective
,
grad_constraints
=
myOptimizationProblem
()
objective
=
c
.
getNumber
(
'
Optimization/Results/pnorm of Von-Mises
'
)
constraints
=
np
.
array
([
c
.
getNumber
(
'
Optimization/Results/VolumeDomain
'
)
\
/
(
0.5
*
c
.
getNumber
(
'
Optimization/Results/VolumeDomainFull
'
))
-
1.0
])
...
...
This diff is collapsed.
Click to expand it.
Team25/shape.pro
+
3
−
5
View file @
241e73fc
...
...
@@ -324,21 +324,18 @@ PostOperation {
{
Name
Get_ObjectiveConstraints
;
NameOfPostProcessing
ObjectiveConstraints
;
Operation
{
CreateDir
[
Opt_ResDir
];
Print
[
az
,
OnElementsOf
Domain
,
Format
NodeTable
,
File
""
,
SendToServer
StrCat
[
Opt_ResDir_Onelab
,
"a"
],
Hidden
1
];
Print
[
w
,
OnGrid
{(
9.5
e
-
3
+
2.25
e
-
3
)
*
Cos
[
$
A
],(
9.5
e
-
3
+
2.25
e
-
3
)
*
Sin
[
$
A
],
0
}{
0
:
50
*
Pi
/
180
:
5
*
Pi
/
180
,
0
,
0
},
Format
SimpleTable
,
File
StrCat
[
Opt_ResDir
,
"w.txt"
]];
Print
[
bMag
,
OnGrid
{(
9.5
e
-
3
+
2.25
e
-
3
)
*
Cos
[
$
A
],(
9.5
e
-
3
+
2.25
e
-
3
)
*
Sin
[
$
A
],
0
}{
0
:
50
*
Pi
/
180
:
5
*
Pi
/
180
,
0
,
0
},
Format
SimpleTable
,
File
StrCat
[
Opt_ResDir
,
"bMag.txt"
]];
Print
[
az
,
OnElementsOf
Domain
,
Format
NodeTable
,
File
""
,
SendToServer
StrCat
[
Opt_ResDir_Onelab
,
"a"
],
Hidden
1
];
Print
[
bMag
,
OnElementsOf
Domain
,
File
StrCat
[
Opt_ResDir
,
"az.pos"
]];
Print
[
az
,
OnElementsOf
Domain
,
File
StrCat
[
Opt_ResDir
,
"az.pos"
]];
Print
[
bTarget
,
OnGrid
{(
9.5
e
-
3
+
2.25
e
-
3
)
*
Cos
[
$
A
],(
9.5
e
-
3
+
2.25
e
-
3
)
*
Sin
[
$
A
],
0
}{
0
:
50
*
Pi
/
180
:
5
*
Pi
/
180
,
0
,
0
},
File
StrCat
[
Opt_ResDir
,
"bTarget.pos"
]];
Print
[
b
,
OnGrid
{(
9.5
e
-
3
+
2.25
e
-
3
)
*
Cos
[
$
A
],(
9.5
e
-
3
+
2.25
e
-
3
)
*
Sin
[
$
A
],
0
}{
0
:
50
*
Pi
/
180
:
5
*
Pi
/
180
,
0
,
0
},
File
StrCat
[
Opt_ResDir
,
"b.pos"
]];
//
Print
[
az
,
OnElementsOf
Domain
,
File
StrCat
[
Opt_ResDir
,
"az.pos"
]];
If
(
Flag_PrintLevel
>
5
)
Print
[
mur
,
OnElementsOf
Domain
,
File
StrCat
[
Opt_ResDir
,
"mur.pos"
]];
Print
[
az
,
OnElementsOf
Domain
,
File
StrCat
[
Opt_ResDir
,
"az.pos"
]];
...
...
@@ -359,6 +356,7 @@ PostProcessing{
PostQuantity
{
{
Name
Lie_w
;
Value
{
Term
{
[
2
*
(
CompX
[{
d
a
}]
-
bx
[])
*
CompX
[{
d
Lva
}]
+
2
*
(
CompY
[{
d
a
}]
-
by
[])
*
CompY
[{
d
Lva
}]
]
;
In
Domain
;
Jacobian
Vol
;
}}}
{
Name
az
;
Value
{
Term
{
[
CompZ
[{
a
}]];
In
Domain
;
Jacobian
Vol
;
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment