Defines | Functions | Variables

src/fem/vfetk.c File Reference

Class Vfetk methods. More...

#include "apbscfg.h"
#include "apbs/vfetk.h"
Include dependency graph for vfetk.c:

Go to the source code of this file.

Defines

#define VMAXLOCALCOLORSDONTREUSETHISVARIABLE   1024
#define VRINGMAX   1000
 Maximum number of simplices in a simplex ring.
#define VATOMMAX   1000000
 Maximum number of atoms associated with a vertex.

Functions

VPRIVATE double Vfetk_qfEnergyAtom (Vfetk *thee, int iatom, int color, double *sol)
VPRIVATE double diel ()
VPRIVATE double ionacc ()
VPRIVATE double smooth (int nverts, double dist[VAPBS_NVS], double coeff[VAPBS_NVS], int meth)
VPRIVATE double debye_U (Vpbe *pbe, int d, double x[])
VPRIVATE double debye_Udiff (Vpbe *pbe, int d, double x[])
VPRIVATE void coulomb (Vpbe *pbe, int d, double x[], double eps, double *U, double dU[], double *d2U)
VPRIVATE void init_2DP1 (int dimIS[], int *ndof, int dof[], double c[][VMAXP], double cx[][VMAXP], double cy[][VMAXP], double cz[][VMAXP])
VPRIVATE void init_3DP1 (int dimIS[], int *ndof, int dof[], double c[][VMAXP], double cx[][VMAXP], double cy[][VMAXP], double cz[][VMAXP])
VPRIVATE void setCoef (int numP, double c[][VMAXP], double cx[][VMAXP], double cy[][VMAXP], double cz[][VMAXP], int ic[][VMAXP], int icx[][VMAXP], int icy[][VMAXP], int icz[][VMAXP])
VPRIVATE void polyEval (int numP, double p[], double c[][VMAXP], double xv[])
VPUBLIC Gem * Vfetk_getGem (Vfetk *thee)
 Get a pointer to the Gem (grid manager) object.
VPUBLIC AM * Vfetk_getAM (Vfetk *thee)
 Get a pointer to the AM (algebra manager) object.
VPUBLIC VpbeVfetk_getVpbe (Vfetk *thee)
 Get a pointer to the Vpbe (PBE manager) object.
VPUBLIC VcsmVfetk_getVcsm (Vfetk *thee)
 Get a pointer to the Vcsm (charge-simplex map) object.
VPUBLIC int Vfetk_getAtomColor (Vfetk *thee, int iatom)
 Get the partition information for a particular atom.
VPUBLIC VfetkVfetk_ctor (Vpbe *pbe, Vhal_PBEType type)
 Constructor for Vfetk object.
VPUBLIC int Vfetk_ctor2 (Vfetk *thee, Vpbe *pbe, Vhal_PBEType type)
 FORTRAN stub constructor for Vfetk object.
VPUBLIC void Vfetk_setParameters (Vfetk *thee, PBEparm *pbeparm, FEMparm *feparm)
 Set the parameter objects.
VPUBLIC void Vfetk_dtor (Vfetk **thee)
 Object destructor.
VPUBLIC void Vfetk_dtor2 (Vfetk *thee)
 FORTRAN stub object destructor.
VPUBLIC double * Vfetk_getSolution (Vfetk *thee, int *length)
 Create an array containing the solution (electrostatic potential in units of $k_B T/e$) at the finest mesh level.
VPUBLIC double Vfetk_energy (Vfetk *thee, int color, int nonlin)
 Return the total electrostatic energy.
VPUBLIC double Vfetk_qfEnergy (Vfetk *thee, int color)
 Get the "fixed charge" contribution to the electrostatic energy.
VPUBLIC double Vfetk_dqmEnergy (Vfetk *thee, int color)
 Get the "mobile charge" and "polarization" contributions to the electrostatic energy.
VPUBLIC void Vfetk_setAtomColors (Vfetk *thee)
 Transfer color (partition ID) information frmo a partitioned mesh to the atoms.
