CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [openFuelCell] pemfcSinglePhaseModel-4.0 on OpenFOAM (https://www.cfd-online.com/Forums/openfoam-community-contributions/206727-pemfcsinglephasemodel-4-0-openfoam.html)

ramakant September 12, 2018 00:37

pemfcSinglePhaseModel-4.0 on OpenFOAM
 
1 Attachment(s)
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

AmBeWo September 18, 2018 11:00

pemfc Model OFv4.0
 
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

ramakant September 18, 2018 12:00

Quote:

Originally Posted by AmBeWo (Post 706715)
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.

Amalryk September 19, 2018 10:04

Quote:

Originally Posted by ramakant (Post 706718)
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 :)

ramakant September 23, 2018 01:02

pemfcSinglePhaseModel-4.0 with OpenFOAM
 
1 Attachment(s)
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

wyldckat September 26, 2018 17:50

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

AmBeWo September 27, 2018 03:20

Hey Bruno,

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

Best,
Amadeus

ramakant September 27, 2018 04:38

Quote:

Originally Posted by AmBeWo (Post 707838)
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

Amalryk September 27, 2018 04:45

Hi!

The model works fine now. Thank you!

Best regards,
Michal

ramakant September 27, 2018 10:13

Quote:

Originally Posted by Amalryk (Post 707855)
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 October 1, 2018 12:27

How to plot graph between Cell Voltage Vs Current Density
 
Quote:

Originally Posted by ramakant (Post 707960)
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

AmBeWo January 31, 2019 08:05

Modification of the pemFC -Model
 
1 Attachment(s)
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

hansihans March 29, 2019 12:16

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.

AmBeWo March 31, 2019 17:51

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

hansihans April 4, 2019 03:49

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

AmBeWo April 4, 2019 07:55

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

hansihans April 8, 2019 10:51

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 :confused:

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

AmBeWo April 8, 2019 12:27

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

muhammadlr95 April 19, 2019 22:37

pemfcSinglePhaseModel-4.0 on OpenFOAM
 
1 Attachment(s)
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 (Post 707740)
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.
Attachment 69507

hansihans April 21, 2019 18:14

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


All times are GMT -4. The time now is 08:14.