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

[PyFoam] PyFoam on macOS

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Delta Cheng

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 10, 2021, 18:49
Default PyFoam on macOS
  #1
Member
 
Join Date: Jun 2016
Posts: 99
Rep Power: 9
xuegy is on a distinguished road
Hello all,

I have issues running pyFoamPlotWatcher.py on macOS. (installed thru pip)
Code:
gnuplot> set terminal aqua
              
gnuplot> set terminal aqua

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

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

gnuplot> set terminal x11 noraise noenhanced

gnuplot> set terminal x11 noraise noenhanced

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 title "pyFoam: Bounded variables"

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

gnuplot> set terminal x11 title "pyFoam: Continuity"

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

gnuplot> set terminal aqua

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

gnuplot> set terminal x11 noraise noenhanced

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

gnuplot> set terminal x11 title "pyFoam: Residuals"

line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list
Obvisouly it is caused by the incomplete installation of gnuplot on macOS.
However brew install gnuplot --with-qt or --with-x11 is now deprecated. https://stackoverflow.com/questions/...11-not-working
Is there any solution to get PyFoam supported on macOS? The author uses mercurial for source code and I don't even know how to submit an issue!

Thanks in advance.
xuegy is offline   Reply With Quote

Old   January 13, 2021, 19:31
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 xuegy View Post
Hello all,

I have issues running pyFoamPlotWatcher.py on macOS. (installed thru pip)
Code:
gnuplot> set terminal aqua
              
gnuplot> set terminal aqua

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

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

gnuplot> set terminal x11 noraise noenhanced

gnuplot> set terminal x11 noraise noenhanced

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 title "pyFoam: Bounded variables"

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

gnuplot> set terminal x11 title "pyFoam: Continuity"

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

gnuplot> set terminal aqua

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

gnuplot> set terminal x11 noraise noenhanced

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

gnuplot> set terminal x11 title "pyFoam: Residuals"

line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list
Obvisouly it is caused by the incomplete installation of gnuplot on macOS.
However brew install gnuplot --with-qt or --with-x11 is now deprecated. https://stackoverflow.com/questions/...11-not-working
Is there any solution to get PyFoam supported on macOS? The author uses mercurial for source code and I don't even know how to submit an issue!

Thanks in advance.

I don't have access to an up to date Mac anymore so I can only guess


There is a setting that allows specifying the terminal to be used in Gnuplot. So it might be fixed by putting

Code:
[Plotting]
gnuplot_terminal: x11

into a file ~/.pyFoam/pyfoamrc and replace x11 with whatever is now the default terminal to use in Gnuplot on a Mac
__________________
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   January 13, 2021, 20:28
Default
  #3
Member
 
Join Date: Jun 2016
Posts: 99
Rep Power: 9
xuegy is on a distinguished road
Quote:
Originally Posted by gschaider View Post
I don't have access to an up to date Mac anymore so I can only guess


There is a setting that allows specifying the terminal to be used in Gnuplot. So it might be fixed by putting

Code:
[Plotting]
gnuplot_terminal: x11

into a file ~/.pyFoam/pyfoamrc and replace x11 with whatever is now the default terminal to use in Gnuplot on a Mac
Here's what's supported in pyFoam
Code:
Error in /usr/local/bin/pyFoamPlotWatcher.py : FatalError in PyFoam: 'PyFoam FAT
AL ERROR on line 52 of file /usr/local/lib/python3.9/site-packages/PyFoam/Basic
s/PlotTimelinesFactory.py: Terminal qt not in list of valid terminals x11, wxt, 
caca, dumb, aqua'
Here's what supported by gnuplot in macOS
Code:
Available terminal types:
cairolatex  LaTeX picture environment using graphicx package and Cairo backend
canvas  HTML Canvas object
cgm  Computer Graphics Metafile
context  ConTeXt with MetaFun (for PDF documents)
domterm  DomTerm terminal emulator with embedded SVG
dumb  ascii art for anything that prints text
dxf  dxf-file for AutoCad (default size 120x80)
emf  Enhanced Metafile format
epscairo  eps terminal based on cairo
epslatex  LaTeX picture environment using graphicx package
fig  FIG graphics language V3.2 for XFIG graphics editor
gif  GIF images using libgd and TrueType fonts
hpgl  HP7475 and relatives [number of pens] [eject]
jpeg  JPEG images using libgd and TrueType fonts
lua  Lua generic terminal driver
mf  Metafont plotting standard
mp  MetaPost plotting standard
pcl5  PCL5e/PCL5c printers using HP-GL/2
pdfcairo  pdf terminal based on cairo
pict2e  LaTeX2e picture environment
png  PNG images using libgd and TrueType fonts
pngcairo  png terminal based on cairo
postscript  PostScript graphics, including EPSF embedded files (*.eps)
pslatex  LaTeX picture environment with PostScript \specials
pstex  plain TeX with PostScript \specials
pstricks  LaTeX picture environment with PSTricks macros
qt  Qt cross-platform interactive terminal
sixelgd  sixel using libgd and TrueType fonts
svg  W3C Scalable Vector Graphics
tek40xx  Tektronix 4010 and others; most TEK emulators
tek410x  Tektronix 4106, 4107, 4109 and 420X terminals
texdraw  LaTeX texdraw environment
tikz  TeX TikZ graphics macros via the lua script driver
tkcanvas  Tk canvas widget
unknown  Unknown terminal type - not a plotting device
vttek  VT-like tek40xx terminal emulator
xterm  Xterm Tektronix 4014 Mode
The only option seems to be "dumb"
Screen Shot 2021-01-13 at 8.24.31 PM.jpg
Which is definitely not what I want. I guess this will be a simple fix, by setting the terminal to qt if the system is macOS, but I'm not a pro in python.
xuegy is offline   Reply With Quote