VPUBLIC unsigned long int Vfetk_memChk (Vfetk *thee)
 Return the memory used by this structure (and its contents) in bytes.
VPUBLIC Vrc_Codes Vfetk_genCube (Vfetk *thee, double center[3], double length[3], Vfetk_MeshLoad meshType)
 Construct a rectangular mesh (in the current Vfetk object)
VPUBLIC Vrc_Codes Vfetk_loadMesh (Vfetk *thee, double center[3], double length[3], Vfetk_MeshLoad meshType, Vio *sock)
 Loads a mesh into the Vfetk (and associated) object(s).
VPUBLIC void Bmat_printHB (Bmat *thee, char *fname)
 Writes a Bmat to disk in Harwell-Boeing sparse matrix format.
VPUBLIC PDE * Vfetk_PDE_ctor (Vfetk *fetk)
 Constructs the FEtk PDE object.
VPUBLIC int Vfetk_PDE_ctor2 (PDE *thee, Vfetk *fetk)
 Intializes the FEtk PDE object.
VPUBLIC void Vfetk_PDE_dtor (PDE **thee)
 Destroys FEtk PDE object.
VPUBLIC void Vfetk_PDE_dtor2 (PDE *thee)
 FORTRAN stub: destroys FEtk PDE object.
VPUBLIC void Vfetk_PDE_initAssemble (PDE *thee, int ip[], double rp[])
 Do once-per-assembly initialization.
VPUBLIC void Vfetk_PDE_initElement (PDE *thee, int elementType, int chart, double tvx[][3], void *data)
VPUBLIC void Vfetk_PDE_initFace (PDE *thee, int faceType, int chart, double tnvec[])
 Do once-per-face initialization.
VPUBLIC void Vfetk_PDE_initPoint (PDE *thee, int pointType, int chart, double txq[], double tU[], double tdU[][3])
VPUBLIC void Vfetk_PDE_Fu (PDE *thee, int key, double F[])
 Evaluate strong form of PBE. For interior points, this is:

\[ -\nabla \cdot \epsilon \nabla u + b(u) - f \]

where $b(u)$ is the (possibly nonlinear) mobile ion term and $f$ is the source charge distribution term (for PBE) or the induced surface charge distribution (for RPBE). For an interior-boundary (simplex face) point, this is:

\[ [\epsilon(x) \nabla u(x) \cdot n(x)]_{x=0^+} - [\epsilon(x) \nabla u(x) \cdot n(x)]_{x=0^-} \]

where $n(x)$ is the normal to the simplex face and the term represents the jump in dielectric displacement across the face. There is no outer-boundary contribution for this problem.

VPUBLIC double Vfetk_PDE_Fu_v (PDE *thee, int key, double V[], double dV[][VAPBS_DIM])
 This is the weak form of the PBE; i.e. the strong form integrated with a test function to give:

\[ \int_\Omega \left[ \epsilon \nabla u \cdot \nabla v + b(u) v - f v \right] dx \]

where $b(u)$ denotes the mobile ion term.

VPUBLIC double Vfetk_PDE_DFu_wv (PDE *thee, int key, double W[], double dW[][VAPBS_DIM], double V[], double dV[][3])
VPUBLIC void Vfetk_PDE_delta (PDE *thee, int type, int chart, double txq[], void *user, double F[])
 Evaluate a (discretized) delta function source term at the given point.
VPUBLIC void Vfetk_PDE_u_D (PDE *thee, int type, int chart, double txq[], double F[])
 Evaluate the Dirichlet boundary condition at the given point.
VPUBLIC void Vfetk_PDE_u_T (PDE *thee, int type, int chart, double txq[], double F[])
 Evaluate the "true solution" at the given point for comparison with the numerical solution.
