|
[Sponsors] |
October 10, 2017, 21:52 |
Making changes in the fluent user file
|
#1 |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
Hi everyone,
I am working on modelling of PEM fuel cell. I want to change the value of “phase_ch_const” value in the ansys user file (pem_user.c). I am trying to fix since last month, but not getting any clue. Can someone help to get out of this problem. The pic of code is attached. Cheers,IMG_5124.jpg |
|
October 10, 2017, 23:03 |
|
#2 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
Next time put here code, not picture of code. Did you try this one? Code:
cxboolean const_rate_from_gui = FALSE; real phase_ch_const = 999999999999999999999999999; return phase_ch_const; |
||
October 10, 2017, 23:05 |
|
#3 | |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
Quote:
Do I need to compel it after making changes? When I try to compel it after changes I get this error ( pic attached)Image1507687508.794312.jpg |
||
October 10, 2017, 23:13 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Go to the C:\Program Files\ANSYS Inc\v170\fluent\fluentXXXX\addons\fuelcells
Inside you have 2 files INSTRUCTIONS-CLIENT and makefile_master-client.nt In INSTRUCTIONS-CLIENT there is information regarding FC model For example Code:
====================== Customizing the module ====================== The PEM module has a user-modifiable component called "pem_user.c", which can be edited and recompiled to create a customized version of the PEM library. On both systems it is recommended that you make a copy of the addons/fuelcells directory to a local directory. Changes to the user-customizable part of the library should be made in your copy. The user customizable file is .../addons/fuelcells/src/pem_user.c This is the only source file you will edit. =================== Customizing on Unix =================== * Edit line 11 of fuelcells/src/makefile so that FLUENT_INC points to the official fluent installation directory. This is normally [path]/ansys_inc/vXX.X/fluent !!! MAKE SURE THAT THERE ARE NO BLANK SPACES TRAILING THIS DIRECTORY NAME * Build the library from the fuelcells directory with the following command: make -f Makefile-client FLUENT_ARCH=lnx86 (on other systems, use the appropriate architecture) ====================== Customizing on Windows ====================== * Define environment variable FLUENT_INC to point to the official fluent installation directory. - note on Windows this looks like [path]\ANSYS Inc\vXX.X\fluent * Build the library from the fuelcells directory with the following command: nmake /f makefile_master-client.nt Then run command nmake /f makefile_master-client.nt from SDK command promt. You should be in this folder C:\Program Files\ANSYS Inc\v170\fluent\fluentXXXX\addons\fuelcells Best regards |
|
October 11, 2017, 00:06 |
|
#5 |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
I have followed the steps but didn’t get any changes in results
|
|
October 11, 2017, 00:50 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
You may try to use UDM variable to plot the contour of phase_ch_const
Code:
cxboolean const_rate_from_gui = FALSE; real phase_ch_const = 999999999999999999999999999; C_UDMI(c,t,0) = phase_ch_const; return phase_ch_const; Best regards |
|
October 11, 2017, 00:52 |
|
#7 |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
How I can make sure that fluent is now using my customisable file?
Regards, |
|
October 11, 2017, 01:00 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
That is the way. You will deg user-defined variable that can be monitored directly from Fluent GUI.
The other way, but it is just to check, is to put output message inside the code. For example Code:
real Phase_Change_const(cell_t c, Thread *t) { cxboolean const_rate_from_gui = FALSE; real phase_ch_const = 999999999999999999999999999; C_UDMI(c,t,0) = phase_ch_const; Message("Modification is made, phase_ch_const = %f",phase_ch_const); return phase_ch_const; } |
|
October 11, 2017, 01:03 |
|
#9 |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
I am running my simulations in parallel for 500 iterations to check the changes in results
|
|
October 11, 2017, 01:06 |
|
#10 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
For parallel case use
Code:
real Phase_Change_const(cell_t c, Thread *t) { cxboolean const_rate_from_gui = FALSE; real phase_ch_const = 999999999999999999999999999; C_UDMI(c,t,15) = phase_ch_const; Message0("Modification is made, phase_ch_const = %f",phase_ch_const); return phase_ch_const; } Go to User-Defined -> Memory -> change 15 to 16 (15 is default number regarding source file of FC model, it you made other modifications take it into account) Best regards |
|
October 11, 2017, 01:13 |
|
#11 |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
I m using vs12 command prompt instead of sdk, pic attached IMG_5133.jpg
|
|
October 11, 2017, 01:18 |
|
#12 |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
now i m getting this error after making the above changes
> No error handler available Error: Cortex received a fatal signal (SEGMENTATION VIOLATION). Error Object: () |
|
October 11, 2017, 02:11 |
|
#13 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
There were errors during compiling process, don't you see?
Looks like your compiler uses x86, but your computer has x64 architecture. You need to install x64 compiler. I recommend you to read help article: https://www.cfd-online.com/Wiki/Flue...Fload_a_UDF.3F Best regards |
|
October 11, 2017, 03:09 |
|
#14 |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
Is there any way to check the value of condensation rate constant in GUI?
|
|
October 11, 2017, 04:01 |
|
#15 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
I described before the ways, how you can monitor phase content, but it requires modification of source code and compiling
This is a list of built in variables, that you can monitor using default library (without any modifications) Code:
void Set_UDS_Names(char uds[n_uds_required][STRING_SIZE]) { strncpy(uds[0], "Electric Potential", STRING_SIZE-1); strncpy(uds[1], "Protonic Potential", STRING_SIZE-1); strncpy(uds[2], "Water Saturation", STRING_SIZE-1); strncpy(uds[3], "Water Content", STRING_SIZE-1); } void Set_UDM_Names(char udm[n_udm_required][STRING_SIZE]) { strncpy(udm[ 0], "X Current Flux Density", STRING_SIZE-1); strncpy(udm[ 1], "Y Current Flux Density", STRING_SIZE-1); strncpy(udm[ 2], "Z Current Flux Density", STRING_SIZE-1); strncpy(udm[ 3], "Current Flux Density Magnitude", STRING_SIZE-1); strncpy(udm[ 4], "Ohmic Heat Source", STRING_SIZE-1); strncpy(udm[ 5], "Reaction Heat Source", STRING_SIZE-1); strncpy(udm[ 6], "Overpotential", STRING_SIZE-1); strncpy(udm[ 7], "Phase Change Source (PEM)", STRING_SIZE-1); strncpy(udm[ 8], "Osmotic Drag Coefficient (PEM)", STRING_SIZE-1); strncpy(udm[ 9], "Liquid Water Activity (PEM)", STRING_SIZE-1); strncpy(udm[10], "Membrane Water Content (PEM)", STRING_SIZE-1); strncpy(udm[11], "Protonic Conductivity", STRING_SIZE-1); strncpy(udm[12], "Back Diffusion Source(PEM)", STRING_SIZE-1); strncpy(udm[13], "Transfer Current", STRING_SIZE-1); strncpy(udm[14], "Osmotic Drag Source (PEM)", STRING_SIZE-1); } |
|
March 26, 2018, 20:15 |
|
#16 |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
Hi Alexander hope u will be fine. I am trying to compare polarization curve of simulation with experimental. My question at which surface should I take the value of current means at membrane/ cathode catalyst interface or external surface ie terminal of cathode side?
|
|
March 26, 2018, 22:21 |
|
#17 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
i think you should take a look into ANSYS Fluent Advanced Add-On Modules file
in part V you may find information regarding PEMFC simulation in fluent best regards |
|
March 26, 2018, 22:22 |
|
#18 |
New Member
Arif
Join Date: Sep 2017
Posts: 17
Rep Power: 9 |
Thanks for the reply
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom Thermophysical Properties | wsmith02 | OpenFOAM | 4 | June 1, 2023 15:30 |
polynomial BC | srv537 | OpenFOAM Pre-Processing | 4 | December 3, 2016 10:07 |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 17:02 |
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error | FerdiFuchs | OpenFOAM Community Contributions | 27 | April 16, 2014 16:14 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |