21 double*,
double*,
int,
void*,
double);
41 fprintf(stderr,
"Error in FPPowerSystem3BusInitialize(): nvars has to be %d.\n",
_MODEL_NVARS_);
45 fprintf(stderr,
"Error in FPPowerSystem3BusInitialize(): ndims has to be %d.\n",
_MODEL_NDIMS_);
49 double pi = 4.0*atan(1.0);
57 physics->
Href = 13.60;
58 physics->
E1 = 1.01556070860155;
59 physics->
E2 = 1.0491099265981;
60 physics->
Eref = 1.05623172878954;
61 physics->
omegaB = 2*pi*60.0;
62 physics->
sigma[0][0] = 0.0125;
63 physics->
sigma[0][1] = 0.0;
64 physics->
sigma[1][0] = 0.0;
65 physics->
sigma[1][1] = 0.0125;
67 physics->
lambda[0][1] = 0.0;
68 physics->
lambda[1][0] = 0.0;
70 physics->
gamma = 0.25;
72 physics->
G = (
double*) calloc (3*3,
sizeof(
double));
73 physics->
B = (
double*) calloc (3*3,
sizeof(
double));
75 physics->
G[0*3+0] = 0.276805493111691;
76 physics->
G[0*3+1] = 0.213024867595501;
77 physics->
G[0*3+2] = 0.209205876527443;
78 physics->
G[1*3+0] = 0.213024867595501;
79 physics->
G[1*3+1] = 0.419642083051144;
80 physics->
G[1*3+2] = 0.286592141665043;
81 physics->
G[2*3+0] = 0.209205876527443;
82 physics->
G[2*3+1] = 0.286592141665044;
83 physics->
G[2*3+2] = 0.844559256324453;
85 physics->
B[0*3+0] = -2.36794416971567;
86 physics->
B[0*3+1] = 1.08817493992579;
87 physics->
B[0*3+2] = 1.22601259339234;
88 physics->
B[1*3+0] = 1.08817493992579;
89 physics->
B[1*3+1] = -2.72352378723346;
90 physics->
B[1*3+2] = 1.51348094527252;
91 physics->
B[2*3+0] = 1.22601259339234;
92 physics->
B[2*3+1] = 1.51348094527252;
93 physics->
B[2*3+2] = -2.98729895217208;
97 if ((!mpi->
rank) && (!count)) printf(
"Reading physical model inputs from file \"physics.inp\".\n");
98 in = fopen(
"physics.inp",
"r");
100 if (!mpi->
rank) fprintf(stderr,
"Error: File \"physics.inp\" not found.\n");
104 ferr = fscanf(in,
"%s",word);
if (ferr != 1)
return(1);
105 if (!strcmp(word,
"begin")){
106 while (strcmp(word,
"end")){
107 ferr = fscanf(in,
"%s",word);
if (ferr != 1)
return(1);
108 if (!strcmp(word,
"Pm1_avg" )) {ferr=fscanf(in,
"%lf",&physics->
Pm1_avg ) ;
if(ferr!=1)
return(1);}
109 else if (!strcmp(word,
"Pm2_avg" )) {ferr=fscanf(in,
"%lf",&physics->
Pm2_avg ) ;
if(ferr!=1)
return(1);}
110 else if (!strcmp(word,
"Pmref_avg" )) {ferr=fscanf(in,
"%lf",&physics->
Pmref_avg ) ;
if(ferr!=1)
return(1);}
111 else if (!strcmp(word,
"H1" )) {ferr=fscanf(in,
"%lf",&physics->
H1 ) ;
if(ferr!=1)
return(1);}
112 else if (!strcmp(word,
"H2" )) {ferr=fscanf(in,
"%lf",&physics->
H2 ) ;
if(ferr!=1)
return(1);}
113 else if (!strcmp(word,
"Href" )) {ferr=fscanf(in,
"%lf",&physics->
Href ) ;
if(ferr!=1)
return(1);}
114 else if (!strcmp(word,
"E1" )) {ferr=fscanf(in,
"%lf",&physics->
E1 ) ;
if(ferr!=1)
return(1);}
115 else if (!strcmp(word,
"E2" )) {ferr=fscanf(in,
"%lf",&physics->
E2 ) ;
if(ferr!=1)
return(1);}
116 else if (!strcmp(word,
"Eref" )) {ferr=fscanf(in,
"%lf",&physics->
Eref ) ;
if(ferr!=1)
return(1);}
117 else if (!strcmp(word,
"omegaB" )) {ferr=fscanf(in,
"%lf",&physics->
omegaB ) ;
if(ferr!=1)
return(1);}
118 else if (!strcmp(word,
"gamma" )) {ferr=fscanf(in,
"%lf",&physics->
gamma ) ;
if(ferr!=1)
return(1);}
119 else if (!strcmp(word,
"sigma" )) {
120 ferr=fscanf(in,
"%lf",&physics->
sigma[0][0]) ;
if(ferr!=1)
return(1);
121 ferr=fscanf(in,
"%lf",&physics->
sigma[0][1]) ;
if(ferr!=1)
return(1);
122 ferr=fscanf(in,
"%lf",&physics->
sigma[1][0]) ;
if(ferr!=1)
return(1);
123 ferr=fscanf(in,
"%lf",&physics->
sigma[1][1]) ;
if(ferr!=1)
return(1);
124 }
else if (!strcmp(word,
"lambda")) {
125 ferr=fscanf(in,
"%lf",&physics->
lambda[0][0]) ;
if(ferr!=1)
return(1);
126 ferr=fscanf(in,
"%lf",&physics->
lambda[0][1]) ;
if(ferr!=1)
return(1);
127 ferr=fscanf(in,
"%lf",&physics->
lambda[1][0]) ;
if(ferr!=1)
return(1);
128 ferr=fscanf(in,
"%lf",&physics->
lambda[1][1]) ;
if(ferr!=1)
return(1);
129 }
else if (!strcmp(word,
"G")) {
130 ferr=fscanf(in,
"%lf",&physics->
G[0*3+0]) ;
if(ferr!=1)
return(1);
131 ferr=fscanf(in,
"%lf",&physics->
G[0*3+1]) ;
if(ferr!=1)
return(1);
132 ferr=fscanf(in,
"%lf",&physics->
G[0*3+2]) ;
if(ferr!=1)
return(1);
133 ferr=fscanf(in,
"%lf",&physics->
G[1*3+0]) ;
if(ferr!=1)
return(1);
134 ferr=fscanf(in,
"%lf",&physics->
G[1*3+1]) ;
if(ferr!=1)
return(1);
135 ferr=fscanf(in,
"%lf",&physics->
G[1*3+2]) ;
if(ferr!=1)
return(1);
136 ferr=fscanf(in,
"%lf",&physics->
G[2*3+0]) ;
if(ferr!=1)
return(1);
137 ferr=fscanf(in,
"%lf",&physics->
G[2*3+1]) ;
if(ferr!=1)
return(1);
138 ferr=fscanf(in,
"%lf",&physics->
G[2*3+2]) ;
if(ferr!=1)
return(1);
139 }
else if (!strcmp(word,
"B")) {
140 ferr=fscanf(in,
"%lf",&physics->
B[0*3+0]) ;
if(ferr!=1)
return(1);
141 ferr=fscanf(in,
"%lf",&physics->
B[0*3+1]) ;
if(ferr!=1)
return(1);
142 ferr=fscanf(in,
"%lf",&physics->
B[0*3+2]) ;
if(ferr!=1)
return(1);
143 ferr=fscanf(in,
"%lf",&physics->
B[1*3+0]) ;
if(ferr!=1)
return(1);
144 ferr=fscanf(in,
"%lf",&physics->
B[1*3+1]) ;
if(ferr!=1)
return(1);
145 ferr=fscanf(in,
"%lf",&physics->
B[1*3+2]) ;
if(ferr!=1)
return(1);
146 ferr=fscanf(in,
"%lf",&physics->
B[2*3+0]) ;
if(ferr!=1)
return(1);
147 ferr=fscanf(in,
"%lf",&physics->
B[2*3+1]) ;
if(ferr!=1)
return(1);
148 ferr=fscanf(in,
"%lf",&physics->
B[2*3+2]) ;
if(ferr!=1)
return(1);
152 if (!mpi->
rank) fprintf(stderr,
"Error: Illegal format in file \"physics.inp\".\n");
160 fprintf(stderr,
"Error in FPPowerSystem3BusInitialize: This physical model does not have a splitting ");
161 fprintf(stderr,
"of the hyperbolic term defined.\n");
double(* ComputeCFL)(void *, void *, double, double)
int FPPowerSystem3BusInitialize(void *, void *)
int(* HFunction)(double *, double *, int, int, void *, double)
int(* Upwind)(double *, double *, double *, double *, double *, double *, int, void *, double)
MPI related function definitions.
int(* FFunction)(double *, double *, int, void *, double)
int FPPowerSystem3BusDiffusion(double *f, double *u, int dir1, int dir2, void *s, double t)
int FPPowerSystem3BusUpwind(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _MAX_STRING_SIZE_
double FPPowerSystem3BusComputeCFL(void *s, void *m, double dt, double t)
double(* ComputeDiffNumber)(void *, void *, double, double)
int FPPowerSystem3BusAdvection(double *f, double *u, int dir, void *s, double t)
Structure containing variable and parameters specific to the 3-bus power system model. This structure contains the physical parameters and variables for the Fokker-Planck model for a 3-bus power system.
Contains structure definition for hypar.
char SplitHyperbolicFlux[_MAX_STRING_SIZE_]
Some basic definitions and macros.
Contains macros and function definitions for common array operations.
double FPPowerSystem3BusComputeDiffNumber(void *s, void *m, double dt, double t)
Structure of MPI-related variables.
Structure containing all solver-specific variables and functions.