CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   SWAK4FOAM_SRC environment variable (http://www.cfd-online.com/Forums/openfoam-solving/103268-swak4foam_src-environment-variable.html)

fcuevas June 15, 2012 09:14

SWAK4FOAM_SRC environment variable
 
Hi everybody,

I'm trying to run the CodeStream/cylinderWithSwak example included in swak4Foam library but I have this error

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading field p

Reading field U


Calculating potential flow
swak4Foam: Allocating new repository for sampledGlobalVariables


--> FOAM FATAL ERROR:
Compilation of the function object only works if the environment variable SWAK4FOAM_SRC points to the Libraries directory of the swak4Foam-sources


From function swakCodedFunctionObject::read(const dictionary& dict)
in file swakCodedFunctionObject.C at line 225.

FOAM exiting
************************************************** ***

In the README file says for the swakFunctionObjects library: "... Assumes that the =SWAK4FOAM_SRC= environment variable is set to the Libraries=-directory of the =swak4Foam=-sources"

but I don't really know where/when can I set the environment variable (before I compile all swak4Foam or in the controlDictof the case that use this library or...)

The swak4Foam library is installed in $(WM_PROJECT_USER_DIR)/lib/swak4Foam and the compilation doesn't show any strange problem (as far as I know), actually I can use without problems the groovyBC library.

How and where should I set the environment variable?

Regards,
Felipe

gschaider June 15, 2012 14:55

Quote:

Originally Posted by fcuevas (Post 366666)
Hi everybody,

I'm trying to run the CodeStream/cylinderWithSwak example included in swak4Foam library but I have this error

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading field p

Reading field U


Calculating potential flow
swak4Foam: Allocating new repository for sampledGlobalVariables


--> FOAM FATAL ERROR:
Compilation of the function object only works if the environment variable SWAK4FOAM_SRC points to the Libraries directory of the swak4Foam-sources


From function swakCodedFunctionObject::read(const dictionary& dict)
in file swakCodedFunctionObject.C at line 225.

FOAM exiting
************************************************** ***

In the README file says for the swakFunctionObjects library: "... Assumes that the =SWAK4FOAM_SRC= environment variable is set to the Libraries=-directory of the =swak4Foam=-sources"

but I don't really know where/when can I set the environment variable (before I compile all swak4Foam or in the controlDictof the case that use this library or...)

The swak4Foam library is installed in $(WM_PROJECT_USER_DIR)/lib/swak4Foam and the compilation doesn't show any strange problem (as far as I know), actually I can use without problems the groovyBC library.

How and where should I set the environment variable?

Regards,
Felipe

The thing is that the functionObject has to know where to find the swak4Foam-sources. As this is not standard-OF-software it depends on the user where it is installed and I didn't want to force anyone on a specific location (because usually 20% are not allowed to install it there because of administrative policies anyway ...) so the user has to give an indication by setting that environment variable. Setting an environment variable depends on the shell you're using. For the location you're giving and the shell I usually use (bash or zsh) you'd type
Code:

export SWAK4FOAM_SRC=$WM_PROJECT_USER_DIR/lib/swak4Foam/Libraries
for csh/tcsh it is setenv I think.

This variable is currently only needed for this functionObject as it is compiling something that requires the swak-headers. groovyBC and friends only need binaries (which you compiled at the start) and don't care where the sources are.

I'll add a test to the Allwmake that prints the proposed value for SWAK4FOAM_SRC

Where you actually set the environment variable (bashrc in your home, the site-configuration of OF, ...) is up to you

fcuevas June 18, 2012 09:58

Set on bashrc, works perfectly

Regards,
Felipe


All times are GMT -4. The time now is 04:35.