Changeset ac6d04 for src/interface/interface_fcs.cpp
- Timestamp:
- Apr 10, 2012, 1:55:49 PM (14 years ago)
- Children:
- a40eea
- Parents:
- d24c2f
- File:
-
- 1 edited
-
src/interface/interface_fcs.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/interface/interface_fcs.cpp
rd24c2f rac6d04 17 17 18 18 #include <mpi.h> 19 #ifdef HAVE_MARMOT 20 #include <enhancempicalls.h> 21 #include <sourceinfompicalls.h> 22 #endif 19 23 20 24 #include "base/object.hpp" … … 22 26 #include "comm/comm_mpi.hpp" 23 27 #include "comm/domain_decomposition_mpi.hpp" 28 #include "comm/mpi/error_handler.hpp" 24 29 #include "interface/interface_fcs.h" 25 30 #include "interface/interface_particles.hpp" 26 31 #include "level/level_operator_cs.hpp" 32 #include "level/level_operator_fas.hpp" 27 33 #include "samples/discretization_poisson_fd.hpp" 34 #include "samples/discretization_poisson_fv.hpp" 28 35 #include "samples/stencils.hpp" 29 36 #include "samples/techniques.hpp" … … 70 77 VMGBackupSettings::mpi_comm = mpi_comm; 71 78 79 MPI_Errhandler mpiErrorHandler; 80 MPI_Comm_create_errhandler(VMG::MPI::ConvertToException, &mpiErrorHandler); 81 MPI_Comm_set_errhandler(MPI_COMM_WORLD, mpiErrorHandler); 82 72 83 const Boundary boundary(periodic[0] ? Periodic : Open, 73 84 periodic[1] ? Periodic : Open, … … 85 96 * Register particle interface. 86 97 */ 87 Interface* interface = new VMG::InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells); 98 Interface* interface; 99 if (singular) 100 interface = new InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells, 0, 1.0); 101 else 102 interface = new InterfaceParticles(boundary, 2, level, Vector(box_offset), box_size, near_field_cells, 2, 1.6); 88 103 MG::SetInterface(interface, comm); 89 104 90 105 /* 91 * Use a finite difference discretization of the Poisson equation 92 */ 93 Discretization* discretization = new DiscretizationPoissonFD(); 106 * Define discretization of the Poisson equation. 107 * Finite volumes for locally refined grids and 108 * finite differences otherwise. 109 */ 110 Discretization* discretization; 111 if (singular) 112 discretization = new DiscretizationPoissonFD(); 113 else 114 discretization = new DiscretizationPoissonFV(); 94 115 discretization->Register("DISCRETIZATION"); 95 116 … … 99 120 * with a half-weight version once debugging is finished. 100 121 */ 101 LevelOperator* lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 122 LevelOperator* lop; 123 if (singular) 124 lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 125 else 126 lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 102 127 lop->Register("LEVEL_OPERATOR"); 103 128 … … 126 151 */ 127 152 if (singular) 128 Techniques::SetCorrectionSchemePeriodic( 2, level, gamma);129 else 130 Techniques::Set CorrectionSchemeDirichlet(2, level, gamma);153 Techniques::SetCorrectionSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), gamma); 154 else 155 Techniques::SetFullApproximationSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), gamma); 131 156 132 157 /* … … 137 162 new ObjectStorage<vmg_float>("PRECISION", precision); 138 163 new ObjectStorage<int>("MAX_ITERATION", max_iter); 139 140 164 new ObjectStorage<int>("PARTICLE_NEAR_FIELD_CELLS", near_field_cells); 141 165 … … 180 204 } 181 205 206 int VMG_fcs_check() 207 { 208 const int& near_field_cells = MG::GetFactory().GetObjectStorageVal<int>("PARTICLE_NEAR_FIELD_CELLS"); 209 const Multigrid& multigrid = *MG::GetRhs(); 210 const Grid& grid = multigrid(multigrid.MaxLevel()); 211 212 if (!grid.Global().LocalSize().IsComponentwiseGreater(near_field_cells)) 213 return 1; 214 215 return 0; 216 } 217 182 218 void VMG_fcs_run(vmg_float* x, vmg_float* q, vmg_float* p, vmg_float* f, vmg_int num_particles_local) 183 219 {
Note:
See TracChangeset
for help on using the changeset viewer.