VPUBLIC void Vfetk_PDE_bisectEdge (int dim, int dimII, int edgeType, int chart[], double vx[][3])
VPUBLIC void Vfetk_PDE_mapBoundary (int dim, int dimII, int vertexType, int chart, double vx[3])
VPUBLIC int Vfetk_PDE_markSimplex (int dim, int dimII, int simplexType, int faceType[VAPBS_NVS], int vertexType[VAPBS_NVS], int chart[], double vx[][3], void *simplex)
VPUBLIC void Vfetk_PDE_oneChart (int dim, int dimII, int objType, int chart[], double vx[][3], int dimV)
VPUBLIC double Vfetk_PDE_Ju (PDE *thee, int key)
 Energy functional. This returns the energy (less delta function terms) in the form:

\[ c^{-1}/2 \int (\epsilon (\nabla u)^2 + \kappa^2 (cosh u - 1)) dx \]

for a 1:1 electrolyte where $c$ is the output from Vpbe_getZmagic.

VPUBLIC void Vfetk_externalUpdateFunction (SS **simps, int num)
 External hook to simplex subdivision routines in Gem. Called each time a simplex is subdivided (we use it to update the charge-simplex map)
VPUBLIC int Vfetk_PDE_simplexBasisInit (int key, int dim, int comp, int *ndof, int dof[])
 Initialize the bases for the trial or the test space, for a particular component of the system, at all quadrature points on the master simplex element.
VPUBLIC void Vfetk_PDE_simplexBasisForm (int key, int dim, int comp, int pdkey, double xq[], double basis[])
 Evaluate the bases for the trial or test space, for a particular component of the system, at all quadrature points on the master simplex element.
VPUBLIC void Vfetk_dumpLocalVar ()
 Debugging routine to print out local variables used by PDE object.
VPUBLIC int Vfetk_fillArray (Vfetk *thee, Bvec *vec, Vdata_Type type)
 Fill an array with the specified data.
VPUBLIC int Vfetk_write (Vfetk *thee, const char *iodev, const char *iofmt, const char *thost, const char *fname, Bvec *vec, Vdata_Format format)
 Write out data.

Variables

VPRIVATE Vfetk_LocalVar var
VPRIVATE char * diriCubeString
VPRIVATE char * neumCubeString
VPRIVATE int dim_2DP1 = 3
VPRIVATE int lgr_2DP1 [3][VMAXP]
VPRIVATE int lgr_2DP1x [3][VMAXP]
VPRIVATE int lgr_2DP1y [3][VMAXP]
VPRIVATE int lgr_2DP1z [3][VMAXP]
VPRIVATE int dim_3DP1 = VAPBS_NVS
VPRIVATE int lgr_3DP1 [VAPBS_NVS][VMAXP]
VPRIVATE int lgr_3DP1x [VAPBS_NVS][VMAXP]
VPRIVATE int lgr_3DP1y [VAPBS_NVS][VMAXP]
VPRIVATE int lgr_3DP1z [VAPBS_NVS][VMAXP]
VPRIVATE const int P_DEG = 1
VPRIVATE int numP
VPRIVATE double c [VMAXP][VMAXP]
VPRIVATE double cx [VMAXP][VMAXP]
VPRIVATE double cy [VMAXP][VMAXP]
VPRIVATE double cz [VMAXP][VMAXP]

Detailed Description

Class Vfetk methods.

Author:
Nathan Baker
Version:
Id:
vfetk.c 1567 2010-03-12 22:10:39Z sdg0919
Attention:
 *
 * APBS -- Adaptive Poisson-Boltzmann Solver
 *
 * Nathan A. Baker (nathan.baker@pnl.gov)
 * Pacific Northwest National Laboratory
 *
 * Additional contributing authors listed in the code documentation.
 *
 * Copyright (c) 2010, Pacific Northwest National Laboratory.  Portions Copyright (c) 2002-2010, Washington University in St. Louis.  Portions Copyright (c) 2002-2010, Nathan A. Baker.  Portions Copyright (c) 1999-2002, The Regents of the University of California. Portions Copyright (c) 1995, Michael Holst.
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met: 
 *
 * -  Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.  
 * 
 * - Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 * 
 * - Neither the name of Washington University in St. Louis nor the names of its
 * contributors may be used to endorse or promote products derived from this
 * software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * 

