CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   GroovyBC problem in the defining inlet velocity (https://www.cfd-online.com/Forums/openfoam-solving/91147-groovybc-problem-defining-inlet-velocity.html)

 iampolaris August 1, 2011 23:32

GroovyBC problem in the defining inlet velocity

Hello, every one!
As defining inlet velocity of a two-phase flow bed, in which the voidage is constant, i need to ensure that the inlet mass flux of one phase is equal to the outlet flux from the top patch. Based on the groovyBC utility, i have defined Ua(volvectorField of one phase) in the inlet boundary, as shown below. UsL and UsR are both the inlet boundary.
boundaryField
20 {
21 UsL
22 {
23 type groovyBC;
24 valueExpression "0.5*flux";
25 variables "totalArea@UsL=sum(mag(Sf()));
flux@top=sum(phia())/totalArea/ 929.5;";
26 value uniform ( 0 0 0 );
27 }
28
29 UsR
30 {
31 type groovyBC;
32 valueExpression "0.5*flux";
33 variables "totalArea@UsR=sum(mag(Sf()));
flux@top=sum(phia())/totalArea/ 929.5;";
34 value uniform ( 0 0 0 );
35 }

35 }
........
However, when i ran the case, there were errors displayed on the screen.
"
--> FOAM FATAL IO ERROR:

file: /home/zhouquan/OpenFOAM/zhouquan-1.7.1/run/tutorials/multiphase/twoPhaseEulerFoam/bed3/0/Ua at line 1.

in file db/regIOobject/regIOobjectRead.C at line 69.
"
Who can tell me how to do with it?
Thank you!

 gschaider August 2, 2011 05:08

Quote:
 Originally Posted by iampolaris (Post 318394) However, when i ran the case, there were errors displayed on the screen. " --> FOAM FATAL IO ERROR: problem while reading header for object Ua file: /home/zhouquan/OpenFOAM/zhouquan-1.7.1/run/tutorials/multiphase/twoPhaseEulerFoam/bed3/0/Ua at line 1. From function regIOobject::readStream() in file db/regIOobject/regIOobjectRead.C at line 69. " Who can tell me how to do with it? Thank you!
"reading header" means that OF has a problem with the meta-information at the top of the file (the stuff in the "FoamFile" dictionary). IS it possible that you accidentially damaged that while editing?

 iampolaris August 2, 2011 08:27

Quote:
 Originally Posted by gschaider (Post 318446) "reading header" means that OF has a problem with the meta-information at the top of the file (the stuff in the "FoamFile" dictionary). IS it possible that you accidentially damaged that while editing?
Bernhard, Thank you for you reply!
As you pointed out, It's the error that i deleted the top of the file by accident. However, after correcting the mistake and running the case, there was another error.
"
file: /home/zhouquan/OpenFOAM/zhouquan-1.7.1/run/tutorials/multiphase/twoPhaseEulerFoam/bed3/0/Ua::boundaryField::UsL from line 25 to line 28.

From function fvPatchField<Type>::New(const fvPatch&, const DimensionedField<Type, volMesh>&, const dictionary&)
in file /opt/openfoam171/src/finiteVolume/lnInclude/newFvPatchField.C at line 110.

FOAM exiting
"
What's wrong with the usage of groovyBC utility in my case? Besides, I have thought about the message and had a questions about it. As for defining the volvectorField with groovyBC utility in the boundary, it only gives the definition of "variables" and "valueExpression", but without direction of the vector(eg. Ua in my definition). How does it work?

 gschaider August 2, 2011 12:55

Quote:
 Originally Posted by iampolaris (Post 318495) Bernhard, Thank you for you reply! As you pointed out, It's the error that i deleted the top of the file by accident. However, after correcting the mistake and running the case, there was another error. " file: /home/zhouquan/OpenFOAM/zhouquan-1.7.1/run/tutorials/multiphase/twoPhaseEulerFoam/bed3/0/Ua::boundaryField::UsL from line 25 to line 28. From function fvPatchField::New(const fvPatch&, const DimensionedField&, const dictionary&) in file /opt/openfoam171/src/finiteVolume/lnInclude/newFvPatchField.C at line 110. FOAM exiting " What's wrong with the usage of groovyBC utility in my case? Besides, I have thought about the message and had a questions about it. As for defining the volvectorField with groovyBC utility in the boundary, it only gives the definition of "variables" and "valueExpression", but without direction of the vector(eg. Ua in my definition). How does it work?
No idea what the problem might be now as there is only a part of the error message there. Did you load the groovyBC.so in the libs-list in the controlDict. Apart from that my guess is that you forgot a } or a ; somewhere

 iampolaris August 3, 2011 23:28

