/[escript]/trunk/paso/src/FCT_Solver.cpp
ViewVC logotype

Diff of /trunk/paso/src/FCT_Solver.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4843 by caltinay, Tue Apr 8 05:32:07 2014 UTC revision 4846 by caltinay, Tue Apr 8 23:55:38 2014 UTC
# Line 35  Line 35 
35  #include "PasoUtil.h"  #include "PasoUtil.h"
36    
37    
38  Paso_FCT_Solver* Paso_FCT_Solver_alloc(Paso_TransportProblem *fctp, Paso_Options* options)  Paso_FCT_Solver* Paso_FCT_Solver_alloc(Paso_TransportProblem *fctp, paso::Options* options)
39  {  {
40      Paso_FCT_Solver* out=NULL;      Paso_FCT_Solver* out=NULL;
41      const dim_t blockSize=Paso_TransportProblem_getBlockSize(fctp);      const dim_t blockSize=Paso_TransportProblem_getBlockSize(fctp);
# Line 131  double Paso_FCT_Solver_getSafeTimeStepSi Line 131  double Paso_FCT_Solver_getSafeTimeStepSi
131  }  }
132    
133  /* modifies the main diagonal of the iteration matrix to introduce new dt */  /* modifies the main diagonal of the iteration matrix to introduce new dt */
134  void Paso_FCT_Solver_initialize(const double dt, Paso_FCT_Solver *fct_solver, Paso_Options* options, Paso_Performance* pp)  void Paso_FCT_Solver_initialize(const double dt, Paso_FCT_Solver *fct_solver, paso::Options* options, Paso_Performance* pp)
135  {  {
136     Paso_TransportProblem* fctp = fct_solver->transportproblem;     Paso_TransportProblem* fctp = fct_solver->transportproblem;
137     const index_t* main_iptr=Paso_TransportProblem_borrowMainDiagonalPointer(fctp);     const index_t* main_iptr=Paso_TransportProblem_borrowMainDiagonalPointer(fctp);
# Line 139  void Paso_FCT_Solver_initialize(const do Line 139  void Paso_FCT_Solver_initialize(const do
139     const double theta = Paso_FCT_Solver_getTheta(fct_solver);     const double theta = Paso_FCT_Solver_getTheta(fct_solver);
140     const double omega=1./(dt* theta);     const double omega=1./(dt* theta);
141     dim_t i;     dim_t i;
142     Paso_Options options2;     paso::Options options2;
143    
144    
145    
# Line 162  void Paso_FCT_Solver_initialize(const do Line 162  void Paso_FCT_Solver_initialize(const do
162      }      }
163    
164      /* allocate preconditioner/solver */      /* allocate preconditioner/solver */
     Paso_Options_setDefaults(&options2);  
165      options2.verbose = options->verbose;      options2.verbose = options->verbose;
166      if (fct_solver->method == PASO_LINEAR_CRANK_NICOLSON  ) {      if (fct_solver->method == PASO_LINEAR_CRANK_NICOLSON) {
167          options2.preconditioner = PASO_GS;          options2.preconditioner = PASO_GS;
168      } else  {      } else  {
169          options2.preconditioner = PASO_JACOBI;          options2.preconditioner = PASO_JACOBI;
# Line 179  void Paso_FCT_Solver_initialize(const do Line 178  void Paso_FCT_Solver_initialize(const do
178  }  }
179    
180  /* entry point for update procedures */  /* entry point for update procedures */
181  err_t Paso_FCT_Solver_update(Paso_FCT_Solver *fct_solver, double* u, double *u_old,  Paso_Options* options, Paso_Performance *pp)  err_t Paso_FCT_Solver_update(Paso_FCT_Solver *fct_solver, double* u, double *u_old,  paso::Options* options, Paso_Performance *pp)
182  {  {
183      const index_t method=fct_solver->method;      const index_t method=fct_solver->method;
184      err_t err_out = SOLVER_NO_ERROR;      err_t err_out = SOLVER_NO_ERROR;
# Line 197  err_t Paso_FCT_Solver_update(Paso_FCT_So Line 196  err_t Paso_FCT_Solver_update(Paso_FCT_So
196  }  }
197    
198  /* linear crank-nicolson update */  /* linear crank-nicolson update */
199  err_t Paso_FCT_Solver_update_LCN(Paso_FCT_Solver *fct_solver, double * u, double *u_old, Paso_Options* options, Paso_Performance *pp)  err_t Paso_FCT_Solver_update_LCN(Paso_FCT_Solver *fct_solver, double * u, double *u_old, paso::Options* options, Paso_Performance *pp)
200  {  {
201      double const dt = fct_solver->dt;      double const dt = fct_solver->dt;
202      dim_t sweep_max, i;      dim_t sweep_max, i;
# Line 264  err_t Paso_FCT_Solver_update_LCN(Paso_FC Line 263  err_t Paso_FCT_Solver_update_LCN(Paso_FC
263    
264  }  }
265    
266  err_t Paso_FCT_Solver_updateNL(Paso_FCT_Solver *fct_solver, double* u, double *u_old, Paso_Options* options, Paso_Performance *pp)  err_t Paso_FCT_Solver_updateNL(Paso_FCT_Solver *fct_solver, double* u, double *u_old, paso::Options* options, Paso_Performance *pp)
267  {  {
268     const dim_t num_critical_rates_max=3; /* number of rates >=critical_rate accepted before divergence is triggered */     const dim_t num_critical_rates_max=3; /* number of rates >=critical_rate accepted before divergence is triggered */
269     const double critical_rate=0.95;   /* expected value of convergence rate */     const double critical_rate=0.95;   /* expected value of convergence rate */

Legend:
Removed from v.4843  
changed lines
  Added in v.4846

  ViewVC Help
Powered by ViewVC 1.1.26