Old   January 14, 2021, 03:24
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 xuegy View Post
Here's what's supported in pyFoam
Code:
Error in /usr/local/bin/pyFoamPlotWatcher.py : FatalError in PyFoam: 'PyFoam FAT
AL ERROR on line 52 of file /usr/local/lib/python3.9/site-packages/PyFoam/Basic
s/PlotTimelinesFactory.py: Terminal qt not in list of valid terminals x11, wxt, 
caca, dumb, aqua'
Here's what supported by gnuplot in macOS
Code:
Available terminal types:
cairolatex  LaTeX picture environment using graphicx package and Cairo backend
canvas  HTML Canvas object
cgm  Computer Graphics Metafile
context  ConTeXt with MetaFun (for PDF documents)
domterm  DomTerm terminal emulator with embedded SVG
dumb  ascii art for anything that prints text
dxf  dxf-file for AutoCad (default size 120x80)
emf  Enhanced Metafile format
epscairo  eps terminal based on cairo
epslatex  LaTeX picture environment using graphicx package
fig  FIG graphics language V3.2 for XFIG graphics editor
gif  GIF images using libgd and TrueType fonts
hpgl  HP7475 and relatives [number of pens] [eject]
jpeg  JPEG images using libgd and TrueType fonts
lua  Lua generic terminal driver
mf  Metafont plotting standard
mp  MetaPost plotting standard
pcl5  PCL5e/PCL5c printers using HP-GL/2
pdfcairo  pdf terminal based on cairo
pict2e  LaTeX2e picture environment
png  PNG images using libgd and TrueType fonts
pngcairo  png terminal based on cairo
postscript  PostScript graphics, including EPSF embedded files (*.eps)
pslatex  LaTeX picture environment with PostScript \specials
pstex  plain TeX with PostScript \specials
pstricks  LaTeX picture environment with PSTricks macros
qt  Qt cross-platform interactive terminal
sixelgd  sixel using libgd and TrueType fonts
svg  W3C Scalable Vector Graphics
tek40xx  Tektronix 4010 and others; most TEK emulators
tek410x  Tektronix 4106, 4107, 4109 and 420X terminals
texdraw  LaTeX texdraw environment
tikz  TeX TikZ graphics macros via the lua script driver
tkcanvas  Tk canvas widget
unknown  Unknown terminal type - not a plotting device
vttek  VT-like tek40xx terminal emulator
xterm  Xterm Tektronix 4014 Mode
The only option seems to be "dumb"
Attachment 82104
Which is definitely not what I want. I guess this will be a simple fix, by setting the terminal to qt if the system is macOS, but I'm not a pro in python.

Go to the file /usr/local/lib/python3.9/site-packages/PyFoam/Basics/GnuplotTimelines.py line 16. Extend the variable terms with the terminal qt
Code:
terms=["x11","wxt","caca","dumb","qt"]
Let me know which terminal works and I'll adapt the sources accordingly


Side note: the reason why PyFoam has a list of valid terminals is to prevent people from specifying a terminal "png" and ending up with an unusable terminal


PS: I think terminal "dumb" is really cool
__________________
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   January 14, 2021, 09:34
Default
  #5
Member
 
Join Date: Jun 2016
Posts: 99
Rep Power: 9
xuegy is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Go to the file /usr/local/lib/python3.9/site-packages/PyFoam/Basics/GnuplotTimelines.py line 16. Extend the variable terms with the terminal qt
Code:
terms=["x11","wxt","caca","dumb","qt"]
Let me know which terminal works and I'll adapt the sources accordingly


