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

raise Error if a Mesh Cell is skewed above threshold #235

Merged
merged 27 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
15afcff
raise Error if a Mesh Cell is skewed above threshold
DavidAnderegg Oct 5, 2022
4bfba43
Fix calculation of skewness, correct typos
DavidAnderegg Oct 6, 2022
d41c5cd
Add skewness test
DavidAnderegg Oct 6, 2022
c8ea620
Run flacke8 and black
DavidAnderegg Oct 6, 2022
513dde3
Add documentation
DavidAnderegg Oct 6, 2022
8d9d975
Merge branch 'main' into skewness
eirikurj Nov 7, 2022
53d0498
fix print typo
DavidAnderegg Mar 15, 2023
af7b700
Merge commit '92fb23458e8a501dd591c830eef6fcbbd0af9f63' into skewness
DavidAnderegg Mar 15, 2023
0d7e8b5
Update error printing to new format
DavidAnderegg Mar 15, 2023
0683e89
Run fprettify
DavidAnderegg Mar 15, 2023
3a53b3b
Merge commit 'cd6ec63f37e3d8027aeba1a8ae071e6e7a8e501d' into skewness
DavidAnderegg Mar 15, 2023
b41d236
Merge branch 'master' into skewness
DavidAnderegg Mar 15, 2023
0bbd321
Merge remote-tracking branch 'upstream/main' into skewness
DavidAnderegg Mar 15, 2023
bde016c
Fix bug where skewness code is executed when deactivated
DavidAnderegg Mar 16, 2023
5db2ab0
Add constants for choosen metric
DavidAnderegg Mar 16, 2023
c1f1f5c
run fprettify
DavidAnderegg Mar 16, 2023
914a378
deallocate skew variable
DavidAnderegg Mar 16, 2023
5ecc45a
Make complex to compile
DavidAnderegg Mar 16, 2023
d6f17bb
run fprettify
DavidAnderegg Mar 16, 2023
6688aaa
Merge branch 'main' of https://github.com/mdolab/adflow into mdolab-main
DavidAnderegg Sep 26, 2023
e660da8
Merge branch 'mdolab-main' into skewness
DavidAnderegg Sep 26, 2023
69cab36
Make error prints nice again
DavidAnderegg Sep 26, 2023
7711f62
Tidy up skewness branch
DavidAnderegg Sep 26, 2023
bb6ef96
Run fprettify
DavidAnderegg Sep 26, 2023
05fe217
Add back lost space
DavidAnderegg Oct 9, 2023
7e12427
Merge pull request #22 from mdolab/main
DavidAnderegg Oct 9, 2023
07ccd31
inflating my commit counts by pushing newline changes
anilyil Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions adflow/pyADflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5521,6 +5521,8 @@ def _getDefaultOptions():
],
"turbulenceOrder": [str, ["first order", "second order"]],
"turbResScale": [(float, list, type(None)), None],
"meshMaxSkewness": [float, 1.0],
"useSkewnessCheck": [bool, False],
"turbulenceProduction": [str, ["strain", "vorticity", "Kato-Launder"]],
"useQCR": [bool, False],
"useRotationSA": [bool, False],
Expand Down Expand Up @@ -5696,6 +5698,7 @@ def _getDefaultOptions():
"setMonitor": [bool, True],
"printWarnings": [bool, True],
"printNegativeVolumes": [bool, False],
"printBadlySkewedCells": [bool, False],
"monitorVariables": [list, ["cpu", "resrho", "resturb", "cl", "cd"]],
"surfaceVariables": [list, ["cp", "vx", "vy", "vz", "mach"]],
"volumeVariables": [list, ["resrho"]],
Expand Down Expand Up @@ -5783,6 +5786,7 @@ def _getImmutableOptions(self):
"zippersurfacefamily",
"cutcallback",
"explicitsurfacecallback",
"useskewnesscheck",
)

