Coder Social home page Coder Social logo

mdh266 / pecs-1d Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 1.0 674 KB

Photoelectrochemical Solar Cell Simulator in 1D

CMake 0.40% C++ 96.30% Python 3.29% Shell 0.01%
solar-cells c-plus-plus finite-element-methods discontinuous-galerkin multithreading domain-decomposition eigen-library boost-libraries high-performance-computing semiconductor-electrolyte-interface

pecs-1d's Introduction

PhotoElectrochemical Cell Simulator

Introduction

Photoelectrochemical Solar Cells

Large-scale utilization of photovoltaic (PV) devices, or solar cells, has been hampered for years due to high costs and lack of energy storage mechanisms. Photoelectrochemical solar cells (PECs), are an attractive alternative to conventional solid state PV devices. PECs such as those depicted below are able to directly convert solar energy into hydrogen fuel. The hydrogen fuel can then be used at a later time to generate electricity. The typical setup of a PEC is shown below,

Photoelectrochemical Solar Cell

A PEC consists of four main components: the solid semiconductor electrode, the liquid electrolyte component, the semiconductor-electrolyte interface and the counter (metal or semiconductor) electrode. When sunlight shines on the semiconductor component, photons are absorbed and generate electron-hole pairs. These electrons and holes are separated by a built-in electric field within the semiconductor. The separation of the electrons and holes leads to an electrical current in the cell and the accumulation of charges at the semiconductor-electrolyte interface. At the interface, the photo-generated electrons or holes induce a chemical reaction at the semiconductor electrode. A similar chemical reaction also occurs at the counter electrode. These chemical reactions at the electrode interfaces create or eliminate reductant-oxidant (redox) species in the electrolyte leading to the generation of hydrogen fuel.

Software Overview

This software is designed to simulate the dynamics of the reactive interface between a semiconductor and electrolyte in a 1D. The interface of between the semiconductor and electrolyte make up a "half cell" of a photoelectrochemical cell. The main challenges in constructing a numerical algorithms that produces reliable simulations of PECs are due to the highly nonlinear nature of the system and the different time scales of the semicondcutor and electrolye charge carriers. Furthermore, regions of stiffness caused by boundary layer formation where sharp transitions in densities and electric potential occur near the interface (as shown below) and pose severe constraints on the choice of discretization strategy in order to maintain numerical stability.

The resulting output files from the simulation are in .dat format and can viewed using the python plotter.py script in /run/ directoy. The results of one simulation are shown below,

Densities

This code will automatically run in parallel using the OpenMP for multithreading if the library is present.

For much more background on the model and algorithms used in this project please see the 2D documentation page.

Dependencies:

  1. CMAKE 2.8 (Required)
  2. GSL 1.16 (Required)
  3. EIGEN 3.0 (Required)
  4. BOOST (Required)
  5. OpenMP (Optional)
  6. Python, NumPy and matplotlib for visualization. (Optional)

Installing

After installing all the dependencies for this code, go into the PECS-1D/ directory. Then use the following command in the terminal,

mkdir build
cd build 
cmake  ..
make solar_cell_app
mv solar_cell_app ../run

Using the software

From your terminal, cd in to the run directory. If you want to use multi-threading you need to first type into your terminal,

	export OMP_NUM_THREADS=num_threads

where num_threads is the number of cores on your machine.

To set the paremeter values into you need to change the values in the input file,

 	ddp-input.ini 

see the documentation page for more datails on parameter values.

To run the code, type the following command from the run/ directory,

	./solar_cell_app

If you want to change the doping/concentration profiles change the file the ConcentrationProfile directory. All units (densities and space) in these files are in non-dimensional form. You will need to recompile if you change any of these files, i.e. use the steps,

make solar_cell_app mv solar_cell_app ../run

The data output files are labeled StateXXXX.dat where XXXX are specific numbers and contain the information,

 when (xvalues < 0)
	 xvalues, electron density, hole density, electric field, potential, current, time

 when	(xvalues > 0)
	 xvalues, reductant density, oxidante density, electric field, potential, current, time

To make visualizations of the simulations use the Python script plotter.py in directory run by typing the command,

	python plotter.py

To get rid of simulation produced files .dats, .png, .mp4 invoke:

	./clean.sh

Edit and use Runner_IV.py if you want to run this over multiple bias values.

Testing

To test the code run the following commands from the build/ directory,

make test_System
./test_System

You will then receive a report back of whether the code passed all the tests.

Documentation

If you want to build the documentation for this code tou must have doxygen and latex installed. Once it is has been obtained, from the documentation directory type the command,

doxygen dox

and a html file website we be built in the directory html/. This can be viewed from any web browser by opening the index.html file within the directory.

Trouble Shooting

  • If oscillations appear in semiconductor domain (usually on the electron densities) use a smaller value for the timeStepFactor.

NOTE: will slow down run time.

  • If you see negative values/spikes/stability issues (NANs) in your results then increase the numBoundaryElements (make sure to increase numElements so that numBoundaryElementsremains less than numElements). Also, if this issue area is outside of the boundaryLayerWidth region, increase boundaryLayerWidth so that it covers these issue areas.

NOTE: will slow down run time

pecs-1d's People

Contributors

mdh266 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

greatwallisme

pecs-1d's Issues

head file ddpTimeStepping.hpp missed

[ 1%] Building CXX object CMakeFiles/L2_Schwarz.dir/src/L2_Schwarz_Errors.cpp.o
/home/chenl0d/PECS/PECS-1D-master/src/L2_Schwarz_Errors.cpp:20:31: fatal error: ddpTimeStepping.hpp: No such file or directory
#include "ddpTimeStepping.hpp"

Checked the online repository and didn't find ddpTimeStepping.hpp in ./include.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.