Skip to content
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

Separation constraint using surface vector projection #238

Open
wants to merge 88 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
b48133b
added new separation constraint
ArshSaja Jun 7, 2022
b930796
changes
ArshSaja Jun 8, 2022
ca5676b
new changes
ArshSaja Jun 8, 2022
ef11f9a
found the issue and meed to be fixed
ArshSaja Jun 8, 2022
0275e36
fixing
ArshSaja Jun 8, 2022
1db5cde
fixed output mode
ArshSaja Jun 9, 2022
4b9fa06
Fixed the unit vectors
ArshSaja Jun 9, 2022
f0e3d71
adding slices
ArshSaja Sep 21, 2022
89c72ee
Merge branch 'sepconstrnew' of github.com:ArshSaja/adflow into sepcon…
ArshSaja Sep 21, 2022
18bad41
adding slices corrections
ArshSaja Sep 21, 2022
a03b058
updated the addslices option
ArshSaja Sep 29, 2022
523afd1
Fixed the merge conflicts and updated adjoints
ArshSaja Oct 17, 2022
105a716
Setting default options
ArshSaja Oct 17, 2022
bd0af07
merge fix
ArshSaja Oct 17, 2022
0c70701
mulit US mesh for mphys wrapper
ArshSaja Oct 18, 2022
0f845cf
Merge branch 'sepconstrnew_cp' of github.com:ArshSaja/adflow into sep…
ArshSaja Oct 18, 2022
47233a3
Several fixes and adding test function
ArshSaja Oct 18, 2022
0547d47
Test for separation
ArshSaja Oct 18, 2022
3b868ea
multi US mesh option in mphys
ArshSaja Oct 18, 2022
2efdf90
doc update and slight tol adjustment for new test
ArshSaja Oct 18, 2022
7967bb9
test update
ArshSaja Oct 18, 2022
509a738
update aoa in ap
ArshSaja Oct 18, 2022
1e94bbe
update in ap
ArshSaja Oct 18, 2022
6f76399
jason file update
ArshSaja Oct 18, 2022
087c976
test function fixes
ArshSaja Oct 19, 2022
d8d1cff
flake8 and black
ArshSaja Oct 19, 2022
8c6d62e
fixing conflicts
ArshSaja Jan 4, 2023
f4156b6
fixed the test option for new changes
ArshSaja Jan 4, 2023
4f001ca
minnor fix
ArshSaja Jan 4, 2023
598041c
fixing conflicts
ArshSaja Mar 14, 2023
b745855
commiting fprettify changes
ArshSaja Mar 14, 2023
796e106
fixing merge conflicts
ArshSaja Mar 14, 2023
17626fb
Merge branch 'mdolab:main' into sepconstrnew_cp
ArshSaja Mar 14, 2023
6803a7e
fixing flake errors
ArshSaja Mar 14, 2023
d3ef851
Merge branch 'mdolab:main' into sepconstrnew_cp
ArshSaja May 22, 2023
e7c83b5
minor Fixes and tests function
ArshSaja May 22, 2023
8534e68
Merge branch 'sepconstrnew_cp' of github.com:ArshSaja/adflow into sep…
ArshSaja May 22, 2023
ca95d3e
tapenade files
ArshSaja May 22, 2023
aac508a
style fixes and tolerance update
ArshSaja May 23, 2023
a5263cf
Merge branch 'mdolab:main' into sepconstrnew_cp
ArshSaja May 23, 2023
fa38741
style fixes
ArshSaja May 23, 2023
6083b9f
fprettify fixes
ArshSaja May 23, 2023
efd6e88
option
ArshSaja May 23, 2023
f4d9143
Merge branch 'main' into sepconstrnew_cp
gawng May 24, 2023
28f0a80
complex test
ArshSaja May 24, 2023
b5fb379
Merge branch 'sepconstrnew_cp' of github.com:ArshSaja/adflow into sep…
ArshSaja May 24, 2023
a031566
changing variable names
ArshSaja May 24, 2023
b15e6ef
fprettify cahnge
ArshSaja May 24, 2023
0f321cc
error fix
ArshSaja May 24, 2023
eedd90e
tolerance update
ArshSaja May 24, 2023
e03f5d9
tolerance update
ArshSaja May 24, 2023
536ac7e
removing multi US mesh
ArshSaja Jun 26, 2023
eb200d2
merging main into branch
ArshSaja Jun 27, 2023
46d6fae
adding KS aggregation for separation
ArshSaja Feb 7, 2024
793be68
merging conflicts
ArshSaja Feb 7, 2024
92f3019
Tapenade changes
ArshSaja Feb 7, 2024
edaf203
KS function for separation sensor
ArshSaja Feb 7, 2024
e68d96a
setting max sepsensor to 1
ArshSaja Feb 8, 2024
1730783
separation test update
ArshSaja Feb 8, 2024
5de0dcf
separation test fixes
ArshSaja Feb 8, 2024
fa800e4
separation test fixed
ArshSaja Feb 9, 2024
5c57495
fprettify and black
ArshSaja Feb 9, 2024
0e3cb76
all tests passed
ArshSaja Feb 9, 2024
7ce61ae
black for test_separation
ArshSaja Feb 9, 2024
3aa33d0
black for test_separation
ArshSaja Feb 9, 2024
6631194
surfvec_ks option ins docs
ArshSaja Feb 9, 2024
a40b949
docs option updated and tapenade runs
ArshSaja Feb 9, 2024
45d70fa
docs option updated
ArshSaja Feb 9, 2024
2e82c05
docs option updated
ArshSaja Feb 9, 2024
0a0ba4f
docs option updated
ArshSaja Feb 12, 2024
cd72f4e
default option to surfvec
ArshSaja Feb 15, 2024
bc6fae1
minor comment edits on surfaceintegration
ArshSaja Feb 15, 2024
0727921
set surfvec to default
ArshSaja Feb 15, 2024
54bb2bf
docs update
ArshSaja Feb 15, 2024
067e6e1
option update
ArshSaja Feb 15, 2024
c7dc2eb
Merge branch 'main' into sepconstrnew_cp
ArshSaja Feb 27, 2024
d207556
addessing coments
ArshSaja Feb 29, 2024
941453b
running black
ArshSaja Feb 29, 2024
a1d1196
docs change
ArshSaja Feb 29, 2024
3332dc8
addressing comments
ArshSaja Mar 1, 2024
43e22ce
Merge branch 'main' into sepconstrnew_cp
ArshSaja Mar 1, 2024
d694c11
Merge branch 'mdolab:main' into sepconstrnew_cp
ArshSaja Apr 26, 2024
5537040
allowing some deflections in separation sensor and reformulating the …
ArshSaja Apr 30, 2024
e8a1652
fprettify and docs update
ArshSaja Apr 30, 2024
9920bb6
minor fixes
ArshSaja Apr 30, 2024
65a05ba
removing schur post group changes
ArshSaja Apr 30, 2024
94d01d8
setting the deviation angle to be at the verge of Sep
ArshSaja May 13, 2024
572c5fd
Merge branch 'main' into sepconstrnew_cp
ArshSaja May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/options.yaml
Expand Up @@ -1530,7 +1530,7 @@ sepSensorModel:
We project the freestream over the desired surface and compute the desired flow direction based on the sweep angle of the wing (``sepSweepAngleCorrection``) in 3D cases (For airfoils, the desired direction would be the projected freestream vector over the airfoil surface).
Then we compute the deviation between the local flow velocity and this desired direction. We use a separation metric to integrate this computation over the desired surface.
``0`` means no separation and ``1`` means that the flow is fully separated.
Although, this method is formulated for 3D cases, it is appropriate for airfoils. However, for 3D cases, please use ``surfvec_ks`` option, which has KS aggregation to aggregate the maximum separation sensor value to be constrained.
Although this method is formulated for 3D cases, it is appropriate for airfoils. However, for 3D cases, please use ``surfvec_ks`` option, which has KS aggregation to aggregate the maximum separation sensor value to be constrained. This option will effectively alleviate separation anywhere on the interested surface and provide separation free design. On the other hand, ``surfvec`` option may not gurrantee to achieve separation free design when the separation happens in a very smaller region and thus, the integration over this region may not violate the constraint.
sseraj marked this conversation as resolved.
Show resolved Hide resolved
surfvec_ks: This method uses similar formulation to ``surfvec`` to compute the maximum separation sensor value on a desired surface instead of integrating over this surface.
Therefore, this maximum separation sensor value from KS aggregation function can be constrained to alleviate separation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to "... function can be used to constrain separation."


