HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FPPowerSystemFunctions.c
Go to the documentation of this file.
1 #include <math.h>
3 
4 double FPPowerSystemDriftFunction(int dir,void *p,double x,double y, double t)
5 {
6  FPPowerSystem *params = (FPPowerSystem*) p;
7 
8  double drift = 0;
9  if (dir == 0) drift = params->O_s * (y - 1.0);
10  else if (dir == 1) {
11  if (t < params->tf) params->Pmax = params->E*params->V/params->g1;
12  else if (t < params->tcl) params->Pmax = 0.0;
13  else params->Pmax = params->E*params->V/params->g2;
14  drift = (1.0/(2.0*params->H)) * (params->Pm - params->Pmax*sin(x) - params->D*(y-1.0));
15  }
16 
17  return drift;
18 }
19 
20 double FPPowerSystemDissipationFunction(int dir,void *p,double t)
21 {
22  FPPowerSystem *params = (FPPowerSystem*) p;
23 
24  double dissp = 0;
25  if (dir == 1) {
26  double gamma = params->D / (2.0*params->H);
27  dissp = (1.0/(2.0*params->H)) * (1.0/(2.0*params->H))
28  * ((params->l*params->q*params->q)/(params->l*gamma+1.0))
29  * (1.0 - exp(-(gamma+1.0/params->l)*t));
30  }
31 
32  return(dissp);
33 }
#define drift(x)
Definition: fpdoublewell.h:31
double FPPowerSystemDissipationFunction(int, void *, double)
double FPPowerSystemDriftFunction(int, void *, double, double, double)