00001 /*@HEADER 00002 // *********************************************************************** 00003 // 00004 // Ifpack: Object-Oriented Algebraic Preconditioner Package 00005 // Copyright (2002) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 //@HEADER 00041 */ 00042 00043 #ifndef MATGENFD_DH_DH 00044 #define MATGENFD_DH_DH 00045 00046 /*===================================================================== 00047 option summary: 00048 --------------- 00049 processor topology 00050 -px <int> -py <int> -pz <int> 00051 defaults: -px 1 -py 1 -pz 0 00052 00053 grid topology 00054 -m <int> 00055 if pz=0, each processor has a square grid of dimension m*m, 00056 hence there are m*m*px*py unknowns. 00057 if pz > 0, each local grid is of dimension m*m*m, hence 00058 there are m*m*m*px*py*pz unknowns. 00059 00060 00061 diffusion coefficients (default is 1.0): 00062 -dx <double> -dy <double> -dz <double> 00063 00064 convection coefficients (default is 0.0) 00065 -cx <double> -cy <double> -cz <double> 00066 00067 grid dimension; if more than one mpi process, this is 00068 the local size for each processor: 00069 -m <int> 00070 00071 boundary conditions: 00072 This is very primitive; boundary conditions can only be generated for 00073 2D grids; the condition along each side is either dirichlet (constant), 00074 if bcXX >= 0, or neuman, if bcXX < 0. 00075 00076 -bcx1 <double> 00077 -bcx2 <double> 00078 -bcy1 <double> 00079 -bcy2 <double> 00080 00081 Misc. 00082 -debug_matgen 00083 -striped (may not work?) 00084 =====================================================================*/ 00085 00086 00087 #include "euclid_common.h" 00088 00089 #ifdef __cplusplus 00090 extern "C" 00091 { 00092 #endif 00093 00094 struct _matgenfd 00095 { 00096 bool allocateMem; 00097 /* If true, memory is allocated when run() is called, in which case 00098 * the caller is responsible for calling FREE_DH for the rp, cval, 00099 * aval, and rhs arrays. If false, caller is assumed to have 00100 * allocated memory when run is called. 00101 * Default is "true" 00102 */ 00103 int px, py, pz; /* Processor graph dimensions */ 00104 bool threeD; 00105 int m; /* number of matrix rows in local matrix */ 00106 int cc; /* Dimension of each processor's subgrid */ 00107 double hh; /* Grid spacing; this is constant, equal to 1.0/(px*cc-1) */ 00108 int id; /* the processor whose submatrix is to be generated */ 00109 int np; /* number of subdomains (processors, mpi tasks) */ 00110 double stencil[8]; 00111 00112 00113 /* derivative coefficients; a,b,c are 2nd derivatives, 00114 * c,d,e are 1st derivatives; f,g,h not currently used. 00115 */ 00116 double a, b, c, d, e, f, g, h; 00117 00118 int first; /* global number of first locally owned row */ 00119 bool debug; 00120 00121 /* boundary conditions; if value is < 0, neumen; else, dirichelet */ 00122 double bcX1, bcX2; 00123 double bcY1, bcY2; 00124 double bcZ1, bcZ2; 00125 00126 /* The following return coefficients; default is konstant() */ 00127 double (*A) (double coeff, double x, double y, double z); 00128 double (*B) (double coeff, double x, double y, double z); 00129 double (*C) (double coeff, double x, double y, double z); 00130 double (*D) (double coeff, double x, double y, double z); 00131 double (*E) (double coeff, double x, double y, double z); 00132 double (*F) (double coeff, double x, double y, double z); 00133 double (*G) (double coeff, double x, double y, double z); 00134 double (*H) (double coeff, double x, double y, double z); 00135 }; 00136 00137 extern void MatGenFD_Create (MatGenFD * mg); 00138 extern void MatGenFD_Destroy (MatGenFD mg); 00139 extern void MatGenFD_Run (MatGenFD mg, int id, int np, Mat_dh * A, 00140 Vec_dh * rhs); 00141 00142 /* =========== coefficient functions ============== */ 00143 extern double konstant (double coeff, double x, double y, double z); 00144 extern double e2_xy (double coeff, double x, double y, double z); 00145 00146 00147 00148 /* 3 boxes nested inside the unit square domain. 00149 diffusivity constants are: -dd1, -dd2, -dd3. 00150 */ 00151 /* box placement */ 00152 #define BOX1_X1 0.1 00153 #define BOX1_X2 0.4 00154 #define BOX1_Y1 0.1 00155 #define BOX1_Y2 0.4 00156 00157 #define BOX2_X1 0.6 00158 #define BOX2_X2 0.9 00159 #define BOX2_Y1 0.1 00160 #define BOX2_Y2 0.4 00161 00162 #define BOX3_X1 0.2 00163 #define BOX3_X2 0.8 00164 #define BOX3_Y1 0.6 00165 #define BOX3_Y2 0.8 00166 00167 /* default diffusivity */ 00168 #define BOX1_DD 10 00169 #define BOX2_DD 100 00170 #define BOX3_DD 50 00171 00172 extern double box_1 (double coeff, double x, double y, double z); 00173 /* -bd2 is diffusion coeff outside box; 00174 -bd1 is diffusion coeff inside box. 00175 */ 00176 00177 00178 00179 extern double box_2 (double coeff, double x, double y, double z); 00180 00181 #ifdef __cplusplus 00182 } 00183 #endif 00184 #endif
1.7.6.1