CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

How to write these time-dependent equation (PEM Fuel Cell)

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 10, 2022, 16:53
Default
  #21
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
You mention repository by that do you mean HTPEM? I made an example case for HTPEM, the overall changes necessary are the same for the LTPEM code to my knowledge. Let me know if there are any issues. Do note I don't know if the HTPEM code can handle a cell temperature of 80C.

Let me know when you have downloaded the case so that I can remove it, however, just a short description for any future insterest, change all T boundary fields to 150C instead of 160C and the cell properties file for the temperature fields except of the reference field.

https://www.dropbox.com/s/wr8rhsx6dq...se.tar.gz?dl=0

Regards Lasse
Swagga5aur is offline   Reply With Quote

Old   January 11, 2022, 15:45
Default Change temperature to pemfcMultiphaseModel-4.0
  #22
New Member
 
Jose
Join Date: Dec 2020
Posts: 18
Rep Power: 6
jose.ceballos is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
You mention repository by that do you mean HTPEM? I made an example case for HTPEM, the overall changes necessary are the same for the LTPEM code to my knowledge. Let me know if there are any issues. Do note I don't know if the HTPEM code can handle a cell temperature of 80C.

Let me know when you have downloaded the case so that I can remove it, however, just a short description for any future insterest, change all T boundary fields to 150C instead of 160C and the cell properties file for the temperature fields except of the reference field.

https://www.dropbox.com/s/wr8rhsx6dq...se.tar.gz?dl=0

Regards Lasse
I've downloaded the case, thanks very much.

But I meant this repository: https://unnc.digitalcommonsdata.com/...s/c743sh73j8/1

pemfcMultiphaseModel-4.0 is set to 353 K and I want to run it at 313, 323, 333 and 343 K. I calculated all properties and also used values obtained from tables (I have different cases/folders for calculated and table values); but still no convergence, stops at time 1. I suppose, that I have changed all the parameters and properties affected by temperature. Stops at time 1 with bracketing error.

I have no problems building polarization curves at 353 K and changing parameters. But I can't do it at others temperatures.
jose.ceballos is offline   Reply With Quote

Old   January 11, 2022, 16:03
Default
  #23
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Jose, alright my bad for misunderstanding, I will have a look at the case and see if I can make it run at a lower temperature in the near future.

Regards Lasse
Swagga5aur is offline   Reply With Quote

Old   January 11, 2022, 16:41
Default
  #24
New Member
 
Jose
Join Date: Dec 2020
Posts: 18
Rep Power: 6
jose.ceballos is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello Jose, alright my bad for misunderstanding, I will have a look at the case and see if I can make it run at a lower temperature in the near future.

Regards Lasse
Thanks, I appreciate it. I have months stukced wit this issue.
jose.ceballos is offline   Reply With Quote

Old   February 3, 2022, 08:20
Default
  #25
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Jose, sorry for the long delay.

I had to update the source code to V6 as its the lowest version I have running, its located here: https://github.com/Swagga5aur/pemfcMultiphaseModel

A working case with a 10 degree lower operational temperature is located here: https://www.dropbox.com/s/dtrwcd61jm...LT.tar.gz?dl=0

Do note that its not as simple to run a general polarization curve with a fixed electrolyte temperature, but I'm note sure if that is what you want or if this is enough.

Let me know if there are any questions or issues.

Regards, Lasse
Swagga5aur is offline   Reply With Quote

Old   February 6, 2022, 03:27
Default
  #26
New Member
 
Jose
Join Date: Dec 2020
Posts: 18
Rep Power: 6
jose.ceballos is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello Jose, sorry for the long delay.

I had to update the source code to V6 as its the lowest version I have running, its located here: https://github.com/Swagga5aur/pemfcMultiphaseModel

A working case with a 10 degree lower operational temperature is located here: https://www.dropbox.com/s/dtrwcd61jm...LT.tar.gz?dl=0

Do note that its not as simple to run a general polarization curve with a fixed electrolyte temperature, but I'm note sure if that is what you want or if this is enough.

Let me know if there are any questions or issues.

Regards, Lasse
This is excelent my friend!... is a huge step for me. I will try to go lower until I reach the 40°C.

