CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Parser Error : GroovyBC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 4, 2021, 04:50
Default Parser Error : GroovyBC
  #1
Member
 
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 9
Kbshariff is on a distinguished road
Hello, I want to implement a groovyBC on k field in a form of log law.

The BC is given in the figure attached herewith

I have an error when running from the BC
Code:
--> FOAM FATAL ERROR: 
 Parser Error for driver PatchValueExpressionDriver at "1.8-9" :"field Hh not existing or of wrong type"
" (log((Hh/z0))/log((zp+z0)/z0))*Iamb"
here is my BC
Code:
    inlet

	{
	type		groovyBC;
	variables	(
			"zp = pos().z;"
			"Hh = 50;"
			"Uin = 2.7;"	
			"z0 = 0.001;"
			"Iamb = 0.2;"
			"II = (log((Hh/z0))/log((zp+z0)/z0))*Iamb;"
			"k = 1.5*II*II*Uin*Uin;"
			);
	valueExpression	"k";
	}
I use the same BC in fluent as UDF it works but am having an error in implementing it in OF.
Thank you.
Attached Images
File Type: png II.png (3.4 KB, 0 views)
Kbshariff is offline   Reply With Quote

Old   August 5, 2021, 05:31
Default
  #2
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 638
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

My guess is that the syntax is incorrect as it only seems to read the first line.

Can you try this:

Code:
    inlet

	{
	type		groovyBC;
	variables	"zp = pos().z;
			 Hh = 50;
			 Uin = 2.7;	
			 z0 = 0.001;
			 Iamb = 0.2;
			 II = (log((Hh/z0))/log((zp+z0)/z0))*Iamb;
			 k = 1.5*II*II*Uin*Uin;";
	valueExpression	"k";
	}
Or this:

Code:
    inlet

	{
	type		groovyBC;
	variables	"zp = pos().z;Hh = 50;Uin = 2.7;z0 = 0.001;Iamb = 0.2;II = (log((Hh/z0))/log((zp+z0)/z0))*Iamb;k = 1.5*II*II*Uin*Uin;";
	valueExpression	"k";
	}
This is taken from the OpenFOAMwiki
tomf is offline   Reply With Quote

Old   August 6, 2021, 05:47
Default
  #3
Member
 
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 9
Kbshariff is on a distinguished road
Hi, yes indeed the error is in declaration of variables,

I calculated the expression in the valueExpression as follows;

Code:
   {
     type            groovyBC;
     variables "H=50;z0=0.001;vel=2.7;amb=0.2;";
     valueExpression "1.5*pow((amb*(log(H/z0)/log(pos().z/z0)))*vel,2)";

   }
It works well so far, merci
Kbshariff is offline   Reply With Quote

Reply

Tags
groovybc


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] Error installing swak4Foam Hisham OpenFOAM Community Contributions 182 February 8, 2024 10:36
[Other] vtk to OpenFoam (or something else that can reach after OpenFoam) cristina87 OpenFOAM Meshing & Mesh Conversion 8 July 19, 2019 08:28
ERROR CCL parser failed with message: Perl Syntax errors detected: Can't use an undef nands_bullwalker Fluent UDF and Scheme Programming 2 October 9, 2017 09:13
[swak4Foam] Error using groovyBC - 'parser error for expression driver' odellar OpenFOAM Community Contributions 4 September 21, 2015 11:51
parabolic inlet velocity condition ofslcm OpenFOAM Programming & Development 12 February 5, 2014 00:30


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