Evaluates B and C coefficients (please refer to the user manual for details on the theory) The actual evaluation is done in parallel on all the nodes of the domain (SPMD). The matrices are partitioned according to scalapack 2D block cyclic distribution (locRows x locCols). In each loop over the nodes, krow lines of the coefficient matrices can be loaded into memory to minimize memory usage and then written on two different files:
where <nodeid> is the rank of the node (to avoid name-clashing on multiple process running on the same node). The same files are then read in the Matrices assembly procedure (matrices.c), basically we dictate here the overall partitioning method for the run.
52 int npsib,nphib,nelmu;
56 struct panel4* mpi_elements;
65 DOUBLE source,doublet,ratelet;
80 int nrow,nrowi,iloop,nloop,irow,nio,nrlast;
87 int bsymmoffset,csymmoffset;
89 long long int perc,ioldcurrent,icurrent,ntotal;
107 #ifdef _ACOUSTO_DEBUG 109 sprintf(fname,
"elements.%d",
rank);
111 f = fopen(fname,
"w");
113 fprintf(f,
"# ielmb=%d\n",i);
114 fprintf(f,
VECTOR_PRINTF,mpi_elements[i].
x[0].
x, mpi_elements[i].x[0].
y, mpi_elements[i].x[0].
z);
115 fprintf(f,
VECTOR_PRINTF,mpi_elements[i].
x[1].
x, mpi_elements[i].x[1].
y, mpi_elements[i].x[1].
z);
116 fprintf(f,
VECTOR_PRINTF,mpi_elements[i].
x[2].
x, mpi_elements[i].x[2].
y, mpi_elements[i].x[2].
z);
117 fprintf(f,
VECTOR_PRINTF,mpi_elements[i].
x[3].
x, mpi_elements[i].x[3].
y, mpi_elements[i].x[3].
z);
121 sprintf(fname,
"cntr.%d",
rank);
123 f = fopen(fname,
"w");
124 for(i=0;i<mpi_ncntr;i++){
128 sprintf(fname,
"normals.%d",
rank);
130 f = fopen(fname,
"w");
131 for(i=0;i<mpi_ncntr;i++){
134 mpi_cntr[i].
y+mpi_elements[i].
n.
y,
135 mpi_cntr[i].
z+mpi_elements[i].
n.
z);
158 logger(
LOG_DEBUG,
"Total allocated memory for body coefficients=%d bytes\n",
168 logger(
LOG_DEBUG,
"body coefficients will be in files \"%s\" and \"%s\"\n", fbname,fcname);
170 fbcoef = fopen(fbname,
"wb");
171 fccoef = fopen(fcname,
"wb");
175 j12(locRows,nrow,&nrlast,&nloop);
182 for(iloop=0;iloop<nloop;iloop++){
185 if(iloop == nloop-1) nrowi = nrlast;
187 bstride = nrowi*locCols;
188 cstride = nrowi*locCols;
190 for(irow=0;irow<nrowi;irow++){
191 i=
j21(irow,iloop,nrow);
193 for(j=0;j<locCols;j++){
199 bsymmoffset = is * 2*nrowi*locCols;
200 csymmoffset = is * 4*nrowi*locCols;
201 ielmb = ielmu + is*nelmu;
203 kode = (ielmb == icntr) ? 1 : 0;
205 delaya(&theta,ielmb,&mpi_elements[ielmb],mpi_cntr[icntr]);
206 intgba(1, 0, kode, &mpi_cntr[icntr], &mpi_elements[ielmb], &source, &doublet, &ratelet);
208 ic = irow*locCols +j;
218 bodycoefs->
C[ic + cstride*3 + csymmoffset] = (icntr == ielmb) ? 0.5 : 0.0;
222 if( (icurrent*10/ntotal) != (ioldcurrent*10/ntotal)){
223 perc =icurrent*100/ntotal;
226 ioldcurrent = icurrent;
276 #ifdef _ACOUSTO_DEBUG 279 fbcoef = fopen(fbname,
"rb"); fccoef = fopen(fcname,
"rb");
283 f = fopen(fname,
"w");
284 j12(locRows,nrow,&nrlast,&nloop);
285 for(iloop=0;iloop<nloop;iloop++){
287 if(iloop == nloop-1) nrowi = nrlast;
288 bstride = nrowi*locCols;
289 cstride = nrowi*locCols;
294 for(irow=0;irow<nrowi;irow++){
295 i=
j21(irow,iloop,nrow);
297 for(j=0;j<locCols;j++){
301 ielmb = ielmu + is*nelmu;
302 bsymmoffset = is * 2*nrowi*locCols;
303 csymmoffset = is * 4*nrow*locCols;
304 fprintf(f,
"%d %d %f %f %f %f %f %f\n",icntr,ielmb,
306 bodycoefs->
B[(irow*locCols+j) + bstride + bsymmoffset],
308 bodycoefs->
C[(irow*locCols+j) + cstride + csymmoffset],
309 bodycoefs->
C[(irow*locCols+j) + cstride*2 + csymmoffset],
310 bodycoefs->
C[(irow*locCols+j) + cstride*3 + csymmoffset]);
324 #undef _ACOUSTO_DEBUG struct bodycoefs_struct * bodycoefs
Definition: globals.h:48
struct run_info * runinfo
Definition: globals.h:34
int npcols
Definition: structs.h:113
int ncntr
Definition: structs.h:299
DOUBLE vsound
Definition: structs.h:102
#define VECTOR_PRINTF
Definition: formats.h:66
void delaya(DOUBLE *theta, int ielmb, struct panel4 *element, struct vector xc)
Definition: integrals.c:268
struct to hold Coefficients at the body.
Definition: structs.h:379
int myrow
Definition: structs.h:115
int nprows
Definition: structs.h:111
void get_filename(char *filename, const char *format,...)
Definition: utils.c:59
vector struct to hold triplets.
Definition: structs.h:29
DOUBLE * B
Definition: structs.h:385
#define MSG_BODYCOEF_END
Definition: messages.h:48
int nchief
Definition: structs.h:301
DOUBLE * C
Definition: structs.h:387
#define LOG_INFO
Definition: logger.h:26
int nelmb
Definition: structs.h:295
#define MSG_BODYCOEF_START
Definition: messages.h:46
Definition of a quadrilateral panel.
Definition: structs.h:44
struct vector n
Definition: structs.h:48
DOUBLE z
Definition: structs.h:35
void j12(int i12, int n1, int *i1, int *i2)
Definition: math.c:206
#define LOG_DEBUG
Definition: logger.h:27
int j21(int i1, int i2, int n1)
Definition: math.c:202
int mycol
Definition: structs.h:117
int nsymm
Definition: structs.h:97
double DOUBLE
Definition: types.h:44
int numroc_(int *m, int *mb, int *p, int *ia, int *npr)
int rank
Definition: globals.h:79
DOUBLE x
Definition: structs.h:31
int col_block_size
Definition: structs.h:121
void intgba(int kcrce, int kelem, int kode, struct vector *xcntr, struct panel4 *element, DOUBLE *source, DOUBLE *doublet, DOUBLE *ratelet)
Definition: integrals.c:40
int krow
Definition: structs.h:105
Geometry info structure.
Definition: structs.h:161
struct vector x[4]
Definition: structs.h:46
#define MAX_PATH
Definition: constants.h:29
int row_block_size
Definition: structs.h:119
void logger(int level, char *msg,...)
Definition: logger.c:56
#define calloc(n, size)
Definition: allocation.h:37
struct modgeom_info * modgeominfo
Definition: globals.h:38
void sc_l2g(int il, int p, int n, int np, int nb, int *i)
Definition: matutils.c:116
DOUBLE y
Definition: structs.h:33