CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] groovyBC and funkySetFields married and got a kid named swak4Foam

Register Blogs Community New Posts Updated Threads Search

Like Tree14Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 13, 2010, 07:47
Default 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
kumar is on a distinguished road
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
Attached Images
File Type: png cartesion_mesh.png (12.6 KB, 53 views)
kumar is offline   Reply With Quote

Old   December 13, 2010, 12:27
Default
  #42
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by neewbie View Post
hi,

i am facing the same problem (ld returned 1 exit status). Is it possible that this is somehow related to where the *.o file is written... because i had to manually change the Make/files when compiling swak4Foam. I changed from ../Libraries/... to ../lib/.. and this fixed the "earlier" problem..

neewbie
Where did you change that? The only time that Libraries is written is in one Make/options and that is because it is assumed that the sources to simpleFunctionObjects are installed there ($FOAM_USER_LIBBIN as I extrapolate that your change is, is in my opinion not the appropriate place for sources). Anyway. This shouldn't affect the linking stage

Bernhard
gschaider is offline   Reply With Quote

Old   December 13, 2010, 12:31
Default
  #43
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alfa_8C View Post
Hello Bernhard,

two short questions:

1. what exactly do you mean with your comment:

BTW: I'm sure you've included the overall mass-source into the continuity equation

My Eqns look like this:

UEqn:

fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
==
//rho*g
rho.dimensionedInternalField()*g
+ momentumSource.Su()
);

UEqn.relax();

if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));
}


...and

YEqn:

for (label i=0; i<Y.size(); i++)
{
if (Y[i].name() != inertSpecie)
{
volScalarField& Yi = Y[i];

solve
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(turbulence->muEff(), Yi)
==
//kappa*chemistry.RR(i),
kappa*chemistry.RR(i)().dimensionedInternalField()
+ massSource.Su(i),
mesh.solver("Yi")
);

Yi.max(0.0);
Yt += Yi;

Is there something wrong regarding the specie fractions or what else do you mean?
What I meant is that is the sum of all massSource.Su(i) is NOT zero then your continuity equation has a source-term and you've got to adapt your pEqn accordingly

Quote:
Originally Posted by alfa_8C View Post
2. Do you know where to get the properties set for CO in the same "form" like other species used for reactingFoam? OpenFOAM support doesn't help unfortunately...

Many thanx in advance,
Tony
Which properties do you mean?

Bernhard
gschaider is offline   Reply With Quote

Old   December 13, 2010, 12:34
Default
  #44
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kumar View Post
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
The sketch for the expression would be "(mag(pos()-center)< radius ? 'parabolic inlet expression' : vector(0,0,0)" (look up the meaning of ?: in C/C++ and fill in the details according to your geometry)

Of course you might have some fun with the "jagged" edges of the inlet

Bernahrd
gschaider is offline   Reply With Quote

Old   December 13, 2010, 12:48
Default
  #45
Senior Member
 
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17
kumar is on a distinguished road
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
Attached Images
File Type: png alphafield.png (12.5 KB, 76 views)
File Type: png contour.png (19.7 KB, 86 views)
kumar is offline   Reply With Quote

Old   December 13, 2010, 15:34
Default
  #46
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kumar View Post
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
Yeah. But be sure to approriatly use -valuePatches and -keepPatches. Otherwise you'll lose all other BCs:

http://openfoamwiki.net/index.php/Co...and_line_usage
gschaider is offline   Reply With Quote

Old   December 14, 2010, 11:33
Default
  #47
Senior Member
 
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17
kumar is on a distinguished road
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
kumar is offline   Reply With Quote

Old   December 14, 2010, 12:19
Default
  #48
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kumar View Post
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
The secret is that both branches have to be a vector. For a very simple inlet (assuming it is located at x=-1) you write (havn't tested it, you'll have to adapt it to your case)
"(mag(pos()-vector(-1,0,0))<1) ? vector(1-pow(pos()-vector(-1,0,0),2),0,0) : vector(0,0,0)"
gschaider is offline   Reply With Quote

Old   December 14, 2010, 13:13
Default
  #49
Senior Member
 
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17
kumar is on a distinguished road
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
kumar is offline   Reply With Quote

Old   December 15, 2010, 05:54
Default
  #50
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kumar View Post
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
Please have a look at the hotRoom-example on the funkySetFields-Wikipage. That should clear it up)

