CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] need funkysetfields to creat a droplet (https://www.cfd-online.com/Forums/openfoam-community-contributions/98052-need-funkysetfields-creat-droplet.html)

callahance March 1, 2012 18:58

need funkysetfields to creat a droplet
 
Hi all,

im new here and im new in OpenFOAM too... im tryin to simulate a water droplet sliding on an inclined plane. I have read that i need either funkysetfields or swak4foam to creat a droplet. I think that funkysetfields doesnt work on OF 2.1 so i tried to install swak4foam. I downloaded the file and installed it but im not sure if its installed correctly. Now i wanna try it on the dam tutorial but i cant find the swak4foam dict. in system... any advices would be appreciated..

gschaider March 1, 2012 19:42

Quote:

Originally Posted by callahance (Post 347186)
Hi all,

im new here and im new in OpenFOAM too... im tryin to simulate a water droplet sliding on an inclined plane. I have read that i need either funkysetfields or swak4foam to creat a droplet. I think that funkysetfields doesnt work on OF 2.1 so i tried to install swak4foam. I downloaded the file and installed it but im not sure if its installed correctly. Now i wanna try it on the dam tutorial but i cant find the swak4foam dict. in system... any advices would be appreciated..

I'm not quite sure whether I understand your problem. I assume that you did the following:
1. Download swak4Foam (usually this is done via SVN)
2. In the directory swak4Foam executed ./Allwmake
IF step 2 finished without problems (if you're not sure: just rerun ./Allwmake. The output should be much shorter) then funkySetFields is installed (amongst a number of other things). Just use it the way it is described on the Wiki-page for the "old" funkySetFields.

Don't know what you mean with the swak4Foam-dict. A dictionary for FSF if used in dictionary-mode? There is none in the regular tutorials. Have a look at the existing examples and with some very basic mathematics you can write one yourself. Ah. And in my talk at the Workshop in PennState I used it as an example. The slides (and examples) are linked at the swak-Wiki-page. Slide 36 is the one you're looking for

callahance March 1, 2012 19:48

I'v taken a look at the slides before ... and exactly this funkysetfieldsDict. ... where can i find it ?

callahance March 1, 2012 20:40

Here's what i get from ./Allwmake :

Bison is version 2.4.1
No 'swakConfiguration'. Python etc won't work
OpenFOAM-version: Major 2 Minor 1 Patch 0
No change to Libraries/swak4FoamParsers/foamVersion4swak.H
SOURCE=GlobalVariablesRepository.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -IMake/linuxGccDPOpt -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/sampling/lnInclude -I/opt/openfoam210/src/triSurface/lnInclude -I/opt/openfoam210/src/lagrangian/basic/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/GlobalVariablesRepository.o
In file included from GlobalVariablesRepository.H:45:0,
from GlobalVariablesRepository.C:34:
ExpressionResult.H:49:2: error: #error "This swak4Foam-version is only used for the 1.x-versions of OpenFOAM. For higher versions there is a special branch"
make: *** [Make/linuxGccDPOpt/GlobalVariablesRepository.o] Error 1
SOURCE=groovyBCFvPatchFields.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -IMake/linuxGccDPOpt -I/opt/openfoam210/src/finiteVolume/lnInclude -I../swak4FoamParsers/lnInclude/ -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/groovyBCFvPatchFields.o
In file included from ../swak4FoamParsers/lnInclude/PatchValueExpressionDriver.H:50:0,
from groovyBCFvPatchField.H:48,
from groovyBCFvPatchFields.H:37,
from groovyBCFvPatchFields.C:36:
../swak4FoamParsers/lnInclude/ExpressionResult.H:49:2: error: #error "This swak4Foam-version is only used for the 1.x-versions of OpenFOAM. For higher versions there is a special branch"
In file included from groovyBCFvPatchField.H:48:0,
from groovyBCFvPatchFields.H:37,
from groovyBCFvPatchFields.C:36:
../swak4FoamParsers/lnInclude/PatchValueExpressionDriver.H:60:45: fatal error: PatchValueExpressionParser.tab.hh: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/groovyBCFvPatchFields.o] Error 1
SOURCE=manipulateField.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I../swak4FoamParsers/lnInclude -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -I/opt/openfoam210/src/sampling/lnInclude -I/opt/openfoam210/src/triSurface/lnInclude -I/opt/openfoam210/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/manipulateField.o
In file included from manipulateField.C:30:0:
../swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:18:45: fatal error: FieldValueExpressionParser.tab.hh: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/manipulateField.o] Error 1
SOURCE=patch/patchAverageFunctionObject/patchAverageFunctionObject.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -I/opt/openfoam210/src/sampling/lnInclude -I/opt/openfoam210/src/triSurface/lnInclude -I/opt/openfoam210/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/patchAverageFunctionObject.o
In file included from lnInclude/simpleFunctionObject.H:40:0,
from lnInclude/simpleDataFunctionObject.H:40,
from lnInclude/timelineFunctionObject.H:40,
from lnInclude/patchFunctionObject.H:40,
from lnInclude/patchFieldFunctionObject.H:40,
from patch/patchAverageFunctionObject/patchAverageFunctionObject.H:40,
from patch/patchAverageFunctionObject/patchAverageFunctionObject.C:28:
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H: In static member function ‘static Foam::autoPtr<Foam::functionObject> Foam::functionObject::adddictionaryConstructorToTa ble<functionObjectType>::New(const Foam::word&, const Foam::Time&, const Foam::dictionary&) [with functionObjectType = Foam::patchAverageFunctionObject]’:
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H:91:1: instantiated from ‘Foam::functionObject::adddictionaryConstructorToT able<functionObjectType>::adddictionaryConstructor ToTable(const Foam::word&) [with functionObjectType = Foam::patchAverageFunctionObject]’
patch/patchAverageFunctionObject/patchAverageFunctionObject.C:44:1: instantiated from here
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H:84:9: error: cannot allocate an object of abstract type ‘Foam::patchAverageFunctionObject’
patch/patchAverageFunctionObject/patchAverageFunctionObject.H:51:7: note: because the following virtual functions are pure within ‘Foam::patchAverageFunctionObject’:
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H:152:22: note: virtual bool Foam::functionObject::execute(bool)
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H:84:9: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [Make/linuxGccDPOpt/patchAverageFunctionObject.o] Error 1
SOURCE=general/swakExpressionFunctionObject.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I../simpleFunctionObjects/lnInclude -I/home/callahance/OpenFOAM/callahance-2.1.0/Libraries/simpleFunctionObjects/lnInclude -I../swak4FoamParsers/lnInclude -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -I/opt/openfoam210/src/sampling/lnInclude -I/opt/openfoam210/src/triSurface/lnInclude -I/opt/openfoam210/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/swakExpressionFunctionObject.o
In file included from ../swak4FoamParsers/lnInclude/CommonValueExpressionDriver.H:53:0,
from general/swakExpressionFunctionObject.H:42,
from general/swakExpressionFunctionObject.C:28:
../swak4FoamParsers/lnInclude/ExpressionResult.H:49:2: error: #error "This swak4Foam-version is only used for the 1.x-versions of OpenFOAM. For higher versions there is a special branch"
In file included from ../swak4FoamParsers/lnInclude/CommonValueExpressionDriver.H:428:0,
from general/swakExpressionFunctionObject.H:42,
from general/swakExpressionFunctionObject.C:28:
../swak4FoamParsers/lnInclude/CommonValueExpressionDriverI.H: In member function ‘void Foam::CommonValueExpressionDriver::error(const Location&, const string&)’:
../swak4FoamParsers/lnInclude/CommonValueExpressionDriverI.H:724:15: error: expected unqualified-id before ‘::’ token
../swak4FoamParsers/lnInclude/CommonValueExpressionDriverI.H:724:15: error: expected ‘;’ before ‘::’ token
In file included from ../simpleFunctionObjects/lnInclude/simpleFunctionObject.H:40:0,
from ../simpleFunctionObjects/lnInclude/simpleDataFunctionObject.H:40,
from ../simpleFunctionObjects/lnInclude/timelineFunctionObject.H:40,
from general/swakExpressionFunctionObject.H:40,
from general/swakExpressionFunctionObject.C:28:
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H: In static member function ‘static Foam::autoPtr<Foam::functionObject> Foam::functionObject::adddictionaryConstructorToTa ble<functionObjectType>::New(const Foam::word&, const Foam::Time&, const Foam::dictionary&) [with functionObjectType = Foam::swakExpressionFunctionObject]’:
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H:91:1: instantiated from ‘Foam::functionObject::adddictionaryConstructorToT able<functionObjectType>::adddictionaryConstructor ToTable(const Foam::word&) [with functionObjectType = Foam::swakExpressionFunctionObject]’
general/swakExpressionFunctionObject.C:44:1: instantiated from here
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H:84:9: error: cannot allocate an object of abstract type ‘Foam::swakExpressionFunctionObject’
general/swakExpressionFunctionObject.H:53:7: note: because the following virtual functions are pure within ‘Foam::swakExpressionFunctionObject’:
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H:152:22: note: virtual bool Foam::functionObject::execute(bool)
/opt/openfoam210/src/OpenFOAM/lnInclude/functionObject.H:84:9: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [Make/linuxGccDPOpt/swakExpressionFunctionObject.o] Error 1
SOURCE=expressionToCell.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I../swak4FoamParsers/lnInclude -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/expressionToCell.o
In file included from expressionToCell.C:39:0:
../swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:18:45: fatal error: FieldValueExpressionParser.tab.hh: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/expressionToCell.o] Error 1
SOURCE=expressionSource.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I../swak4FoamParsers/lnInclude -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/expressionSource.o
In file included from expressionSource.H:45:0,
from expressionSource.C:33:
../swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:18:45: fatal error: FieldValueExpressionParser.tab.hh: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/expressionSource.o] Error 1
SOURCE=groovyTotalPressureFvPatchScalarField.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -IMake/linuxGccDPOpt -I/opt/openfoam210/src/finiteVolume/lnInclude -I../groovyBC/lnInclude/ -I../swak4FoamParsers/lnInclude/ -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/groovyTotalPressureFvPatchScalarField.o
In file included from ../swak4FoamParsers/lnInclude/PatchValueExpressionDriver.H:50:0,
from groovyTotalPressureFvPatchScalarField.H:47,
from groovyTotalPressureFvPatchScalarField.C:33:
../swak4FoamParsers/lnInclude/ExpressionResult.H:49:2: error: #error "This swak4Foam-version is only used for the 1.x-versions of OpenFOAM. For higher versions there is a special branch"
In file included from groovyTotalPressureFvPatchScalarField.H:47:0,
from groovyTotalPressureFvPatchScalarField.C:33:
../swak4FoamParsers/lnInclude/PatchValueExpressionDriver.H:60:45: fatal error: PatchValueExpressionParser.tab.hh: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/groovyTotalPressureFvPatchScalarField.o] Error 1
SWAK_PYTHON_INCLUDE not defined .... no Python-Integration
SOURCE=funkySetFields.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -IMake/linuxGccDPOpt -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -I../../Libraries/swak4FoamParsers/lnInclude/ -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/funkySetFields.o
In file included from funkySetFields.C:41:0:
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:18:45: fatal error: FieldValueExpressionParser.tab.hh: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/funkySetFields.o] Error 1
SOURCE=funkySetBoundaryField.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -IMake/linuxGccDPOpt -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -I../../Libraries/swak4FoamParsers/lnInclude/ -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/funkySetBoundaryField.o
In file included from ../../Libraries/swak4FoamParsers/lnInclude/PatchValueExpressionDriver.H:50:0,
from funkySetBoundaryField.C:41:
../../Libraries/swak4FoamParsers/lnInclude/ExpressionResult.H:49:2: error: #error "This swak4Foam-version is only used for the 1.x-versions of OpenFOAM. For higher versions there is a special branch"
In file included from funkySetBoundaryField.C:41:0:
../../Libraries/swak4FoamParsers/lnInclude/PatchValueExpressionDriver.H:60:45: fatal error: PatchValueExpressionParser.tab.hh: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/funkySetBoundaryField.o] Error 1
make: `/home/callahance/OpenFOAM/callahance-2.1.0/platforms/linuxGccDPOpt/bin/replayTransientBC' is up to date.
SOURCE=funkyDoCalc.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -IMake/linuxGccDPOpt -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -I../../Libraries/swak4FoamParsers/lnInclude/ -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/funkyDoCalc.o
In file included from ../../Libraries/swak4FoamParsers/lnInclude/CommonValueExpressionDriver.H:53:0,
from funkyDoCalc.C:41:
../../Libraries/swak4FoamParsers/lnInclude/ExpressionResult.H:49:2: error: #error "This swak4Foam-version is only used for the 1.x-versions of OpenFOAM. For higher versions there is a special branch"
In file included from ../../Libraries/swak4FoamParsers/lnInclude/CommonValueExpressionDriver.H:428:0,
from funkyDoCalc.C:41:
../../Libraries/swak4FoamParsers/lnInclude/CommonValueExpressionDriverI.H: In member function ‘void Foam::CommonValueExpressionDriver::error(const Location&, const string&)’:
../../Libraries/swak4FoamParsers/lnInclude/CommonValueExpressionDriverI.H:724:15: error: expected unqualified-id before ‘::’ token
../../Libraries/swak4FoamParsers/lnInclude/CommonValueExpressionDriverI.H:724:15: error: expected ‘;’ before ‘::’ token
make: *** [Make/linuxGccDPOpt/funkyDoCalc.o] Error 1

gschaider March 2, 2012 05:42

Quote:

Originally Posted by callahance (Post 347193)
I'v taken a look at the slides before ... and exactly this funkysetfieldsDict. ... where can i find it ?

That is explained in the slides: with the appropriate "git checkout" (the last one before that slide) you get a case that resembles the one that is described on the slides (you just have to get the data)

Alternative is to copy paste the dict from the slide (maybe you'll need a header, but what is on the slide is all that is required)

gschaider March 2, 2012 05:51

Quote:

Originally Posted by callahance (Post 347200)
Here's what i get from ./Allwmake :

Bison is version 2.4.1
No 'swakConfiguration'. Python etc won't work
OpenFOAM-version: Major 2 Minor 1 Patch 0
No change to Libraries/swak4FoamParsers/foamVersion4swak.H
SOURCE=GlobalVariablesRepository.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -IMake/linuxGccDPOpt -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/sampling/lnInclude -I/opt/openfoam210/src/triSurface/lnInclude -I/opt/openfoam210/src/lagrangian/basic/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/GlobalVariablesRepository.o
In file included from GlobalVariablesRepository.H:45:0,
from GlobalVariablesRepository.C:34:
ExpressionResult.H:49:2: error: #error "This swak4Foam-version is only used for the 1.x-versions of OpenFOAM. For higher versions there is a special branch"
make: *** [Make/linuxGccDPOpt/GlobalVariablesRepository.o] Error 1

You got the wrong version of swak4Foam (the one for 1.7). I think the error message is pretty clear in that respect.

How to get the version for 2.x (either svn or hg) is described in http://openfoamwiki.net/index.php/Co...am#Downloading

calim_cfd March 2, 2012 06:30

also make sure you got all the necessary libraries and applications like: bison; python; flex and the other OF requirements.

and remember not to install it as root.. it makes it harder to compile

gschaider March 2, 2012 07:35

Quote:

Originally Posted by calim_cfd (Post 347260)
also make sure you got all the necessary libraries and applications like: bison; python; flex and the other OF requirements.

The usual cause for failure "missing bison" is checked for by the compile-script since the last release. And he has that according to his output

calim_cfd March 2, 2012 13:59

Quote:

Originally Posted by gschaider (Post 347275)
The usual cause for failure "missing bison" is checked for by the compile-script since the last release. And he has that according to his output

when i tried to compile the code in Sude OS i had nearly everything but the flex one

Code:

the compiler generators =bison= and =flex=
    - =swak4Foam= is known to work with =bison= version 2.3 and
      higher. Lower versions *may* work. If it works with a lower
      version please report it

i had that in ubuntu so i didn’t noticed the compilation error when i first tried to install it in suse

callahance March 2, 2012 15:00

first thanks for the replies ... i'll try to install the swak4foam for the 2.1 version and then i'll try to figure the droplet out .... one other question : in interfoam usually g is a constant and in one direction . How can i make g (gravity) a function of time ? like i want gravity = 9.81*sin(t) in z direction where t corresponds to time

gschaider March 4, 2012 09:37

Quote:

Originally Posted by calim_cfd (Post 347345)
when i tried to compile the code in Sude OS i had nearly everything but the flex one

Code:

the compiler generators =bison= and =flex=
    - =swak4Foam= is known to work with =bison= version 2.3 and
      higher. Lower versions *may* work. If it works with a lower
      version please report it

i had that in ubuntu so i didn’t noticed the compilation error when i first tried to install it in suse

It never occurred to me to check for flex as it is required for 7 files in OpenFOAM so I figured "where Foam, there flex". But of course not everyone compiles OF from sources. I'll add a check for the existence of flex

calim_cfd March 4, 2012 10:03

Quote:

Originally Posted by gschaider (Post 347547)
It never occurred to me to check for flex as it is required for 7 files in OpenFOAM so I figured "where Foam, there flex". But of course not everyone compiles OF from sources. I'll add a check for the existence of flex

yeah.. at home (ubuntu) i did compile OF but at work(suse) the guy downloaded the compiled version..

Thanks for checking! :D

gj with the army knife!

gschaider March 4, 2012 18:43

Quote:

Originally Posted by callahance (Post 347352)
first thanks for the replies ... i'll try to install the swak4foam for the 2.1 version and then i'll try to figure the droplet out .... one other question : in interfoam usually g is a constant and in one direction . How can i make g (gravity) a function of time ? like i want gravity = 9.81*sin(t) in z direction where t corresponds to time

Not directly. The object-type that g is stored in in OF (uniformDimensionedVectorField) can't be directly manipulated in swak4Foam. And even if you could it wouldn't change anything (in current solver implementations. Note that this can change in future ones. Then this recipe will probably not work too) as g is only used in the beginning to calculate two fields gh and ghf. And this is where we get our foot in the door: by changing these fields with the maipulateField-functionObject. Andding something like the code below to the controlDict makes it work (setGH and setGHF replicate the original computaton in the solver and therefor should stay as they are. Get creative with gravityDirection):

Code:

libs (
    "libswakFunctionObjects.so"
);

functions (
    gravityDirection {
        type expressionField;
        fieldName gDirection;
        autowrite true;
        variables (
            "duration=5;"
            "maxAngle=45;"
            "angle=pi/180*(time()<duration ? time()/duration*maxAngle : maxAngle);"
        );
        expression "-9.81*vector(sin(angle),cos(angle),0)";
        outputControl timeStep;
        outputInterval 1;
    }
    setGH {
        type manipulateField;
        outputControl timeStep;
        outputInterval 1;
        fieldName gh;
        expression "gDirection & pos()";
        mask "true";
    }
    setGHF {
        type manipulateField;
        outputControl timeStep;
        outputInterval 1;
        fieldName ghf;
        expression "interpolate(gDirection) & fpos()";
        mask "surf(true)";
    }
);


Zuixy May 21, 2012 09:51

Hey Bernhard,I would like to simulate somewave propagation with the potentialWaveFoam solver. I set the internal field just like the one in the tutorial with funkySetFields. but now i want to simulate a continuous wave.
My first idea was to write a python script so that OpenFoam will stop after every time step, run funkySetFields and then start again the solver and so on..
But this is very slow.
Now i read about manipulateField and want to try it but somehow it doesn't work. I don't get an error but i only get one period. Do you have an idea where the mistake is?

I added this to the controlDict:

libs ( "libswakFunctionObjects.so" "libOpenFOAM.so" "libconvectiveOutlet.so");

functions
(

setPhi {
type manipulateField;
outputControl timeStep;
outputInterval 1;
fieldName phi;
expression "-1*cos(1000*(time()+1.67981e-8))";
condition "pow(pos().x-0.015,2) + pow(pos().y,2) < pow(0.0015,2)";
//mask "true";
keepPatches 1;
}

setPhi_0 {
type manipulateField;
outputControl timeStep;
outputInterval 1;
fieldName phi_0;
expression "-1*cos(1000*time())";
condition "pow(pos().x-0.015,2) + pow(pos().y,2) < pow(0.0015,2)";
//mask "true";
keepPatches 1;
}

);


I also tried it with mask "true"; (No idea what that does)

gschaider May 21, 2012 16:00

Quote:

Originally Posted by Zuixy (Post 362206)
Hey Bernhard,I would like to simulate somewave propagation with the potentialWaveFoam solver. I set the internal field just like the one in the tutorial with funkySetFields. but now i want to simulate a continuous wave.
My first idea was to write a python script so that OpenFoam will stop after every time step, run funkySetFields and then start again the solver and so on..
But this is very slow.
Now i read about manipulateField and want to try it but somehow it doesn't work. I don't get an error but i only get one period. Do you have an idea where the mistake is?

I added this to the controlDict:

libs ( "libswakFunctionObjects.so" "libOpenFOAM.so" "libconvectiveOutlet.so");

functions
(

setPhi {
type manipulateField;
outputControl timeStep;
outputInterval 1;
fieldName phi;
expression "-1*cos(1000*(time()+1.67981e-8))";
condition "pow(pos().x-0.015,2) + pow(pos().y,2) < pow(0.0015,2)";
//mask "true";
keepPatches 1;
}

setPhi_0 {
type manipulateField;
outputControl timeStep;
outputInterval 1;
fieldName phi_0;
expression "-1*cos(1000*time())";
condition "pow(pos().x-0.015,2) + pow(pos().y,2) < pow(0.0015,2)";
//mask "true";
keepPatches 1;
}

);


I also tried it with mask "true"; (No idea what that does)

At first: I don't think that phi and it's previous value (phi_0) are a good idea. For the sake of consistency leave phi_0 alone. It should be the old phi (with manipulation) anyway.

Concerning condition/mask: "condition" is not used. "mask" is what "condition" is in funkySetFields.

I don't quite understand what you mean with "I only get one period"

Zuixy May 22, 2012 12:42

Thankl you, I changed my controlDict and now I got this

pplication potentialWaveFoam;

startFrom latestTime;

startTime 0;

stopAt endTime; //nextWrite;

endTime 0.00003;

deltaT 1.67981e-8;

writeControl timeStep;

writeInterval 20;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression compressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

libs ( "libswakFunctionObjects.so" "libOpenFOAM.so" "libconvectiveOutlet.so");

functions
(

setPhi{
type manipulateField;
outputControl time Step;
outputInterval 1;
fieldName phi;
expression "-1*cos(1*(time()+1.67981e-8))";
mask "pow(pos().x-0.015,2) + pow(pos().y,2) < pow(0.0015,2)";
keepPatches 1;
}
);



My goal is, that manipulateField sets a value, calculated according to expression, in the cells defined by mask.
But the Field stays the same. There is no change at all.

"I don't quite understand what you mean with "I only get one period"" - that was a mistake due to the boundary conditions

Zuixy May 22, 2012 13:13

Ok, I think somehow I got the idea wrong. I tried as a testcase the icoFoam/elbow tutorial and changed the controlDict:

libs ( "libswakFunctionObjects.so");

functions
(

setp{
type manipulateField;
outputControl timeStep;
outputInterval 1;
fieldName p;
expression "-50";
mask "pos().x<30";
keepPatches 1;
}
);


The logfile looks fine:
...
Courant Number mean: 0.0811515 max: 0.506287
DILUPBiCG: Solving for Ux, Initial residual = 0.0279884, Final residual = 5.29406e-09, No Iterations 2
DILUPBiCG: Solving for Uy, Initial residual = 0.00545903, Final residual = 2.8224e-06, No Iterations 1
DICPCG: Solving for p, Initial residual = 0.654126, Final residual = 6.94353e-07, No Iterations 78
DICPCG: Solving for p, Initial residual = 0.545781, Final residual = 7.15208e-07, No Iterations 78
DICPCG: Solving for p, Initial residual = 0.101394, Final residual = 8.16843e-07, No Iterations 75
time step continuity errors : sum local = 3.10015e-10, global = -1.68954e-12, cumulative = 2.55056e-08
DICPCG: Solving for p, Initial residual = 0.176486, Final residual = 6.14894e-07, No Iterations 77
DICPCG: Solving for p, Initial residual = 0.0391996, Final residual = 8.09098e-07, No Iterations 73
DICPCG: Solving for p, Initial residual = 0.00463171, Final residual = 6.57855e-07, No Iterations 70
time step continuity errors : sum local = 1.60675e-10, global = 1.4462e-12, cumulative = 2.5507e-08
ExecutionTime = 6.35 s ClockTime = 6 s

Manipulated field p in 209 cells with the expression "-50"
Time = 19.55
...

Now I would expect to see a pressure of -50 in each cell which has a x-value below 30 (should be 209 cells, like the logfile says). But in Paraview there are no such cells.

There is the mistake? I don't get it.

gschaider May 22, 2012 15:41

Quote:

Originally Posted by Zuixy (Post 362501)
Ok, I think somehow I got the idea wrong. I tried as a testcase the icoFoam/elbow tutorial and changed the controlDict:

libs ( "libswakFunctionObjects.so");

functions
(

setp{
type manipulateField;
outputControl timeStep;
outputInterval 1;
fieldName p;
expression "-50";
mask "pos().x<30";
keepPatches 1;
}
);


The logfile looks fine:


Manipulated field p in 209 cells with the expression "-50"
Time = 19.55
...

Now I would expect to see a pressure of -50 in each cell which has a x-value below 30 (should be 209 cells, like the logfile says). But in Paraview there are no such cells.

There is the mistake? I don't get it.

The problem is the place when the functionObjects are executed: during the increase of the time which is AFTER the data was written to disc. So the updated pressure will be used for the next solution of the U-Eqn (you should see some trace in the U) but then the p-Eqn is solved and that removes your manipulation (especially as there is no ddt-term in the incompressible p-Eqn).

To convince yourself try manipulating the U-field instead. As the U-Eqn has a ddt-term you should see that more clearly there

Zuixy May 22, 2012 17:25

Ok, thank you very much. But how do i set a value for U? I tried some possibilities like

expression "(1 0.5 0)";
expression "1 0.5 0";

but it doesn't work.

gschaider May 22, 2012 17:38

Quote:

Originally Posted by Zuixy (Post 362546)
Ok, thank you very much. But how do i set a value for U? I tried some possibilities like

expression "(1 0.5 0)";
expression "1 0.5 0";

but it doesn't work.

The "best" documentation of the expression syntax is still http://openfoamwiki.net/index.php/Co...funkySetFields I'm afraid.
Code:

expression "vector(0,0,0)";
should so the trick for you. Looks unfoamy, but the space-delimeted syntax you propose would have been a nightmare in the parser


All times are GMT -4. The time now is 19:02.