CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

How to implant anisotropic electrical conductivity UDF inside fluent's PEMFC module

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 24, 2022, 04:41
Default How to implant anisotropic electrical conductivity UDF inside fluent's PEMFC module
  #1
New Member
 
Qingshan Liu
Join Date: Oct 2021
Posts: 9
Rep Power: 5
brucelqs is on a distinguished road
Hi all, I have encountered a problem. After I implanted the anisotropic conductivity UDF in the fluent fuel cell module, and clicked the "Calculate" button, the program did not run, and the following error message popped up when I exited the software "Error at Node 0: No anisotropic UDS diffusivity option" has been selected for difflayer". I tried to add the anisotropic conductivity of UDS-0 (i.e. electron potential) within the source code and through UDF, but both failed. Please help me, I don't know where the problem is.

Here is the code I use inside the source code (pemfc_user.c):
Code:
DEFINE_ANISOTROPIC_DIFFUSIVITY(aniso_econd, c, t, i, dmatrix)
{
  anisotropic_elec_cond(c, t, i, dmatrix);
    
  if (pem_initialized && User_Defined_Non_Iso_Econd)
  {
    int zt = get_fc_zone_type(t->id);

    if (zt == adl_zone || zt == cdl_zone || zt == amp_zone || zt == cmp_zone)
    {
      /*--- In this section, users can redefine the "dmatrix" that was computed above for GDL andd MPL only ---*/
        real por, ip, tp, tri, trp;
        por = C_POR(c, t);
        ip = 1. - (3. * por / (2. + por)) * 0.962 * exp(0.367 * (1. - por)) * pow(1. - por, -0.016);
        tp = 1. - (3. * por / (2. + por)) * 0.962 * exp(0.889 * (1. - por)) * pow(1. - por, -0.00715);
        tri = sqrt(ip);
        trp = sqrt(tp);
        real x[3][3];
        static const real diff[3] = { 23000.,23000.,23000. }; //diff is inherent conductivity
        x[1][0] = x[0][1] = 0.0;
        x[2][0] = x[0][2] = 0.0;
        x[2][1] = x[1][2] = 0.0;
        x[2][2] = x[0][0] = tri;
        x[1][1] = trp;

        dmatrix[0][0] = diff[0] * x[0][0] * x[0][0] 
            + diff[1] * x[1][0] * x[1][0]   
            + diff[2] * x[2][0] * x[2][0];  //XX direction,x[1][0]=0,x[2][0]=0
        dmatrix[1][1] = diff[0] * x[0][1] * x[0][1] 
            + diff[1] * x[1][1] * x[1][1]   
            + diff[2] * x[2][1] * x[2][1];  //YY direction,x[0][1]=0,x[2][1]=0
        dmatrix[1][0] = diff[0] * x[0][1] * x[0][0]
            + diff[1] * x[1][1] * x[1][0]
            + diff[2] * x[2][1] * x[2][0];  //dmatrix[1][0]=0
        dmatrix[0][1] = dmatrix[1][0];  //dmatrix[0][1]=0
        dmatrix[2][2] = diff[0] * x[0][2] * x[0][2] 
            + diff[1] * x[1][2] * x[1][2]   
            + diff[2] * x[2][2] * x[2][2];  //ZZ direction,x[0][2]=0,x[1][2]=0
        dmatrix[0][2] = diff[0] * x[0][0] * x[0][2]
            + diff[1] * x[1][0] * x[1][2]
            + diff[2] * x[2][0] * x[2][2];  //dmatrix[0][2]=0
        dmatrix[2][0] = dmatrix[0][2];  //dmatrix[2][0]=0
        dmatrix[1][2] = diff[0] * x[0][1] * x[0][2]
            + diff[1] * x[1][1] * x[1][2]
            + diff[2] * x[2][1] * x[2][2];  //dmatrix[1][2]=0
        dmatrix[2][1] = dmatrix[1][2];  //dmatrix[2][1]=0
    }
  }

  return;
}
I turned on the "Anisotropic E-cond. in GDL/MPL" option in the module, hooked the UDF in the material of GDL and MPL, I tried using the "orthotropic" option, the anisotropic conductivity option was able to calculate correctly , but it fails after loading the UDF.

Below is a screenshot from the software:
1.jpg

2.jpg

3.png
brucelqs is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conductivity as a vector value Nurzhan CFX 19 June 19, 2021 06:30
Anisotropic thermal conductivity UDF Kwiaci Fluent UDF and Scheme Programming 2 January 20, 2017 09:42
Question about anisotropic thermal conductivity Szweyk STAR-CCM+ 2 June 30, 2016 09:26
UDF for specific heat and electrical conductivity walied123 Fluent UDF and Scheme Programming 4 February 20, 2015 07:17
Help with electrical conductivity in Fuel cells Golnaz FLUENT 3 June 17, 2011 17:21


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