|
[Sponsors] |
[swak4Foam] groovyBC and funkySetFields married and got a kid named swak4Foam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 13, 2010, 07:47 |
using groovyBC and funkysetfields to set a circular volume fraction
|
#41 |
Senior Member
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17 |
Hello Everybody,
I am using interFoam for Jet studies. I have installed swak4Foam. Thanks for the nice tool. I have been using ogrid topology mesh till now for my studies. But for a validation study I have to use a cartesian mesh now. I want to set a circular inlet (alpha=1) on the left wall of box mesh. And I also want to set a parabolic velocity profile on that inlet. I have not used groovyBC or funkysetFields before, so any help on how to do this on the mesh I am attaching down is helpful. I hope it is possible yo do so with swak4Foam. regards K.Suresh kumar |
|
December 13, 2010, 12:27 |
|
#42 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Bernhard |
||
December 13, 2010, 12:31 |
|
#43 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Quote:
Bernhard |
|||
December 13, 2010, 12:34 |
|
#44 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Of course you might have some fun with the "jagged" edges of the inlet Bernahrd |
||
December 13, 2010, 12:48 |
|
#45 |
Senior Member
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17 |
Hello Bernhard,
Thankyou very much for the explanation. I have had some success in setting the inlet, by using the following expression. funkySetFields -field alpha1 -expression 1 -time 0 -condition "pow(pos().x-2.1e-3,2) + pow(pos().y-2.1e-3,2) + pow(pos().z-0,2) < pow(1e-3,2)" I am attaching the figure of my inlet section and the contour. I will set the velocity according to your explanation and I will get back to you if I have some problems. regards K.Suresh kumar |
|
December 13, 2010, 15:34 |
|
#46 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
http://openfoamwiki.net/index.php/Co...and_line_usage |
||
December 14, 2010, 11:33 |
|
#47 |
Senior Member
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17 |
Hi Bernhard,
I tried to impose the round inlet from the command prompt by using the command funkySetFields -field alpha1 -expression 1 -time 0 -condition "pow(pos().x-2.1e-3,2) + pow(pos().y-2.1e-3,2) + pow(pos().z-0,2) < pow(1e-3,2)" That generates the round inlet as shown in the last post. But then i try to impose the parabolic velocity on it by using your idea : funkySetFields -field U -expression "mag(pos()-center < 1e-3 ? '10*(1-((y)^2/(1e-3)^2)) : vector(0,0,0)" -time 0 I tried to define the center which in my case is (2.1e-3,2.1e-3,0) using different possibilites, but failed. My parabolic profile should be like this U = U_mean*(1-(r^2/R^2)). R is the radius. I think i am mixing the two approaches. Any idea would be helpful. regards K.Suresh kumar |
|
December 14, 2010, 12:19 |
|
#48 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
"(mag(pos()-vector(-1,0,0))<1) ? vector(1-pow(pos()-vector(-1,0,0),2),0,0) : vector(0,0,0)" |
||
December 14, 2010, 13:13 |
|
#49 |
Senior Member
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17 |
Hi Bernhard,
Thanks. I will try the new expression by defining it as a vector. But I am still not happy with the definition of my alpha1 on the inlet, because I think I am defining it wrong because I have a surface in the z direction for certain height. Which will affect my jet evolution. I want the inlet to be only on the inlet wall . If I understood correctly the expression you mentioned in the last post is to only define U, So inorder to define the alpha1 as 1 on the inlet wall is there a straight forward way. regards K.Suresh kumar |
|
December 15, 2010, 05:54 |
|
#50 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Bernhard |
||
December 18, 2010, 19:50 |
New release of swak4Foam
|
#51 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
There is a new release of swak4Foam available. From a user point-of-view the most important changes are (this is an excerpt from the README):
Especially the addition of calculations on sampledSurfaces allows applications like calculations on control-surfaces that are not restricted by the mesh (another application are dynamic control-surfaces defined by iso-surfaces) |
|
December 20, 2010, 11:45 |
|
#52 |
Member
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 15 |
Hello Bernhard,
The modifications to be done in my solver for using the source-term control ability of swak4Foam seems not to be that simple as I thought. I have a file called createExplicitSources.H in the solver directory where I can definde my sources. The file looks like this: Info<< "Creating mass source\n" << endl; scalarTimeActivatedExplicitSourceList massSource ( "mass", mesh, dimMass/dimTime/dimVolume, composition.species() ); Info<< "Creating momentum source\n" << endl; vectorTimeActivatedExplicitSourceList momentumSource ( "momentum", mesh, dimMass*dimVelocity/dimTime/dimVolume, "U" ); Info<< "Creating energy source\n" << endl; scalarTimeActivatedExplicitSourceList energySource ( "energy", mesh, dimEnergy/dimTime/dimVolume, "h" ); Info<< "Creating Smoke source\n" << endl; scalarTimeActivatedExplicitSourceList SmokeSource ( "Smoke", mesh, dimMass/dimTime/dimVolume, "Smoke" ); If I try to modify my solver in the same way as you did with interFoam I receive the following error: In file included from /home/poyry/OpenFOAM/OpenFOAM-1.7.1/../Contributions/swak4Foam/Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionParser_location.hh:44:0, from FieldValueExpressionParser.tab.hh:65, from /home/poyry/OpenFOAM/OpenFOAM-1.7.1/../Contributions/swak4Foam/Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:18, from /home/poyry/OpenFOAM/OpenFOAM-1.7.1/../Contributions/swak4Foam/Libraries/swakSourceFields/lnInclude/expressionSource.H:45, from poyrySWAKVolumeSmokeSourcePseudoFireFoam.C:40: position.hh: In function ‘bool parserField:perator==(const parserField:osition&, const parserField:osition&)’: position.hh:136:69: warning: suggest parentheses around ‘&&’ within ‘||’ In file included from poyrySWAKVolumeSmokeSourcePseudoFireFoam.C:57:0: createExplicitSources.H: In function ‘int main(int, char**)’: createExplicitSources.H:13:1: error: conflicting declaration ‘Foam::vectorTimeActivatedExplicitSourceList momentumSource’ createFields.H:144:13: error: ‘momentumSource’ has a previous declaration as ‘Foam::expressionSource<Foam::Vector<double> > momentumSource’ createExplicitSources.H:22:1: error: conflicting declaration ‘Foam::scalarTimeActivatedExplicitSourceList energySource’ createFields.H:160:13: error: ‘energySource’ has a previous declaration as ‘Foam::expressionSource<double> energySource’ In file included from poyrySWAKVolumeSmokeSourcePseudoFireFoam.C:79:0: UEqn.H:9:24: error: ‘class Foam::expressionSource<Foam::Vector<double> >’ has no member named ‘Su’ In file included from poyrySWAKVolumeSmokeSourcePseudoFireFoam.C:81:0: hsEqn.H:19:21: error: ‘class Foam::expressionSource<double>’ has no member named ‘Su’ make: *** [Make/linux64GccDPOpt/poyrySWAKVolumeSmokeSourcePseudoFireFoam.o] Error 1 Sorry I have no idea where to proceed... |
|
December 20, 2010, 12:36 |
|
#53 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Bernhard |
||
December 23, 2010, 06:54 |
|
#54 | |
Senior Member
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17 |
Quote:
Hello Bernhard, I saw the hotroom example and also after trying some expressions posted on the forum. I could set the alpha1 field properly. Now I am working on setting the parabolic velocity on that round circular inlet. I started with the expression that you told me to start with. But when I try to use the expression for my case. It gives a syntax error. Could you please point out the error. thanks regards K.Suresh kumar |
||
December 23, 2010, 09:03 |
|
#55 |
Senior Member
Join Date: Mar 2009
Location: My oyster
Posts: 124
Rep Power: 17 |
Code:
pow(pos()-vector(-1,0,0),2) Code:
pow(pos().x-(-1),2) |
|
December 23, 2010, 10:44 |
|
#56 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Bernhard |
||
December 23, 2010, 11:40 |
|
#57 |
Senior Member
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17 |
Hi Bernhard,
I was looking around on the forum to use the parabolic velocity profile and got this idea from another post and thought that it is more appropriate to use groovyBC to set the parabolic inlet. So decided to use this expression My U file: dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inletWall { type groovyBC; variables "rpm=0.0;Un=20;c=vector(2.1e-3,2.1e-3,0);n=sum(normal())/mag(sum(normal()));p=pos()-c;r=mag(p)+1.0e-10;R=max(r);xt=vector(n.y,-n.x,0);xT=xt/mag(xt);yt=vector(-n.x*n.z,-n.y*n.z,n.x*n.x+n.y*n.y);yT=yt/mag(yt);"; valueExpression "-(alpha1+internalField(alpha1))*{-Un*normal()*(1-pow(r/R,2)) + (rpm*pi/30)*((p & yT)*xT - (p & xT)*yT)}"; value uniform (0 0 0); timelines (); } atmosphere { type fixedValue; value uniform (0 0 0); } } But when I run the solver interFoam, it gives me the error: --> FOAM FATAL ERROR: The expected return type scalar is different from the stored result type "vector" From function tmp<Field<Type> > ExpressionResult::getResult() in file lnInclude/ExpressionResultI.H at line 76. FOAM aborting #0 Foam::error:rintStack(Foam::Ostream&) in "/home/kumar/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so" #1 Foam::error::abort() in "/home/kumar/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so" #2 Foam::Field<double>* Foam::PatchValueExpressionDriver::getField<double> (Foam::string const&) in "/home/kumar/OpenFOAM/kumar-1.6.x/lib/linux64GccDPOpt/libswak4FoamParsers.so" #3 parserPatch::PatchValueExpressionParser:arse() in "/home/kumar/OpenFOAM/kumar-1.6.x/lib/linux64GccDPOpt/libswak4FoamParsers.so" #4 Foam::PatchValueExpressionDriver:arse(std::strin g const&) in "/home/kumar/OpenFOAM/kumar-1.6.x/lib/linux64GccDPOpt/libswak4FoamParsers.so" #5 Foam::CommonValueExpressionDriver::evaluateVariabl e(Foam::word const&, Foam::string const&) in "/home/kumar/OpenFOAM/kumar-1.6.x/lib/linux64GccDPOpt/libswak4FoamParsers.so" #6 Foam::CommonValueExpressionDriver::addVariables(Fo am::string const&, bool) in "/home/kumar/OpenFOAM/kumar-1.6.x/lib/linux64GccDPOpt/libswak4FoamParsers.so" #7 Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() in "/home/kumar/OpenFOAM/kumar-1.6.x/lib/linux64GccDPOpt/libgroovyBC.so" #8 Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<doub le>, Foam::fvPatchField, Foam::volMesh>&, Foam::dimensionSet const&) in "/home/kumar/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libincompressibleLESModels.so" #9 Foam::fv::gaussLaplacianScheme<Foam::Vector<double >, double>::fvmLaplacianUncorrected(Foam::GeometricFi eld<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) in "/home/kumar/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libfiniteVolume.so" #10 Foam::fv::gaussLaplacianScheme<Foam::Vector<double >, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) in "/home/kumar/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libfiniteVolume.so" #11 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&, Foam::word const&) in "/home/kumar/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/interFoam" #12 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) in "/home/kumar/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/interFoam" #13 main in "/home/kumar/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/interFoam" #14 __libc_start_main in "/lib/libc.so.6" #15 _start at /build/buildd/eglibc-2.10.1/csu/../sysdeps/x86_64/elf/start.S:116 I have set the position vector c as the centre of the inlet patch. Any suggestions from the error message will be helpful regards K.Suresh kumar |
|
December 26, 2010, 17:29 |
|
#58 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Bernhard |
||
January 30, 2011, 12:35 |
|
#59 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
There is a new release available in the SVN (the actual changes have been lying around in the Mercurial-repository for a while but I never found time to update the README). The main change is that if you're using 1.6-ext then you cna use it for the finiteArea-stuff, too. Also there are some bugfixes which have been discussed in the Mantis-Bugtracker
|
|
March 25, 2011, 05:09 |
fpos in funkySetFields
|
#60 |
Senior Member
|
I am getting an error when trying to use the fpos functionality in swak4Foam>funkySetFields.
funkySetFields -latestTime /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM Extend Project: Open source CFD | | \\ / O peration | Version: 1.6-ext | | \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 1.6-ext-943ecc426649 Exec : funkySetFields -latestTime Date : Mar 25 2011 Time : 04:58:35 Host : egpMBA.local PID : 70817 Case : /Users/egp/OpenFOAM/egp-1.6-ext/run/RayleighTaylor/coarse nProcs : 1 SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 1 Part: Alpha Putting "average((fpos().y+surf(0.5)*fproj().y)>=surf(-0.05)*cos(surf(6.2831)*fpos().x) ? surf(1.0) : surf(0.))" into field alpha1 at t = "1" if condition "true" is true --> FOAM FATAL ERROR: Parser Error at "1.9-12" :"syntax error, unexpected TOKEN_fposition" "average((fpos().y+surf(0.5)*fproj().y)>=surf(-0.05)*cos(surf(6.2831)*fpos().x) ? surf(1.0) : surf(0.))" " ^^^^ " From function parsingValue in file lnInclude/CommonValueExpressionDriverI.H at line 365. FOAM exiting This is strange since swak4FoamParsers/FieldValueExpressionDriver.C creates an IOobject named "fpos", and the machinery appears to largely be in place for surface field operations. Note: this funkySetFieldsDict works just fine with the stand-alone FSF. |
|
|
|