CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   problem with groovyBC (http://www.cfd-online.com/Forums/openfoam-solving/110131-problem-groovybc.html)

immortality December 4, 2012 10:17

problem with groovyBC
 
when I use groovyBC in my run this error is shown.but simple boundary conditions have no error.

error:
---------------------------------------------------------------------------------------
fluxScheme: Kurganov

Starting time loop

Mean and max Courant Numbers = 1.06808 2.25305
deltaT = 1.72414e-07
Time = 1.72414e-07

diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal: Solving for rhoUx, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal: Solving for rhoUy, Initial residual = 0, Final residual = 0, No Iterations 0
swak4Foam: Allocating new repository for sampledGlobalVariables
smoothSolver: Solving for Ux, Initial residual = 0.0172088, Final residual = 2.44657e-17, No Iterations 3
smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 3.09454e-15, No Iterations 3
diagonal: Solving for rhoE, Initial residual = 0, Final residual = 0, No Iterations 0
word::stripInvalid() called for word r
For debug level (= 2) > 1 this is considered fatal
Aborted
---------------------------------------------------------------------------------------


my U condition is:
---------------------------------------------------------------------------------------
dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
right
{
type fixedValue;
value uniform (0 0 0);
}

left
{
type groovyBC;
variables "PI=3.1415926535;y_max=max(pts().y);y_min=min(pts( ).y);r=0.06;rpm=3600;omegav=rpm*PI/30;vel_r=r*omegav;tetha_1=11*PI/180;tetha_2=60*PI/180;tetha_3=90*PI/180;time_1=tetha_1/omegav;time_2=tetha_2/omegav;time_3=tetha_3/omegav;pr_01=250000;Tr_01=288;pr_02=100000;Tr_02=2 88;gamma=1.4;R_g=287.14;H_t=gamma*R_g*internalFiel d(T)/(gamma-1)+0.5*pow(mag(internalField(U)),2);R_minus=mag(in ternalField(U))-(2/(gamma-1))*sqrt(gamma*R_g*internalField(T));c_b=(-2*R_minus+sqrt(4*pow(R_minus,2)-4*(1+2/(gamma-1))*((gamma-1)/2)*(pow(R_minus,2)-2*H_t)))/(2+4/(gamma-1));U_b=2*c_b/(gamma-1)+R_minus;time_final=0.005;";
valueFraction "((y_max-pos().y)/vel_r+time_2<=time()&&time()<=time_3)?0:1";
valueExpression "(0<=time()&&time()<=((y_max-pos().y)/vel_r))||(time_1<=time()&&time()<=time_2)||(time_2 <=time()&&time()<=((y_max-pos().y)/vel_r+time_2))||(time_3<=time()&&time()<=time_fina l) ? vector(0,-vel_r,0):vector(U_b,0,0)";
gradientExpression "vector(0,0,0)";
value uniform (0 0 0);
//type fixedValue;
//value uniform (2 0 0);
//type zeroGradient;
}
//M1=sqrt(((pow((pr_01/p_prime),.2857142857))-1)*(2/(gamma-1)))
walls
{
type fixedValue;
value uniform (0 0 0);

}

empty
{
type empty;

}
}
---------------------------------------------------------------------------------------


my p is this:
---------------------------------------------------------------------------------------
dimensions [1 -1 -2 0 0 0 0];

internalField uniform 1000;

boundaryField
{
right
{
type zeroGradient;
}

left
{
type groovyBC;
variables "PI=3.1415926535;y_max=max(pts().y);y_min=min(pts( ).y);r=0.06;rpm=3600;omegav=rpm*PI/30;vel_r=r*omegav;tetha_1=11*PI/180;tetha_2=60*PI/180;tetha_3=90*PI/180;time_1=tetha_1/omegav;time_2=tetha_2/omegav;time_3=tetha_3/omegav;pr_01=250000;Tr_01=288;pr_02=100000;Tr_02=2 88;gamma=1.4;R_g=287.14;H_t=gamma*R_g*internalFiel d(T)/(gamma-1)+0.5*pow(mag(internalField(U)),2);R_minus=mag(in ternalField(U))-(2/(gamma-1))*sqrt(gamma*R_g*internalField(T));c_b=(-2*R_minus+sqrt(4*pow(R_minus,2)-4*(1+2/(gamma-1))*((gamma-1)/2)*(pow(R_minus,2)-2*H_t)))/(2+4/(gamma-1));U_b=2*c_b/(gamma-1)+R_minus;time_final=0.005;";



valueFraction "((0<=time()&&time()<=((y_max-pos().y)/vel_r))||(time_1<=time()&&time()<=time_2)||(time_2 <=time()&&time()<=((y_max-pos().y)/vel_r+time_2))||(time_3<=time()&&time()<=time_fina l)?0:1";

valueExpression "(time()<time_1) ? pr_01*(1+(gamma-1)/2*(U_b/c_b)^2)^(gamma/(gamma-1)):pr_02*(1+(gamma-1)/2*((sqr(mag(internalField(U))))/(gamma*R_g*internalField(T))))^(-gamma/(gamma-1))";

gradientExpression "0";
value uniform 100000;
//type fixedValue;
//value uniform 250000;
}

walls
{
type zeroGradient;

}

empty
{
type empty;

}
}
---------------------------------------------------------------------------------------

