CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] swak4FoamFilter to filter grid data- could use some Help

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2018, 07:12
Default swak4FoamFilter to filter grid data- could use some Help
  #1
Member
 
Jeff
Join Date: May 2016
Posts: 44
Rep Power: 10
jf_vt is on a distinguished road
Hi
I am trying to extract and write into a file the positions (x,y,z) and ideally closest cell volume but I still has to figure out how to to that, where the velocity magnitude exceed a threshold using swak4foam writeIf feature.

After reading some examples, I came with the following:
Code:
 {
      type writeIfSwakExpression;
      verbose yes;
      outputControlMode timeStep;
      outputInterval 1;
      valueType internalField;
      writeCondition "mag(U)>90";
      writeControlMode always;
      cooldownMode no;
      storeAndWritePreviousState no;
      writeConditionAccumulation or;
      variables (
         "X=pos().x;"
         "Y=pos().y;"
         "Z=pos().z;"
);
      storedVariables
        (

          {
            name X;
            name Y;
            name Z;
            initialValue "0";

          }
        );

    }
When the case run the log file provides the following:
Code:
swak4Foam: Allocating new repository for sampledMeshes
swak4Foam: Allocating new repository for sampledGlobalVariables
filterTest: "mag(U)>90" evaluated to true
filterTest starts writing
filterTest triggered writing of t=1
filterTest: Writing ....
which let think that all goes well ( I know the max velocity is larger than 300m/s in this case)

But when the case ends I cannot find the information I need.

Obviously I am doing something wrong but I dont know what
If someone could point me into the right direction, it will be much appreciated

Thanks
JF
ps: the motivation is to build a script that refine a mesh based on some physical criteria
jf_vt is offline   Reply With Quote

Old   August 27, 2018, 18:29
Default
  #2
New Member
 
Paul Lee
Join Date: Jun 2018
Location: Vancouver
Posts: 14
Rep Power: 7
paoching is on a distinguished road
is swak4foam compatible with current version of OpenFOAM v6 or OpenFOAM v1806?
I want to used groovyBC, which is a sub function in swak4foam and found this page:
https://openfoamwiki.net/index.php/Contrib/swak4Foam
but cannot find a version supporting v6 or v1806. Do I have to install a legacy OpenFoam?
what version of swak4Foam are you using with what version of OpenFOAM? Can you post me a link?
paoching is offline   Reply With Quote

Old   August 27, 2018, 19:49
Default
  #3
Member
 
Jeff
Join Date: May 2016
Posts: 44
Rep Power: 10
jf_vt is on a distinguished road
Quote:
Originally Posted by paoching View Post
is swak4foam compatible with current version of OpenFOAM v6 or OpenFOAM v1806?
I want to used groovyBC, which is a sub function in swak4foam and found this page:
https://openfoamwiki.net/index.php/Contrib/swak4Foam
but cannot find a version supporting v6 or v1806. Do I have to install a legacy OpenFoam?
what version of swak4Foam are you using with what version of OpenFOAM? Can you post me a link?
you already have the link
(almost) Everythng is explained there (with some news on the tweet feed as well).
TO answer your question
I am using swak 0.4.2 with foan-extend 4.1,but I read that swak should work with OF6 and 18.06
Just download the dev version on the mercurial website as explained on the wiki
JF
jf_vt is offline   Reply With Quote

Old   August 27, 2018, 20:45
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by jf_vt View Post
Hi
I am trying to extract and write into a file the positions (x,y,z) and ideally closest cell volume but I still has to figure out how to to that, where the velocity magnitude exceed a threshold using swak4foam writeIf feature.

After reading some examples, I came with the following:
Code:
 {
      type writeIfSwakExpression;
      verbose yes;
      outputControlMode timeStep;
      outputInterval 1;
      valueType internalField;
      writeCondition "mag(U)>90";
      writeControlMode always;
      cooldownMode no;
      storeAndWritePreviousState no;
      writeConditionAccumulation or;
      variables (
         "X=pos().x;"
         "Y=pos().y;"
         "Z=pos().z;"
);
      storedVariables
        (

          {
            name X;
            name Y;
            name Z;
            initialValue "0";

          }
        );

    }
