function call Log Out | Topics | Search
Moderators | Register | Edit Profile

FlexPDE User's Forum » User Postings » function call « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Lichun Zhu (lzhu)
New member
Username: lzhu

Post Number: 1
Registered: 11-2003
Posted on Thursday, November 13, 2003 - 09:56 am:   

hi,
I am new to flexpde. One thing I want to know is that can we implement external functions calls like function calls in C language (either in C or flexPDE script)? This way we can easily call that function in the main FlexPde script.
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 61
Registered: 06-2003
Posted on Thursday, November 13, 2003 - 02:35 pm:   

FlexPDE does not have facilities for linking to external C code.

The FlexPDE scripting language contains extensive facilities for defining cascaded dependencies. Just define your dependency in the DEFINITIONS section, and FlexPDE will figure out how to use it. Many of our examples use such definitions. See for example "Samples | steady_state | chemistry | reaction.pde".

Or you can use the TABLE facility to encode the results of complex external computations. Table coordinates are arbitrary, so you can tabulate vs a computed quantity.

Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 62
Registered: 06-2003
Posted on Thursday, November 13, 2003 - 02:44 pm:   

You can also use what we call "Parameterized definitions" (equivalent to "function definitions"). See the Help section "Problem Descriptor Reference | Sections | Definitions | Parameterized Definitions" and the example "Samples | Misc | Funcdef.pde".
[Note that these definitions are text-replacement functions, not runtime calls.]
Top of pagePrevious messageNext messageBottom of page Link to this message

Lichun Zhu (lzhu)
New member
Username: lzhu

Post Number: 2
Registered: 11-2003
Posted on Thursday, November 13, 2003 - 05:00 pm:   

Hi, Robert:
Thanks for your reply. I am doing a permafrost thermal modeling project. For that, I need quite complex boundary condition, that boundary condition will be the output of another ecosystem model. But the ecosystem model will also need the Temperature (it will be the field variable in the PDE). Then this two models need dynamic interaction in each step. The ecosystem model is already in C. If FlexPde have the capability to link external functions (just the same as your internal functions such as sin(t)), It will be a great improvement for your software, it will provide great flexibility to user. Do you have any plan to add this kind of capability?
Thanks.

Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 63
Registered: 06-2003
Posted on Friday, November 14, 2003 - 02:43 pm:   

Linking to external functions raises serious difficulties in defining what part of the FlexPDE environment needs to be passed to the external function, and how to specify that export.

We do not at present have plans to implement this facility.

You can export data tables as a result of the FlexPDE computation, and you can read in tables from an external source. But this cannot be done on a timestep-by-timestep basis.

The best I can offer is that you try to condense the results of your external computation into a 1- 2- or 3-dimensional table in which FlexPDE can look up the BC behavior.
Top of pagePrevious messageNext messageBottom of page Link to this message

Lichun Zhu (lzhu)
Junior Member
Username: lzhu

Post Number: 3
Registered: 11-2003
Posted on Monday, November 17, 2003 - 10:08 am:   

Hi, Robert:
I think theoretically, this can be fairly straight forward. For example:
For each step:
TIME
From StartTime To EndTime By TimeInc
Call BoundaryFunc(PreviousStepTemperatureArray, return_value_of_current_step_boundary_TemperatureArray)

Internally, you need to call this function at each step. Any comments?


Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Topics | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration