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

[swak4Foam] log velocity profile with groovyBC - syntax

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 8, 2020, 05:22
Default
  #41
Member
 
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 9
Kbshariff is on a distinguished road
Hi, thank you Bernhard for the observation, I have modified the groovyBC as follows; I define the variables a and u_f as scalars and i use the *normal() to make the expression a vector. My main concern now is pos().z,

Code:
    inlet           
   {
     type            groovyBC;
     variables "a=0.197;u_f=0.00787;n=1e-5;";
     valueExpression "(2.5*u_f*log((u_f*pos().z)/(n))+a)*normal()";

   }
My main concern now is the defination of z as pos().z, when i run the case i get this error. Its no clear for me what is the source of error.

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


SIMPLE: convergence criteria
    field p      tolerance 0.001
    field U      tolerance 0.0001
    field "(k|epsilon)"  tolerance 0.0001

Reading field p

Reading field U

--> FOAM Warning :
    From groovyBCFvPatchField<Type>::groovyBCFvPatchField(const fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
    in file groovyBCFvPatchField.C at line 141
    No value defined for U on inlet therefore using the internal field next to the patch
Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs
{
    Cmu             0.09;
    C1              1.44;
    C2              1.92;
    sigmaEps        1.11;
    C3              0;
    sigmak          1;
}

No MRF models present

Creating finite volume options from "constant/fvOptions"

Selecting finite volume options type actuationDiskSource
    Source: disk1
    - selecting cells using cellSet actuationDisk1
    - selected 1036 cell(s) with volume 9.78444444444e-05
    - selecting cells using points
    - creating actuation disk zone: disk1
    - force computation method: Froude

Starting time loop

Time = 1

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in /lib64/libpthread.so.0
#3  log in /lib64/libm.so.6
#4  Foam::log(Foam::Field<double>&, Foam::UList<double> const&) at ??:?
#5  Foam::log(Foam::UList<double> const&) at ??:?
#6  parserPatch::PatchValueExpressionParser::parse() at ??:?
#7  Foam::PatchValueExpressionDriver::parseInternal(int) at ??:?
#8  Foam::CommonValueExpressionDriver::parse(Foam::exprString const&, Foam::word const&) at ??:?
#9  Foam::tmp<Foam::Field<Foam::Vector<double> > > Foam::CommonValueExpressionDriver::evaluate<Foam::Vector<double> >(Foam::exprString const&, bool) at ??:?
#10  Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() at ??:?
#11  Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) at ??:?
#12  ? at ??:?
#13  ? at ??:?
#14  __libc_start_main in /lib64/libc.so.6
#15  ? at ??:?
Floating point exception
Thank you for your time and support.
Kbshariff is offline   Reply With Quote

Old   December 8, 2020, 06:01
Default
  #42
Member
 
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 9
Kbshariff is on a distinguished road
i attached herewith files perusal

0/U
Code:
boundaryField
{

    inlet           
   {
     type            groovyBC;
     variables "a=0.197;u_f=0.00787;n=1e-5;";
     valueExpression "(2.5*u_f*log((u_f*pos().z)/(n))+a)*normal()";

   }



    	outlet
    		{
       			type            zeroGradient;
    		}

	top
		{
			type		slip;
		}
	
	bottom
		{
			type		slip;
		}

	walls
		{
			type		slip;
		}
"proc.*"
{
    type            processor;
}
	
}
0/p
Code:
internalField   uniform 0;

boundaryField
{

	inlet
		{
        		type           zeroGradient;
		}

    	outlet
    		{
       			type           fixedValue;
			value		uniform 0;
    		}

	top
		{
			type		slip; 	
		}
	
	bottom
		{
			type		slip; 	
		}

	walls
		{
			type		slip; 	
		}

"proc.*"
{
    type            processor;
}
}
0/eps

Code:
internalField   uniform 1.821e-5;  //4.851e-5;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 1.821e-5;  //4.851e-5;
    }
    outlet
    {
        type            zeroGradient;
    }
    top
    {
        type            epsilonWallFunction;
        value           uniform 1.821e-5;  //4.851e-5;
    }
    bottom
    {
        type            epsilonWallFunction;
        value           uniform 1.821e-5;  //4.851e-5;
    }
    walls
    {
        type            epsilonWallFunction;
        value           uniform 1.821e-5;  //4.851e-5;
    }

