File electra.c

RCS Header: /cvsroot/rheoplast/electra.c,v 1.43 2006/03/06 18:11:48 wanida Exp

This is an electrostatic module for rheoplast. TO DO:


Included Files


Preprocessor definitions

#define __FUNCT__ "conductivity"

This function calculates electrical conductivity of each species.

#define __FUNCT__ "electra_first_setup"

#define __FUNCT__ "electra_labels_initcond"

#define V( point )

#define Vfunc( point )

#define sigma( point )

#define sigmaprime( point )

#define sigma_effprime( point )

#define zt_ti( point )

#define sigma_eff( point )

#define C( point )

#define u( point )

#define v( point )

#define C2( point )

#define C3( point )

#define Mu2( point )

#define Mu3( point )

#define __FUNCT__ "electra_temp_parameters_line"

#define __FUNCT__ "electra_temp_parameters_boundary_line"

#define __FUNCT__ "electra_interior_line_function"

#define __FUNCT__ "electra_boundary_line_function"

#define __FUNCT__ "electra_interior_line_jacobian"


Global Function electra_boundary_line_function()

This calculates the time derivatives and constraint functions for the conservation of charge equations for a boundary line. Note the shearstrain module interaction programmed here;

void electra_boundary_line_function ( PetscScalar* x, PetscScalar* func, PetscScalar* temp, PetscTruth** mixed_constraints, int points, int gxm, int gym, PetscScalar xmin, PetscScalar xmax, PetscScalar ycoord, PetscScalar zcoord, PetscScalar time, AppCtx* data, int side )

PetscScalar* x
The field variables from which to evaluate the function.
PetscScalar* func
Where to put the evaluated function.
PetscScalar* temp
Array of temporary field variables.
PetscTruth** mixed_constraints
Arrays of boolean variables indicating constraint equations in mixed timestep-constraint fields.
int points
Number of points to evaluate at.
int gxm
The x-width of the ``local'' vector's array, including shadow nodes, for the y-increment.
int gym
The y-width of the ``local'' vector's array, including shadow nodes, for the z-increment.
PetscScalar xmin
First node x-coordinate.
PetscScalar xmax
Last node plus one x-coordinate.
PetscScalar ycoord
This line y-coordinate.
PetscScalar zcoord
This line z-coordinate.
PetscScalar time
Current simulation time.
AppCtx* data
Pointer to the main simulation parameter structure, which includes the vortparm struct typedef, from which this gets needed parameters.
int side
 
void cahnhill_interior_line_function It returns nothing.
Voltage is constant at ymin and ymax


Global Function electra_first_setup()

The basic setup, assigning the number of solved and temporary field variables, the stencil width, and using options to set the parameters in the echemparm struct typedef.

void electra_first_setup ( PetscTruth threedee, int* vars, int* tempvars, int* stencilwid, AppCtx* data )

PetscTruth threedee
Request support for 3-D.
int* vars
Pointer to the number of solved field variables.
int* tempvars
Pointer to the number of temporary field variables.
int* stencilwid
Pointer to the stencil width.
AppCtx* data
Pointer to the
AppCtx struct typedef, into whose echemparm structure this inserts parameters from the command line.


Global Function electra_interior_line_function()

This evaluates the function of V

void electra_interior_line_function ( PetscScalar* x, PetscScalar* func, PetscScalar* temp, PetscTruth** mixed_constraints, int points, int gxm, int gym, PetscScalar xmin, PetscScalar xmax, PetscScalar ycoord, PetscScalar zcoord, PetscScalar time, AppCtx* data )

PetscScalar* x
The field variables from which to evaluate the function.
PetscScalar* func
Where to put the evaluated function.
PetscScalar* temp
Array of temporary field variables.
PetscTruth** mixed_constraints
Arrays of boolean variables indicating constraint equations in mixed timestep-constraint fields.
int points
Number of points to evaluate at.
int gxm
The x-width of the ``local'' vector's array, including shadow nodes, for the y-increment.
int gym
The y-width of the ``local'' vector's array, including shadow nodes, for the z-increment.
PetscScalar xmin
First node x-coordinate.
PetscScalar xmax
Last node plus one x-coordinate.
PetscScalar ycoord
This line y-coordinate.
PetscScalar zcoord
This line z-coordinate.
PetscScalar time
 
