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

[swak4Foam] on run time object

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 3, 2014, 14:36
Default on run time object
  #1
Member
 
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0
hchen is on a distinguished road
Hi,

I want to extract the sum of a vector field in a cell zone at every time step. The cell zone is already set up in the mesh.

The vector field is something like:
(a & U + mag(U) * b & U) * cellVolume
where a and b are 3*3 tensor and & means the inner product.
So the final result is supposed to be a vector.

It seems that swak4foam can do that but I never use it before. I am trying to find some information and any helps are appreciated!

Best regards
Hao
hchen is offline   Reply With Quote

Old   December 3, 2014, 16:55
Default
  #2
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 hchen View Post
Hi,

I want to extract the sum of a vector field in a cell zone at every time step. The cell zone is already set up in the mesh.

The vector field is something like:
(a & U + mag(U) * b & U) * cellVolume
where a and b are 3*3 tensor and & means the inner product.
So the final result is supposed to be a vector.

It seems that swak4foam can do that but I never use it before. I am trying to find some information and any helps are appreciated!

Best regards
Hao
When you google "swak4Foam" the first page you get is this page on which a number of information is linked https://openfoamwiki.net/index.php/C...er_information

The basic training from the 9th Workshop is probably currently the best introduction (and it even has an example with a cellset if I remember it correctly)
__________________
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   December 4, 2014, 05:40
Default
  #3
Member
 
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0
hchen is on a distinguished road
Hi Bernhard:

Thanks for your information. So swak4foam can do that right?

I am trying to learn it and also pyFoam.

When I install Pyfoam and use pyFoamPlotRunner, it shows some error so it did not plot the residuals:

Code:
gnuplot> set terminal x11
                      ^
         line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list


gnuplot> set terminal x11

gnuplot> set terminal x11 noraise
                                            ^
 ^
                 line 0: line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list

unknown or ambiguous terminal type; type just 'set terminal' for a list


gnuplot> set terminal x11 noraise
                      ^
         line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list


gnuplot> set terminal x11
                      ^
         line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list


gnuplot> set terminal x11 noraise
                      ^
         line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list

 PyFoam WARNING on line 142 of file /usr/local/lib/python2.7/dist-packages/PyFoam/LogAnalysis/GeneralLineAnalyzer.py : Problem doing timelines could not convert string to float:  
 PyFoam WARNING on line 142 of file /usr/local/lib/python2.7/dist-packages/PyFoam/LogAnalysis/GeneralLineAnalyzer.py : Problem doing timelines could not convert string to float:  
 PyFoam WARNING on line 142 of file /usr/local/lib/python2.7/dist-packages/PyFoam/LogAnalysis/GeneralLineAnalyzer.py : Problem doing timelines could not convert string to float:
Maybe it is due to the version of gnuplot? I then check the pyFoamVersion:
Code:
Python version: 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2]

Python executable: /usr/bin/python

Python 2.7 is one development platform for PyFoam (along with Python 3)
PYTHONPATH is not set

Location of this utility: /usr/local/bin/pyFoamVersion.py

 PyFoam WARNING on line 192 of file /usr/local/lib/python2.7/dist-packages/PyFoam/FoamInformation.py : Basedir /home/hchen/OpenFOAM for fork openfoam does not exist or is not a directory 
Version 3.1 Fork extend of the installed 1 versions:
extend-3.1 : /home/hchen/foam/foam-extend-3.1

pyFoam-Version: 0.6.4

Path where PyFoam was found (PyFoam.__path__) is ['/usr/local/lib/python2.7/dist-packages/PyFoam']

Configuration search path: [('file', '/etc/pyFoam/pyfoamrc'), ('directory', '/etc/pyFoam/pyfoamrc.d'), ('file', '/home/hchen/.pyFoam/pyfoamrc'), ('directory', '/home/hchen/.pyFoam/pyfoamrc.d')]
Configuration files (used): []

Installed libraries:
cython               :  No      Not used. Maybe will by used later to spped up parts of PyFoam 
cProfile             :  Yes 
docutils             :  No      Not necessary. Needed for RestructuredText to HTML conversion 
Gnuplot              :  No      Not a problem. Version from ThirdParty is used 
hotshot              :  Yes 
ipdb                 :  No      Not necessary. Only makes debugging more comfortable 
IPython              :  No      Not necessary. But the interactive shell may be more comfortable 
matplotlib           :  Yes      version: 1.3.1 
mercurial            :  Yes      version: 2.8.2 
nose                 :  No      Only needed for running the unit-tests (developers only) 
numpy                :  Yes      version: 1.8.2 
openpyxl             :  No      Not a problem. Only used for exporting pandas-data to Excel-files (advanced) 
pandas               :  No      Not a problem. Only used for handling of advanced data-handling 
ply                  :  No      Not a problem. Version from ThirdParty is used 
profile              :  Yes 
psyco                :  No      Not a problem. Acceleration not possible 
PyQt4                :  Yes      version: 4.8.6 
PyQt4.Qwt5           :  No      Only an alternate plotting back-end 
scipy                :  Yes      version: 0.13.3 
Tkinter              :  Yes      version: $Revision: 81008 $ 
twisted              :  Yes      version: 13.2.0 
vtk                  :  Yes      version: 5.8.0 
xlwt                 :  No      Not a problem. Only used for exporting pandas-data to Excel-files 
xlrd                 :  No      Not a problem. Only used for importing Excel-files to pandas-data 