Expand Down
7 changes: 2 additions & 5 deletions src/output/outputMod.F90
Expand Up @@ -2252,7 +2252,7 @@ subroutine storeSurfsolInBuffer(sps, buffer, nn, blockID, &
sensor = (v(1) * vectCorrected(1) + v(2) * vectCorrected(2) + &
v(3) * vectCorrected(3))

sensor = one / two * (one - sensor)
sensor = half * (one - sensor)
buffer(nn) = sensor
end do
end do
Expand All @@ -2264,10 +2264,7 @@ subroutine storeSurfsolInBuffer(sps, buffer, nn, blockID, &
v(1) = ww2(i, j, ivx)
v(2) = ww2(i, j, ivy)
v(3) = ww2(i, j, ivz)
! Get normalized surface velocity:
! v(1) = ww2(ii, jj, ivx)
! v(2) = ww2(ii, jj, ivy)
! v(3) = ww2(ii, jj, ivz)

! Normalize
v = v / (sqrt(v(1)**2 + v(2)**2 + v(3)**2) + 1e-16)

Expand Down
5 changes: 1 addition & 4 deletions src/solver/surfaceIntegrations.F90
Expand Up @@ -1475,7 +1475,7 @@ subroutine computeSepSenMaxFamily(famList)

! loop over the TS instances and compute sepsenmax_family for each TS instance
do sps = 1, nTimeIntervalsSpectral
! set the local cp min to a large value so that we get the actual min
! set the local sepsensor to a smaller value so that we get the actual max
sepsensor_local = 0.0_realType
do nn = 1, nDom
call setPointers(nn, 1, sps)
Expand Down Expand Up @@ -1550,9 +1550,6 @@ subroutine computeSepSenMaxFamily(famList)

sensor = half * (one - sensor) * blk

! only take this if its a compute cell
! if (BCData(mm)%iblank(i, j) .eq. one) then

! compare it against the current value on this proc
sepsensor_local = max(sepsensor_local, sensor)
! end if
Expand Down
82 changes: 35 additions & 47 deletions tests/reg_tests/test_separation.py
Expand Up @@ -23,21 +23,7 @@
"aero_prob": ap_naca0012_separation,
"N_PROCS": 2,
"options": {
sseraj marked this conversation as resolved.
Show resolved Hide resolved
"gridfile": gridFile,
"outputdirectory": os.path.join(baseDir, "../output_files"),
"writevolumesolution": False,
"writesurfacesolution": False,
"writetecplotsurfacesolution": False,
"mgcycle": "sg",
"ncycles": 1000,
"useanksolver": True,
"usenksolver": True,
"anksecondordswitchtol": 1e-2,
"nkswitchtol": 1e-6,
"volumevariables": ["temp", "mach", "resrho", "cp"],
"equationType": "RANS",
"l2convergence": 1e-15,
"adjointl2convergence": 1e-15,

"sepSensorModel": "surfvec_ks",
"sepSensorMaxRho": 100.0,
"sepSweepAngleCorrection": 0.0,
Expand All @@ -49,21 +35,7 @@
"aero_prob": ap_naca0012_separation,
"N_PROCS": 2,
"options": {
"gridfile": gridFile,
"outputdirectory": os.path.join(baseDir, "../output_files"),
"writevolumesolution": False,
"writesurfacesolution": False,
"writetecplotsurfacesolution": False,
"mgcycle": "sg",
"ncycles": 1000,
"useanksolver": True,
"usenksolver": True,
"anksecondordswitchtol": 1e-2,
"nkswitchtol": 1e-6,
"volumevariables": ["temp", "mach", "resrho", "cp"],
"equationType": "RANS",
"l2convergence": 1e-15,
"adjointl2convergence": 1e-15,

"sepSensorModel": "surfvec",
"sepSweepAngleCorrection": 0.0,
},
Expand All @@ -74,21 +46,7 @@
"aero_prob": ap_naca0012_separation,
"N_PROCS": 2,
"options": {
"gridfile": gridFile,
"outputdirectory": os.path.join(baseDir, "../output_files"),
"writevolumesolution": False,
"writesurfacesolution": False,
"writetecplotsurfacesolution": False,
"mgcycle": "sg",
"ncycles": 1000,
"useanksolver": True,
"usenksolver": True,
"anksecondordswitchtol": 1e-2,
"nkswitchtol": 1e-6,
"volumevariables": ["temp", "mach", "resrho", "cp"],
"equationType": "RANS",
"l2convergence": 1e-15,
"adjointl2convergence": 1e-15,

"sepSensorModel": "heaviside",
"sepSweepAngleCorrection": 0.0,
},
Expand All @@ -115,6 +73,21 @@ def setUp(self):
super().setUp()

options = copy.copy(adflowDefOpts)
options.update({"gridfile": gridFile,
"outputdirectory": os.path.join(baseDir, "../output_files"),
"writevolumesolution": False,
"writesurfacesolution": False,
"writetecplotsurfacesolution": False,
"mgcycle": "sg",
"ncycles": 1000,
"useanksolver": True,
"usenksolver": True,
"anksecondordswitchtol": 1e-2,
"nkswitchtol": 1e-6,
"volumevariables": ["temp", "mach", "resrho", "cp"],
"equationType": "RANS",
"l2convergence": 1e-15,
"adjointl2convergence": 1e-15,})
options.update(self.options)

# Setup aeroproblem
Expand All @@ -133,7 +106,7 @@ def setUp(self):
self.CFDSolver.addFunction("sepsensor", "wingup")

def test_separation_metrics_and_derivatives(self):
evalFuncs = ["sepsensor_wingup", "cl"]
evalFuncs = ["sepsensor_wingup"]

self.CFDSolver(self.ap)

Expand Down Expand Up @@ -236,6 +209,21 @@ def setUp(self):
super().setUp()

options = copy.copy(adflowDefOpts)
options.update({"gridfile": gridFile,
"outputdirectory": os.path.join(baseDir, "../output_files"),
"writevolumesolution": False,
"writesurfacesolution": False,
"writetecplotsurfacesolution": False,
"mgcycle": "sg",
"ncycles": 1000,
"useanksolver": True,
"usenksolver": True,
"anksecondordswitchtol": 1e-2,
"nkswitchtol": 1e-6,
"volumevariables": ["temp", "mach", "resrho", "cp"],
"equationType": "RANS",
"l2convergence": 1e-15,
"adjointl2convergence": 1e-15,})
options.update(self.options)

# Setup aeroproblem
Expand Down Expand Up @@ -270,7 +258,7 @@ def cmplx_test_separation_adjoints(self):
self.assert_solution_failure()
self.CFDSolver.evalFunctions(self.ap, funcs)

evalFuncs = ["sepsensor_wingup", "cl"]
evalFuncs = ["sepsensor_wingup"]
funcs_plus = {}
for dv in ["alpha", "vol_perturbation"]:
if dv == "alpha":
Expand Down