raise Error if a Mesh Cell is skewed above threshold
Purpose
I am optimising a two element-airfoil. Because of the proximity of those elements, the mesh quality deteriorates fast. To fix this, i check if the variable adflow.killsignals.fatalfail is set to true. When this is the case, I regenerate a mesh.
Unfortunately, this method is to slow as the variable is only set when the mesh has negative volumes.
This PR should addresses this in the following way:
Calculate the skewness as described here. If it goes above a certain threshold defined in the regular python-wrapper (e.g. meshMaxSkewness: 0.4), ADflow errors out by means of setting adflow.killsignals.fatalfail to true.
I do not consider this PR ready yet. But I want to get feeback from you guys as soon as possible. I am especially interested in these points:
- I only calculate the skewness when we are actually interested in it (
meshMaxSkewness< 1). Does this make sense? - Is highjacking the subroutine
WriteNegVolumesfine as I did? - I need to release my new
flowdomvariableskew. Where is the best place to do this?
Expected time until merged
Probably a couple of weeks.
Type of change
- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (non-backwards-compatible fix or feature)
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Documentation update
- [ ] Maintenance update
- [ ] Other (please describe)
Testing
I copied the cube_4x4x4.cgns file and coarsed it to a 1x1x1 cube. I also set the wallBC on all faces. This is necesairy to prohibit idwarp from warping everything. You find it here: cube_1x1x1.zip
The idea is to warp each face of each axis two times. Once by slightly less than 1 and the other time slightly more than 1.
Warping by 1 gives a skewness of 0.5. So i set the meshMaxSkewness to 0.5 and test if adflow.killsignals.fatalfail is False in the first case and True in the seccond.
Checklist
- [x] I have run
flake8andblackto make sure the Python code adheres to PEP-8 and is consistently formatted - [ ] I have formatted the Fortran code with
fprettifyor C/C++ code withclang-formatas applicable - [ ] I have run unit and regression tests which pass locally with my changes
- [x] I have added new tests that prove my fix is effective or that my feature works
- [x] I have added necessary documentation
Changing to draft as author suggest that the PR is not ready and content needs discussion.
Codecov Report
Merging #235 (07ccd31) into main (559a1de) will not change coverage. The diff coverage is
n/a.
@@ Coverage Diff @@
## main #235 +/- ##
=======================================
Coverage 41.94% 41.94%
=======================================
Files 13 13
Lines 4005 4005
=======================================
Hits 1680 1680
Misses 2325 2325
| Files | Coverage Δ | |
|---|---|---|
| adflow/pyADflow.py | 68.94% <ø> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more