Shrirang Abhyankar avatar Shrirang Abhyankar committed ab7c975

Started adding noise component in ex10.c

Corrected the diffusion coefficient term.
Updated the options for introducing noise (-q, -lambda)
No fault scenario used.
Moved printing of PM_min, mu_delta etc. at the end of the simulation.

Comments (0)

Files changed (2)

src/ts/examples/tutorials/power_grid/ex10.c

   ierr = PetscViewerDestroy(&user.binv);CHKERRQ(ierr);
   ierr = DMDestroy(&user.da);CHKERRQ(ierr);
   ierr = TSDestroy(&ts);CHKERRQ(ierr);
+  ierr = PetscPrintf(PETSC_COMM_WORLD,"Corrected user->mu_delta = %f, user->mu_w = %f user->PM_min = %f,user->ddelta = %f\n",user.mu_delta,user.mu_w,user.PM_min,user.ddelta);CHKERRQ(ierr);
   PetscFinalize();
   return 0;
 }
   ierr = PetscPrintf(PETSC_COMM_WORLD,"Original user->mu_delta = %f, user->mu_w = %f\n",user->mu_delta,user->mu_w);CHKERRQ(ierr);
   ierr = DMDAGetLogicalCoordinate(user->da,user->mu_delta,user->mu_w,0.0,&I,&J,NULL,&user->mu_delta,&user->mu_w,NULL);CHKERRQ(ierr);
   user->PM_min = user->Pmax*sin(user->mu_delta);
-  ierr = PetscPrintf(PETSC_COMM_WORLD,"Corrected user->mu_delta = %f, user->mu_w = %f user->PM_min = %f,user->ddelta = %f\n",user->mu_delta,user->mu_w,user->PM_min,user->ddelta);CHKERRQ(ierr);
   if (I > -1 && J > -1) {
     p[J][I] = 1.0;
   }
 
   PetscScalar diffuse1,gamma;
   gamma = user->D*1.0/(2*user->H);
-  diffuse1 = user->lambda*user->lambda*user->q/(user->lambda*gamma+1)*(1.0 - PetscExpScalar(-t*(gamma+1.0)/user->lambda));
+  diffuse1 = user->lambda*user->lambda*user->q/(user->lambda*gamma+1)*(1.0 - PetscExpScalar(-t*(gamma + 1.0/user->lambda)));
   user->disper_coe = 1.0/(4*user->H*user->H)*diffuse1;
 
   for (i=xs; i < xs+xm; i++) {

src/ts/examples/tutorials/power_grid/petscopt_ex10

 -ts_type ssp
 -ts_final_time 5.0
 -ts_dt 0.001
+-howoften 100
 
--q 0.0
+-q 0.01
+-lambda 0.025
 -Inertia 5.0
 -D 5.0
 -PM_min 0.9
 
 -stencil_width 1
 
--tf 1.0
--tcl 1.05
+-tf 10000
+-tcl 10500
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.