Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Unable to hook the compiled UDF

    • Qingshan Liu
      Subscriber

      I am working on the problem of specifying anisotropic electric conductivity to the gas diffusion layer of a fuel cell, using the PEM Fuel Cell module that comes with Fluent. Since the module treats the electric-potential as UDS-0, the DEFINE_ANISOTROPIC_DIFFUSIVITY macro is required to specify the corresponding electric conductivity. The source code gives the appropriate modification areas and hints, and I made the changes in the appropriate locations in the source code. After recompiling the source code, the software did not prompt for errors, and the following is the complete code for that section. However, after I hook the compiled UDF to the GDL material and run it, the console pops up with the error "Error at Node X(0-7): No anisotropic UDS diffusivity option has been selected for difflayer " error report, and the software does not run. Here is how I hooked the UDF. I don't know why this error message appears, does this mean that the UDF was not hooked successfully? After I modified this part of the code and compiled it as a separate UDF file, the same error is not reported by the software, but the same error occurs after mounting and running. Please help me!?

    • Rob
      Forum Moderator

      Did you set the other 4 UDS diffusivuty values?

      • Qingshan Liu
        Subscriber

        The values of the other four UDS diffusivuty are set as follows:

    • Rob
      Forum Moderator

      User defined as what? Shouldn't the UDF label show up? Put a constant in for UDS1-4 and see if it works. 

      • Qingshan Liu
        Subscriber

        As you suggested, I specified the UDS-1 (protonic potential) of the catalyst as a constant value of 5, but after 10 iterations, the protonic potential diffusion coefficient calculated using the Report command is not equal to 5. The following figure shows.

    • Rob
      Forum Moderator

      But it runs, so that's pointing at the UDF setting. 

      Re the returned value. It's fine here, I've checked with two scalars on a test case. How's the mesh resolution in that cell zone? What values are set for scalar bc's?  

      • Qingshan Liu
        Subscriber

        I am using catalyst to test if assigning diffusivity to UDS works, and for difflayer it still doesn't work after hooking UDF. Can you tell me why the value of protonic potential diffusivity calculated with Report (anode and cathode catalyst do not agree and are not equal to 5) is not equal to the value (constant value 5) I specified for UDS-1 (protonic potential)? I started the modeling from modeling, drew the mesh, set the case, and the result is still the same as before, which means that it is not a problem with the mesh. The mesh quality is as follows.

        Mesh Quality:

        Minimum Orthogonal Quality = 7.07226e-01 cell 1084 on zone 24 (ID: 183000 on partition: 2) at location ( 5.53174e-04, 3.10227e-03, 9.95000e-03)

        Maximum Aspect Ratio = 8.77089e+01 cell 1960 on zone 29 (ID: 86124 on partition: 2) at location ( 1.50000e-04, 1.75887e-03, 7.65000e-03)

        My boundary condition settings are the same as those given in the module calculation, as shown below.

    • Rob
      Forum Moderator

      What else is set in those cell zones? 

      • Qingshan Liu
        Subscriber

        I can't quite understand what you mean, can you explain? And what should I do next? Thanks!?

    • Rob
      Forum Moderator

      Any other models? Ie where did the current density come from, any porous media etc.   Not sure how to fix without a lot more digging: we (staff) are not able to do that via the Community either. 

      Usual trick is to turn stuff off and test on a simple model. So, try your UDF out on a pipe or similar geometry. Then make it more complicated. 

      • Qingshan Liu
        Subscriber

        Ok, I will try it as you suggested to test if the PEM Fuel Cell module is causing the problem. Thanks!?

      • Qingshan Liu
        Subscriber

        With the assistance of my friend and after my testing, I found that this situation of the diffusivity calculated by Report not being equal to the specified value after assigning a constant value to UDS-1 still exists under different computers, different software versions and different cases. I think this is a bug in the software itself.?

    • Qingshan Liu
      Subscriber

      After my further testing, the results calculated by Report do not change even when I assign all UDS to the constant value 0. This means that assigning other values to the UDS or hooking the UDF does not work under the PEM Fuel Cell module, please tell me where I should change to have a real impact on the UDS??

    • Rob
      Forum Moderator

      Just read up on the model, I think I have an answer, if not a colleague (who uses the PEMFC module) is checking. 

      https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_ug/flu_pemfc_chap_pem_using.html

      Click on Help in Fluent, then paste the link into the browser, you want the limitations section. 

    • Qingshan Liu
      Subscriber

      I tried the Fuel Cell & Electrolysis module again, and under that module, the same problem still occurs! What should I do to hook UDF for each UDS under the PEM Fuel Cell module?

    • Qingshan Liu
      Subscriber

      I saw the limitations stated in the document and I was wondering if the anisotropic of the electric and protonic potential is also considered in the species diffusivity? I thought the species diffusivity refers to the diffusivity of gases and liquids.

      Note the following limitation when using the PEMFC model:
      • The anisotropic species diffusivity option is not compatible with the PEMFC model.

    • Rob
      Forum Moderator

      From our expert. 

      UDS-0 is an allocated electric potential. It cannot be different in 3 different directions. Having said this, the current density can. The current is the product of electric conductivity and the potential gradient in any given direction.

      The Theory Guide has the equations in tensor form. 

      • Qingshan Liu
        Subscriber

        Thank you for your answer, but I still have a question. The following code is from the source code of the ANSYS Fluent PEM Fuel Cell module, which states that users can specify anisotropic electric conductivity for UDS-0, but I am unable to run the program after specifying it as required. Can you give me a sample code? So that I can specify the anisotropic conductivity and run the software.

    • Rob
      Forum Moderator

      Can you try with a different value in the UDS?  Say, 2, 3, 4, 5 for each UDS respectively. It's to test which values the solver thinks it's using. 

      • Qingshan Liu
        Subscriber

        Sorry for the late reply, please see the message I replied to earlier, I have tested giving the UDS a constant value to test but found that assigning any constant value to UDS-1 for the catalyst layer is invalid, maybe a bug in the PEM Fuel Cell module??

    • Rob
      Forum Moderator

      Possibly, a colleague is watching the thread, he's too familiar with the module to be safe to post: we can only discuss what's in the documentaiton or that is "common knowledge". I'll remind him to check. It may be limited to the anisotropic part: I don't use that module so am not able to quickly check. 

      • Qingshan Liu
        Subscriber

        Thanks for your help and if you have any suggestions, please do not hesitate to contact me.?

Viewing 12 reply threads
  • The topic ‘Unable to hook the compiled UDF’ is closed to new replies.