User_Defined_Script output issue
Posted: Sun Jun 21, 2015 12:28 pm
Hello, basically I was simulating an aerofoil in flowfield. I need to use scripts to generate instaneous lift and drag on different spanwise positions (Z direction) of the aerofoil and save to differenct files. As the spanwise positions could be more than 40, I wrote a loop as follows to output the data.
"if (ineedf.eq.1) then
do ioutput = 2, 3
do ii = 1, ndim
xfor(ii) = 0.d0
enddo
a1 = 0.1d0 * dble(ioutput-2) / 2.0d0
a2 = 0.1d0 * dble(ioutput-1) / 2.0d0
write(nfecra,*) a1, a2
call getfbr('AIRFOIL and z > a1 and z < a2', nlelt, lstelt)
!==========
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
do ii = 1, ndim
xfor(ii) = xfor(ii) + bfprp_for(ii, ifac)
enddo
enddo
if (irangp.ge.0) then
call parrsm(ndim,xfor)
endif
!Output Forces
if (irangp.le.0) then
write(impusr(ioutput),*)ntcabs,xfor(1),xfor(2),xfor(3)
endif
enddo
endif"
And the error is always:
"fvm_selector_postfix.c:1281: Fatal error.
Error parsing expression:
AIRFOIL and z > a1 and z < a2
.................^
Operator needs a floating point operand
on one side, x, y, or z on the other"
But when I change a1 and a2 to real numbers say 0.0 or 0.05, it works perfectly. And the correct values of a1 and a2 can be printed into listing file successfully. It seems to me that CodeSaturne cannot recognise a1 and a2 when I am using the function "getfbr".
Can someone help please? I don't want to copy and paste 40 times to make the function run.

"if (ineedf.eq.1) then
do ioutput = 2, 3
do ii = 1, ndim
xfor(ii) = 0.d0
enddo
a1 = 0.1d0 * dble(ioutput-2) / 2.0d0
a2 = 0.1d0 * dble(ioutput-1) / 2.0d0
write(nfecra,*) a1, a2
call getfbr('AIRFOIL and z > a1 and z < a2', nlelt, lstelt)
!==========
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
do ii = 1, ndim
xfor(ii) = xfor(ii) + bfprp_for(ii, ifac)
enddo
enddo
if (irangp.ge.0) then
call parrsm(ndim,xfor)
endif
!Output Forces
if (irangp.le.0) then
write(impusr(ioutput),*)ntcabs,xfor(1),xfor(2),xfor(3)
endif
enddo
endif"
And the error is always:
"fvm_selector_postfix.c:1281: Fatal error.
Error parsing expression:
AIRFOIL and z > a1 and z < a2
.................^
Operator needs a floating point operand
on one side, x, y, or z on the other"
But when I change a1 and a2 to real numbers say 0.0 or 0.05, it works perfectly. And the correct values of a1 and a2 can be printed into listing file successfully. It seems to me that CodeSaturne cannot recognise a1 and a2 when I am using the function "getfbr".
Can someone help please? I don't want to copy and paste 40 times to make the function run.

