added relaxation-weight for additive Schwarz-smoother and the
possibility to change the number of sweeps for special smoothers independently from the conventional smoothers
This commit is contained in:
parent
1da24ece65
commit
3f5d30a2f4
@ -378,6 +378,17 @@ HYPRE_BoomerAMGSetSmoothOption( HYPRE_Solver solver,
|
||||
return( hypre_BoomerAMGSetSmoothOption( (void *) solver, smooth_option ) );
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* HYPRE_BoomerAMGSetSmoothNumSweep
|
||||
*--------------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
HYPRE_BoomerAMGSetSmoothNumSweep( HYPRE_Solver solver,
|
||||
int smooth_num_sweep )
|
||||
{
|
||||
return( hypre_BoomerAMGSetSmoothNumSweep((void *)solver,smooth_num_sweep ));
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* HYPRE_BoomerAMGSetIOutDat
|
||||
*--------------------------------------------------------------------------*/
|
||||
@ -478,6 +489,18 @@ HYPRE_BoomerAMGSetDomainType( HYPRE_Solver solver,
|
||||
return( hypre_BoomerAMGSetDomainType( (void *) solver, domain_type ) );
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* HYPRE_BoomerAMGSetSchwarzRlxWeight
|
||||
*--------------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
HYPRE_BoomerAMGSetSchwarzRlxWeight( HYPRE_Solver solver,
|
||||
double schwarz_rlx_weight)
|
||||
{
|
||||
return( hypre_BoomerAMGSetSchwarzRlxWeight( (void *) solver,
|
||||
schwarz_rlx_weight ) );
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* HYPRE_BoomerAMGSetNumFunctions
|
||||
*--------------------------------------------------------------------------*/
|
||||
|
||||
@ -271,6 +271,12 @@ int HYPRE_BoomerAMGSetOverlap(HYPRE_Solver solver,
|
||||
int HYPRE_BoomerAMGSetDomainType(HYPRE_Solver solver,
|
||||
int domain_type);
|
||||
|
||||
/**
|
||||
* (Optional)
|
||||
**/
|
||||
int HYPRE_BoomerAMGSetSchwarzRlxWeight(HYPRE_Solver solver,
|
||||
double schwarz_rlx_weight);
|
||||
|
||||
/**
|
||||
* Return the number of iterations taken.
|
||||
**/
|
||||
@ -854,6 +860,8 @@ int HYPRE_SchwarzSetOverlap(HYPRE_Solver solver, int overlap);
|
||||
|
||||
int HYPRE_SchwarzSetDomainType(HYPRE_Solver solver, int domain_type);
|
||||
|
||||
int HYPRE_SchwarzSetRelaxWeight(HYPRE_Solver solver, double relax_weight);
|
||||
|
||||
int HYPRE_SchwarzSetDomainStructure(HYPRE_Solver solver,
|
||||
HYPRE_CSRMatrix domain_structure);
|
||||
|
||||
|
||||
@ -120,6 +120,17 @@ HYPRE_SchwarzSetNumFunctions( HYPRE_Solver solver,
|
||||
return( hypre_SchwarzSetNumFunctions( (void *) solver, num_functions ) );
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* HYPRE_SchwarzSetRelaxWeight
|
||||
*--------------------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
HYPRE_SchwarzSetRelaxWeight( HYPRE_Solver solver,
|
||||
double relax_weight)
|
||||
{
|
||||
return( hypre_SchwarzSetRelaxWeight((void *) solver,relax_weight));
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* HYPRE_SchwarzSetDofFunc
|
||||
*--------------------------------------------------------------------------*/
|
||||
|
||||
@ -48,8 +48,10 @@ hypre_BoomerAMGCreate()
|
||||
int **grid_relax_points;
|
||||
double *relax_weight;
|
||||
int *smooth_option;
|
||||
int smooth_num_sweep;
|
||||
|
||||
int variant, overlap, domain_type;
|
||||
double schwarz_rlx_weight;
|
||||
|
||||
/* log info */
|
||||
int num_iterations;
|
||||
@ -80,6 +82,8 @@ hypre_BoomerAMGCreate()
|
||||
variant = 0;
|
||||
overlap = 1;
|
||||
domain_type = 2;
|
||||
schwarz_rlx_weight = 1.0;
|
||||
smooth_num_sweep = 1;
|
||||
|
||||
/* solve params */
|
||||
min_iter = 0;
|
||||
@ -139,6 +143,7 @@ hypre_BoomerAMGCreate()
|
||||
hypre_BoomerAMGSetNumFunctions(amg_data, num_functions);
|
||||
hypre_BoomerAMGSetVariant(amg_data, variant);
|
||||
hypre_BoomerAMGSetOverlap(amg_data, overlap);
|
||||
hypre_BoomerAMGSetSchwarzRlxWeight(amg_data, schwarz_rlx_weight);
|
||||
hypre_BoomerAMGSetDomainType(amg_data, domain_type);
|
||||
|
||||
hypre_BoomerAMGSetMinIter(amg_data, min_iter);
|
||||
@ -150,6 +155,7 @@ hypre_BoomerAMGCreate()
|
||||
hypre_BoomerAMGSetGridRelaxPoints(amg_data, grid_relax_points);
|
||||
hypre_BoomerAMGSetRelaxWeight(amg_data, relax_weight);
|
||||
hypre_BoomerAMGSetSmoothOption(amg_data, smooth_option);
|
||||
hypre_BoomerAMGSetSmoothNumSweep(amg_data, smooth_num_sweep);
|
||||
|
||||
hypre_BoomerAMGSetNumIterations(amg_data, num_iterations);
|
||||
hypre_BoomerAMGSetIOutDat(amg_data, ioutdat);
|
||||
@ -510,6 +516,17 @@ hypre_BoomerAMGSetSmoothOption( void *data,
|
||||
return (ierr);
|
||||
}
|
||||
|
||||
hypre_BoomerAMGSetSmoothNumSweep( void *data,
|
||||
int smooth_num_sweep )
|
||||
{
|
||||
int ierr = 0;
|
||||
hypre_ParAMGData *amg_data = data;
|
||||
|
||||
hypre_ParAMGDataSmoothNumSweep(amg_data) = smooth_num_sweep;
|
||||
|
||||
return (ierr);
|
||||
}
|
||||
|
||||
int
|
||||
hypre_BoomerAMGSetIOutDat( void *data,
|
||||
int ioutdat )
|
||||
@ -711,3 +728,15 @@ hypre_BoomerAMGSetDomainType( void *data,
|
||||
return (ierr);
|
||||
}
|
||||
|
||||
int
|
||||
hypre_BoomerAMGSetSchwarzRlxWeight( void *data,
|
||||
double schwarz_rlx_weight)
|
||||
{
|
||||
int ierr = 0;
|
||||
hypre_ParAMGData *amg_data = data;
|
||||
|
||||
hypre_ParAMGDataSchwarzRlxWeight(amg_data) = schwarz_rlx_weight;
|
||||
|
||||
return (ierr);
|
||||
}
|
||||
|
||||
|
||||
@ -61,9 +61,11 @@ typedef struct
|
||||
int num_levels;
|
||||
int *smooth_option;
|
||||
HYPRE_Solver *smoother;
|
||||
int smooth_num_sweep;
|
||||
int variant;
|
||||
int overlap;
|
||||
int domain_type;
|
||||
double schwarz_rlx_weight;
|
||||
|
||||
/* data generated in the solve phase */
|
||||
hypre_ParVector *Vtemp;
|
||||
@ -133,9 +135,12 @@ typedef struct
|
||||
#define hypre_ParAMGDataNumLevels(amg_data) ((amg_data)->num_levels)
|
||||
#define hypre_ParAMGDataSmoothOption(amg_data) ((amg_data)->smooth_option)
|
||||
#define hypre_ParAMGDataSmoother(amg_data) ((amg_data)->smoother)
|
||||
#define hypre_ParAMGDataSmoothNumSweep(amg_data) ((amg_data)->smooth_num_sweep)
|
||||
#define hypre_ParAMGDataVariant(amg_data) ((amg_data)->variant)
|
||||
#define hypre_ParAMGDataOverlap(amg_data) ((amg_data)->overlap)
|
||||
#define hypre_ParAMGDataDomainType(amg_data) ((amg_data)->domain_type)
|
||||
#define hypre_ParAMGDataSchwarzRlxWeight(amg_data) \
|
||||
((amg_data)->schwarz_rlx_weight)
|
||||
|
||||
/* data generated in the solve phase */
|
||||
#define hypre_ParAMGDataVtemp(amg_data) ((amg_data)->Vtemp)
|
||||
|
||||
@ -438,6 +438,8 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
||||
HYPRE_SchwarzSetOverlap(smoother[0],hypre_ParAMGDataOverlap(amg_data));
|
||||
HYPRE_SchwarzSetDomainType(smoother[0],
|
||||
hypre_ParAMGDataDomainType(amg_data));
|
||||
HYPRE_SchwarzSetRelaxWeight(smoother[0],
|
||||
hypre_ParAMGDataSchwarzRlxWeight(amg_data));
|
||||
HYPRE_SchwarzSetup(smoother[0],
|
||||
(HYPRE_ParCSRMatrix) A_array[0],
|
||||
(HYPRE_ParVector) F_array[0],
|
||||
@ -489,6 +491,8 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
||||
HYPRE_SchwarzSetOverlap(smoother[j],hypre_ParAMGDataOverlap(amg_data));
|
||||
HYPRE_SchwarzSetDomainType(smoother[j],
|
||||
hypre_ParAMGDataDomainType(amg_data));
|
||||
HYPRE_SchwarzSetRelaxWeight(smoother[j],
|
||||
hypre_ParAMGDataSchwarzRlxWeight(amg_data));
|
||||
HYPRE_SchwarzSetup(smoother[j],
|
||||
(HYPRE_ParCSRMatrix) A_array[j],
|
||||
(HYPRE_ParVector) F_array[j],
|
||||
|
||||
@ -159,7 +159,7 @@ hypre_BoomerAMGCycle( void *amg_vdata,
|
||||
if (smooth_option[level] == -1)
|
||||
num_sweep = num_grid_sweeps[cycle_param];
|
||||
else
|
||||
num_sweep = 1;
|
||||
num_sweep = hypre_ParAMGDataSmoothNumSweep(amg_data);
|
||||
relax_type = grid_relax_type[cycle_param];
|
||||
}
|
||||
else if (max_levels > 1)
|
||||
|
||||
@ -29,6 +29,7 @@ hypre_SchwarzCreate()
|
||||
int domain_type;
|
||||
int overlap;
|
||||
int num_functions;
|
||||
double relax_weight;
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Setup default values for parameters
|
||||
@ -39,6 +40,7 @@ hypre_SchwarzCreate()
|
||||
overlap = 1; /* minimal overlap */
|
||||
domain_type = 2; /* domains generated by agglomeration */
|
||||
num_functions = 1;
|
||||
relax_weight = 1.0;
|
||||
|
||||
schwarz_data = hypre_CTAlloc(hypre_SchwarzData,1);
|
||||
|
||||
@ -46,6 +48,7 @@ hypre_SchwarzCreate()
|
||||
hypre_SchwarzSetDomainType(schwarz_data, domain_type);
|
||||
hypre_SchwarzSetOverlap(schwarz_data, overlap);
|
||||
hypre_SchwarzSetNumFunctions(schwarz_data, num_functions);
|
||||
hypre_SchwarzSetRelaxWeight(schwarz_data, relax_weight);
|
||||
|
||||
hypre_SchwarzDataDomainStructure(schwarz_data) = NULL;
|
||||
hypre_SchwarzDataScale(schwarz_data) = NULL;
|
||||
@ -95,6 +98,7 @@ hypre_SchwarzSetup(void *schwarz_vdata,
|
||||
int domain_type = hypre_SchwarzDataDomainType(schwarz_data);
|
||||
int overlap = hypre_SchwarzDataOverlap(schwarz_data);
|
||||
int num_functions = hypre_SchwarzDataNumFunctions(schwarz_data);
|
||||
double relax_weight = hypre_SchwarzDataRelaxWeight(schwarz_data);
|
||||
|
||||
Vtemp = hypre_ParVectorCreate(hypre_ParCSRMatrixComm(A),
|
||||
hypre_ParCSRMatrixGlobalNumRows(A),
|
||||
@ -110,7 +114,8 @@ hypre_SchwarzSetup(void *schwarz_vdata,
|
||||
|
||||
if (variant)
|
||||
{
|
||||
hypre_GenerateScale(domain_structure, num_variables, &scale);
|
||||
hypre_GenerateScale(domain_structure, num_variables, relax_weight,
|
||||
&scale);
|
||||
hypre_SchwarzDataScale(schwarz_data) = scale;
|
||||
}
|
||||
|
||||
@ -197,6 +202,17 @@ hypre_SchwarzSetNumFunctions( void *data, int num_functions )
|
||||
return (ierr);
|
||||
}
|
||||
|
||||
int
|
||||
hypre_SchwarzSetRelaxWeight( void *data, double relax_weight )
|
||||
{
|
||||
int ierr = 0;
|
||||
hypre_SchwarzData *schwarz_data = data;
|
||||
|
||||
hypre_SchwarzDataRelaxWeight(schwarz_data) = relax_weight;
|
||||
|
||||
return (ierr);
|
||||
}
|
||||
|
||||
int
|
||||
hypre_SchwarzSetDomainStructure( void *data, hypre_CSRMatrix *domain_structure )
|
||||
{
|
||||
|
||||
@ -64,6 +64,7 @@ int HYPRE_BoomerAMGSetGridRelaxType( HYPRE_Solver solver , int *grid_relax_type
|
||||
int HYPRE_BoomerAMGSetGridRelaxPoints( HYPRE_Solver solver , int **grid_relax_points );
|
||||
int HYPRE_BoomerAMGSetRelaxWeight( HYPRE_Solver solver , double *relax_weight );
|
||||
int HYPRE_BoomerAMGSetSmoothOption( HYPRE_Solver solver , int *smooth_option );
|
||||
int HYPRE_BoomerAMGSetSmoothNumSweep( HYPRE_Solver solver , int smooth_num_sweep );
|
||||
int HYPRE_BoomerAMGSetIOutDat( HYPRE_Solver solver , int ioutdat );
|
||||
int HYPRE_BoomerAMGSetLogFileName( HYPRE_Solver solver , char *log_file_name );
|
||||
int HYPRE_BoomerAMGSetLogging( HYPRE_Solver solver , int ioutdat , char *log_file_name );
|
||||
@ -73,6 +74,7 @@ int HYPRE_BoomerAMGGetFinalRelativeResidualNorm( HYPRE_Solver solver , double *r
|
||||
int HYPRE_BoomerAMGSetVariant( HYPRE_Solver solver , int variant );
|
||||
int HYPRE_BoomerAMGSetOverlap( HYPRE_Solver solver , int overlap );
|
||||
int HYPRE_BoomerAMGSetDomainType( HYPRE_Solver solver , int domain_type );
|
||||
int HYPRE_BoomerAMGSetSchwarzRlxWeight( HYPRE_Solver solver , double schwarz_rlx_weight );
|
||||
int HYPRE_BoomerAMGSetNumFunctions( HYPRE_Solver solver , int num_functions );
|
||||
int HYPRE_BoomerAMGSetDofFunc( HYPRE_Solver solver , int *dof_func );
|
||||
|
||||
@ -159,6 +161,7 @@ int HYPRE_SchwarzSetOverlap( HYPRE_Solver solver , int overlap );
|
||||
int HYPRE_SchwarzSetDomainType( HYPRE_Solver solver , int domain_type );
|
||||
int HYPRE_SchwarzSetDomainStructure( HYPRE_Solver solver , HYPRE_CSRMatrix domain_structure );
|
||||
int HYPRE_SchwarzSetNumFunctions( HYPRE_Solver solver , int num_functions );
|
||||
int HYPRE_SchwarzSetRelaxWeight( HYPRE_Solver solver , double relax_weight );
|
||||
int HYPRE_SchwarzSetDofFunc( HYPRE_Solver solver , int *dof_func );
|
||||
|
||||
/* driver.c */
|
||||
@ -192,6 +195,7 @@ int hypre_BoomerAMGSetGridRelaxType( void *data , int *grid_relax_type );
|
||||
int hypre_BoomerAMGSetGridRelaxPoints( void *data , int **grid_relax_points );
|
||||
int hypre_BoomerAMGSetRelaxWeight( void *data , double *relax_weight );
|
||||
int hypre_BoomerAMGSetSmoothOption( void *data , int *smooth_option );
|
||||
int hypre_BoomerAMGSetSmoothNumSweep( void *data , int smooth_num_sweep );
|
||||
int hypre_BoomerAMGSetIOutDat( void *data , int ioutdat );
|
||||
int hypre_BoomerAMGSetLogFileName( void *data , char *log_file_name );
|
||||
int hypre_BoomerAMGSetNumIterations( void *data , int num_iterations );
|
||||
@ -207,6 +211,7 @@ int hypre_BoomerAMGGetRelResidualNorm( void *data , double *rel_resid_norm );
|
||||
int hypre_BoomerAMGSetVariant( void *data , int variant );
|
||||
int hypre_BoomerAMGSetOverlap( void *data , int overlap );
|
||||
int hypre_BoomerAMGSetDomainType( void *data , int domain_type );
|
||||
int hypre_BoomerAMGSetSchwarzRlxWeight( void *data , double schwarz_rlx_weight );
|
||||
|
||||
/* par_amg_setup.c */
|
||||
int hypre_BoomerAMGSetup( void *amg_vdata , hypre_ParCSRMatrix *A , hypre_ParVector *f , hypre_ParVector *u );
|
||||
@ -277,6 +282,7 @@ int hypre_SchwarzSetVariant( void *data , int variant );
|
||||
int hypre_SchwarzSetDomainType( void *data , int domain_type );
|
||||
int hypre_SchwarzSetOverlap( void *data , int overlap );
|
||||
int hypre_SchwarzSetNumFunctions( void *data , int num_functions );
|
||||
int hypre_SchwarzSetRelaxWeight( void *data , double relax_weight );
|
||||
int hypre_SchwarzSetDomainStructure( void *data , hypre_CSRMatrix *domain_structure );
|
||||
int hypre_SchwarzSetScale( void *data , double *scale );
|
||||
int hypre_SchwarzSetDofFunc( void *data , int *dof_func );
|
||||
@ -320,7 +326,7 @@ int move_entry( int weight , int *weight_max , int *previous , int *next , int *
|
||||
int matinv( double *x , double *a , int k );
|
||||
int hypre_parCorrRes( hypre_ParCSRMatrix *A , hypre_ParVector *x , hypre_Vector *rhs , double **tmp_ptr );
|
||||
int hypre_AdSchwarzSolve( hypre_ParCSRMatrix *par_A , hypre_ParVector *par_rhs , hypre_CSRMatrix *domain_structure , double *scale , hypre_ParVector *par_x , hypre_ParVector *par_aux );
|
||||
int hypre_GenerateScale( hypre_CSRMatrix *domain_structure , int num_variables , double **scale_pointer );
|
||||
int hypre_GenerateScale( hypre_CSRMatrix *domain_structure , int num_variables , double relaxation_weight , double **scale_pointer );
|
||||
|
||||
/* transpose.c */
|
||||
int hypre_CSRMatrixTranspose( hypre_CSRMatrix *A , hypre_CSRMatrix **AT );
|
||||
|
||||
@ -2089,6 +2089,7 @@ int hypre_AdSchwarzSolve(hypre_ParCSRMatrix *par_A,
|
||||
int
|
||||
hypre_GenerateScale(hypre_CSRMatrix *domain_structure,
|
||||
int num_variables,
|
||||
double relaxation_weight,
|
||||
double **scale_pointer)
|
||||
{
|
||||
int num_domains = hypre_CSRMatrixNumRows(domain_structure);
|
||||
@ -2105,7 +2106,7 @@ hypre_GenerateScale(hypre_CSRMatrix *domain_structure,
|
||||
scale[j_domain_dof[j]] += 1.0;
|
||||
|
||||
for (i=0; i < num_variables; i++)
|
||||
scale[i] = 1.0/scale[i];
|
||||
scale[i] = relaxation_weight/scale[i];
|
||||
|
||||
*scale_pointer = scale;
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ typedef struct
|
||||
int domain_type;
|
||||
int overlap;
|
||||
int num_functions;
|
||||
double relax_weight;
|
||||
|
||||
hypre_CSRMatrix *domain_structure;
|
||||
hypre_ParVector *Vtemp;
|
||||
@ -37,6 +38,8 @@ typedef struct
|
||||
#define hypre_SchwarzDataOverlap(schwarz_data) ((schwarz_data)->overlap)
|
||||
#define hypre_SchwarzDataNumFunctions(schwarz_data) \
|
||||
((schwarz_data)->num_functions)
|
||||
#define hypre_SchwarzDataRelaxWeight(schwarz_data) \
|
||||
((schwarz_data)->relax_weight)
|
||||
#define hypre_SchwarzDataDomainStructure(schwarz_data) \
|
||||
((schwarz_data)->domain_structure)
|
||||
#define hypre_SchwarzDataVtemp(schwarz_data) ((schwarz_data)->Vtemp)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user