"proc.*"
{
    type            processor;
}
}
0/k
Code:
internalField   uniform 0.00001756;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 0.00001756;
    }
    outlet
    {
        type            zeroGradient;
    }
    top
    {
        type            kqRWallFunction;
        value           uniform 0.00001756;
    }
    bottom
    {
        type            kqRWallFunction;
        value           uniform 0.00001756;
    }
    walls
    {
        type            kqRWallFunction;
        value           uniform 0.00001756;
    }

"proc.*"
{
    type            processor;
}
}
Kbshariff is offline   Reply With Quote

Old   December 8, 2020, 17:47
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 Kbshariff View Post
Hi, thank you Bernhard for the observation, I have modified the groovyBC as follows; I define the variables a and u_f as scalars and i use the *normal() to make the expression a vector. My main concern now is pos().z,

Code:
    inlet           
   {
     type            groovyBC;
     variables "a=0.197;u_f=0.00787;n=1e-5;";
     valueExpression "(2.5*u_f*log((u_f*pos().z)/(n))+a)*normal()";

   }
My main concern now is the defination of z as pos().z, when i run the case i get this error. Its no clear for me what is the source of error.

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


SIMPLE: convergence criteria
    field p      tolerance 0.001
    field U      tolerance 0.0001
    field "(k|epsilon)"  tolerance 0.0001

Reading field p

Reading field U

--> FOAM Warning :
    From groovyBCFvPatchField<Type>::groovyBCFvPatchField(const fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
    in file groovyBCFvPatchField.C at line 141
    No value defined for U on inlet therefore using the internal field next to the patch
Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs
{
    Cmu             0.09;
    C1              1.44;
    C2              1.92;
    sigmaEps        1.11;
    C3              0;
    sigmak          1;
}

No MRF models present

Creating finite volume options from "constant/fvOptions"

Selecting finite volume options type actuationDiskSource
    Source: disk1
    - selecting cells using cellSet actuationDisk1
    - selected 1036 cell(s) with volume 9.78444444444e-05
    - selecting cells using points
    - creating actuation disk zone: disk1
    - force computation method: Froude

Starting time loop

Time = 1

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in /lib64/libpthread.so.0
#3  log in /lib64/libm.so.6
#4  Foam::log(Foam::Field<double>&, Foam::UList<double> const&) at ??:?
#5  Foam::log(Foam::UList<double> const&) at ??:?
#6  parserPatch::PatchValueExpressionParser::parse() at ??:?
#7  Foam::PatchValueExpressionDriver::parseInternal(int) at ??:?
#8  Foam::CommonValueExpressionDriver::parse(Foam::exprString const&, Foam::word const&) at ??:?
#9  Foam::tmp<Foam::Field<Foam::Vector<double> > > Foam::CommonValueExpressionDriver::evaluate<Foam::Vector<double> >(Foam::exprString const&, bool) at ??:?
#10  Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() at ??:?
#11  Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) at ??:?
#12  ? at ??:?
#13  ? at ??:?
#14  __libc_start_main in /lib64/libc.so.6
#15  ? at ??:?
Floating point exception
Thank you for your time and support.

Seems that the log function is used outside the range on which it is defined (either 0 or negative). swak4Foam can't protect you from that. Of course you can always use max to make sure that you're in the comfort zone of the function: log(max(1e-10,x)) with x being the function you want to use. But of course you should think WHY is this outside of the comfort zone (because it might be a problem in your setup)
__________________
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   December 9, 2020, 15:36
Default
  #44
Member
 
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 9
Kbshariff is on a distinguished road
Thank you Bernhard,
Yes, the log function was used with wrong z position. Initially, z coordinates ranges from - 0.15 to 0.15. Calculating log of negative is mathematically wrong. I have now change the coordinates to 0 to 0.3.

The simulation now works well. Thank you once again.
Kbshariff is offline   Reply With Quote

Reply

Tags
groovybc, logarithmic, syntax, velocity profile


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
[UDF] Relative coordinates in logarithmic velocity profile cfdworker Fluent UDF and Scheme Programming 25 July 13, 2017 03:44
UDF error - parabolic velocity profile - 3D turbine Zaqie Fluent UDF and Scheme Programming 9 June 25, 2016 19:08
[swak4Foam] Problem with fully developed velocity profile groovyBC in 2D axi-sym mesh harshad88 OpenFOAM Community Contributions 7 July 24, 2014 14:28
[swak4Foam] groovyBC error: velocity profile (2D) >> what's wrong? vitorspadeto OpenFOAM Community Contributions 4 June 19, 2014 15:31
[boundary condition] logarithmic velocity profile cfdworker FLUENT 2 April 17, 2009 23:36


All times are GMT -4. The time now is 12:48.