When the case run the log file provides the following:
Code:
swak4Foam: Allocating new repository for sampledMeshes
swak4Foam: Allocating new repository for sampledGlobalVariables
filterTest: "mag(U)>90" evaluated to true
filterTest starts writing
filterTest triggered writing of t=1
filterTest: Writing ....
which let think that all goes well ( I know the max velocity is larger than 300m/s in this case)

But when the case ends I cannot find the information I need.

Obviously I am doing something wrong but I dont know what
If someone could point me into the right direction, it will be much appreciated

Thanks
JF
ps: the motivation is to build a script that refine a mesh based on some physical criteria

writeIfSwakExpression only triggers the writing of a complete timestep


storedVariable is "only" a special time of variable that keeps its value between timesteps (applications would be finding a maximum over time, summing up mass-flows etc)


What kind of data would you need? Only one position or all the cells "violating" the condition?
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   August 27, 2018, 21:13
Default
  #5
Member
 
Jeff
Join Date: May 2016
Posts: 44
Rep Power: 10
jf_vt is on a distinguished road
All the cell violating a condition ( that can be possibly complex ) ==>
It generate a cloud of points ( a file of x,y,z possibly with vol(cell) s an added information that can then be used to refine the mesh automatically in a scriptable mesher.
I currently do it through paraview threshold but this is not practical for large mesh size ( but sufficient to test the workflow).
JF
jf_vt is offline   Reply With Quote

Old   August 28, 2018, 05:28
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by jf_vt View Post
All the cell violating a condition ( that can be possibly complex ) ==>
It generate a cloud of points ( a file of x,y,z possibly with vol(cell) s an added information that can then be used to refine the mesh automatically in a scriptable mesher.
I currently do it through paraview threshold but this is not practical for large mesh size ( but sufficient to test the workflow).
JF

Have a look at manipulateCellSet in swakFunctionObjects (example in Examples/other/topoSetDamBreak). That creates a cellSet depending on a condition. cellSets are "natural" for a lot of OpenFOAM-tools


If you still need to output all cell centers then you can use dumpSwakExpression from simpleSwakFunctionObjects (which I hardly use because of its tendency to clutter the hard-disk)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   August 28, 2018, 07:04
Default
  #7
Member
 
Jeff
Join Date: May 2016
Posts: 44
Rep Power: 10
jf_vt is on a distinguished road
Thank you

a quick look at the exemple indicates that manipulateCellSet is the function I need for my current endeavor.
I will play a bit with it to get acquainted first

As for dumpSwakExpression, you clearly documented the disk cluttering issue in the relevant example! I will nevertheless take the time to understand what it does.. just in case.

JF
jf_vt is offline   Reply With Quote

Old   August 28, 2018, 07:47
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by jf_vt View Post
Thank you

a quick look at the exemple indicates that manipulateCellSet is the function I need for my current endeavor.
I will play a bit with it to get acquainted first

As for dumpSwakExpression, you clearly documented the disk cluttering issue in the relevant example! I will nevertheless take the time to understand what it does.. just in case.

JF

Stupid question: have you considered using dynamicRefineFvMesh with a custom field that you calculate with an expressionField functionObject (instead of the alpha.water that is used in the damBreakWithObstacle-tutorial)?
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   August 28, 2018, 08:03
Default
  #9
Member
 
Jeff
Join Date: May 2016
Posts: 44
Rep Power: 10
jf_vt is on a distinguished road
Yes, briefly but I did not explore it.
Indeed, and to the best of my understanding of the documentation, dynamicRefineMesh will cut a cell in 8 or not based on a predefined criteria.

That does not work well for complex unstructured mesh such as the ones I am working with, as it increases contrast between cell that are cut and the ones that are not.
I cannot speak in general, but in most situation I can think of ( read: useful to me), this decrease the overall mesh quality.

On the other hand a scriptable mesher allows for more complex remeshing strategies in order to maintain mesh quality around the "bad" cell that will be reduced.

Last edited by jf_vt; August 28, 2018 at 08:04. Reason: typos
jf_vt 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
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 21:00
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 18 May 11, 2018 07:31
Remapping pressure data for another grid clktp OpenFOAM Post-Processing 3 February 6, 2018 08:34
Run OpenFoam in 2 nodes of a cluster WhiteW OpenFOAM Running, Solving & CFD 16 December 20, 2016 00:51
matching variable data with grid point data anfho OpenFOAM Programming & Development 0 May 6, 2011 15:28


All times are GMT -4. The time now is 23:38.