CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Compiling User Fortran with CFX 14.0 on Win64 (https://www.cfd-online.com/Forums/cfx/127785-compiling-user-fortran-cfx-14-0-win64.html)

Opaque February 12, 2016 12:34

Quote:

Originally Posted by CFXNewbie (Post 584867)
Thanks for your answer!

I understand, that the solution given by PeMo would prevent the solver from calling the subroutine in most cases, which would probably cause abortion of the run, as the result-value from the subroutine is required.

But is there no way to store the result after the first run of the subroutine and use the stored value again always when needed inside current Iteration Loop?

If you use the utility functions for the CFX memory management system, you can store anything you want in your private area, and reuse at will. However, since we do not have the details of what you are doing, I can only warn you that every call to the subroutine is not necessarily for the same mesh faces (assuming is called for faces). Therefore, if your calculation produces a single value for all the faces in the boundary condition, you are safe; otherwise, you must be careful how you store, and retrieve previous data to match the corresponding faces.

My 2 cents, and hope it helps

CFXNewbie February 24, 2016 05:02

Okay, Thanks!

honcho62 February 24, 2016 06:06

I haven't read through your entire code but the fact that your routine is called several times within a single iteration isn't bad necessarily. Even if you run a serial computation some domains and boundaries are split in locales. I've had a similar experience and started outputting the amount of 'successful' actions of my subroutine and noticed it was never the same amount. In other words, as far as I understand, the entire domain is always split some form or another (irrespective of serial/parallel), so you'll always see multiple calls of your subroutine in a single iteration.

CFXNewbie February 25, 2016 10:42

Quote:

Originally Posted by honcho62 (Post 586613)
I haven't read through your entire code but the fact that your routine is called several times within a single iteration isn't bad necessarily. Even if you run a serial computation some domains and boundaries are split in locales. I've had a similar experience and started outputting the amount of 'successful' actions of my subroutine and noticed it was never the same amount. In other words, as far as I understand, the entire domain is always split some form or another (irrespective of serial/parallel), so you'll always see multiple calls of your subroutine in a single iteration.

Thank you for your answer.

The problem is: In the new model I'm using the subroutine instead of the cfx-pre-expressions (old model). Nothing else has changed. The new model needs more computing time compared with the old model. As my task is, to replace the expressions by a subroutine, i cannot go back and use expressions. Thats why I'm desperately looking for a possibility to save computing time....

honcho62 February 26, 2016 02:51

I'm far from an expert on this stuff. But my gut feeling says that Fortran should be as fast if not faster than CEL for simple equations. Have you considered checking things other than the subroutine, like your source coefficient. I've used a different source option (general momentum) and tweaking that coefficient can significantly speed up your simulation.

CFXNewbie March 8, 2016 13:46

thanks again for your answers so far!

i think im very close to a solution now

my idea is, to find out the actual partition number and calculate the scalar only if Partition number is 1 in each Iteration loop. after having calculated it, i want to save it via Memory Manegement System (MMS) and read it from there, when partition number is different from 1.

how can i save a value with MMS and read it from there? i've read chapter 18.6. from the solver modelling guide, but still have no idea how i can save and read values. Ive tried

RZ(1)=P ...if Partition number is 1...
...
...
P=RZ(1) ...else: Partition number not equal 1...

but this didn't work.


Thanks for your help!!! :)

honcho62 March 8, 2016 14:57

The only experience I have with that is passing data to CFX via a junction box sub routine. I'm guessing you'd have to save this data in a pointer probably. I'm not sure how much work this might be, otherwise you could consider making a multi-body mesh and only apply it on the relevant body. It's the same thing, just much easier to accomplish.

Opaque March 8, 2016 17:01

Quote:

Originally Posted by CFXNewbie (Post 588692)
thanks again for your answers so far!

i think im very close to a solution now

my idea is, to find out the actual partition number and calculate the scalar only if Partition number is 1 in each Iteration loop. after having calculated it, i want to save it via Memory Manegement System (MMS) and read it from there, when partition number is different from 1.

how can i save a value with MMS and read it from there? i've read chapter 18.6. from the solver modelling guide, but still have no idea how i can save and read values. Ive tried

RZ(1)=P ...if Partition number is 1...
...
...
P=RZ(1) ...else: Partition number not equal 1...

but this didn't work.


Thanks for your help!!! :)

Have you read the examples in the documentation ? For example, 18.8.1. Junction Box Example 1: Profile Boundary Conditions

It shows how to create a memory data area, store the value of interest, and later how to read it from another routine/function.

Hope the above helps,

CFXNewbie March 9, 2016 10:22

Thank you for your answer!

I've read through example 18.8.1, I'think it's close to my Problem. My idea is now: First calculate and store my value once in each Iteration Loop, using a Junction Box Routine with Location

"Start of Coefficient Loop: Called at the start of each iteration loop. For a transient run, this relates to the inner Loop."

And then read it from stack with a CEL Routine, which is called as often as needed. My Problem now is: The junction box Routine is never executed and therefore the value the CEL Routine is reading from stack is allways Zero.

Any ideas how i can get my Junction Box Routine working?

Thank you! :)

Opaque March 9, 2016 12:45

Did you activate the usage of the Junction Box Routine as outlined in the documentation ?

Quote:

18.2.2. Calling Junction Box Routines

Many junction box routines may be defined, but only those selected on the Solver Control tab will be called during execution of the CFX-Solver. For details, see Basic Settings Tab in the CFX-Pre User's Guide.
Hope the above helps,


All times are GMT -4. The time now is 05:46.