ImportError: cannot import name Publisher When Using py2exe

1. change
from wx.lib.pubsub import Publisher
to
from wx.lib.pubsub import setuparg1 #must be setuparg1! not setupv1. otherwise cause problem: sendMessage() takes exactly 2 arguments (3 given) py2exe
from wx.lib.pubsub import pub
Publisher = pub.Publisher()

2. put this in the setup.py:

from distutils.core import setup
import py2exe

options = {“py2exe”: {“packages”: [‘wx.lib.pubsub’]}}
setup(windows=[{‘script’: ‘controllerGUI_multiThread.py’}],options=options)

Posted in Others | Leave a comment

eps or pdf to svg

When use inkscape to open an ps file exported from icemcfd, the mesh is missing.

Solution: open the ps file in evince and print it to svg. Then the svg file can be edit in inkscape without missing anything. And a pdf file with much smaller volume can be exported from inkscape.

Posted in CFX, ICEM CFD | Leave a comment

add auto-complete to emacs

Installing auto-complete to emacs. It’s not loaded. Solution:

add the following text to ~/.emacs

;; auto-complete
(add-to-list ‘load-path “~/.emacs.d/”)
(require ‘auto-complete-config)
(add-to-list ‘ac-dictionary-directories “~/.emacs.d//ac-dict”)
(ac-config-default)-c

Posted in Linux | Leave a comment

Density and Specific Heat Dependencies

Be aware of the density and specific heat dependencies.

For a pure substance, the flow solver allows only density and specific heat capacity to be functions of temperature or pressure.
When you select the Value option for density or specific heat capacity, you can use an expression to specify Density and/or Specific Heat Capacity, but the expression is allowed to depend only on pressure and temperature for liquids and gases. For a solid, they can depend on temperature or spatial location (x, y, z), but not both at the same time.
For ideal gases, the density is evaluated using the Ideal Gas law and the specific heat may be a function of temperature only.
Both density and specific heat capacity can also be a function of an algebraic Additional Variable, but the algebraic Additional Variable must be a function only of temperature and pressure. CFX-Pre will not allow you to set this and you must therefore edit the CCL file to implement such a case.
If density, specific heat, or other properties are set as expressions that depend on pressure, the solver automatically uses the absolute pressure when evaluating the expression.

Posted in CFD, CFX | Leave a comment

Install adobe pdf read on Linux

It would be better to install adobe pdf reader on linux, though envince is more preferred to me. But for some certain functions, it has to be used, playing animation for example.

Method to install adobe pdf reader on linux ubuntu

sudo add-apt-repository “deb http://archive.canonical.com/ precise partner”
sudo apt-get update
sudo apt-get install acroread

Posted in Linux | Leave a comment

#!/usr/bin/env

The shebang line (from “sharp bang”, i.e. #!) is processed by the kernel. The kernel doesn’t want to know about environment variables such as PATH. So the name on the shebang line must be an absolute path to an executable. You can also specify an additional argument to pass to that executable before the script name (with system-dependent restrictions I won’t go into here). For example, for a Python script, you can specify

#!/usr/bin/python

on the first line, and when you execute the script, the kernel will in fact execute /usr/bin/python /path/to/script. But that’s not convenient: you need to specify the full path of the command. What if you have python in /usr/bin on some machines and /usr/local/bin on others? Or you want to set your PATH to /home/joe/opt/python-2.5/bin so as to use a specific version of Python? Since the kernel won’t do the PATH lookup for you, the idea is to make the kernel run a command that in turns looks up the desired interpreter in the PATH:

#!/fixed/path/to/path-lookup-command python

That path-lookup-command must take the name of an executable as an argument and look it up in PATH and execute it: the kernel will run /fixed/path/to/path-lookup-command python /path/to/script. As it happens, the env command does just that. Its main purpose is to run a command with a different environment, but since it looks up the command name in $PATH, it’s perfect for our purpose here.

Although this is not officially guaranteed, historic Unix systems provided env in /usr/bin, and modern systems have kept that location precisely because of the widespread use of #!/usr/bin/env. So, in practice, the way to specify that a script must be executed by the user’s favorite Python interpreter is

#!/usr/bin/env python

Posted in Linux | Tagged | Leave a comment

UserWarning: Module dap was already imported from None …

When importing certain modules from matlibplot such as matplotlib.animation, you may get the following warning message:

UserWarning: Module dap was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path __import__(‘pkg_resources’).declare_namespace(__name__)

Method to remove the warning:
Add dap as the first line in file /usr/lib/python2.7/dist-packages/dap-2.2.6.7.egg-info/namespace_packages.txt

But it’s not an official solution, no guarantee can be made that this change does not break other things.

Tagged | Leave a comment

CFX-POST -BATCH

This method is useful when need to process cfx post  in batch.

For example,  in transient simulations, you could export information on an user-defined polyline at every timestep to .csv files automatically by using this method.

Procedures:

1. Open CFX-POST

2. CREATE A NEW SESSION and save it as postbatch.cse

3. START recoding the session (Session>Start Recording).

 4. Load the result file *.res

5. produce a polyline (plane, isosurface …. anything you want)

6. Export a csv file .

7. STOP recording the session.

8. Now open the session file postbatch.cse. 

9 .INSERT the following code in the body of the cse file. (the code are written in perl, which can be recognized by cfx. Every sentence should start with a symbol ‘!’, so that cfx knows it’s a implemented perl line.)

(1, code for updating input file’s name after loading the res file.

! $List=getValue(“DATA READER”,”Timestep List”); #this looks for all trn.files
! print “$List \n”; #shows the result of the search
! @Wert=split(/, /,$List); #makes it accessible for further tasks
! $lastFrame=$List[$#timestepList]; # very nice, this gives you the number of the last frame, nice for animations
! foreach $List(@Wert){ #the MAINTASK, do the line and graph and export for every trn.file, see below
> load timestep = $List #load the timestep
! print “calculating for TIMESTEP $List \n”;
! ($time, $timeunits) = evaluate(“Time”);

2, update export file’s name to $List.csv;

3,’ !}’ in the very end of the file).

10. command line:  cfx5post -batch postbatch.cse

The final *.cse file should be like this: (Don’t miss any thing in the compensated code, even a space)

http://codepad.org/ZDBsRjxh

Posted in CFX | Leave a comment

linux cinnamon theme change

To install a theme: Download it and decompress it in ~/.themes.

To install an applet: Download it and decompress it in ~/.local/share/cinnamon/applets.

Posted in Linux | Leave a comment

Huge icon on the panel when theme is changed

From a post in Linux Mint forums:
“I don’t know anything about your monitor problems …. but for the problem of the large icons on the panel:
Try going to Menu > Preferences > Cinnamon Settings > Panel
Check the two boxes –
“Use customized panel size (otherwise it’s defined by the theme)” and
“Allow Cinnamon to scale panel text and icons according to the panel heights””

Posted in Linux | Leave a comment