Author |
Message |
Mohammad Rahmani (mrahmani)
Member Username: mrahmani
Post Number: 27 Registered: 10-2004
| Posted on Friday, January 07, 2005 - 01:25 pm: | |
Is it possible to link any user-defined function to a FlexPDE code? i.e a piece of code to do a special job. For optimization and parameter estimation problems you need a little flexibility. I mean can we write such a code in FlexPDE or in a second language such as Fortran/Matlab and use them in FlexPDE. I know we can call the FlexPDE as a computation engine but the procedure is rather slow specially in the case of parameter estimation.
|
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 297 Registered: 06-2003
| Posted on Friday, January 07, 2005 - 05:08 pm: | |
FlexPDE has no provision for linking external plugins. However, the scripting language should be powerful enough to do anything you want. 1. cascaded definitions are implicitly linked through parameter names. 2. parameters can be defined with arguments. 3. one, two or three dimensional tables of anything vs anything can be imported from external computations. 4. "Scalar" variables can form integrals over the mesh or other summary operations. What is your task, that it cannot be encompassed by these facilities? |
Mohammad Rahmani (mrahmani)
Member Username: mrahmani
Post Number: 28 Registered: 10-2004
| Posted on Saturday, January 08, 2005 - 01:21 am: | |
Thanks Robert, In a case I try to estimate kinetic parameters for a catalytic reaction poisoning by a second reaction in a fixed bed reactor. The simplified model contains a set of two coupled PDEs with three unkown parameters. The system is highly nonlinear. I have also a set of experimental data, so from mathematical point of view the task is "parameter estimation". What I did is to implement the PDEs in dimensionless form in FlexPDE and then use Optimization toolbox in Matlab to estimate the parameters. I developed a function in Matlab to write the values of unkwons in a file for each iteration and then call FlexPDE to read the new values, solve the PDEs with new value of unknowns and write the results in a files which can be read by Matlab. Of course the procedure is very slow. I thought it would be very efficient if we could implement the optimization code in FlexPDE and run the whole problem in FlexPDE. p.s: Robert, I remembered a problem, if you add a file by "include" command in a FlexPDE code, after runing the code if you change the included file in a second editor and then run the code again FlexPDE doesn't update the code and you need to close and reopen the code to inform it about the changes. /Mohammad |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 298 Registered: 06-2003
| Posted on Saturday, January 08, 2005 - 02:25 pm: | |
You can declare the three unknown parameters as SCALAR VARIABLES and write equations for them in the EQUATIONS section that drive them toward optimal values. The Newton's method of FlexPDE then becomes the minimizing solver. See the examples "Heaterssi.pde" and "Heaterti.pde" in the "Samples | Misc" folder. |
Mohammad Rahmani (mrahmani)
Member Username: mrahmani
Post Number: 31 Registered: 10-2004
| Posted on Sunday, January 09, 2005 - 12:28 am: | |
Thanks Robert, I will try and inform you the results later /Mohammad |
Jack Zhang (lovekk)
Member Username: lovekk
Post Number: 10 Registered: 01-2007
| Posted on Wednesday, March 21, 2007 - 10:26 pm: | |
I also attach a email Nelson sent to me that seems to be relevant to the above topic as follows: FlexPDE can be run from a command line, so You can run it as a sub-task from any program that can run a system command. You still need to communicate with it through a script file. A controller can in principle write a script and start FlexPDE to run it. You can get information back by EXPORTing data from FlexPDE and reading it from your controller. See "Command-line switches" in the Help Index, where it says: When FlexPDE is run from a command line or as a subtask from another application, there are some command-line switches that can be used to control its behavior: -R Run the file which is named on the command line. Do not enter edit mode. -V View the file which is named on the command line. Do not enter edit mode. -X Exit FlexPDE when the problem completes. -M Run in "minimized" mode (reduced to an icon). -Q Run "quietly". Combines -R -X -M. -S Run "silently". -Q with all error reports supressed. 2. If by back-analysis you mean inverse modeling (computation of parameters from known solutions), you don't need Matlab to do that. FlexPDE was used several years ago at Lawrence Livermore Lab to solve a forward-inverse problem. The report on this work can be seen at http://www-afim.llnl.gov/ Appendix B of this report deals with the specific inverse solution method. A copy of this appendix is posted at www.pdesolutions.com/download/gelinas.appb.doc A lower-level report on the core problem grad(K)<dot>grad(H)=0 was written here at PDE Solutions Inc in 1997. This report can be downloaded from www.pdesolutions.com/download/hyperbolic.doc This report used FlexPDE version 2 and has not been updated since, but I presume the script translation should be straightforward.
|
lee (leemu215)
Member Username: leemu215
Post Number: 21 Registered: 06-2008
| Posted on Friday, October 31, 2008 - 11:47 am: | |
what does it mean by '1. cascaded definitions are implicitly linked through parameter names. ' Thanks. |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 1185 Registered: 06-2003
| Posted on Friday, October 31, 2008 - 02:27 pm: | |
Well, it's been a while since I wrote that post, but I guess what I meant was: You can define cascades of paramaters like the following phony arithmetic VARIABLES U DEFINITIONS A= sin(U) B = 1.0/(1.0 + A^2) C = B^3 + A EQUATIONS div(B*grad(u)) + C = 0 All the cascaded definitions will be substituted into the equation, and the total dependency on U will be computed.
|