Changeset a24b80 for src/units/particle/interface_fcs.cpp
- Timestamp:
- Jun 11, 2012, 3:01:12 PM (13 years ago)
- Children:
- 290aa3
- Parents:
- 2d4211
- File:
-
- 1 edited
-
src/units/particle/interface_fcs.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/units/particle/interface_fcs.cpp
r2d4211 ra24b80 54 54 #include "smoother/gsrb_poisson_2.hpp" 55 55 #include "smoother/gsrb_poisson_4.hpp" 56 #ifdef HAVE_LAPACK57 #include "solver/dgesv.hpp"58 #include "solver/dsysv.hpp"59 #else60 56 #include "solver/givens.hpp" 61 #endif62 57 #include "solver/solver_regular.hpp" 63 58 #include "solver/solver_singular.hpp" … … 116 111 const bool singular = periodic[0] * periodic[1] * periodic[2]; 117 112 118 /* 119 * Register communication class. 120 */ 121 Comm* comm = new Particle::CommMPI(boundary, new DomainDecompositionMPI(), mpi_comm); 113 Comm* comm; 114 Discretization* discretization; 115 Interface* interface; 116 LevelOperator* lop; 117 Smoother* smoother; 118 Solver* solver; 119 120 /* 121 * Choose multigrid components 122 */ 123 if (singular) { 124 125 comm = new Particle::CommMPI(boundary, new DomainDecompositionMPI(), mpi_comm); 126 discretization = new DiscretizationPoissonFD(discretization_order); 127 interface = new InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells, 0, 1.0); 128 lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 129 solver = new Givens<SolverSingular>(); 130 131 Techniques::SetCorrectionSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), cycle_type); 132 133 }else { 134 135 comm = new Particle::CommMPI(boundary, new DomainDecompositionMPI(), mpi_comm); 136 discretization = new DiscretizationPoissonFV(discretization_order); 137 interface = new InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells, 2, 1.6); 138 lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 139 solver = new Givens<SolverRegular>(); 140 141 Techniques::SetFullApproximationSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), cycle_type); 142 143 } 144 145 /* 146 * Use Gauss-Seidel Red-Black ordering 147 */ 148 if (discretization_order == 2) 149 smoother = new GaussSeidelRBPoisson2(); 150 else 151 smoother = new GaussSeidelRBPoisson4(); 152 153 /* 154 * Register multigrid components 155 */ 122 156 comm->Register("COMM"); 123 124 /*125 * Register particle interface.126 */127 Interface* interface;128 if (singular)129 interface = new InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells, 0, 1.0);130 else131 interface = new InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells, 2, 1.6);132 MG::SetInterface(interface, comm);133 134 /*135 * Define discretization of the Poisson equation.136 * Finite volumes for locally refined grids and137 * finite differences otherwise.138 */139 Discretization* discretization;140 if (singular)141 discretization = new DiscretizationPoissonFD(discretization_order);142 else143 discretization = new DiscretizationPoissonFV(discretization_order);144 157 discretization->Register("DISCRETIZATION"); 145 146 /* 147 * Use a correction scheme multigrid algorithm with full weight stencils. 148 * Since we use the Gauss-Seidel RB smoother here, this may be replaced 149 * with a half-weight version once debugging is finished. 150 */ 151 LevelOperator* lop; 152 if (singular) 153 lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 154 else 155 lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 158 interface->Register("INTERFACE"); 156 159 lop->Register("LEVEL_OPERATOR"); 157 158 /* 159 * Use Gauss-Seidel Red-Black ordering 160 */ 161 if (discretization_order == 2) { 162 Smoother* smoother = new GaussSeidelRBPoisson2(); 163 smoother->Register("SMOOTHER"); 164 }else { 165 Smoother* smoother = new GaussSeidelRBPoisson4(); 166 smoother->Register("SMOOTHER"); 167 } 168 169 /* 170 * Use LAPACK solver when available, otherwise use Givens rotations. 171 */ 172 #ifdef HAVE_LAPACK 173 Solver* solver = (singular ? 174 static_cast<Solver*>(new DSYSV<SolverSingular>()) : 175 static_cast<Solver*>(new DGESV<SolverRegular>())); 176 #else 177 Solver* solver = (singular ? 178 static_cast<Solver*>(new Givens<SolverSingular>()) : 179 static_cast<Solver*>(new Givens<SolverRegular>())); 180 #endif 160 smoother->Register("SMOOTHER"); 181 161 solver->Register("SOLVER"); 182 183 /*184 * Set commands for the actual multigrid cycle185 */186 if (singular)187 Techniques::SetCorrectionSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), cycle_type);188 else189 Techniques::SetFullApproximationSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), cycle_type);190 162 191 163 /* … … 200 172 201 173 /* 174 * Post init 175 */ 176 MG::PostInit(); 177 178 /* 202 179 * Check whether the library is correctly initialized now. 203 180 */ 204 181 MG::IsInitialized(); 205 206 /*207 * Post init communication class208 */209 MG::PostInit();210 182 } 211 183
Note:
See TracChangeset
for help on using the changeset viewer.