Bernhard
gschaider is offline   Reply With Quote

Old   December 18, 2010, 19:50
Default New release of swak4Foam
  #51
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
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):
  • Parser for sampledSurfaces
    Now expressions for the field on a sampled surface can be evaluated. All sampledSurfaces offered by OpenFOAM now can be used
  • Multiline variables
    The variables entry (most notably used in groovyBC and swakExpression) now can be a list of strings. This allows some kind of "formatting" (one expression per line) and should improve readability
  • Two maintainance-scripts were added
    These can copy the libraries and utilities to the global installation (for those who think that the swak4Foam-stuff is stable enough and want to 'bless' all users at their site with it). Note that any local installation still takes precedence (because $FOAM_USER_APPBIN is before $FOAM_APPBIN in the $PATH)

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)
gschaider is offline   Reply With Quote

Old   December 20, 2010, 11:45
Default
  #52
Member
 
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 15
alfa_8C is an unknown quantity at this point
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...
alfa_8C is offline   Reply With Quote

Old   December 20, 2010, 12:36
Default
  #53
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alfa_8C View Post
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",
Are you sure that you're not mixing two approaches? scalarTimeActivatedExplicitSourceList is not something that comes with SWAK (it is in the distribution). Maybe it is a residual from copy/pasting from another try (and as your other source is called massSource too the names will clash)

Bernhard
gschaider is offline   Reply With Quote

Old   December 23, 2010, 06:54
Default
  #54
Senior Member
 
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17
kumar is on a distinguished road
Quote:
Originally Posted by gschaider View Post
The secret is that both branches have to be a vector. For a very simple inlet (assuming it is located at x=-1) you write (havn't tested it, you'll have to adapt it to your case)
"(mag(pos()-vector(-1,0,0))<1) ? vector(1-pow(pos()-vector(-1,0,0),2),0,0) : vector(0,0,0)"

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
kumar is offline   Reply With Quote

Old   December 23, 2010, 09:03
Default
  #55
Senior Member
 
Join Date: Mar 2009
Location: My oyster
Posts: 124
Rep Power: 17
ziad is on a distinguished road
Code:
pow(pos()-vector(-1,0,0),2)
shouldn't this be
Code:
pow(pos().x-(-1),2)
ziad is offline   Reply With Quote

Old   December 23, 2010, 10:44
Default
  #56
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kumar View Post
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
It's a bit hard to say without the exact syntax error, but when looking at the old posting I would guess that the problem is that the pow-function is used on a vector. Enclose the vector in a mag, then it should work (as I said: it is just a sketch, you'll have to work out the details yourself)

Bernhard
gschaider is offline   Reply With Quote

Old   December 23, 2010, 11:40
Default
  #57
Senior Member
 
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17
kumar is on a distinguished road
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
kumar is offline   Reply With Quote

Old   December 26, 2010, 17:29
Default
  #58
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by kumar View Post
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
Havn't tried it. According to the stack-trace this happens during the evaluation of variables. So you might want to try to strip away one variable expression after the other (starting from the last one). As soon as you don't get that error anymore but either an "unknown symbol" or a syntax-error (what are the {} there supposed to mean?) from the valueExpression then you found the the culprit

Bernhard
gschaider is offline   Reply With Quote

Old   January 30, 2011, 12:35
Default
  #59
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
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
gschaider is offline   Reply With Quote

Old   March 25, 2011, 05:09
Default fpos in funkySetFields
  #60
egp
Senior Member
 
egp's Avatar
 
Eric Paterson
Join Date: Mar 2009
Location: Blacksburg, VA
Posts: 197
Blog Entries: 1
Rep Power: 18
egp is on a distinguished road
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.
egp is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:49.