Skip to content

Commit

Permalink
Fix nonlinear examples (#263)
Browse files Browse the repository at this point in the history
* Fix annulus example

* Remove niceplots code from cantilever example

* Fix nonlinear hemisphere benchmark

* Alter solver options in skin buckle example

* Fixing more benchmarks

---------

Co-authored-by: Tim Brooks <41971846+timryanb@users.noreply.github.com>
  • Loading branch information
A-CGray and timryanb authored Oct 25, 2023
1 parent 806c2cf commit 4b59e62
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 31 deletions.
12 changes: 6 additions & 6 deletions examples/mach_tutorial_wing/benchmark/benchmark_mach_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

# Reference values for eval functions
FUNC_REF = {
"StructAnalysis_compliance": 155457.77449517886,
"StructAnalysis_l_skin_ksFailure": 0.6688990169113461,
"StructAnalysis_compliance": 155444.88138037617,
"StructAnalysis_l_skin_ksFailure": 0.6688691183266002,
"StructAnalysis_l_skin_mass": 1056.704174594214,
"StructAnalysis_mass": 3196.8719514874,
"StructAnalysis_rib_ksFailure": 0.25352002232016596,
"StructAnalysis_rib_ksFailure": 0.25350286472639316,
"StructAnalysis_rib_mass": 686.2303380471093,
"StructAnalysis_spar_ksFailure": 0.6336362974489301,
"StructAnalysis_spar_mass": 400.0665693788245,
"StructAnalysis_u_skin_ksFailure": 0.46504728373719834,
"StructAnalysis_spar_ksFailure": 0.6336086764475523,
"StructAnalysis_spar_mass": 400.06656937882445,
"StructAnalysis_u_skin_ksFailure": 0.46502733574612126,
"StructAnalysis_u_skin_mass": 1053.8708694672512,
"AdjCon_L_SKIN_panelThicknessAdj": np.zeros(21),
"AdjCon_L_SKIN_stiffenerHeightAdj": np.zeros(21),
Expand Down
6 changes: 3 additions & 3 deletions examples/nonlinear_annulus/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ def elemCallBack(dvNum, compID, compDescript, elemDescripts, specialDVs, **kwarg
"printLevel": 1,
}
newtonOptions = {
"MaxIter": 50,
"MaxLinIters": 5,
"MaxLinIters": 10,
"UseEW": True,
}
continuationOptions = {
"InitialStep": 0.01,
"TargetIter": 6,
"RelTol": 1e-7,
"UsePredictor": True,
"NumPredictorStates": 8,
"NumPredictorStates": 6,
"MaxIter": 60,
}
problem = FEAAssembler.createStaticProblem("Annulus", options=probOptions)
problem.nonlinearSolver.setOptions(continuationOptions)
Expand Down
6 changes: 3 additions & 3 deletions examples/nonlinear_annulus/benchmark/benchmark_annulus.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

# Reference values for eval functions
FUNC_REF = {
"Annulus_Compliance": 19.00178466211241,
"Annulus_KSFailure": 0.10786534506897062,
"Annulus_MaxZDisp": 12.519062474962869,
"Annulus_Compliance": 19.001784662112364,
"Annulus_KSFailure": 48164.44513056076,
"Annulus_MaxZDisp": 12.519062474962878,
}


Expand Down
3 changes: 0 additions & 3 deletions examples/nonlinear_cantilever/ValidationPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@

LENGTH = 10.0

# plt.style.use(niceplots.get_style())
# colours = niceplots.get_colors()

alphaTest = np.arange(0.05, 1.01, 0.05) * 4
alphaPlot = np.linspace(0.0, 1.0, 101) * 4

Expand Down
7 changes: 3 additions & 4 deletions examples/nonlinear_hemisphere/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def elemCallBack(dvNum, compID, compDescript, elemDescripts, specialDVs, **kwarg
"InitialStep": 1.0,
}
newtonOptions = {
"newtonSolverMaxIter": 50,
"newtonSolverUseEW": True,
"newtonSolverMaxLinIters": 10,
"MaxIter": 50,
"UseEW": True,
"MaxLinIters": 10,
}

problem = FEAAssembler.createStaticProblem("RadialForces", options=probOptions)
Expand Down Expand Up @@ -168,4 +168,3 @@ def elemCallBack(dvNum, compID, compDescript, elemDescripts, specialDVs, **kwarg

if COMM.rank == 0:
pprint(funcs)
pprint(funcsSens)
10 changes: 5 additions & 5 deletions examples/nonlinear_hemisphere/benchmark/benchmark_hemisphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
sys.path.append(example_path)

# Reference values for eval functions
FUNC_REFS = {
"RadialForces_Compliance": 121.37975434927841,
"RadialForces_KSFailure": 0.09375588756570011,
"RadialForces_MaxYDisp": 0.23012106687058378,
"RadialForces_MaxZDisp": 2.3202346529634763,
FUNC_REF = {
"RadialForces_Compliance": 121.37975434928234,
"RadialForces_KSFailure": 312113.1779703558,
"RadialForces_MaxYDisp": 0.2301210668705867,
"RadialForces_MaxZDisp": 2.3202346529635003,
}


Expand Down
17 changes: 10 additions & 7 deletions examples/nonlinear_skin_buckle/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,21 @@ def elemCallBack(dvNum, compID, compDescript, elemDescripts, specialDVs, **kwarg
FEAAssembler.initialize(elemCallBack)

probOptions = {
"printTiming": True,
"nRestarts": 3,
"subSpaceSize": 20,
"printLevel": 1,
}
continuationOptions = {
"InitialStep": 0.25,
}
newtonOptions = {
"MaxLinIters": 0,
"SkipFirstNLineSearch": 0,
"MaxIter": 100,
"MaxLinIters": 10,
"UseEW": True,
}
continuationOptions = {
"InitialStep": 0.05,
"TargetIter": 6,
"RelTol": 1e-7,
"UsePredictor": True,
"NumPredictorStates": 4,
"MaxIter": 60,
}

problem = FEAAssembler.createStaticProblem("TipForce", options=probOptions)
Expand Down

0 comments on commit 4b59e62

Please sign in to comment.