Skip to content
Snippets Groups Projects
Commit 241e73fc authored by Erin Kuci's avatar Erin Kuci
Browse files

up

parent 0dd84bda
No related branches found
No related tags found
No related merge requests found
......@@ -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])
......
......@@ -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.5e-3+2.25e-3)*Cos[$A],(9.5e-3+2.25e-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.5e-3+2.25e-3)*Cos[$A],(9.5e-3+2.25e-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.5e-3+2.25e-3)*Cos[$A],(9.5e-3+2.25e-3)*Sin[$A],0}{0:50*Pi/180:5*Pi/180,0,0},
File StrCat[Opt_ResDir,"bTarget.pos"]];
Print[b, OnGrid {(9.5e-3+2.25e-3)*Cos[$A],(9.5e-3+2.25e-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; } } }
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment