CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[openFuelCell] pemfcSinglePhaseModel-4.0 on OpenFOAM

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree10Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 12, 2018, 00:37
Default pemfcSinglePhaseModel-4.0 on OpenFOAM
  #1
Senior Member
 
Ramakant Gadhewal
Join Date: Apr 2010
Location: Chemical Engineering,National Institute of Technology,Warangal (T.S.),India
Posts: 112
Rep Power: 12
ramakant is on a distinguished road
Dear All

I need your comments on compiling the above PEM fuel cell Single Phase model. When I am compiling ./Allwmake its shows fatal error. Please, any can give me solution for this.


Thank you

Ramakant
Attached Images
File Type: jpg PEM.jpg (137.1 KB, 30 views)
AmBeWo likes this.
ramakant is offline   Reply With Quote

Old   September 18, 2018, 11:00
Default pemfc Model OFv4.0
  #2
New Member
 
Amadeus Wolf
Join Date: Dec 2017
Location: Germany
Posts: 10
Rep Power: 4
AmBeWo is on a distinguished road
Hey everyone,

I am currently on working with the pemfc-Model for OFv4.0 which is based on openFuelcell.

http://www.mdpi.com/2079-3197/6/2/38

and

http://dx.doi.org/10.17632/3gz7pxznzn.1


Does anyone have already experience with it?


When I try to compile the model I get the following error:

Quote:
/OpenFOAM/OpenFOAMv4.0/OpenFOAM-4.0/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt64Opt/pemfcSinglephaseNonIsothermalSolver.o' failedmake: *** [Make/linux64GccDPInt64Opt/pemfcSinglephaseNonIsothermalSolver.o] Error 1
Can someone help?
Thanks in advance
AmBeWo is offline   Reply With Quote

Old   September 18, 2018, 12:00
Default
  #3
Senior Member
 
Ramakant Gadhewal
Join Date: Apr 2010
Location: Chemical Engineering,National Institute of Technology,Warangal (T.S.),India
Posts: 112
Rep Power: 12
ramakant is on a distinguished road
Quote:
Originally Posted by AmBeWo View Post
Hey everyone,

I am currently on working with the pemfc-Model for OFv4.0 which is based on openFuelcell.

http://www.mdpi.com/2079-3197/6/2/38

and

http://dx.doi.org/10.17632/3gz7pxznzn.1


Does anyone have already experience with it?


When I try to compile the model I get the following error:

Can someone help?
Thanks in advance
Dear
I am also working/using on the same openfuelcell code and getting the same kind of the compilation (./Allwmake) error.
ramakant is offline   Reply With Quote

Old   September 19, 2018, 10:04
Default
  #4
New Member
 
Michal
Join Date: Sep 2018
Posts: 2
Rep Power: 0
Amalryk is on a distinguished road
Quote:
Originally Posted by ramakant View Post
Dear
I am also working/using on the same openfuelcell code and getting the same kind of the compilation (./Allwmake) error.
Hello!

Same here, I contacted the main author of the paper, unfortunately he could not assist me with the issue. I think that the uploaded code lacks an important detail (it is unfinished, perhaps?). For example, during compilation (before the crash) the first (from many) error is given with the following message:

Quote:
In file included from pemfcSinglephaseNonIsothermalSolver.C:104:0: ../src/patch/createPatchToPatchInterpolation.H: In function ‘int main(int, char**)’:
../src/patch/createPatchToPatchInterpolation.H:10:5: error: ‘mypatchToPatchInterpolation’ was not declared in this scope
mypatchToPatchInterpolation anodeToCathode
^
This can be "repaired" by changing "mypatchToPatchInterpolation" phrase to "myPatchToPatchInterpolation" in the createPatchToPatchInterpolation.H file. When you replace the phrases, the error is gone but the following occur:
Quote:
In file included from pemfcSinglephaseNonIsothermalSolver.C:104:0: ../src/patch/createPatchToPatchInterpolation.H: In function ‘int main(int, char**)’:
../src/patch/createPatchToPatchInterpolation.H:10:33: error: missing template arguments before ‘anodeToCathode’
myPatchToPatchInterpolation anodeToCathode
_______________________^
../src/patch/createPatchToPatchInterpolation.H:12:33: error: missing template arguments before ‘cathodeToAnode’
myPatchToPatchInterpolation cathodeToAnode
_______________________^
[...]
and so on, ending with:
Quote:
/opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/pemfcSinglephaseNonIsothermalSolver.o' failed
make: *** [Make/linux64GccDPInt32Opt/pemfcSinglephaseNonIsothermalSolver.o] Error 1
I tried to look at the code more carefully but its structure stays unclear to me . Any suggestions would be appreciated
Amalryk is offline   Reply With Quote

Old   September 23, 2018, 01:02
Default pemfcSinglePhaseModel-4.0 with OpenFOAM
  #5
Senior Member
 
Ramakant Gadhewal
Join Date: Apr 2010
Location: Chemical Engineering,National Institute of Technology,Warangal (T.S.),India
Posts: 112
Rep Power: 12
ramakant is on a distinguished road
I have installed on my computer the OF4.0 (Ubuntu 16.04 on OS) as per the author instructions and try to compile the pemfcSinglePhaseModel-4.0.While compiling (./Allwclean & ./Allwmake ) the following error is showing on the screen. Please give some comments on the error.

Thank you
Ramakant
Attached Images
File Type: jpg mypatchToPatchInterpolation.jpg (172.3 KB, 22 views)
ramakant is offline   Reply With Quote

Old   September 26, 2018, 17:50
Default
  #6
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,956
Blog Entries: 43
Rep Power: 122
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all,

I've split off from the OpenFuelCell thread, the posts that are referring to the package provided here: http://dx.doi.org/10.17632/3gz7pxznzn.1

Apparently that ZIP file was somehow corrupted by someone in the middle... what I mean is that the file "lib/myPatchToPatchInterpolation/mypatchToPatchInterpolation.H" was replaced by the content from "lib/myPatchToPatchInterpolation/myPatchToPatchInterpolation.H", which is why this problem is occurring. It's possible to recover the broken file, by using the original code "patchToPatchInterpolation.H" from OpenFOAM 4.0 as a basis.

After downloading the ZIP file, I've ran the following commands, in order to be able to compile the code with OpenFOAM 4.0, along with the necessary corrections:
Code:
unzip pemfcSinglePhaseModel-4.0.zip
cd pemfcSinglePhaseModel-4.0
cd pemfcSinglePhaseNonIsothermalSolver
find -name "All*" | xargs chmod +x
cp $FOAM_SRC/OpenFOAM/interpolations/patchToPatchInterpolation/patchToPatchInterpolation.H lib/myPatchToPatchInterpolation/mypatchToPatchInterpolation.H
sed -i -e 's=patchToPatchInterpolation=mypatchToPatchInterpolation=g'  -e 's=PatchToPatchInterpolation=myPatchToPatchInterpolation=g' lib/myPatchToPatchInterpolation/mypatchToPatchInterpolation.H
./Allwmake > log.make 2>&1
./Allwmake > log.make2 2>&1
The last 2 commands will create 2 log files: "log.make" and "log.make2", where the second file should have something like this inside:
Code:
...
..../libSinglephasePEMFC.so' is up to date.
...
.../pemfcSinglephaseNonIsothermalSolver' is up to date.

Best regards,
Bruno
ramakant and aalzoubi06 like this.
__________________
wyldckat is offline   Reply With Quote

Old   September 27, 2018, 03:20
Default
  #7
New Member
 
Amadeus Wolf
Join Date: Dec 2017
Location: Germany
Posts: 10
Rep Power: 4
AmBeWo is on a distinguished road
Hey Bruno,

worked out really well in my case too.
Many thanks for your support!

Best,
Amadeus
ramakant likes this.
AmBeWo is offline   Reply With Quote

Old   September 27, 2018, 04:38
Default
  #8
Senior Member
 
Ramakant Gadhewal
Join Date: Apr 2010
Location: Chemical Engineering,National Institute of Technology,Warangal (T.S.),India
Posts: 112
Rep Power: 12
ramakant is on a distinguished road
Quote:
Originally Posted by AmBeWo View Post
Hey Bruno,

worked out really well in my case too.
Many thanks for your support!

Best,
Amadeus
worked out really well in my case too.
Many thanks for your support!

thnak you
Ramakant
ramakant is offline   Reply With Quote

Old   September 27, 2018, 04:45
Default
  #9
New Member
 
Michal
Join Date: Sep 2018
Posts: 2
Rep Power: 0
Amalryk is on a distinguished road
Hi!

The model works fine now. Thank you!

Best regards,
Michal
Amalryk is offline   Reply With Quote

Old   September 27, 2018, 10:13
Default
  #10
Senior Member
 
Ramakant Gadhewal
Join Date: Apr 2010
Location: Chemical Engineering,National Institute of Technology,Warangal (T.S.),India
Posts: 112
Rep Power: 12
ramakant is on a distinguished road
Quote:
Originally Posted by Amalryk View Post
Hi!

The model works fine now. Thank you!

Best regards,
Michal
Please tell me any one of you. How to calculate in inlet velocity of fuel and Air.

Thank you
ramakant is offline   Reply With Quote

Old   October 1, 2018, 12:27
Default How to plot graph between Cell Voltage Vs Current Density
  #11
Senior Member
 
Ramakant Gadhewal
Join Date: Apr 2010
Location: Chemical Engineering,National Institute of Technology,Warangal (T.S.),India
Posts: 112
Rep Power: 12
ramakant is on a distinguished road
Quote:
Originally Posted by ramakant View Post
Please tell me any one of you. How to calculate in inlet velocity of fuel and Air.

Thank you
Dear All

I need your help regarding the graph. After the simulation is over how to plot a graph between Cell voltage Vs current density.

Thank you
ramakant is offline   Reply With Quote

Old   January 31, 2019, 08:05
Default Modification of the pemFC -Model
  #12
New Member
 
Amadeus Wolf
Join Date: Dec 2017
Location: Germany
Posts: 10
Rep Power: 4
AmBeWo is on a distinguished road
Hey Everyone,


recently I modified the "pemfcSinglePhaseNonIsothermal" - Model.
New geometry (length, width and hight of the fuel cell, channel number, channel area, thickness of the functional layers), new reaction kinetic parameters (transfer coefficent, exchange current density) and mass transport parameters (effective diffusivity, porosity) have been changed in the test case.

According to checkMesh the mesh is OK.

No modification of the source code (yet)!

However, simulating these new test cases is not successful. Error is always the same. (log.file is attached).

By studying the log.file I come to the conclusion, that the O2 concentration tends to zero (1e-15) which causes floating point errors in current density calculation. Increasing the O2 concentration at the inlet does not lead to any improvement.

Is there anybody who is familiar with this model and can help me?
I would appreciate any kind of recommendation :-)

Greeting,
Amadeus
Attached Files
File Type: c log.run.pemfc.C (20.3 KB, 8 views)
AmBeWo is offline   Reply With Quote

Old   March 29, 2019, 12:16
Default
  #13
New Member
 
Hans Xaver
Join Date: Dec 2018
Location: Germany
Posts: 8
Rep Power: 3
hansihans is on a distinguished road
I do not have a solution for this problem, but I am working on the multiphase model of it and tried the singlephase model before.

But what I noticed in your logfile is that in line 271 (Solving air flow) and line 280 (solving fuel flow) you do not get any FOAM Warning like I get

Code:
Solving air flow
--> FOAM Warning :
    From function Foam::fv::gaussConvectionScheme<Type>::gaussConvectionScheme(const Foam::fvMesh&, const surfaceScalarField&, Foam::Istream&) [with Type = Foam::Vector<double>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]
    in file finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H at line 124
    Reading "/home/hans/OpenFOAM/hans-4.1/run/cases_runned/Kone_PEM-FC_cases/singlephase/case_0/system/air/fvSchemes.divSchemes.div(phi,U)" at line 32
    Unbounded 'Gauss' div scheme used in steady-state solver, use 'bounded Gauss' to ensure boundedness.
    To remove this warning switch off 'warnUnboundedGauss' in "/opt/openfoam4/etc/controlDict"
DILUPBiCG:  Solving for Ux, Initial residual = 0.9999968, Final residual = 1.5478e-10, No Iterations 4
DILUPBiCG:  Solving for Uy, Initial residual = 0.999979, Final residual = 4.87157e-12, No Iterations 5
DILUPBiCG:  Solving for Uz, Initial residual = 1, Final residual = 2.371463e-10, No Iterations 4
DICPCG:  Solving for p, Initial residual = 1, Final residual = 7.897306e-10, No Iterations 238
time step continuity errors : sum local = 2.027143e-06, global = -3.367083e-08
DICPCG:  Solving for p, Initial residual = 0.0403882, Final residual = 8.410109e-10, No Iterations 215
time step continuity errors : sum local = 2.235446e-06, global = -6.680733e-08

