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/)
-   -   Problem using swak4Foam in a modiefied solver (http://www.cfd-online.com/Forums/openfoam-solving/94999-problem-using-swak4foam-modiefied-solver.html)

bastil December 2, 2011 03:39

Problem using swak4Foam in a modified solver
 
Dear experts,

I have written a slightly modified solver and I have problems to load the swak4Foam-Library into it. I get the following warning:

Code:

--> FOAM Warning :
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
    could not load "libsimpleSwakFunctionObjects.so"
--> FOAM Warning :
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
    could not load "libswakFunctionObjects.so"

Afterwards, swak4Foam cannot be used. I ensured that the missing libraries are placed in $FOAM_USER_LIBBIN and that $FOAM_USER_LIBBIN is in $LD_LIBRARY_PATH. This is the case and I have no further ideas.
The basic solver does not have this problem. Ideas are welcome. Thanks.

Regards Bastian

gschaider December 2, 2011 07:26

Quote:

Originally Posted by bastil (Post 334367)
Dear experts,

I have written a slightly modified solver and I have problems to load the swak4Foam-Library into it. I get the following warning:

Code:

--> FOAM Warning :
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
    could not load "libsimpleSwakFunctionObjects.so"
--> FOAM Warning :
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
    could not load "libswakFunctionObjects.so"

Afterwards, swak4Foam cannot be used. I ensured that the missing libraries are placed in $FOAM_USER_LIBBIN and that $FOAM_USER_LIBBIN is in $LD_LIBRARY_PATH. This is the case and I have no further ideas.
The basic solver does not have this problem. Ideas are welcome. Thanks.

Regards Bastian

Hmm. The dynamic loader. Hours of endless fun

No idea. Just some pointers (not necessarily in the correct order):
- try adding libswak4FoamParsers.so to libs to see if that fails too (preferably before the other libs)
- check with "file $FOAM_USER_LIBBIN/libswak4FoamParsers.so" etc that these are really libraries
- make sure there are none in $FOAM_LIBBIN and $FOAM_SITE_LIBBIN (from old installations for instance)
- Check if a utility that uses the swak-libraries (funkySetFields for instance) works correctly
- do a complete recompile of swak4Foam (yeah. The old "programmer repairs a car"-joke)

maalan July 27, 2013 13:05

Hi there!! I have the same problem as bastil. I have a slightly modified solver and I have problems to load "libsimpleSwakFunctionObjects.so".

I post here the whole error message:

Quote:

Create time

--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libsimpleSwakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libsimpleSwakFunctionObjects.so"
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libswakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libswakFunctionObjects.so"
Create mesh for time = 0

Reading field X

--> FOAM FATAL ERROR:
Unknown function type swakExpression

Valid functions are :

5
(
initSwakFunctionObject
patchProbes
probes
sets
surfaces
)
I have followed without success the steps posted by gschaider. Any hint will be appreciated! Thanks!

gschaider July 29, 2013 13:07

Quote:

Originally Posted by maalan (Post 442339)
Hi there!! I have the same problem as bastil. I have a slightly modified solver and I have problems to load "libsimpleSwakFunctionObjects.so".

I post here the whole error message:



I have followed without success the steps posted by gschaider. Any hint will be appreciated! Thanks!

At first: for output use the CODE-tag not QUOTE. Because the second will be removed when somebody quotes your message.

Have you checked whether the libraries in question are in $FOAM_USER_LIBBIN (or $FOAM_SITE_LIBBIN or $FOAM_LIBBIN)? If not then swak is not properly installed (usual compilation generates these libraries in $FOAM_USER_LIBBIN)

maalan July 30, 2013 15:39

Thanks for your reply!! I installed swak4foam in an older OF release and it works!!
Now, as I said I have a slightly modified solver which writes my field and their gradients (written in my write.H code library), and would like to operate between fields... for instance, solve the volume integral of p*U and write this field for each time step! I had a look to the swak4foam examples but I don't know how to write the operation and probably my code writes my function gradients after than swak4foam needs them to operate. So, I am thinking of doing everything with swak4foam... could you tell me briefly how to proceed??

Thanks so much!
Best!

gschaider July 31, 2013 08:00

Quote:

Originally Posted by maalan (Post 442904)
Thanks for your reply!! I installed swak4foam in an older OF release and it works!!

So the problem was that you didn't install it in the new OF release?

Quote:

Originally Posted by maalan (Post 442904)
Now, as I said I have a slightly modified solver which writes my field and their gradients (written in my write.H code library), and would like to operate between fields... for instance, solve the volume integral of p*U and write this field for each time step! I had a look to the swak4foam examples but I don't know how to write the operation and probably my code writes my function gradients after than swak4foam needs them to operate. So, I am thinking of doing everything with swak4foam... could you tell me briefly how to proceed??

If you want to evaluate the expressions only for postprocessing (your solver will not use them in any way) then I'd recommend using functionObjects in controlDict. Don't burden the solver with stuff that he doesn't need

If you want to evaluate an expression and use the field later on I'd recommend the expressionSource-class in swakSourceFields. For an example of the usage see InterFoamWithSources. Basically you only have to create an option. Every time you call the ()-operator on it it gets evaluated and returns a field

maalan September 4, 2013 07:17

Thanks for your reply, although late...
I have already used some functionObjects both of OF and swak4foam. So, I would like to integrate an expression and regarding your pdf's on swak4foam I tried:

integral
{
type swakExpression;
valueType internalField;
accumulations (
sum
);
expression "U^curl(U)";
verbose true;
}

I want to calculate the volume integral in a transient simulation, just spatial not temporal, Am I right??

Thanks again!
Best!

gschaider September 4, 2013 08:18

Quote:

Originally Posted by maalan (Post 449803)
Thanks for your reply, although late...

The reply was a day after your question. Why is that late? Or do you mean your reply?
Quote:

Originally Posted by maalan (Post 449803)
I have already used some functionObjects both of OF and swak4foam. So, I would like to integrate an expression and regarding your pdf's on swak4foam I tried:

integral
{
type swakExpression;
valueType internalField;
accumulations (
sum
);
expression "U^curl(U)";
verbose true;
}

I want to calculate the volume integral in a transient simulation, just spatial not temporal, Am I right??

Sum simply adds the values in the cells. So for a volume integral your expression would have to be "vol()*U^curl(U)". Then sum takes care of the "integration". The development version has a accumulation weightedSum that does this for you

maalan September 4, 2013 12:11

Quote:

The reply was a day after your question. Why is that late? Or do you mean your reply?
I meant my reply. Your reply was really prompt.

Quote:

Sum simply adds the values in the cells. So for a volume integral your expression would have to be "vol()*U^curl(U)". Then sum takes care of the "integration". The development version has a accumulation weightedSum that does this for you
Yes!! You are right: 'vol()' would be the 'dV' term inside the integral. It works!!

Now, my question is how could I multiply the term "U^curl(U)" by a steady and vectorial solution that I have obtained from another field (e.g., K ) in a different case?? I would like to do the operation "(U^curl(U))&grad(K)*vol()" and accumulate the sum for integration for every time step...

Thanks so much!!
BEst!

gschaider September 4, 2013 12:54

Quote:

Originally Posted by maalan (Post 449876)
I meant my reply. Your reply was really prompt.



Yes!! You are right: 'vol()' would be the 'dV' term inside the integral. It works!!

Now, my question is how could I multiply the term "U^curl(U)" by a steady and vectorial solution that I have obtained from another field (e.g., K ) in a different case?? I would like to do the operation "(U^curl(U))&grad(K)*vol()" and accumulate the sum for integration for every time step...

Thanks so much!!
BEst!

You can use the foreign-meshes feature. Have a look at Examples/FunkyDoCalc/drivenCavity.compareWithGraded. The feature is also available in funkySetFields with the -other-options

Mind: this only gives you access to a mapped version of the foreign mesh no calculations are possible on it. So either calculate the gradient beforehand in the other case or calculate the gradient of the mapped data (which might give loss of precision/weird results)

maalan September 4, 2013 14:16

Quote:

You can use the foreign-meshes feature. Have a look at Examples/FunkyDoCalc/drivenCavity.compareWithGraded. The feature is also available in funkySetFields with the -other-options
I forgot to tell the mesh is the same in both cases, so no need to map anything. Then, should I use FunkyDoCalc anyway or could I finish my calculations by using functionObjects?? I have no idea how to use FunkyDoCalc and I don't find anything about it...

Quote:

Mind: this only gives you access to a mapped version of the foreign mesh no calculations are possible on it. So either calculate the gradient beforehand in the other case or calculate the gradient of the mapped data (which might give loss of precision/weird results)
And yes, I have also calculated the gradient in the other case by using functionObjects as well.

gschaider September 4, 2013 15:27

Quote:

Originally Posted by maalan (Post 449909)
I forgot to tell the mesh is the same in both cases, so no need to map anything.

That doesn't matter. Then the mapping algorithm has to work less
Quote:

Originally Posted by maalan (Post 449909)
Then, should I use FunkyDoCalc anyway or could I finish my calculations by using functionObjects?? I have no idea how to use FunkyDoCalc and I don't find anything about it...

Admittedly the description in the README (you read that before you asked?) is not much
Code:

*** =funkyDoCalc=
    Evaluates expressions that are listed in a dictionary using data
    that is found on the disc and prints summarized data (min, max,
    average, sum) to the screen

but together with the two files in Examples/FunkyDoCalc and the general description of expressions in Documentation/swak4FoamReference (which nobody seems to read. That's why I don't feel too motivated to invest more time it) it shouldn't be too hard to get it too work

Quote:

Originally Posted by maalan (Post 449909)
And yes, I have also calculated the gradient in the other case by using functionObjects as well.

As the mesh is the same the easiest solution is to just copy the field files into the case you're investigating

maalan September 5, 2013 11:43

Quote:

As the mesh is the same the easiest solution is to just copy the field files into the case you're investigating
Finally, I have coupled both solvers into one and then integrated by using functionObjects. It has been the easiest solution.

Thanks a lot, bernhard!


All times are GMT -4. The time now is 14:17.