AppCtx* data
 

Global Function electra_interior_line_jacobian()

This calculates the Jacobian of the equations corresponding to the electrical potential variables.

void electra_interior_line_jacobian ( PetscScalar* x, PetscScalar* temp, Mat J, int points, int gxm, int gym, int firstrow, PetscScalar xmin, PetscScalar xmax, PetscScalar ycoord, PetscScalar zcoord, PetscScalar time, AppCtx* data )

PetscScalar* x
The field variables from which to evaluate the Jacobian.
PetscScalar* temp
Array of temporary field variables.
Mat J
Where to put the evaluated Jacobian.
int points
Number of points to evaluate at.
int gxm
The x-width of the ``local'' vector's array, including shadow nodes, for the y-increment.
int gym
The y-width of the ``local'' vector's array, including shadow nodes, for the z-increment.
int firstrow
The matrix row number corresponding to the first point in the line.
PetscScalar xmin
First node x-coordinate.
PetscScalar xmax
Last node plus one x-coordinate.
PetscScalar ycoord
This line y-coordinate.
PetscScalar zcoord
This line z-coordinate.
PetscScalar time
Current simulation time.
AppCtx* data
Pointer to the main simulation parameter structure, which includes the echemparm struct typedef, from which this gets needed parameters.
First this calculates the coefficients with respect to V part. The variable jvalue will hold the Jacobian values for insertion into the matrix. There are five non-zeroes per row (7 in 3-D). Additional jvalue from coupling variables are filled in each row corresponding to new column numbers.


Global Function electra_labels_initcond()

This sets up the field variable labels, and initial condition for the potential variables.

void electra_labels_initcond ( PetscScalar* globalarray, int nx, int ny, int nz, int xm, int ym, int zm, int xs, int ys, int zs, int vars, AppCtx* data, PetscScalar* max_explicit_deltat )

PetscScalar* globalarray
The global field array.
int nx
Overall x-width of the global array.
int ny
Overall y-width of the global array.
int nz
Overall z-width of the global array.
int xm
The x-width of the local part of the array.
int ym
The y-width of the local part of the array.
int zm
The z-width of the local part of the array.
int xs
The (integer) x-coordinate of the start of the local part of the array.
int ys
The (integer) y-coordinate of the start of the local part of the array.
int zs
The (integer) z-coordinate of the start of the local part of the array.
int vars
Total number of field variables to be solved.
AppCtx* data
Pointer to the AppCtx struct typedef, whose echemparm structure this uses for various purposes.
PetscScalar* max_explicit_deltat
not used in this module

Global Function electra_temp_parameters_boundary_line()

This just calculates conductivity on the boundary, since those values are needed for adjacent interior points.

void electra_temp_parameters_boundary_line ( PetscScalar* x, PetscScalar* temp, int points, int gxm, int gym, PetscScalar xmin, PetscScalar xmax, PetscScalar ycoord, PetscScalar zcoord, PetscScalar time, AppCtx* data, int side )


Global Function electra_temp_parameters_line()

This calculates the temporary parameter \sigma_eff (C), which is the effective conductivity given by
sigma_eff = z(C)/z(C) sigma_Fe(C) + sigma_eC)}.

void electra_temp_parameters_line ( PetscScalar* x, PetscScalar* temp, int points, int gxm, int gym, PetscScalar xmin, PetscScalar xmax, PetscScalar ycoord, PetscScalar zcoord, PetscScalar time, AppCtx* data )

PetscScalar* x
Array with the "real" field variables.
PetscScalar* temp
Array with the temporary field variables.
int points
Number of points at which to calculate the temporary variables.
int gxm
The x-width of the ``local'' vector's array, including shadow nodes, for the y-increment.
int gym
The y-width of the ``local'' vector's array, including shadow nodes, for the z-increment.
PetscScalar xmin
First node x-coordinate.
PetscScalar xmax
Last node plus one x-coordinate.
PetscScalar ycoord
This line y-coordinate.
PetscScalar zcoord
This line z-coordinate.
PetscScalar time
Current simulation time.
AppCtx* data
Pointer to the main simulation parameter structure, which includes the chparm struct typedef, from which this gets needed parameters.