Solving fuel flow
--> FOAM Warning :
    From function Foam::fv::gaussConvectionScheme<Type>::gaussConvectionScheme(const Foam::fvMesh&, const surfaceScalarField&, Foam::Istream&) [with Type = Foam::Vector<double>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]
    in file finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H at line 124
    Reading "/home/hans/OpenFOAM/hans-4.1/run/cases_runned/Kone_PEM-FC_cases/singlephase/case_0/system/fuel/fvSchemes.divSchemes.div(phi,U)" at line 32
    Unbounded 'Gauss' div scheme used in steady-state solver, use 'bounded Gauss' to ensure boundedness.
    To remove this warning switch off 'warnUnboundedGauss' in "/opt/openfoam4/etc/controlDict"
DILUPBiCG:  Solving for Ux, Initial residual = 0.9999968, Final residual = 1.317541e-11, No Iterations 3
DILUPBiCG:  Solving for Uy, Initial residual = 0.9997891, Final residual = 7.226337e-10, No Iterations 3
DILUPBiCG:  Solving for Uz, Initial residual = 1, Final residual = 2.37403e-10, No Iterations 4
DICPCG:  Solving for p, Initial residual = 1, Final residual = 6.313857e-10, No Iterations 231
time step continuity errors : sum local = 9.173014e-07, global = 2.219646e-10
DICPCG:  Solving for p, Initial residual = 0.04314282, Final residual = 8.862404e-10, No Iterations 208
time step continuity errors : sum local = 8.865e-07, global = 1.06748e-08
ReFuel = 23.95892
ReAir  = 144.5844
So my question is: Did you follow the same instructions like shown in this thread before or do you have another workaround for that? You are also using OpenFOAM 4.0 but I did not manage to get it. When I try to install OF 4.0 - like described on the official web page - it will always installs OF 4.1 (maybe thats why I get this warning). Where did you get OF 4.0 from ?


Like I mentioned before I am working on the multiphase model and also changed some parameter of the MEA and changed the geometry (one Inlet & outlet) but I am stuck in another error which may could be solved with that here.
hansihans is offline   Reply With Quote

Old   March 31, 2019, 17:51
Default
  #14
New Member
 
Amadeus Wolf
Join Date: Dec 2017
Location: Germany
Posts: 10
Rep Power: 4
AmBeWo is on a distinguished road
Hey Hans,

you can change unbounded Gauss div scheme to bounded Gauss in ../system/air/fvSchemes and ../system/fuel/fvSchemes.

A detailed OF4.0 installation can be found here:

https://openfoamwiki.net/index.php/I...OAM-4.0/Ubuntu

Best Regards,
Amadeus
ramakant and hansihans like this.
AmBeWo is offline   Reply With Quote

Old   April 4, 2019, 03:49
Default
  #15
New Member
 
Hans Xaver
Join Date: Dec 2018
Location: Germany
Posts: 8
Rep Power: 3
hansihans is on a distinguished road
Thanks Amadeus,

the information of the installation of OpenFOAM 4.0 helped me.
But the thing with bounded Gauss in the fvSchemes did not work in my test cases. Cases that worked before do not work now (they only get to Time = 4 and then abort, there are also differences noticable on the residuals). So maybe you have some problems with it, too.

Kind regards,
Hans
hansihans is offline   Reply With Quote

Old   April 4, 2019, 07:55
Default
  #16
New Member
 
Amadeus Wolf
Join Date: Dec 2017
Location: Germany
Posts: 10
Rep Power: 4
AmBeWo is on a distinguished road
Hey Hans,

yeah the model is quite delicate when changing parameters. Same often happened to me. Check fvSolution and may increase the maxIt or the tolerance.

Do you recalculated the inlet velocity for your customized case with the attached formula?

In my case I also changed the fuel mass fractions of hydrogen and water.

Best regards,
Amadeus
AmBeWo is offline   Reply With Quote

Old   April 8, 2019, 10:51
Default
  #17
New Member
 
Hans Xaver
Join Date: Dec 2018
Location: Germany
Posts: 8
Rep Power: 3
hansihans is on a distinguished road
Hi Amadeus,

I tried it with the attached formula (in the single phase paper it is formula 8) but I did not get the same value out of it like in the author´s case.