Side note: the reason why PyFoam has a list of valid terminals is to prevent people from specifying a terminal "png" and ending up with an unusable terminal


PS: I think terminal "dumb" is really cool
I modified GnuplotTimelines.py
Code:
terms=["x11","wxt","caca","dumb"]
    if uname()[0]=="Darwin":
        terms.append("qt")
    return terms
Surprisingly there's something for macOS but "aqua" just no longer exists.
I still got some error messages
Code:
gnuplot> set terminal aqua
          
gnuplot> set terminal aqua
                      ^
                     line 0: ^
 unknown or ambiguous terminal type; type just 'set terminal' for a list    

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


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

qt.qpa.fonts: Populating font family aliases took 230 ms. Replace uses of missing font family "Sans" with one that exists to avoid this cost. 
qt.qpa.fonts: Populating font family aliases took 230 ms. Replace uses of missing font family "Sans" with one that exists to avoid this cost.
But eventually the plot popped up
Screen Shot 2021-01-14 at 9.27.24 AM.png
xuegy is offline   Reply With Quote

Old   January 14, 2021, 14: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 xuegy View Post
I modified GnuplotTimelines.py
Code:
terms=["x11","wxt","caca","dumb"]
    if uname()[0]=="Darwin":
        terms.append("qt")
    return terms
Surprisingly there's something for macOS but "aqua" just no longer exists.
I still got some error messages
Code:
gnuplot> set terminal aqua
          
gnuplot> set terminal aqua
                      ^
                     line 0: ^
 unknown or ambiguous terminal type; type just 'set terminal' for a list    

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


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

qt.qpa.fonts: Populating font family aliases took 230 ms. Replace uses of missing font family "Sans" with one that exists to avoid this cost. 
qt.qpa.fonts: Populating font family aliases took 230 ms. Replace uses of missing font family "Sans" with one that exists to avoid this cost.
But eventually the plot popped up
Attachment 82111

Aqua was this: https://sourceforge.net/projects/aquaterm/ That used to be "standard" for gnuplot on Mac OS X if you didn't use X11


I must check. I think I gave "aqua" a special treatment on darwin so that it used x11 if X11 was started (much faster) and otherwise fell back to aqua
__________________
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   January 14, 2021, 14:45
Default
  #7
Member
 
Join Date: Jun 2016
Posts: 99
Rep Power: 9
xuegy is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Aqua was this: https://sourceforge.net/projects/aquaterm/ That used to be "standard" for gnuplot on Mac OS X if you didn't use X11


I must check. I think I gave "aqua" a special treatment on darwin so that it used x11 if X11 was started (much faster) and otherwise fell back to aqua
Have you considered switching to qt for Linux as well? It's cross-platform anyway.
xuegy is offline   Reply With Quote

Old   April 13, 2022, 23:42
Thumbs up Solution using qt instead of x11 or dumb on up to date Macos (M1 INCLUDED)
  #8
New Member
 
Guanda CHENG
Join Date: Apr 2022
Posts: 1
Rep Power: 0
Delta Cheng is on a distinguished road
Thanks to your discussion with gschaider, I've found the final solution by adopting only a few changes to the file 'GnuplotTimelines.py' using qt.

Here is the solution. What you need to do is just a few modifications for the terms marked red:

Code:
   def __init__(self,
                 timelines,
                 custom,
                 terminal="qt",
                 showWindow=True,
                 quiet=False,
                 registry=None):
   GeneralPlotTimelines.__init__(self,timelines,custom,showWindow=showWindow,registry=registry)
        Gnuplot.__init__(self, persist=self.spec.persist, quiet=quiet)

        self.itemlist=[]
        self.terminal="qt"
duanwuCHEN likes this.
Delta Cheng is offline   Reply With Quote

Reply

Tags
pyfoam


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
[PyFoam] PyFoam 6.6.9 installation problems klausb OpenFOAM Community Contributions 2 October 2, 2022 05:56
[PyFoam] PyFoam BasicRunner producing LinuxMem error tas38 OpenFOAM Community Contributions 2 October 5, 2016 11:29
[PyFoam] having problems with pyfoam Installation vitorspadetoventurin OpenFOAM Community Contributions 3 December 2, 2014 07:18
[PyFoam] How to extract values with pyFoam? chriss85 OpenFOAM Community Contributions 13 January 27, 2014 20:16
pyFoam, pyFlu, extend: How does they relate? Horus OpenFOAM 9 May 21, 2011 12:49


All times are GMT -4. The time now is 16:03.