Boundary finite element method in Maple

4 replies · 2K views · last reply
Charles95
Messages
3
Reaction score
0
TL;DR
Fix Maple error in a home made program on Maple
I would like any tips about a Maple ''home made'' program that I received for a project but this program seems to stop before the very end of the code. I want to find de lift of an airfoil with Boundary finites elements method. I have this error at the very end :
Error, (in fprintf) number expected for floating point format. This code is very long, so I don't want to send all of it. I sent the code lines at the end of the program and the text is in french if you need to translate. The program want to find the speed potential, his derivative, the pressure at the extrados and intrados and finally the lift and lift coefficient. I also think that this error occurs near the end of the code for the printing of results. So here is five pictures that resume the end of the program which think would be related to my error. Is someone can help me?

Maple source code excerpt in red text: initialises rho, alpha, ITT, c, cl, L, P, s, sets up vp as a matrix and loops over i to assign vp[i] from DFI[k], then computes vtot, dx, dy, nx, ny and nx for boundary points.
Screenshot of Maple code in red text showing a loop computing normals nx and ny with elif and else branches, then vinf[i] and vtot[i] assignments and an if i=1 then block.
Screenshot of Maple code in red text, showing a loop that computes lift: P[i] = -0.5*rho*vtot[i]^2, then a for loop from 2 to N summing L with P and X differences, then cl = L/(0.5*rho*c) and CL[ITT] = cl.
Screenshot of Maple source code in French with red monospaced text: comments about writing the DLOAD subroutine from an ABAQUS template, a for loop setting Z_temp, and Matrix initializations for X_aba, Y_aba, Z_aba and P_aba.
Screenshot of Maple code in red monospace text: arrays X_aba, Y_aba, Z_aba and P_aba are built in nested loops, then written with fprintf to a text file in a for loop over 1 to 200, with a fclose at the end.
Screenshot of a French-language Maple matrix browser window titled Naviguer dans la matrice, showing rows 186 to 200 of a 200 by 4 matrix with a red error line below.

As you can see for the point #200 it doesn't calculate the last Pressure value and I think it's the reason why the programm doesn't calculate the lift of the airfoil as supposed in picture #3.
Vp is speed perturbated, Vinf is speed at infinity in the domain far from the airfoil. X, Y ,Z are coordinates on the airfoil boundary. If you need any informations please ask me.

Thank you very much!
 
The problem appears to come from the line
Code:
P_aba[i]:=1E-6*P[k]
when k=101. I suspect that P has a dimension of 100 (is N=100?).
 
Yes N = 100. What do I need to change? I'm not very good in programming, but if I change P[k] to P[k-1] or P_aba to P_aba[i-1] could it solves my problem?

Thanks!
 
Charles95 said:
Yes N = 100. What do I need to change? I'm not very good in programming, but if I change P[k] to P[k-1] or P_aba to P_aba[i-1] could it solves my problem?

Thanks!
If by solving the problem, you mean "get rid of the error message," then yes. If instead you mean "get the correct answer," then probably not.

Fixing this will require going back to the original equations and figuring out what is going wrong.
 
DrClaude said:
If by solving the problem, you mean "get rid of the error message," then yes. If instead you mean "get the correct answer," then probably not.

Fixing this will require going back to the original equations and figuring out what is going wrong.
I would like to fix both, but when I write P[k-1] it put the error at the beginning of the vector result. So it means that at P[0] I get the error 0.1E-05*P[0] instead of 0.1E-05*P[101]. How should I fix that? I would like to solve the problem for the correct answer, but I just don't know how we could proceed so I guess I need to turn back to my teacher...