Ifpack Package Browser (Single Doxygen Collection)
Development
Toggle main menu visibility
Loading...
Searching...
No Matches
src
euclid
MatGenFD.h
Go to the documentation of this file.
1
/*@HEADER
2
// ***********************************************************************
3
//
4
// Ifpack: Object-Oriented Algebraic Preconditioner Package
5
// Copyright (2002) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the Corporation nor the names of the
22
// contributors may be used to endorse or promote products derived from
23
// this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38
//
39
// ***********************************************************************
40
//@HEADER
41
*/
42
43
#ifndef MATGENFD_DH_DH
44
#define MATGENFD_DH_DH
45
46
/*=====================================================================
47
option summary:
48
---------------
49
processor topology
50
-px <int> -py <int> -pz <int>
51
defaults: -px 1 -py 1 -pz 0
52
53
grid topology
54
-m <int>
55
if pz=0, each processor has a square grid of dimension m*m,
56
hence there are m*m*px*py unknowns.
57
if pz > 0, each local grid is of dimension m*m*m, hence
58
there are m*m*m*px*py*pz unknowns.
59
60
61
diffusion coefficients (default is 1.0):
62
-dx <double> -dy <double> -dz <double>
63
64
convection coefficients (default is 0.0)
65
-cx <double> -cy <double> -cz <double>
66
67
grid dimension; if more than one mpi process, this is
68
the local size for each processor:
69
-m <int>
70
71
boundary conditions:
72
This is very primitive; boundary conditions can only be generated for
73
2D grids; the condition along each side is either dirichlet (constant),
74
if bcXX >= 0, or neuman, if bcXX < 0.
75
76
-bcx1 <double>
77
-bcx2 <double>
78
-bcy1 <double>
79
-bcy2 <double>
80
81
Misc.
82
-debug_matgen
83
-striped (may not work?)
84
=====================================================================*/
85
86
87
#include "
euclid_common.h
"
88
89
#ifdef __cplusplus
90
extern
"C"
91
{
92
#endif
93
94
struct
_matgenfd
95
{
96
bool
allocateMem
;
97
/* If true, memory is allocated when run() is called, in which case
98
* the caller is responsible for calling FREE_DH for the rp, cval,
99
* aval, and rhs arrays. If false, caller is assumed to have
100
* allocated memory when run is called.
101
* Default is "true"
102
*/
103
int
px
,
py
,
pz
;
/* Processor graph dimensions */
104
bool
threeD
;
105
int
m
;
/* number of matrix rows in local matrix */
106
int
cc
;
/* Dimension of each processor's subgrid */
107
double
hh
;
/* Grid spacing; this is constant, equal to 1.0/(px*cc-1) */
108
int
id
;
/* the processor whose submatrix is to be generated */
109
int
np
;
/* number of subdomains (processors, mpi tasks) */
110
double
stencil
[8];
111
112
113
/* derivative coefficients; a,b,c are 2nd derivatives,
114
* c,d,e are 1st derivatives; f,g,h not currently used.
115
*/
116
double
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
;
117
118
int
first
;
/* global number of first locally owned row */
119
bool
debug
;
120
121
/* boundary conditions; if value is < 0, neumen; else, dirichelet */
122
double
bcX1
,
bcX2
;
123
double
bcY1
,
bcY2
;
124
double
bcZ1
,
bcZ2
;
125
126
/* The following return coefficients; default is konstant() */
127
double (*
A
) (
double
coeff,
double
x,
double
y,
double
z);
128
double (*
B
) (
double
coeff,
double
x,
double
y,
double
z);
129
double (*
C
) (
double
coeff,
double
x,
double
y,
double
z);
130
double (*
D
) (
double
coeff,
double
x,
double
y,
double
z);
131
double (*
E
) (
double
coeff,
double
x,
double
y,
double
z);
132
double (*
F
) (
double
coeff,
double
x,
double
y,
double
z);
133
double (*
G
) (
double
coeff,
double
x,
double
y,
double
z);
134
double (*
H
) (
double
coeff,
double
x,
double
y,
double
z);
135
};
136
137
extern
void
MatGenFD_Create
(
MatGenFD
* mg);
138
extern
void
MatGenFD_Destroy
(
MatGenFD
mg);
139
extern
void
MatGenFD_Run
(
MatGenFD
mg,
int
id
,
int
np,
Mat_dh
* A,
140
Vec_dh
* rhs);
141
142
/* =========== coefficient functions ============== */
143
extern
double
konstant
(
double
coeff,
double
x,
double
y,
double
z);
144
extern
double
e2_xy
(
double
coeff,
double
x,
double
y,
double
z);
145
146
147
148
/* 3 boxes nested inside the unit square domain.
149
diffusivity constants are: -dd1, -dd2, -dd3.
150
*/
151
/* box placement */
152
#define BOX1_X1 0.1
153
#define BOX1_X2 0.4
154
#define BOX1_Y1 0.1
155
#define BOX1_Y2 0.4
156
157
#define BOX2_X1 0.6
158
#define BOX2_X2 0.9
159
#define BOX2_Y1 0.1
160
#define BOX2_Y2 0.4
161
162
#define BOX3_X1 0.2
163
#define BOX3_X2 0.8
164
#define BOX3_Y1 0.6
165
#define BOX3_Y2 0.8
166
167
/* default diffusivity */
168
#define BOX1_DD 10
169
#define BOX2_DD 100
170
#define BOX3_DD 50
171
172
extern
double
box_1
(
double
coeff,
double
x,
double
y,
double
z);
173
/* -bd2 is diffusion coeff outside box;
174
-bd1 is diffusion coeff inside box.
175
*/
176
177
178
179
extern
double
box_2
(
double
coeff,
double
x,
double
y,
double
z);
180
181
#ifdef __cplusplus
182
}
183
#endif
184
#endif
MatGenFD_Create
void MatGenFD_Create(MatGenFD *mg)
Definition
MatGenFD.c:80
MatGenFD_Destroy
void MatGenFD_Destroy(MatGenFD mg)
Definition
MatGenFD.c:149
e2_xy
double e2_xy(double coeff, double x, double y, double z)
Definition
MatGenFD.c:612
MatGenFD_Run
void MatGenFD_Run(MatGenFD mg, int id, int np, Mat_dh *A, Vec_dh *rhs)
Definition
MatGenFD.c:159
box_1
double box_1(double coeff, double x, double y, double z)
Definition
MatGenFD.c:625
box_2
double box_2(double coeff, double x, double y, double z)
Definition
MatGenFD.c:759
konstant
double konstant(double coeff, double x, double y, double z)
Definition
MatGenFD.c:606
euclid_common.h
Vec_dh
struct _vec_dh * Vec_dh
Definition
euclid_common.h:87
MatGenFD
struct _matgenfd * MatGenFD
Definition
euclid_common.h:79
Mat_dh
struct _mat_dh * Mat_dh
Definition
euclid_common.h:85
_matgenfd
Definition
MatGenFD.h:95
_matgenfd::A
double(* A)(double coeff, double x, double y, double z)
Definition
MatGenFD.h:127
_matgenfd::m
int m
Definition
MatGenFD.h:105
_matgenfd::cc
int cc
Definition
MatGenFD.h:106
_matgenfd::debug
bool debug
Definition
MatGenFD.h:119
_matgenfd::stencil
double stencil[8]
Definition
MatGenFD.h:110
_matgenfd::px
int px
Definition
MatGenFD.h:103
_matgenfd::g
double g
Definition
MatGenFD.h:116
_matgenfd::G
double(* G)(double coeff, double x, double y, double z)
Definition
MatGenFD.h:133
_matgenfd::f
double f
Definition
MatGenFD.h:116
_matgenfd::h
double h
Definition
MatGenFD.h:116
_matgenfd::d
double d
Definition
MatGenFD.h:116
_matgenfd::bcY1
double bcY1
Definition
MatGenFD.h:123
_matgenfd::H
double(* H)(double coeff, double x, double y, double z)
Definition
MatGenFD.h:134
_matgenfd::bcZ1
double bcZ1
Definition
MatGenFD.h:124
_matgenfd::hh
double hh
Definition
MatGenFD.h:107
_matgenfd::E
double(* E)(double coeff, double x, double y, double z)
Definition
MatGenFD.h:131
_matgenfd::B
double(* B)(double coeff, double x, double y, double z)
Definition
MatGenFD.h:128
_matgenfd::threeD
bool threeD
Definition
MatGenFD.h:104
_matgenfd::id
int id
Definition
MatGenFD.h:108
_matgenfd::np
int np
Definition
MatGenFD.h:109
_matgenfd::F
double(* F)(double coeff, double x, double y, double z)
Definition
MatGenFD.h:132
_matgenfd::bcX2
double bcX2
Definition
MatGenFD.h:122
_matgenfd::allocateMem
bool allocateMem
Definition
MatGenFD.h:96
_matgenfd::c
double c
Definition
MatGenFD.h:116
_matgenfd::py
int py
Definition
MatGenFD.h:103
_matgenfd::D
double(* D)(double coeff, double x, double y, double z)
Definition
MatGenFD.h:130
_matgenfd::C
double(* C)(double coeff, double x, double y, double z)
Definition
MatGenFD.h:129
_matgenfd::e
double e
Definition
MatGenFD.h:116
_matgenfd::pz
int pz
Definition
MatGenFD.h:103
_matgenfd::bcX1
double bcX1
Definition
MatGenFD.h:122
_matgenfd::a
double a
Definition
MatGenFD.h:116
_matgenfd::b
double b
Definition
MatGenFD.h:116
_matgenfd::bcZ2
double bcZ2
Definition
MatGenFD.h:124
_matgenfd::first
int first
Definition
MatGenFD.h:118
_matgenfd::bcY2
double bcY2
Definition
MatGenFD.h:123
Generated by
1.17.0