CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

dynamicRefineFvMesh + Vorticity ?

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By floquation
  • 2 Post By floquation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 10, 2017, 11:44
Default dynamicRefineFvMesh + Vorticity ?
  #1
Member
 
badoumba
Join Date: Aug 2013
Posts: 68
Rep Power: 12
badoumba is on a distinguished road
Hi experts,

I try to make adaptive mesh refinement reacting to vorticity - no success so far.

- Can I have vorticity declared as function object in ControlDict? What yould it look like?
- Will it be registered in openFoam db() as required by dynamicRefineFvMesh?

Could also be Q-criterion or Lambda2 instead of vorticity (as suggested here: https://www.vutbr.cz/www_base/zav_pr...file_id=148921)

Thx
badoumba is offline   Reply With Quote

Old   August 11, 2017, 03:49
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
floquation will become famous soon enough
Or you use a user extension that can do what you want:
https://github.com/tgvoskuilen/meshBalancing
(It can refine based on the curl of volVectorFields, which is the vorticity when you apply it to U.)
tonnykz likes this.
floquation is offline   Reply With Quote

Old   August 11, 2017, 06:07
Default
  #3
Member
 
badoumba
Join Date: Aug 2013
Posts: 68
Rep Power: 12
badoumba is on a distinguished road
Hi Floquation,

What does this balancing brings on top of the std DynamicRefineFvMesh class?
I think I can do the same with it. I just need to figure out where to set and link the vorticity/curl/Q... variable.

Thx
badoumba is offline   Reply With Quote

Old   August 11, 2017, 07:24
Default
  #4
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
floquation will become famous soon enough
As you can see in their examples:
https://github.com/tgvoskuilen/meshB...ynamicMeshDict
They provide more options to dynamicRefineFvMesh, amongst which:
  • lowerRefineLevel/upperRefineLevel
    • enables you to refine between values of a field, rather than above a certain threshold. Useful if you, for example, want to capture the interface (0.1<alpha<0.9) in interFoam.
  • internalRefinementField
    • allows you to calculate a new field to base the refinement on, amongst which the vorticity if you set it to curl of U.
    • also allow you to use multiple fields to base the refinement on, for example both vorticity and velocity magnitude
  • enableBalancing
    • dynamically redistributes the cells over the processors as to ensure that each cell has (roughly) the same workload. This is particularly important if you have a case in which most refinement occurs within a single processor, causing that processor to do (e.g.) 90% of the work.
Options you do not want to use, you can simply turn off. For example, "enableBalancing = false" turns off the dynamic load balancing.
arvindpj and tonnykz like this.
floquation is offline   Reply With Quote

Old   August 11, 2017, 18:38
Default
  #5
Member
 
badoumba
Join Date: Aug 2013
Posts: 68
Rep Power: 12
badoumba is on a distinguished road
Hi Floquation,

Thanks for sharing. This refinementControls is definitely a great plus. I will give it a try this week-end.

Thanks!
badoumba is offline   Reply With Quote

Old   August 13, 2017, 17:51
Default
  #6
Member
 
badoumba
Join Date: Aug 2013
Posts: 68
Rep Power: 12
badoumba is on a distinguished road
Hi Floquation,

I think I made all the necessary changes in my project including the refinement range. I suspect an error in the refinementControls.

Is there any description somwhere for how to fill in params in RefinementControls section? I don't know exactly what the number means in U (0.5 1).

Is Curls ( U(0.5 1)); the only thing I need for vorticity? Is there a need for SetFieldsDict? I don't think vorticity is available without running a specific function.
What about if I want to try with Q criterion instead, is there any doc I can refer to for this?

Many thx
badoumba is offline   Reply With Quote

Old   August 14, 2017, 04:29
Default
  #7
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
floquation will become famous soon enough
Quote:
Originally Posted by badoumba View Post
Hi Floquation,

I think I made all the necessary changes in my project including the refinement range. I suspect an error in the refinementControls.

Is there any description somwhere for how to fill in params in RefinementControls section? I don't know exactly what the number means in U (0.5 1).
Not that I know of. Note: I never actually used this code myself. I had written a vorticity-based refinement myself in OF40, but I later found this code which could do what my code could do, but then much more. Hence I linked you that one.

Either way, to find out the answer to your question, we open the source code.
cntrl+F for "curl".
Then I spot the following two lines:
Code:
scalar wgt = curlFields_[fldName].first();
label maxLevel = static_cast<label>(curlFields_[fldName].second()+0.5);
In other words, the first number is the weight.
Code:
refFld = wgt * mag(fvc::curl(fld)) * cubeRtV;
refinementField = wgt \cdot |\nabla\times fld| \cdot \Delta x
This is specifically important if you want to combine multiple criteria, as those criteria are combined to a single field. If you do not weigh fields properly, one field might be negligible w.r.t. the others.
A proper weight would be proportional to the inverse characteristic velocity, as then your refFld will be O(1).

Then, the latter (maxLevel), allows you to (code slightly adapted to illustrate the principle):
Code:
// Limit the value of refFld based on its max level
if( cellLevel[cellI] >= maxLevel )
refFld[cellI] = 0.5*(refinePoints.first() + refinePoints.second())
So if your field (so vorticity in your case) is greater than "maxLevel", the refinementField is set equal to the average of the lower and higher limit of refinement.
That is, that specific cell is forced inside the please-do-refine range.
So if your field is larger than maxLevel, those cells will guaranteedly be refined.

Quote:
Originally Posted by badoumba View Post
Is Curls ( U(0.5 1)); the only thing I need for vorticity? Is there a need for SetFieldsDict? I don't think vorticity is available without running a specific function.
The curl of U is by definition vorticity, so that is indeed all that you need.
You do not need setFieldsDict. It is in their example, because it is also possible to use a CellSet to base the refinement on - but you don't need that.

Quote:
Originally Posted by badoumba View Post
What about if I want to try with Q criterion instead, is there any doc I can refer to for this?

Many thx
The code supports "gradient", "curl" and "cellSet".
If you wish to use any other kind of math, you'll have to adapt the code for your purposes.
(Perhaps my simpler code would be more useful for you in that case. What version do you use?)
floquation is offline   Reply With Quote

Old   August 14, 2017, 04:37
Default
  #8
Member
 
badoumba
Join Date: Aug 2013
Posts: 68
Rep Power: 12
badoumba is on a distinguished road
Hi Floquation!

version is 17.06.
badoumba is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Choice of numerical schemes for high accuracy in vorticity D.B OpenFOAM Running, Solving & CFD 1 February 5, 2018 10:44
3D vorticity contour shahzad_munir Main CFD Forum 0 May 1, 2014 02:34
vorticity boundary condition bearcharge Main CFD Forum 0 May 14, 2010 11:32
vorticity calculation at symmetryplane benconnell OpenFOAM 0 April 14, 2009 18:45
Vorticity Iso-Surface John Main CFD Forum 0 April 4, 2009 23:10


All times are GMT -4. The time now is 14:01.