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

[swak4Foam] funkySetFields and groovyBC error

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 4 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 22, 2014, 13:23
Default funkySetFields and groovyBC error
  #1
otq
New Member
 
Christopher Hughes
Join Date: Oct 2012
Posts: 27
Rep Power: 14
otq is on a distinguished road
I am trying to initialize a mass velocity ( rho*U units of kg m^-2 s^-1) volVectorField using both funkySetField and groovyBC.

funkySetField works well, but the issue I have is when I try to refer back to the now nonuniform internalField, I get the following error

--> FOAM FATAL IO ERROR:
compound has already been transfered from token
on line 20 the empty compound of type List<vector>

file: /home/chris/OpenFOAM/chris-2.1.1/run/Supercritical/CO_2_No_Heat_C/0/coolant/G::boundaryField::inlet1::value at line 20.

From function token::transferCompoundToken(const Istream& is)
in file lnInclude/token.C at line 99.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1 Foam::IOerror::abort() in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2 Foam::token::transferCompoundToken(Foam::Istream const&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#3 Foam::Istream& Foam:perator>><Foam::Vector<double> >(Foam::Istream&, Foam::List<Foam::Vector<double> >&) at /opt/openfoam211/src/OpenFOAM/lnInclude/ListIO.C:58
#4 Foam::Field<Foam::Vector<double> >::Field(Foam::word const&, Foam::dictionary const&, int) at /opt/openfoam211/src/OpenFOAM/lnInclude/Field.C:229
#5 Foam::groovyBCFvPatchField<Foam::Vector<double> >::groovyBCFvPatchField(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/chris/OpenFOAM/chris-2.1.1/platforms/linuxGccDPOpt/lib/libgroovyBC.so"
#6 Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::groovyBCF vPatchField<Foam::Vector<double> > >::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/chris/OpenFOAM/chris-2.1.1/platforms/linuxGccDPOpt/lib/libgroovyBC.so"
#7 Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ~/OpenFOAM/chris-2.1.1/run/Supercritical/SCWR/finiteVolume/lnInclude/fvPatchFieldNew.C:171
#8 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricB oundaryField(Foam::fvBoundaryMesh const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:278
#9 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::dictionary const&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:70
#10 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::Istream&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:113
#11 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:363
#12
at ~/OpenFOAM/chris-2.1.1/run/Supercritical/SCWR/fluid/createFluidFields.H:162
#13 __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#14
in "/home/chris/OpenFOAM/chris-2.1.1/platforms/linuxGccDPOpt/bin/chtMultiRegionSimplegFoam"
Aborted (core dumped)

This error goes away if I change my groovyBC from:

inlet1
{
type groovyBC;
value $internalField;
variables "R=0.0022;n=9.0;S=(2.0*pow(n,2))/((n+1.0)*(2.0*n+1));rsq=pow(pos().x,2.0)+pow(pos() .y,2.0);Gmax=1200.0/S;power=1/n;ratio=sqrt(rsq)/R;scale=1-ratio;Gf=Gmax*pow(scale,power);";
valueExpression "vector(0,0,Gf)";
}

to :

inlet1
{
type groovyBC;
value uniform (0 0 1200);
variables "R=0.0022;n=9.0;S=(2.0*pow(n,2))/((n+1.0)*(2.0*n+1));rsq=pow(pos().x,2.0)+pow(pos() .y,2.0);Gmax=1200.0/S;power=1/n;ratio=sqrt(rsq)/R;scale=1-ratio;Gf=Gmax*pow(scale,power);";
valueExpression "vector(0,0,Gf)";
}

what issue does the "value $internalField" entry have with funkySetField? Or do I need to do something additional to account for the nonuniform list?

Thank you for your time.
otq is offline   Reply With Quote

Old   August 22, 2014, 14:11
Default
  #2
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 otq View Post
I am trying to initialize a mass velocity ( rho*U units of kg m^-2 s^-1) volVectorField using both funkySetField and groovyBC.

funkySetField works well, but the issue I have is when I try to refer back to the now nonuniform internalField, I get the following error

--> FOAM FATAL IO ERROR:
compound has already been transfered from token
on line 20 the empty compound of type List<vector>

file: /home/chris/OpenFOAM/chris-2.1.1/run/Supercritical/CO_2_No_Heat_C/0/coolant/G::boundaryField::inlet1::value at line 20.

From function token::transferCompoundToken(const Istream& is)
in file lnInclude/token.C at line 99.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1 Foam::IOerror::abort() in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2 Foam::token::transferCompoundToken(Foam::Istream const&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#3 Foam::Istream& Foam:perator>><Foam::Vector<double> >(Foam::Istream&, Foam::List<Foam::Vector<double> >&) at /opt/openfoam211/src/OpenFOAM/lnInclude/ListIO.C:58
#4 Foam::Field<Foam::Vector<double> >::Field(Foam::word const&, Foam::dictionary const&, int) at /opt/openfoam211/src/OpenFOAM/lnInclude/Field.C:229
#5 Foam::groovyBCFvPatchField<Foam::Vector<double> >::groovyBCFvPatchField(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/chris/OpenFOAM/chris-2.1.1/platforms/linuxGccDPOpt/lib/libgroovyBC.so"
#6 Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::groovyBCF vPatchField<Foam::Vector<double> > >::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/home/chris/OpenFOAM/chris-2.1.1/platforms/linuxGccDPOpt/lib/libgroovyBC.so"
#7 Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ~/OpenFOAM/chris-2.1.1/run/Supercritical/SCWR/finiteVolume/lnInclude/fvPatchFieldNew.C:171
#8 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricB oundaryField(Foam::fvBoundaryMesh const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:278
#9 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::dictionary const&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:70
#10 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readField(Foam::Istream&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:113
#11 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:363
#12
at ~/OpenFOAM/chris-2.1.1/run/Supercritical/SCWR/fluid/createFluidFields.H:162
#13 __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#14
in "/home/chris/OpenFOAM/chris-2.1.1/platforms/linuxGccDPOpt/bin/chtMultiRegionSimplegFoam"
Aborted (core dumped)

This error goes away if I change my groovyBC from:

inlet1
{
type groovyBC;
value $internalField;
variables "R=0.0022;n=9.0;S=(2.0*pow(n,2))/((n+1.0)*(2.0*n+1));rsq=pow(pos().x,2.0)+pow(pos() .y,2.0);Gmax=1200.0/S;power=1/n;ratio=sqrt(rsq)/R;scale=1-ratio;Gf=Gmax*pow(scale,power);";
valueExpression "vector(0,0,Gf)";
}

to :

inlet1
{
type groovyBC;
value uniform (0 0 1200);
variables "R=0.0022;n=9.0;S=(2.0*pow(n,2))/((n+1.0)*(2.0*n+1));rsq=pow(pos().x,2.0)+pow(pos() .y,2.0);Gmax=1200.0/S;power=1/n;ratio=sqrt(rsq)/R;scale=1-ratio;Gf=Gmax*pow(scale,power);";
valueExpression "vector(0,0,Gf)";
}

what issue does the "value $internalField" entry have with funkySetField? Or do I need to do something additional to account for the nonuniform list?

Thank you for your time.
That is not a groovyBC-problem but a general problem. This "$internalField"-thing only works if the internal-field is uniform. As it means "take the internalField as you find it and put a copy here". Which in your case ends with a "take the internalField which has a size of 51456 cells and put it as the value of the this 1632 face patch". The patch says "but I only need 1632 values. What is the rest you're feeding me".

It would also fail if type was fixedValue (try it). Everything with $ is basically textual replacement. It has no concept of the physics/numerics

What you'd like to do is initialize the patch with the values of the cells next to the patch, right? (that won't work with $internalField as you get the values in the order in which they are found in the cells). The only way that I could think of is using funkySetBoundaryFields with an expression "internalField(rhoG)" before the solver (assuming rhoG is the name of your field)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   August 22, 2014, 15:15
Default
  #3
otq
New Member
 
Christopher Hughes
Join Date: Oct 2012
Posts: 27
Rep Power: 14
otq is on a distinguished road
Thank you so much, especially for explaining the error so simply.
I am trying to set the values of the cells next to the patch as the patch.
I'll work on setting up funkySetBoundaryField.
otq is offline   Reply With Quote

Old   August 22, 2014, 15:37
Default
  #4
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 otq View Post
Thank you so much, especially for explaining the error so simply.
I am trying to set the values of the cells next to the patch as the patch.
I'll work on setting up funkySetBoundaryField.
But you gave me a good idea: currently if "value" is unset groovyBC initializes to "0" which leads to failures (for instance if this is a temperature field and density is then calculated from it). It can't initialize with the expression because that can not be evaluated safely (because not all fields are necessarily there yet). But instead of 0 I could get the field from the next cells.

But don't hold your breath. The time from idea to implementation varies between an hour and a year
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   August 27, 2014, 10:05
Default
  #5
otq
New Member
 
Christopher Hughes
Join Date: Oct 2012
Posts: 27
Rep Power: 14
otq is on a distinguished road
This is the silliest question I've ever asked on this forum, but where do I place the funkySetBoundaryFieldsDict file? I'm running chtmultiregionsimpleFoam but the method I used for the funkySetFieldsDict file doesn't work.

Is it somehow integrated into the controlDicts file?

Thank you for your time.
otq is offline   Reply With Quote

Old   August 27, 2014, 17:35
Default
  #6
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 otq View Post
This is the silliest question I've ever asked on this forum, but where do I place the funkySetBoundaryFieldsDict file? I'm running chtmultiregionsimpleFoam but the method I used for the funkySetFieldsDict file doesn't work.

Is it somehow integrated into the controlDicts file?

Thank you for your time.
I think the file goes into system. But what do I know? I only wrote that thing. Doesn't mean I know how to use it properly

What I usually do is

1. Look at the "help": funkySetBoundaryFieldsDict -h
2. Run the utility. OpenFOAM error-messages are quite explicit about which files they are missing

BTW: for your multi-region-case you'll have to use the -region-option. File will then be looked for in the proper sub-directory of system
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   September 9, 2014, 16:56
Default
  #7
otq
New Member
 
Christopher Hughes
Join Date: Oct 2012
Posts: 27
Rep Power: 14
otq is on a distinguished road
This has frustrated me to no end.

My Allrun file has the following

funkySetBoundaryFields -region coolant
funkySetFields -time 0 -region coolant

My funkySetFieldsDict.coolant is located in the system/coolant folder.
I have a funkySetBoundaryFieldsDict.coolant located in the same folder.

I still get the ./Allrun: 9: ./Allrun: funkySetBoundaryFields: not found
error when I run the program. Line 9 is the location of the funkySetBoundaryFields -region coolant code in the Allrun file.

I have tried rewriting the Allrun line to
funkySetBoundaryFields -time 0 -region coolant
in case that was doing something, same error.

I have changed the file name to funkySetBoundaryFieldsDict, same error.

Finally I have changed the file name to funkySetBoundaryFields, same error.

I type funkySetBoundaryFieldsDict -h

and it says funkySetBoundaryFieldsDict: command not found


Do I somehow have a version that does not include funkySetBoundaryFields?

I have installed swak4Foam_2.x_release_0.2.1
otq is offline   Reply With Quote

Old   September 9, 2014, 17:42
Default
  #8
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 otq View Post
This has frustrated me to no end.

My Allrun file has the following

funkySetBoundaryFields -region coolant
funkySetFields -time 0 -region coolant

My funkySetFieldsDict.coolant is located in the system/coolant folder.
I have a funkySetBoundaryFieldsDict.coolant located in the same folder.

I still get the ./Allrun: 9: ./Allrun: funkySetBoundaryFields: not found
error when I run the program. Line 9 is the location of the funkySetBoundaryFields -region coolant code in the Allrun file.

I have tried rewriting the Allrun line to
funkySetBoundaryFields -time 0 -region coolant
in case that was doing something, same error.

I have changed the file name to funkySetBoundaryFieldsDict, same error.

Finally I have changed the file name to funkySetBoundaryFields, same error.

I type funkySetBoundaryFieldsDict -h

and it says funkySetBoundaryFieldsDict: command not found


Do I somehow have a version that does not include funkySetBoundaryFields?

I have installed swak4Foam_2.x_release_0.2.1
"./Allrun: 9: ./Allrun: funkySetBoundaryFields: not found" means "the shell-script did not find the program funkySetBoundaryFields". funkySetBoundaryFields had no chance to have problems as it was not executed.

It seems that funkySetBoundaryFields was not properly compiled (it is one of the old utilities. Older than the old version 0.2.1)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] groovyBC and funkySetFields married and got a kid named swak4Foam gschaider OpenFOAM Community Contributions 169 August 10, 2023 10:01
[swak4Foam] Defining constants for funkySetFields and groovyBC anaiman OpenFOAM Community Contributions 14 January 20, 2020 19:37
[foam-extend.org] 3.2 Installation in Debian 8.5 jsm OpenFOAM Installation 2 June 19, 2016 11:53
[swak4Foam] groovyBC for initial conditions? hajott OpenFOAM Community Contributions 0 July 30, 2015 10:32
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM Community Contributions 300 October 29, 2014 19:00


All times are GMT -4. The time now is 23:53.