Library locations
cProfile             : /usr/lib/python2.7/cProfile.py
hotshot              : /usr/lib/python2.7/hotshot/__init__.py
matplotlib           : /usr/lib/pymodules/python2.7/matplotlib/__init__.pyc
mercurial            : /usr/lib/python2.7/dist-packages/mercurial/__init__.pyc
numpy                : /usr/lib/python2.7/dist-packages/numpy/__init__.pyc
profile              : /usr/lib/python2.7/profile.py
PyQt4                : /usr/lib/python2.7/dist-packages/PyQt4/__init__.pyc
scipy                : /usr/lib/python2.7/dist-packages/scipy/__init__.pyc
Tkinter              : /usr/lib/python2.7/lib-tk/Tkinter.py
twisted              : /usr/lib/python2.7/dist-packages/twisted/__init__.pyc
vtk                  : /usr/lib/pymodules/python2.7/vtk/__init__.pyc

Checking additional envirnoment variables

Checking for PYFOAM_DIR : Location of the PyFoam-installation. Not strictly necessary
PYFOAM_DIR missing from environment

Checking for PYFOAM_SITE_DIR : Location of non-PyFoam-disctributions script. Set and used by some Foam-distributions
PYFOAM_SITE_DIR missing from environment
I did not install PyFoam when I download foam extend so I now use a newer version of pyfoam.

Can you figure out the reason?

Best regards
Hao

Quote:
Originally Posted by gschaider View Post
When you google "swak4Foam" the first page you get is this page on which a number of information is linked https://openfoamwiki.net/index.php/C...er_information

The basic training from the 9th Workshop is probably currently the best introduction (and it even has an example with a cellset if I remember it correctly)
hchen is offline   Reply With Quote

Old   December 4, 2014, 09:06
Default
  #4
Member
 
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0
hchen is on a distinguished road
I solved the problem, it is just because of the version of Gnuplot. I reinstall gnuplot-x11 and seems solved.

But it is a bit wired since it shows that it uses the third party of pyfoam so the gnuplot version should be correct...

Best regards
Hao
hchen is offline   Reply With Quote

Old   December 4, 2014, 09:25
Default
  #5
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 hchen View Post
I solved the problem, it is just because of the version of Gnuplot. I reinstall gnuplot-x11 and seems solved.

But it is a bit wired since it shows that it uses the third party of pyfoam so the gnuplot version should be correct...
What seems weird to ME is that some Linux toy-distributions ship gnuplot without x11-support (what DO they use for interactive plotting?)

pyFoam can only check for the existence of the Gnuplot-Python-library. It COULD check for the gnuplot-binary but checking whether the binary supports the x11-terminal would be harder
__________________
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   December 4, 2014, 10:57
Default
  #6
Member
 
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0
hchen is on a distinguished road
Hi Bernhard:

I went through some of the presentations you gave in the workshop and thanks very much that you develop this wonderful utility!

For my case I can add these in the controlDict:

Code:
functions
(
    whichFields 
    {
        type                 listRegisteredObjects;
        outputControlMode    startup;
    }

    volumeForceSum
    {
        type                 swakExpression;
        valueType            cellZone;
        zoneName             in;
        accumulations        (sum);
        expression           "vol()*U+mag(U)*vol()*U";
        verbose              true;
        outputControlMode    timeStep;
        outputInterval       1;
    }
);

libs 
(
      "libOpenFOAM.so"
      "libsimpleSwakFunctionObjects.so"
      "libswakFunctionObjects.so"
      "libgroovyBC.so"
);
But somehow I have a questions that how can I define the tensor a and b in the controlDict?

Best regards
Hao

Quote:
Originally Posted by gschaider View Post
What seems weird to ME is that some Linux toy-distributions ship gnuplot without x11-support (what DO they use for interactive plotting?)

pyFoam can only check for the existence of the Gnuplot-Python-library. It COULD check for the gnuplot-binary but checking whether the binary supports the x11-terminal would be harder
hchen is offline   Reply With Quote

Old   December 4, 2014, 15:39
Default
  #7
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 hchen View Post
Hi Bernhard:

I went through some of the presentations you gave in the workshop and thanks very much that you develop this wonderful utility!

For my case I can add these in the controlDict:

Code:
functions
(
    whichFields 
    {
        type                 listRegisteredObjects;
        outputControlMode    startup;
    }

    volumeForceSum
    {
        type                 swakExpression;
        valueType            cellZone;
        zoneName             in;
        accumulations        (sum);
        expression           "vol()*U+mag(U)*vol()*U";
        verbose              true;
        outputControlMode    timeStep;
        outputInterval       1;
    }
);

libs 
(
      "libOpenFOAM.so"
      "libsimpleSwakFunctionObjects.so"
      "libswakFunctionObjects.so"
      "libgroovyBC.so"
);
But somehow I have a questions that how can I define the tensor a and b in the controlDict?

Best regards
Hao
Have a look at the incomplete reference guide that comes with the sources (or http://sourceforge.net/p/openfoam-ex...Reference.md): "Constants and type building"
__________________
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

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
pressure in incompressible solvers e.g. simpleFoam chrizzl OpenFOAM Running, Solving & CFD 13 March 28, 2017 05:49
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 11:08
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 02:20
Transient run continues from last time (when startover is desired) bongbang CFX 2 March 22, 2015 23:05
plot over time fferroni OpenFOAM Post-Processing 7 June 8, 2012 07:56


All times are GMT -4. The time now is 18:09.