Quote:
 Originally Posted by gschaider (Post 318544) No idea what the problem might be now as there is only a part of the error message there. Did you load the groovyBC.so in the libs-list in the controlDict. Apart from that my guess is that you forgot a } or a ; somewhere
Thank you very much! After following your advice, i have checked the errors and found that i have wrongly defined the boundary and interfacialproperties. But, as i redefined the boundaryfield in case/0/Ua shown below
"
boundaryField
22 {
23 UsL
24 {
25 type groovyBC;
26 variables "area1@UsL=sum(mag(Sf()));flux1@outlet=sum(phi a)/ area1/929.5;";
27 valueExpression "0.5*flux1";
28 value uniform ( 0 0 0 );
29 }
30
31 UsR
32 {
33 type groovyBC;
34 variables "area2@UsR=sum(mag(Sf()));flux2@outlet=sum(phi a)/ area2/929.5;";
35 valueExpression "0.5*flux2";
36 value uniform ( 0 0 0 );
37 }
"
and ran the case with "twoPhaseEulerFoam", there was error message listed below.
"
--> FOAM FATAL ERROR:
Parser Error at "1.11-15" :"field area1 not existing or of wrong type"
"sum(phia)/area1/929.5"
" ^^^^^ "

From function parsingValue
in file PatchValueExpressionDriver.C at line 192.

I have searched the relevant information, but nothing useful in the web. Why did it say that field area1 is not existing, which i have defined in the "variables" ?
Looking forward to answer, thank you!

 gschaider August 4, 2011 07:17

Quote:
 Originally Posted by iampolaris (Post 318787) Thank you very much! After following your advice, i have checked the errors and found that i have wrongly defined the boundary and interfacialproperties. But, as i redefined the boundaryfield in case/0/Ua shown below " boundaryField 22 { 23 UsL 24 { 25 type groovyBC; 26 variables "area1@UsL=sum(mag(Sf()));flux1@outlet=sum(phi a)/ area1/929.5;"; 27 valueExpression "0.5*flux1"; 28 value uniform ( 0 0 0 ); 29 } 30 31 UsR 32 { 33 type groovyBC; 34 variables "area2@UsR=sum(mag(Sf()));flux2@outlet=sum(phi a)/ area2/929.5;"; 35 valueExpression "0.5*flux2"; 36 value uniform ( 0 0 0 ); 37 } " and ran the case with "twoPhaseEulerFoam", there was error message listed below. " --> FOAM FATAL ERROR: Parser Error at "1.11-15" :"field area1 not existing or of wrong type" "sum(phia)/area1/929.5" " ^^^^^ " From function parsingValue in file PatchValueExpressionDriver.C at line 192. I have searched the relevant information, but nothing useful in the web. Why did it say that field area1 is not existing, which i have defined in the "variables" ? Looking forward to answer, thank you!
Hmm. Strange. Two things I noticed:
a) you're using the old syntax for remote variables so you're using the old-school groovyBC (not the one that comes with swak4Foam). I havn't activly worked on that for over a year and will only fix this bug if it is easy to do
b) area1 and area2 do not have to be remote variables because they are defined on the same patch as the BC. Unlikely, but maybe this is the problem

I'll have a look when I find time. A bug report on the OF-extend-Mantis would speed this up

Bernhard

 OvGU October 18, 2014 08:33

I am using twoPhaseEulerFoam to simulate gas-solid flow.
My question is - I can easily calculate min fluidization velocity (so no need mass flow rate initially ).
But when I need to consider recirculating flow I only can set mass flow rate. How I change B.C ???

 gschaider October 18, 2014 09:25

Quote:
 Originally Posted by OvGU (Post 514937) I am using twoPhaseEulerFoam to simulate gas-solid flow. My question is - I can easily calculate min fluidization velocity (so no need mass flow rate initially ). But when I need to consider recirculating flow I only can set mass flow rate. How I change B.C ???
This is a classic example for a question that will go unanswered:
- it has no relation to the topic of the thread (so the people in the thread will not be interested. And those people interested in twoPhaseEulerFoam will not find it)
- it is very brief and to answer it one must guess what you mean with certain formulations (rule of thumb: don't expect anyone to spend more time on an answer than you spent on formulating the question)

So the only answer I can give to your question ist: "Carefully"

Have a look at https://openfoamwiki.net/index.php/H..._Message_Board and then retry in a proper place

 All times are GMT -4. The time now is 10:39.