Electrical problem including metal diffusion
This post includes the effects of the counter electrode and the metal diffusion. The metal diffusion is included via a solution where the metal gradient doesn't change rapidly at the interface. This is not really very physical, but it will be useful when testing numerical solutions.
At the working electrode :
At the counter electrode :
where
The normals point out of the electrolyte.
In the bulk:
and
where and are the distances from the counter and working electrodes to the reference electode, respectively. is the total distance between the electrodes.
The metal diffusion has an analytical solution
where
This solution is valid when . This leads to two dimensionless quantities that must be small,
and
We can now derive an expression for .
Using the above solution we can derive a new expression for .
If we do this the equations can be reduced to two coupled ODEs for and :
and
The material parameters are:
Integrating this gives:
The code for this is source:trunk/moffat/electrical/misc/1D_metal.py.
The evolution of the :
and the cupric concentrations at various times:
Symmetric Electrical Problem
Extending blog:MoffatElectrical1 by making the system totally symmetric
The changes are:
14c14 < alpha = 0.5 --- > alpha = 0.4 30c30 < return i0 * (numpy.exp(-alpha * Fbar * V) - numpy.exp((1 - alpha) * Fbar * V)) --- > return i0 * (numpy.exp(-alpha * Fbar * V) - numpy.exp((2 - alpha) * Fbar * V)) 34c34 < - (1 - alpha) * Fbar * numpy.exp((1 - alpha) * Fbar * V)) --- > - (2 - alpha) * Fbar * numpy.exp((2 - alpha) * Fbar * V))
gives:
The code for this is source:trunk/moffat/electrical/misc/1D_symmetric.py.
The evolution of the :
Electrical Problem including counter electrode
Including the effects of the counter electrode.
At the working electrode :
At the counter electrode :
The normals point out of the electrolyte.
In the bulk:
and
where and are the distances from the counter and working electrodes to the reference electode, respectively. is the total distance between the electrodes.
If we do this the equations can be reduced to two coupled ODEs for and :
and
The material parameters are:
Integrating this gives:
The code for this is source:trunk/moffat/electrical/misc/1D_counter.py.
The evolution of the :
A few changes to Bill's code
Bill wants me to make four changes to his code, see source:trunk/kirkendall/A-V_phase-field.py@1457.
He needs to make four changes.
- Update to be an expression involving . This is done in r1458.
- The second item is to check source:trunk/kirkendall/A-V_phase-field.py@1457#L71 against Bill's notes. It seems correct other than that he left out the diffusion term in his notes by mistake.
- Save the data from the simulations for later use and read the saved files and plot the results independently from the simulations. See diff:@1458:1460. This now writes a data file directory of the form data/A-V_phase-field_17_36_53Thu02Feb2012. The data files are stored as numpy zip files .npz and numbered by their time step value. plotdata.py reads and plots from the latest data directory created.
The name of an alternative path can be specified as an argument
$ python plotdata.py data/A-V_phase-field_17_33_42Thu02Feb2012
This will use the specified directory, while
$ python plotdata.py
will use the latest created data directory. plotdata.py plots the data for the four main fields using the stored data.
- Add an improved method for extracting the 0.5 level set. See r1461. This is done using scipy's interp1d. After plotting the four main fields for every stored timestep, plotdata.py will throw up a plot of the interface position.