I have read that this toolbox is very sensitive to temperature and exchange current density. But It would be possible to reach the 40°C (313 K)? How could I argue my response?

Thank you very much for your help. Maybe this information will be of help for other users. I will keep working.
jose.ceballos is offline   Reply With Quote

Old   February 6, 2022, 17:50
Default
  #27
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Jose,

To help the solver reaching a lower temperature consider changing the residual control or fvSchemes. However, I'm not certain that 40C is realistic for a LT pem from my experience due to high chances of flooding at these low temperatures, I would guess some of the physical or fluid parameters have to be altered to avoid flooding.

I ran into issues with lower temperatures (just tried 40C), due to RiddersRoot called in totalCurrent.H.
Hope this is of any help.

Regards Lasse
Swagga5aur is offline   Reply With Quote

Old   February 6, 2022, 17:55
Default
  #28
New Member
 
Jose
Join Date: Dec 2020
Posts: 18
Rep Power: 6
jose.ceballos is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello Jose,

To help the solver reaching a lower temperature consider changing the residual control or fvSchemes. However, I'm not certain that 40C is realistic for a LT pem from my experience due to high chances of flooding at these low temperatures, I would guess some of the physical or fluid parameters have to be altered to avoid flooding.

I ran into issues with lower temperatures (just tried 40C), due to RiddersRoot called in totalCurrent.H.
Hope this is of any help.

Regards Lasse
Thanks!... I have been dealing with the same issues...Its just that I've seen works in other software where they can vary the temperature in a wide range of temperature (20 to 100°C).
jose.ceballos is offline   Reply With Quote

Old   September 24, 2024, 18:46
Default
  #29
New Member
 
Join Date: Dec 2022
Posts: 15
Rep Power: 4
Ron71 is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello,

PEM FC modelling in openFOAM, with electrochemistry and all thats involved with mapping of the interfaces from the cathode, anode and the membrane is no simple task, however, I'm uncertain how in depth your model aims to be. Have a look at the openFuelCell model develop by Jülich https://openfoamwiki.net/index.php/Contrib/OpenFuelCell (models SOFC and HT PEM FC)

Additionally, https://www.mdpi.com/2079-3197/6/2/38/htm, https://data.mendeley.com/datasets/3gz7pxznzn/1 are focused on the LT PEM fuel cell (I believe they are based upon the above mentioned model), having both a single phase and multiphase model developed, I haven't tested any of them though.

The last two sources are developed for OFV4, whilst the openFuelCell is updated to OFV6.

Let me know if you have any questions, I have mainly modeled HTPEM though. I remember it as the two last source models are missing something for compilation so let me know and I'll try to help.

Regards, Lasse
Hello Lasse,

How did you master to compile the ‚Kone‘ source code in OF-V4.x, please? I tried with various docker images and various compilers, but didn’t succeed so far.

Cheers, Ronny
Ron71 is offline   Reply With Quote

Old   September 26, 2024, 04:42
Post
  #30
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Ronny,

I sadly weren't able to try and compile the V4.0 source code as I didn't have a Linux distro available to compile the version 4 of the foundation edition code, so I had to update it to V6.0 which is mentioned in a previous post.

If you are having trouble first I would secure that it's V4.0 you have and not V4.1 or similar as its indicated by the maker, its compatible with V4.0.

Afterwards I would check where the potential compilation errors occur, in the app lib or src lib, if its the src lib then you can try and compare it to the src lib in your openFOAM source code library.

Here is the link to the source code I updated to V6 https://github.com/Swagga5aur/pemfcMultiphaseModel hope it's of some help, else feel free to let me know.
Swagga5aur is offline   Reply With Quote

Old   September 26, 2024, 05:02
Default
  #31
New Member
 
Join Date: Dec 2022
Posts: 15
Rep Power: 4
Ron71 is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello Ronny,

I sadly weren't able to try and compile the V4.0 source code as I didn't have a Linux distro available to compile the version 4 of the foundation edition code, so I had to update it to V6.0 which is mentioned in a previous post.

If you are having trouble first I would secure that it's V4.0 you have and not V4.1 or similar as its indicated by the maker, its compatible with V4.0.

Afterwards I would check where the potential compilation errors occur, in the app lib or src lib, if its the src lib then you can try and compare it to the src lib in your openFOAM source code library.