Definition in file vfetk.c.


Variable Documentation

VPRIVATE char* diriCubeString
Initial value:
"mcsf_begin=1;\n\
\n\
dim=3;\n\
dimii=3;\n\
vertices=8;\n\
simplices=6;\n\
\n\
vert=[\n\
0 0 -0.5 -0.5 -0.5\n\
1 0  0.5 -0.5 -0.5\n\
2 0 -0.5  0.5 -0.5\n\
3 0  0.5  0.5 -0.5\n\
4 0 -0.5 -0.5  0.5\n\
5 0  0.5 -0.5  0.5\n\
6 0 -0.5  0.5  0.5\n\
7 0  0.5  0.5  0.5\n\
];\n\
\n\
simp=[\n\
0 0 0 0 1 0 1 0 5 1 2\n\
1 0 0 0 1 1 0 0 5 2 4\n\
2 0 0 0 1 0 1 1 5 3 2\n\
3 0 0 0 1 0 1 3 5 7 2\n\
4 0 0 1 1 0 0 2 5 7 6\n\
5 0 0 1 1 0 0 2 5 6 4\n\
];\n\
\n\
mcsf_end=1;\n\
\n\
"

Definition at line 90 of file vfetk.c.

VPRIVATE int lgr_2DP1[3][VMAXP]
Initial value:
 {


{  2, -2, -2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
}

Definition at line 383 of file vfetk.c.

VPRIVATE int lgr_2DP1x[3][VMAXP]
Initial value:
 {


{ -2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
}

Definition at line 392 of file vfetk.c.

VPRIVATE int lgr_2DP1y[3][VMAXP]
Initial value:
 {


{ -2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
}

Definition at line 399 of file vfetk.c.

VPRIVATE int lgr_2DP1z[3][VMAXP]
Initial value:
 {


{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
}

Definition at line 406 of file vfetk.c.

VPRIVATE int lgr_3DP1[VAPBS_NVS][VMAXP]
Initial value:
 {


{  2, -2, -2, -2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
}

Definition at line 435 of file vfetk.c.

VPRIVATE int lgr_3DP1x[VAPBS_NVS][VMAXP]
Initial value:
 {


{ -2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
}

Definition at line 443 of file vfetk.c.

VPRIVATE int lgr_3DP1y[VAPBS_NVS][VMAXP]
Initial value:
 {


{ -2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 }
}

Definition at line 451 of file vfetk.c.

VPRIVATE int lgr_3DP1z[VAPBS_NVS][VMAXP]
Initial value:
 {


{ -2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
{  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 },
}

Definition at line 459 of file vfetk.c.

VPRIVATE char* neumCubeString
Initial value:
"mcsf_begin=1;\n\
\n\
dim=3;\n\
dimii=3;\n\
vertices=8;\n\
simplices=6;\n\
\n\
vert=[\n\
0 0 -0.5 -0.5 -0.5\n\
1 0  0.5 -0.5 -0.5\n\
2 0 -0.5  0.5 -0.5\n\
3 0  0.5  0.5 -0.5\n\
4 0 -0.5 -0.5  0.5\n\
5 0  0.5 -0.5  0.5\n\
6 0 -0.5  0.5  0.5\n\
7 0  0.5  0.5  0.5\n\
];\n\
\n\
simp=[\n\
0 0 0 0 2 0 2 0 5 1 2\n\
1 0 0 0 2 2 0 0 5 2 4\n\
2 0 0 0 2 0 2 1 5 3 2\n\
3 0 0 0 2 0 2 3 5 7 2\n\
4 0 0 2 2 0 0 2 5 7 6\n\
5 0 0 2 2 0 0 2 5 6 4\n\
];\n\
\n\
mcsf_end=1;\n\
\n\
"

Definition at line 127 of file vfetk.c.