I mean R, T, p and F are known, stoichiometric flow ratio is given, too. For n=2, I=6000A/m2, A_mea= 22*22mm2 and A_ch= 1,5*2mm2 I get completely other values. To get the same result as the author, A_mea would only be 45% of A_ch, which could not be true.
So either I used wrong values or my calculator is broken

In my test cases I changed the mass fractions, too, but currently I am trying to change my geometry that it may somehow works. And then I will change other variables.


Kind regards,
Hans
ramakant likes this.
hansihans is offline   Reply With Quote

Old   April 8, 2019, 12:27
Default
  #18
New Member
 
Amadeus Wolf
Join Date: Dec 2017
Location: Germany
Posts: 10
Rep Power: 4
AmBeWo is on a distinguished road
Hey Hans,

check out this paper, where the formula actually comes from:
https://www.sciencedirect.com/scienc...17931004004685

I also got confused by calculating the velocity using this formula. In your case you have to consider, that in the default test case the fuel cell comprises of 7 channels (your case 2 channels?!). So you can't match because a different flow rate is necessary to achieve the prescribed stoichiometric ratio...

Best Regards,
Amadeus
ramakant and hansihans like this.
AmBeWo is offline   Reply With Quote

Old   April 19, 2019, 22:37
Default pemfcSinglePhaseModel-4.0 on OpenFOAM
  #19
New Member
 
Muhammad
Join Date: Jan 2019
Location: Malaysia
Posts: 3
Rep Power: 3
muhammadlr95 is on a distinguished road
Hi everyone. I've ran the following commands but still I didn't get the same code as in the log.make2 file.

Quote:
Originally Posted by wyldckat View Post
After downloading the ZIP file, I've ran the following commands, in order to be able to compile the code with OpenFOAM 4.0, along with the necessary corrections:
Code:
unzip pemfcSinglePhaseModel-4.0.zip
cd pemfcSinglePhaseModel-4.0
cd pemfcSinglePhaseNonIsothermalSolver
find -name "All*" | xargs chmod +x
cp $FOAM_SRC/OpenFOAM/interpolations/patchToPatchInterpolation/patchToPatchInterpolation.H lib/myPatchToPatchInterpolation/mypatchToPatchInterpolation.H
sed -i -e 's=patchToPatchInterpolation=mypatchToPatchInterpolation=g'  -e 's=PatchToPatchInterpolation=myPatchToPatchInterpolation=g' lib/myPatchToPatchInterpolation/mypatchToPatchInterpolation.H
./Allwmake > log.make 2>&1
./Allwmake > log.make2 2>&1
The last 2 commands will create 2 log files: "log.make" and "log.make2", where the second file should have something like this inside:
Code:
...
..../libSinglephasePEMFC.so' is up to date.
...
.../pemfcSinglephaseNonIsothermalSolver' is up to date.

Best regards,
Bruno
Instead I got like in the image below. How do I fix this? I already ran this on OpenFOAM 4.0.

Thanks.
Screenshot (43).jpg
muhammadlr95 is offline   Reply With Quote

Old   April 21, 2019, 18:14
Default
  #20
New Member
 
Hans Xaver
Join Date: Dec 2018
Location: Germany
Posts: 8
Rep Power: 3
hansihans is on a distinguished road
Hi Muhammad,

looks like you are running OpenFOAM 6 and this model only works with OpenFOAM 4. If you have multiple OpenFOAM versions installed you have to use aliases in the bashrc to activate the desired version. But in my case I could not install OF4 on windows so I had to install Ubuntu parallel to windows.

Kind regards
Hans
hansihans is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
OpenFOAM Training Jan-Jul 2017, Virtual, London, Houston, Berlin CFDFoundation OpenFOAM Announcements from Other Sources 0 January 4, 2017 06:15
[OpenFOAM.org] OpenFOAM 4.0, bad option -t in zsh rdbisme OpenFOAM Installation 3 December 30, 2016 12:10
UNIGE February 13th-17th - 2107. OpenFOAM advaced training days joegi.geo OpenFOAM Announcements from Other Sources 0 October 1, 2016 19:20
OpenFOAM Training: Programming CFD Course 12-13 and 19-20 April 2016 cfd.direct OpenFOAM Announcements from Other Sources 0 January 14, 2016 10:19
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 09:04


All times are GMT -4. The time now is 23:47.