and the T boundary condition is:
---------------------------------------------------------------------------------------
dimensions [0 0 0 1 0 0 0];

internalField uniform 288;

boundaryField
{
right
{
type zeroGradient;
}

left
{
type groovyBC;
variables "PI=3.1415926535;y_max=max(pos().y);y_min=min(pos( ).y); r=.06;rpm=3600;omegav=rpm*PI/30;vel_r=r*omegav;tetha_1=11*PI/180;tetha_2=60*PI/180;tetha_3=90*PI/180;time_1=tetha_1/omegav;time_2=tetha_2/omegav;t_3=tetha_3/omegav;pr_01=250000;Tr_01=288;pr_02=100000;Tr_02=2 88;gamma=1.4;R_g=287.14;H_t=gamma*R_g*internalFiel d(T)/(gamma-1)+0.5*pow((mag(internalField(U))),2);R_minus=mag( internalField(U))-(2/(gamma-1))*sqrt(gamma*R_g*internalField(T));c_b=(-2*R_minus+sqrt(4*pow(R_minus,2)-4*(1+2/(gamma-1))*((gamma-1)/2)*(pow(R_minus,2)-2*H_t)))/(2+4/(gamma-1));U_b=2*c_b/(gamma-1)+R_minus;";



valueFraction "(y_max-y)/vel_r<time()&&time()<time_1)?1:0";

valueExpression "Tr_01/(1+(gamma-1)/2*(U_b/c_b)^2)";

gradientExpression "0";
value uniform 288;

gschaider December 4, 2012 11:35

Quote:

Originally Posted by immortality (Post 395708)
when I use groovyBC in my run this error is shown.but simple boundary conditions have no error.

error:
---------------------------------------------------------------------------------------
fluxScheme: Kurganov

Starting time loop

Mean and max Courant Numbers = 1.06808 2.25305
deltaT = 1.72414e-07
Time = 1.72414e-07

diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal: Solving for rhoUx, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal: Solving for rhoUy, Initial residual = 0, Final residual = 0, No Iterations 0
swak4Foam: Allocating new repository for sampledGlobalVariables
smoothSolver: Solving for Ux, Initial residual = 0.0172088, Final residual = 2.44657e-17, No Iterations 3
smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 3.09454e-15, No Iterations 3
diagonal: Solving for rhoE, Initial residual = 0, Final residual = 0, No Iterations 0
word::stripInvalid() called for word r
For debug level (= 2) > 1 this is considered fatal
Aborted
---------------------------------------------------------------------------------------

Which version of groovy/swak4Foam do you use? I guess it is an old one (this problem should be fixed in the current release): the problem is that the old version was sensitive to spaces on the left hand side of = (in the current version these get stripped away. Spaces on the right are always ignored). My guess is that you have a space somewhere at the "r=someExpression;" but it is hard to see the way you formatted the output (use the CODE-tag above).

BTW: do yourself a favour and use the list-form for variables (it is much easier to read than the single string:
Code:

variables (
  "var1=pos();"
  "var2=mag(var1);"
);


immortality December 4, 2012 17:44

is it possible to write formulas in more than one line in valueExpression etc too?

gschaider December 4, 2012 19:21

Quote:

Originally Posted by immortality (Post 395784)
is it possible to write formulas in more than one line in valueExpression etc too?

No. Reason is that OF doesn't support multiline string variables in files (at least to my knowledge).


All times are GMT -4. The time now is 03:42.