Here is the link to the source code I updated to V6 https://github.com/Swagga5aur/pemfcMultiphaseModel hope it's of some help, else feel free to let me know.

Hey,Swagga5aur


fantastic, and many thanks. I am using V6 in several projects, so it should now be an easy go. Thank you!

cheers, Ron
Ron71 is offline   Reply With Quote

Old   September 26, 2024, 05:10
Post
  #32
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Excellent, let me know if you have any questions or run into some issues and I will try to be of assistance.

I mainly use the HTPEM source code I believe the Kone code is based upon (don't quote me on that), so my user experience is limited, but can most likely update to V7 if needed.

I believe I have a single phase LT model available as well, if it's of interest let me know and I can make a Github for it.

Regard
Lasse
Swagga5aur is offline   Reply With Quote

Old   September 26, 2024, 05:23
Default
  #33
New Member
 
Join Date: Dec 2022
Posts: 15
Rep Power: 4
Ron71 is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Excellent, let me know if you have any questions or run into some issues and I will try to be of assistance.

I mainly use the HTPEM source code I believe the Kone code is based upon (don't quote me on that), so my user experience is limited, but can most likely update to V7 if needed.

I believe I have a single phase LT model available as well, if it's of interest let me know and I can make a Github for it.

Regard
Lasse
compile error occoured, like:
In file included from pemfcMultiphaseNonIsothermalSolver.C:105:
../src/patch/createPatchToPatchInterpolation.H: In function ‘int main(int, char**)’:
../src/patch/createPatchToPatchInterpolation.H:10:33: error: missing template arguments before ‘anodeToCathode’
10 | myPatchToPatchInterpolation anodeToCathode


Same then also for the further mentioned in createPatchToPatchInterpolation.H:
cathodeToAnode,anodeFluidAnodeToElectrolyteAnode and

cathodeFluidCathodeToElectrolyteCathode


cheers, Ron
Ron71 is offline   Reply With Quote

Old   September 26, 2024, 06:11
Post
  #34
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Ron,

There was a naming error in the src library for the myPatch function was mypatch but had to be capital P, let me know if it works now or not, if not I will give it a look tonight. I have updated the of6 branch on github.

Regards,
Lasse
Swagga5aur is offline   Reply With Quote

Old   September 26, 2024, 07:06
Default
  #35
New Member
 
Join Date: Dec 2022
Posts: 15
Rep Power: 4
Ron71 is on a distinguished road
SOLVED, just change it in createPatchToPatchInterpolation.H as the following, then conduct wclean and wmake:



myPatchToPatchInterpolation<polyPatch, polyPatch> anodeToCathode
(
anodePatch,
cathodePatch
);


Quote:
Originally Posted by Swagga5aur View Post
Hello Ron,

There was a naming error in the src library for the myPatch function was mypatch but had to be capital P, let me know if it works now or not, if not I will give it a look tonight. I have updated the of6 branch on github.

Regards,
Lasse
Hi Lasse,

libMultiphasePEMFC.so (10,3MB) is being built successfully. Thank you

But all those misspellings (on several locations, unfortunately) I replaced before. The error is there anyway. I tried this a s countermeasure

myPatchToPatchInterpolation< FromPatch, ToPatch >::mypatchToPatchInterpolation anodeToCathode
(
anodePatch,
cathodePatch
);


according to the class description
https://cpp.openfoam.org/v7/classFoa...99044f03ff0306
Ron71 is offline   Reply With Quote

Old   September 27, 2024, 16:17
Post
  #36
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello again Ron,

I have sadly not a compiled V6 anymore, but updated and test compiled the code for V7 and added the branch to the github.

https://github.com/Swagga5aur/pemfcM...Model/tree/of7

I believe the issue wasn't the renaming mentioned as the template is with a little mypatchToPatch...

There where some issues with the myPatchToPatch directory, remade it with the equivalent files from the source code of openFOAM, and changed some equations in YFuel and YAir from what I remember.

If you don't have openFOAM V7 let me know and I will see if I have the time to compile V6 as well.

Regards,
Lasse
ramakant likes this.
Swagga5aur is offline   Reply With Quote

Old   September 28, 2024, 10:13
Default
  #37
New Member
 
Join Date: Dec 2022
Posts: 15
Rep Power: 4
Ron71 is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello again Ron,

I have sadly not a compiled V6 anymore, but updated and test compiled the code for V7 and added the branch to the github.

https://github.com/Swagga5aur/pemfcM...Model/tree/of7

I believe the issue wasn't the renaming mentioned as the template is with a little mypatchToPatch...

There where some issues with the myPatchToPatch directory, remade it with the equivalent files from the source code of openFOAM, and changed some equations in YFuel and YAir from what I remember.

If you don't have openFOAM V7 let me know and I will see if I have the time to compile V6 as well.

Regards,
Lasse
Hello Lasse,


it is all fine meanwhile and I can work with OF-6 pretty well. I am not fit enough to judge on V7 benefits, so for the moment no need for further action from my side.
But it would be great to have a corrected V6 repo anyways. Thank you

Cheers, Ron
Ron71 is offline   Reply With Quote

Old   September 30, 2024, 12:42
Default
  #38
New Member
 
Join Date: Dec 2022
Posts: 15
Rep Power: 4
Ron71 is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello again Ron,

I have sadly not a compiled V6 anymore, but updated and test compiled the code for V7 and added the branch to the github.

https://github.com/Swagga5aur/pemfcM...Model/tree/of7

I believe the issue wasn't the renaming mentioned as the template is with a little mypatchToPatch...

There where some issues with the myPatchToPatch directory, remade it with the equivalent files from the source code of openFOAM, and changed some equations in YFuel and YAir from what I remember.

If you don't have openFOAM V7 let me know and I will see if I have the time to compile V6 as well.

Regards,
Lasse
Hello Lasse again,

I also tried with OF-7, but this solver version is not able to run in parallel.
I tried with 10 cores on a Linux machine here. Please see the attched log.txt file. But a serial run remains without failure.

cheers, Ron
Attached Files
File Type: txt log.txt (75.9 KB, 1 views)
Ron71 is offline   Reply With Quote

Old   September 30, 2024, 12:48
Default
  #39
Senior Member
 
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 118
Rep Power: 11
Swagga5aur is on a distinguished road
Hello Ron,

Can you attach the case you are having issues with? I know the Jülich HTPEM solver uses a custom decomposition method, which I can test if I get the case. Will look at the log later.

Regards,
Lasse
Swagga5aur is offline   Reply With Quote

Old   September 30, 2024, 13:15
Default
  #40
New Member
 
Join Date: Dec 2022
Posts: 15
Rep Power: 4
Ron71 is on a distinguished road
Quote:
Originally Posted by Swagga5aur View Post
Hello Ron,

Can you attach the case you are having issues with? I know the Jülich HTPEM solver uses a custom decomposition method, which I can test if I get the case. Will look at the log later.

Regards,
Lasse
Hey Lasse, this would be really nice. I also thought about decomposePar -cellDist (decomposeParID) already Further it can be, that this HTPEM solver may require all patches on all processors to be present:
DecomposePar filterPatches copyUniform cellDist functionality

Btw, one can simplify much the so-called parprep process when using collated threads (there will be finally juste only one folder $NPROCS instead of multiple proc*):
https://openfoam.org/guides/parallel-io/

tutorials/IO/fileHandler/Allrun
https://github.com/OpenFOAM/OpenFOAM...Handler/Allrun

For example:
decomposePar -allRegions -fileHandler collated -dict system/decomposeParDict. The same argument can be used with solvers and other utilities…

Indeed, your run case (of your of7 branch) remains unchanged, just start my bash script after make mesh, to be prepared for the parallel solver run.

Cheers,
Ron

Tutorial 9 demonstrates the manual method of decomposition
https://www.fluiddynamics.at/downloa...basic-training
Attached Files
File Type: txt MyParallel.txt (1.7 KB, 1 views)

Last edited by Ron71; September 30, 2024 at 18:58.
Ron71 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
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
pressure in incompressible solvers e.g. simpleFoam chrizzl OpenFOAM Running, Solving & CFD 13 March 28, 2017 06:49
[Helyx OS] Helyx-OS (GUI for SnappyHexMesh elvis OpenFOAM Community Contributions 210 January 30, 2017 19:57
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 12:08
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27


All times are GMT -4. The time now is 13:57.