-
Notifications
You must be signed in to change notification settings - Fork 910
[WIP] Anisotropic mesh adaptation part 1: feature-based metric tensor #2613
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
base: develop
Are you sure you want to change the base?
Conversation
…ble with initialization
- GG gradient/Hessian calculation on adaptation-specific variable containers - Metric integration and normalization for steady and unsteady flows - Storing of proper primitive variables for Euler solver
|
Is the mesh adaptation code itself open source? |
|
If you mean MMG, it's on Github https://github.com/MmgTools/mmg If you mean the SU2-MMG interface, it's in Alberto's fork https://github.com/xla27/SU2/tree/feat_adap_mmg |
pcarruscag
left a comment
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.
Excellent. Next question, what do you need from the python wrapper to do all of this outside of the SU2 core?
|
The python script basically just coordinates calls to SU2 and MMG in 2 nested loops, the inner loop being a series of adaptations at a given target mesh size and the outer loop being over a list of sizes. It also handles file conversions since MMG uses libmeshb for both the mesh and metric field. For the file conversion, Alberto has a straight python implementation that I think only handles tris/tets, and I have a separate repo with a C++ implementation/python API that I used for my results that I presented in Varenna https://github.com/bmunguia/limon |
|
Cool, the functionality would be more flexible if the sensor was also configurable via python, what you have here has a list of hardcoded possible variables, in python it would be very easy to target other solvers, create custom mixes of variables etc. |
| void CSolver::CompleteComms(CGeometry *geometry, | ||
| const CConfig *config, | ||
| MPI_QUANTITIES commType) { | ||
|
|
Check failure
Code scanning / CodeQL
Comparison of narrow type with wide type in loop condition High
iVar
nVarHess
| MPI_QUANTITIES commType) { | ||
|
|
||
| /*--- Local variables ---*/ | ||
|
|
Check failure
Code scanning / CodeQL
Multiplication result converted to larger type High
| auto& gradient = base_nodes->GetGradient_Adapt(); | ||
| auto nHess = config->GetGoal_Oriented_Metric()? nVar : config->GetnMetric_Sensor(); | ||
|
|
||
| computeGradientsGreenGauss(this, MPI_QUANTITIES::GRADIENT_ADAPT, PERIODIC_GRAD_ADAPT, |
Check failure
Code scanning / CodeQL
Comparison of narrow type with wide type in loop condition High
iVar
nVarHess
|
|
||
| computeGradientsGreenGauss(this, MPI_QUANTITIES::GRADIENT_ADAPT, PERIODIC_GRAD_ADAPT, | ||
| *geometry, *config, solution, 0, nHess, idxVel, gradient); | ||
|
|
Check failure
Code scanning / CodeQL
Multiplication result converted to larger type High
| switch (Kind_Hessian_Method) { | ||
| case GREEN_GAUSS: cout << "Hessian for adaptive metric: Green-Gauss." << endl; break; | ||
| } |
Check notice
Code scanning / CodeQL
No trivial switch statements Note
|
Hi Brian, what's the status? |
Proposed Changes
This PR is part of a joint effort with Alberto Perlini (@xla27) and Andrea Rausa (@rois1995) to implement anisotropic mesh adaptation in SU2. In our SU2 conference talks this year, I presented updates to the metric tensor computation in my fork for unsteady adaptation, and Alberto presented updates to the Python adaptation loop to use the open-source MMG remesher, as well as results for incompressible Euler/NS and NEMO.
Part 1 will focus on my contributions in SU2's post-processing/output to calculate metric tensor fields for feature-based adaptation. Part 2 will focus on the implementation of the adaptation loop in Python, including conversion between SU2 restarts/meshes and the .meshb format.
For the metric tensor field computation, I have implemented:
SetPrimitive_Adapt()to store the chosen adaptation sensorcomputeGradientsGreenGauss.hppwhich calculates the Hessian field for the chosen sensor and stores the lower trianglecomputeMetrics.hppThe following relevant config options have been added:
PR Checklist
pre-commit run --allto format old commits.References