hystrath / hyStrath

Hypersonic / Rarefied gas dynamics code developments (GPL-3.0)
https://hystrath.github.io/
GNU General Public License v3.0
225 stars 109 forks source link

Help using AMR #111

Closed Peter1511ogluigi closed 2 years ago

Peter1511ogluigi commented 2 years ago

Dear Sir

I am trying to use AMR in simulation concerning a blunt cone. I have followed the instructions described in tutorial by adding the dynamicMeshDict to the constant folder. After I have done this, I use the command hy2DyMFoam > log.hy2DyMFoam 2>&1 & to run the desired calculation. When I do this, my terminal only gives the following feedback image

The mesh I am using, which has been created in gmsh, consists of 60x30 cells and looks like the following image

Now, the simulations seems to run, giving results at the desired timesteps. However, when I check with paraview there is clearly no change in the structure of the mesh being used. The dynamicMeshDict I have used is given as

Screenshot from 2022-08-08 13-06-43

I wish to use AMR in later calculations with more complex geometries, so help in using this method is greatly appreciated. Do you know why I cannot seem to get it to work?

/Peter

vincentcasseau commented 2 years ago

Hi Peter, I would discourage you from using AMR for this case (mesh not aligned with the bow shock & 3D refinement for a 2D case). In my view, AMR is only good for shock tube cases. It should not be a substitute for a good structured mesh.

As to why nothing happened for your case, you would need to visualise the field you defined (normalisedDensityGradient) and check that the 3 refinement levels you set are OK. Thanks, Vincent

Peter1511ogluigi commented 2 years ago

Hello Vincent Thanks for the fast reply I am trying to compare results using AMR with results from a very fine structured mesh, so it just to see the usefulness of AMR. I have tried changing the refinement levels, and it seems to work so that is very nice.

A problem I now face is that the refinement can only be done on a certain set of values. I wish to refine regions of high temperature therefore having refinement from 1000 K to 20000 K. With the mesh I currently use (finer than shown on image above), I can refine in the region from 3000 K to 20000 K. Do you know why I cannot refine below 3000 K?

here is my dynamicMeshDict

image

vincentcasseau commented 2 years ago

Have you tried setting your unrefineLevel to a value lower than your freestream value? Maybe there is no room to accommodate 2 buffer layers between each level. What if you use an even finer mesh in this area?

Peter1511ogluigi commented 2 years ago

I have tried changing the unrefineLevel but it does not seem to change anything. Have also tried to change the number of buffer layer with no luck whatsoever. When changing the mesh I achieved a larger domain of data to refine (coarse might only allow mesh refinement from 5000-15000 K while fine mesh allows refinement for 3000 - 20000 K)

I had hoped that AMR would allow a rather coarse mesh, which would be easy to generate, to be refined. However, as it looks so far, the mesh needs to be of pretty high quality before the AMR will take over.

vincentcasseau commented 2 years ago

Could you post a picture of the "fine mesh that allows refinement for 3000 - 20000 K" with the Tov solution overlaid.

Peter1511ogluigi commented 2 years ago

Here are some images. I have just realized that a "fine" mesh in this case is 60x70 cells.

img1 img2 img3

vincentcasseau commented 2 years ago

I can't see why there is a the problem, the mesh is refined upstream the shock on the second picture. Are there only cells of levels 0 & 1 in this domain?

Peter1511ogluigi commented 2 years ago

I agree that the mesh is refined as hoped, however I still wonder why it cannot refine below 3000 K. In this run I set the maxRefinement to be 1.

vincentcasseau commented 2 years ago

This is not visible with the current colourbar range. Please rescale to [240, 3000/3500].

Also in Paraview, on the left-hand side panel, Properties tab, untick Decompose Polyhedra and then set Representation to Surface With Edges.

Peter1511ogluigi commented 2 years ago

img4

vincentcasseau commented 2 years ago

Please send me a zip of your case by email. Thanks

vincentcasseau commented 2 years ago
  1. Visualise cell-center values, not the interpolated nodal solution;
  2. When the mesh update is synchronised with the outputTime (constant Dt), and lowerRefineLevel is set to 2500, it works (all red cells are level 1 in the first picture);
  3. If you further decrease lowerRefineLevel, it gets unstable because of the mesh choice (axisymmetric -> the first layer next to the revolution axis doesn't get refined: tets aren't dealt with by AMR) and because of the refinement criterion (the first few layers next to the cone won't get refined either).

All in all, no issues at all, just not the best case. You could aim to replicate the test cases shown in Daniel Espinoza's 2015 conference paper to experiment with AMR.

Screenshot from 2022-08-11 10-45-48 Screenshot from 2022-08-11 10-44-37 Screenshot from 2022-08-11 10-45-15

Peter1511ogluigi commented 2 years ago

Thank you very much, your help is much appreciated (as always) I will try with the other test case instead

Den tor. 11. aug. 2022 kl. 10.58 skrev Vince @.***>:

  1. Visualise cell-center values, not the interpolated nodal solution;
  2. When the mesh update is synchronised with the outputTime (constant Dt), and lowerRefineLevel is set to 2500, it works (all red cells are level 1 in the first picture);
  3. If you further decrease lowerRefineLevel, it gets unstable because of the mesh choice (axisymmetric -> the first layer next to the revolution axis doesn't get refined: tets aren't dealt with by AMR) and because of the refinement criterion (the first few layers next to the cone won't get refined either).

All in all, no issues at all, just not the best case. You could aim to replicate the test cases shown in Daniel Espinoza's 2015 conference paper to experiment with AMR.

[image: Screenshot from 2022-08-11 10-45-48] https://user-images.githubusercontent.com/10944529/184096981-39b84847-0f8e-4b5c-9ccb-408ebec6eace.png [image: Screenshot from 2022-08-11 10-44-37] https://user-images.githubusercontent.com/10944529/184096934-48582eea-7196-4de5-b9f1-2785acacbcb6.png [image: Screenshot from 2022-08-11 10-45-15] https://user-images.githubusercontent.com/10944529/184096964-5df7e35e-afac-4e49-a488-2f903932bf21.png

— Reply to this email directly, view it on GitHub https://github.com/vincentcasseau/hyStrath/issues/111#issuecomment-1211719700, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJCGOCJBHAT5HULNDMKE3DVYS6CDANCNFSM554XH62Q . You are receiving this because you authored the thread.Message ID: @.***>