def _getOptionMap(self):
Expand Down Expand Up @@ -5894,6 +5898,8 @@ def _getOptionMap(self):
},
"turbulenceorder": {"first order": 1, "second order": 2, "location": ["discr", "orderturb"]},
"turbresscale": ["iter", "turbresscale"],
"meshmaxskewness": ["iter", "meshmaxskewness"],
"useskewnesscheck": ["iter", "useskewnesscheck"],
"turbulenceproduction": {
"strain": self.adflow.constants.strain,
"vorticity": self.adflow.constants.vorticity,
Expand Down Expand Up @@ -6095,6 +6101,7 @@ def _getOptionMap(self):
"printiterations": ["iter", "printiterations"],
"printwarnings": ["iter", "printwarnings"],
"printnegativevolumes": ["iter", "printnegativevolumes"],
"printbadlyskewedcells": ["iter", "printbadlyskewedcells"],
"printtiming": ["adjoint", "printtiming"],
"setmonitor": ["adjoint", "setmonitor"],
"storeconvhist": ["io", "storeconvinneriter"],
Expand Down
15 changes: 14 additions & 1 deletion doc/options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,10 @@ printNegativeVolumes:
desc: >
Flag to print the block indices, cell center coordinates, and volume for each negative volume cell in the mesh.

printBadlySkewedCells:
desc: >
Flag to print the block indices, cell center coordinates, and skewness for each cell whose skewness is above the value defined in ``meshMaxSkewness``. Only used when ``useSkewnessCheck`` is active.

monitorVariables:
desc: >
List of the variables whose convergence should be monitored.
Expand Down Expand Up @@ -1545,4 +1549,13 @@ cavSensorSharpness:

cavExponent:
desc: >
The exponent for the numerator term (- Cp - cavitationnumber) of the cavitation sensor.
The exponent for the numerator term (- Cp - cavitationnumber) of the cavitation sensor.

meshMaxSkewness:
desc: >
Adflow throws an error and fails if the `skewness` of the mesh is above this value. `Skewness` is defined as described `here <https://www.simscale.com/docs/simulation-setup/meshing/mesh-quality/#skewness>`__. Only used when ``useSkewnessCheck`` is active.

useSkewnessCheck:
desc: >
When set to true, ADflow computes the `skewness` of each cell and throws an error if it is above ``meshMaxSkewness``. See also ``printBadlySkewedCells``.

5 changes: 4 additions & 1 deletion src/f2py/adflow.pyf
Original file line number Diff line number Diff line change
Expand Up @@ -1082,10 +1082,13 @@ python module libadflow
real(kind=realtype) allocatable,dimension(:) :: etark
real(kind=realtype) allocatable,dimension(:) :: cdisrk
real(kind=realtype), dimension(4) :: turbresscale
real(kind=realtype) :: meshmaxskewness
logical :: useskewnesscheck
logical :: freezeturbsource
logical :: printiterations
logical :: printwarnings
logical :: printnegativevolumes
logical :: printbadlyskewedcells
real(kind=realtype) ::maxl2deviationfactor
logical :: uselinresmonitor
logical :: usedisscontinuation
Expand Down Expand Up @@ -1501,4 +1504,4 @@ python module libadflow
end python module libadflow_cs
#else
end python module libadflow
#endif
#endif
DavidAnderegg marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions src/modules/block.F90
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ module block
! needed for unsteady problems on
! deforming grids. Only allocated on
! the finest grid level.
! skew(0:ib,0:jb,0:kb) - Skewness of Volume
! uv(2,2:il,2:jl,2:kl) - Parametric location on elemID for each cell.
! Only used for fast wall distance calcs.
! porI(1:il,2:jl,2:kl) - Porosity in the i direction.
Expand Down Expand Up @@ -433,6 +434,7 @@ module block
real(kind=realType), dimension(:, :, :), pointer :: vol
real(kind=realType), dimension(:, :, :, :), pointer :: volOld
real(kind=realType), dimension(:, :, :), pointer :: volref
real(kind=realType), dimension(:, :, :), pointer :: skew
real(kind=realType), dimension(:, :, :, :), pointer :: uv
integer(kind=intType), dimension(:, :, :, :), pointer :: surfNodeIndices

Expand Down
1 change: 1 addition & 0 deletions src/modules/blockPointers.F90
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ module blockPointers
real(kind=realType), dimension(:, :, :), pointer :: vol
real(kind=realType), dimension(:, :, :), pointer :: volref
real(kind=realType), dimension(:, :, :, :), pointer :: volOld
real(kind=realType), dimension(:, :, :), pointer :: skew
real(kind=realType), dimension(:, :, :, :), pointer :: dadidata

integer(kind=porType), dimension(:, :, :), pointer :: porI, porJ, porK
Expand Down
4 changes: 4 additions & 0 deletions src/modules/constants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -511,4 +511,8 @@ module constants
integer(kind=intType), parameter :: iZippWallY = 8
integer(kind=intType), parameter :: iZippWallZ = 9

! Metric types
integer(kind=intType), parameter :: MetricVolume = 1
integer(kind=intType), parameter :: MetricSkewness = 2

end module constants
11 changes: 8 additions & 3 deletions src/modules/inputParam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,11 @@ module inputIteration
! cdisRk: Dissipative coefficients in the runge kutta
! scheme. The values depend on the number of
! stages specified.
! printIterations: If True, iterations are printed to stdout
! turbresscale: Scaling factor for turbulent residual. Necessary for
! NKsolver with RANS. Only tested on SA.
! printIterations: If True, iterations are printed to stdout
! turbresscale: Scaling factor for turbulent residual. Necessary for
! NKsolver with RANS. Only tested on SA.
! meshMaxSkewness If one cell has a highe skewness than this, the Solver
! errors out.
! iterType : String used for specifying which type of iteration was taken
!
! Definition of the string, which stores the multigrid cycling
Expand Down Expand Up @@ -285,7 +287,10 @@ module inputIteration
logical :: printIterations
logical :: printWarnings
logical :: printNegativeVolumes
logical :: printBadlySkewedCells
real(kind=realType), dimension(4) :: turbResScale
real(kind=realType) :: meshMaxSkewness
logical :: useSkewnessCheck
logical :: useDissContinuation
real(kind=realType) :: dissContMagnitude, dissContMidpoint, dissContSharpness

Expand Down
Loading