-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add spanwise shape variables #75
Merged
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6be0c7f
added child warning example
9ec85d9
merged in master and moved test
c84ef1b
formatting changes
af48a98
added unittest.main
4c8f49a
tweaked unittest.main
94065c9
tweaked unittest.main again
cfc6f28
add issue ref in code
405915f
inital implementation
2b72469
Merge branch 'master' into spanwise_local
9f51fe4
added test
fe68af3
added missing ref
8e1cf76
fixed mapping for cons
dfad88f
added another test
98395fe
Merge branch 'master' into spanwise_local
1c7164b
Update DVConstraints.py
8529930
Update DVConstraints.py
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,3 +142,60 @@ def scale_circle(val, geo): | |
print(funcsSens) | ||
|
||
|
||
def train_spanwise_dvs(self, train=True, refDeriv=True): | ||
self.test_spanwise_dvs(train=train, refDeriv=refDeriv) | ||
|
||
|
||
def test_spanwise_dvs(self, train=False, refDeriv=False): | ||
refFile = os.path.join(self.base_path,'ref/test_Cylinder_spanwise_dvs.ref') | ||
|
||
with BaseRegTest(refFile, train=train) as handler: | ||
handler.root_print("Test 1: Basic FFD, global DVs") | ||
radius = 1.0 | ||
height = 10.0 | ||
|
||
DVCon = DVConstraints() | ||
surf = self.make_cylinder_mesh(radius, height) | ||
DVCon.setSurface(surf) | ||
# DVCon.writeSurfaceTecplot('cylinder_surface.dat') | ||
|
||
ffd_name = os.path.join(self.base_path,'../inputFiles/cylinder_ffd.xyz') | ||
self.make_ffd(ffd_name, radius, height) | ||
DVGeo = DVGeometry(ffd_name) | ||
|
||
DVGeo.addGeoDVSpanwiseLocal("shape", 'i', lower=-0.5, upper=0.5, axis="y", scale=1.0) | ||
|
||
size = DVGeo._getNDVSpanwiseLocal() | ||
DVCon.setDVGeo(DVGeo) | ||
|
||
|
||
leList = [[0, 0, 0 ], [-radius/2, 0, height]] | ||
xAxis = [-1, 0, 0] | ||
yAxis = [0, 1, 0] | ||
DVCon.addLERadiusConstraints(leList, nSpan=5, axis=yAxis, | ||
chordDir=xAxis, scaled=False) | ||
# DVCon.writeTecplot('cylinder_constraints.dat') | ||
|
||
funcs = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks we are only testing the DVCon sens here... which I guess it is pretty much the same than testing the DV sens directly? See my comment before the review about an additional test - if needed |
||
DVCon.evalFunctions(funcs) | ||
print(funcs) | ||
handler.root_add_dict('funcs1', funcs, rtol=1e-6, atol=1e-6) | ||
|
||
numpy.random.seed(0) | ||
DVGeo.setDesignVars({'shape':(numpy.random.rand(size) - 0.5)}) | ||
|
||
funcs = {} | ||
DVCon.evalFunctions(funcs) | ||
handler.root_add_dict('funcs2', funcs, rtol=1e-6, atol=1e-6) | ||
print(funcs) | ||
|
||
funcsSens = {} | ||
DVCon.evalFunctionsSens(funcsSens) | ||
print(funcsSens) | ||
handler.root_add_dict('funcsSens', funcsSens, rtol=1e-6, atol=1e-6) | ||
print(funcsSens) | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this comes from the previous test, but I am not familiar with this script. Why are we using it?