AcouSTO  version 2.0

◆ read_solution()

void read_solution ( char *  fname)

Reads an externally evaluated solution on Master node. Physical meaning of read quantity depends on Dirichlet or Neumann BC. If dirneu = 1 External file "fname" contains the normal derivatives of primary, secondary and total field on the boundary. If dirneu = 2 External file "fname" contains the primary, secondary and total field on the boundary.

Parameters
[in]fnameFile name.
33  {
34  FILE *file;
35  int mpi_ncntr;
36  //Vec locSol;
37  int i ;
38  int idummy;
39  long double x;
40  long double y;
41  long double z;
42  long double rphiinc;
43  long double iphiinc;
44  long double phinctot;
45  long double rphisc;
46  long double iphisc;
47  long double phisctot;
48  long double rphitot;
49  long double iphitot;
50  long double phitot;
51  char s[255];
52 
53 #define Rf1I12F "%d %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf\n"
54 #define Pf1I12F "%d %+10.8LE %+10.8LE %+10.8LE %+10.8LE %+10.8LE %+10.8LE %+10.8LE %+10.8LE %+10.8LE %+10.8LE %+10.8LE %+10.8LE\n"
55  mpi_ncntr = modgeominfo->ncntr + modgeominfo->nchief;
56 
57 
58  file = fopen(fname,"r");
59  // reading header
60  for(i=0;i<7;i++){
61  fgets(s,255,file);
62  }
63  for(i=0;i<mpi_ncntr;i++){
64  fscanf(file,
65  Rf1I12F,
66  &idummy, // CONTROL POINT INFO
67  &x,
68  &y,
69  &z,
70  &rphiinc, // INCIDENT
71  &iphiinc,
72  &phinctot,
73  &rphisc, // SCATTERING
74  &iphisc,
75  &phisctot,
76  &rphitot, // TOTAL
77  &iphitot,
78  &phitot
79  );
80 
81  if(1 == modsolinfo->knw){
82  solution->sol[i] = (DOUBLE)rphitot + I*(DOUBLE)iphitot;
83  }else{
84  solution->sol[i] = (DOUBLE)rphisc + I*(DOUBLE)iphisc;
85  }
86  }
87 
88  fclose(file);
89 }
int ncntr
Definition: structs.h:299
int nchief
Definition: structs.h:301
COMPLEX * sol
Definition: structs.h:607
#define Rf1I12F
int knw
Definition: structs.h:446
struct solution_struct * solution
Definition: globals.h:52
struct modsol_info * modsolinfo
Definition: globals.h:44
DOUBLE z
Definition: structs.h:35
double DOUBLE
Definition: types.h:44
DOUBLE x
Definition: structs.h:31
struct modgeom_info * modgeominfo
Definition: globals.h:38
DOUBLE y
Definition: structs.h:33