[cig-commits] commit: Solve Stokes with red-black smoothing. No multigrid yet.
Mercurial
hg at geodynamics.org
Fri Feb 25 14:13:16 PST 2011
changeset: 21:131add91e4b8
user: Walter Landry <wlandry at caltech.edu>
date: Sun Jan 02 17:50:55 2011 -0800
files: FACStokes.h FACStokes/initializeLevelData.C FACStokes/solveStokes.C Makefile StokesFACOps.h StokesFACSolver/solveSystem.C
description:
Solve Stokes with red-black smoothing. No multigrid yet.
diff -r 5965c55793a9 -r 131add91e4b8 FACStokes.h
--- a/FACStokes.h Sun Jan 02 00:31:33 2011 -0800
+++ b/FACStokes.h Sun Jan 02 17:50:55 2011 -0800
@@ -45,8 +45,7 @@ namespace SAMRAI {
* @param object_name Ojbect name
* @param database Input database (may be NULL)
*/
- FACStokes(
- const std::string& object_name,
+ FACStokes(const std::string& object_name,
const tbox::Dimension& dim,
tbox::Pointer<tbox::Database> database =
tbox::Pointer<tbox::Database>(NULL));
@@ -66,8 +65,7 @@ namespace SAMRAI {
* @see mesh::StandardTagAndInitStrategy::initializeLevelData()
*/
virtual void
- initializeLevelData(
- const tbox::Pointer<hier::BasePatchHierarchy> hierarchy,
+ initializeLevelData(const tbox::Pointer<hier::BasePatchHierarchy> hierarchy,
const int level_number,
const double init_data_time,
const bool can_be_refined,
@@ -79,8 +77,7 @@ namespace SAMRAI {
* @brief Reset any internal hierarchy-dependent information.
*/
virtual void
- resetHierarchyConfiguration(
- tbox::Pointer<hier::BasePatchHierarchy> new_hierarchy,
+ resetHierarchyConfiguration(tbox::Pointer<hier::BasePatchHierarchy> new_hierarchy,
int coarsest_level,
int finest_level);
@@ -89,8 +86,7 @@ namespace SAMRAI {
//@{ @name appu::VisDerivedDataStrategy virtuals
virtual bool
- packDerivedDataIntoDoubleBuffer(
- double* buffer,
+ packDerivedDataIntoDoubleBuffer(double* buffer,
const hier::Patch& patch,
const hier::Box& region,
const std::string& variable_name,
@@ -129,8 +125,7 @@ namespace SAMRAI {
* @param viz_writer VisIt writer
*/
int
- setupPlotter(
- appu::VisItDataWriter& plotter) const;
+ setupPlotter(appu::VisItDataWriter& plotter) const;
#endif
private:
diff -r 5965c55793a9 -r 131add91e4b8 FACStokes/initializeLevelData.C
--- a/FACStokes/initializeLevelData.C Sun Jan 02 00:31:33 2011 -0800
+++ b/FACStokes/initializeLevelData.C Sun Jan 02 17:50:55 2011 -0800
@@ -95,6 +95,7 @@ namespace SAMRAI {
/*
* Set source function and exact solution.
*/
+
F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) (
pbox.lower()[0],
pbox.upper()[0],
@@ -104,6 +105,12 @@ namespace SAMRAI {
p_rhs_data->getPointer(),
patch_geom->getDx(),
patch_geom->getXLower());
+
+ for(pdat::CellIterator ci(pbox); ci; ci++)
+ {
+ pdat::CellIndex c=ci();
+ (*p_rhs_data)(c)=0;
+ }
tbox::Pointer<pdat::SideData<double> > v_rhs_data =
patch->getPatchData(v_rhs_id);
@@ -116,7 +123,7 @@ namespace SAMRAI {
for(pdat::SideIterator si(pbox,1); si; si++)
{
pdat::SideIndex s=si();
- (*v_rhs_data)(s)=1;
+ (*v_rhs_data)(s)=10;
}
} // End patch loop.
}
diff -r 5965c55793a9 -r 131add91e4b8 FACStokes/solveStokes.C
--- a/FACStokes/solveStokes.C Sun Jan 02 00:31:33 2011 -0800
+++ b/FACStokes/solveStokes.C Sun Jan 02 17:50:55 2011 -0800
@@ -77,15 +77,15 @@ namespace SAMRAI {
* Present data on the solve.
*/
double avg_factor, final_factor;
- d_stokes_fac_solver.getConvergenceFactors(avg_factor, final_factor);
- tbox::plog << "\t" << (solver_ret ? "" : "NOT ") << "converged " << "\n"
- << " iterations: "
- << d_stokes_fac_solver.getNumberOfIterations() << "\n"
- << " residual: "<< d_stokes_fac_solver.getResidualNorm()
- << "\n"
- << " average convergence: "<< avg_factor << "\n"
- << " final convergence: "<< final_factor << "\n"
- << std::flush;
+ // d_stokes_fac_solver.getConvergenceFactors(avg_factor, final_factor);
+ // tbox::plog << "\t" << (solver_ret ? "" : "NOT ") << "converged " << "\n"
+ // << " iterations: "
+ // << d_stokes_fac_solver.getNumberOfIterations() << "\n"
+ // << " residual: "<< d_stokes_fac_solver.getResidualNorm()
+ // << "\n"
+ // << " average convergence: "<< avg_factor << "\n"
+ // << " final convergence: "<< final_factor << "\n"
+ // << std::flush;
d_stokes_fac_solver.deallocateSolverState();
diff -r 5965c55793a9 -r 131add91e4b8 Makefile
--- a/Makefile Sun Jan 02 00:31:33 2011 -0800
+++ b/Makefile Sun Jan 02 17:50:55 2011 -0800
@@ -44,6 +44,7 @@ CXX_OBJS = main.o FACStokes/FACStok
StokesFACOps/postprocessOneCycle.o \
StokesFACOps/prolongErrorAndCorrect.o \
StokesFACOps/redOrBlackSmoothingOnPatch.o \
+ StokesFACOps/relax.o \
StokesFACOps/restrictResidual.o \
StokesFACOps/restrictSolution.o \
StokesFACOps/smoothError.o \
diff -r 5965c55793a9 -r 131add91e4b8 StokesFACOps.h
--- a/StokesFACOps.h Sun Jan 02 00:31:33 2011 -0800
+++ b/StokesFACOps.h Sun Jan 02 17:50:55 2011 -0800
@@ -418,6 +418,14 @@ public:
const hier::IntVector& ratio_to_coarser_level,
const pdat::CellData<double>& w_data,
pdat::SideData<double>& Dgradw_data) const;
+
+ void relax(SAMRAIVectorReal<double>& data,
+ const SAMRAIVectorReal<double>& residual,
+ int ln,
+ int num_sweeps,
+ double residual_tolerance,
+ const int p_id, const int p_rhs_id,
+ const int v_id, const int v_rhs_id);
//@{ @name FACOperatorStrategy virtuals
diff -r 5965c55793a9 -r 131add91e4b8 StokesFACSolver/solveSystem.C
--- a/StokesFACSolver/solveSystem.C Sun Jan 02 00:31:33 2011 -0800
+++ b/StokesFACSolver/solveSystem.C Sun Jan 02 17:50:55 2011 -0800
@@ -65,16 +65,20 @@ namespace SAMRAI {
createVectorWrappers(p, p_rhs);
bool solver_rval;
- solver_rval = d_fac_precond.solveSystem(*d_uv, *d_fv);
- if (d_bc_object == &d_simple_bc) {
- /*
- * Restore the Dirichlet cell data that were overwritten by the
- * solve process. We do this to be backward compatible with the
- * user code.
- */
- d_simple_bc.restoreDirichletData(p);
- }
+ // d_fac_ops.relax(*d_uv, *d_fv, 0, 5, 1.0, p, p_rhs, v, v_rhs);
+ // d_fac_ops.relax(*d_uv, *d_fv, 1, 5, 1.0, p, p_rhs, v, v_rhs);
+ d_fac_ops.relax(*d_uv, *d_fv, 2, 10, 1.0, p, p_rhs, v, v_rhs);
+ // solver_rval = d_fac_precond.solveSystem(*d_uv, *d_fv);
+
+ // if (d_bc_object == &d_simple_bc) {
+ // /*
+ // * Restore the Dirichlet cell data that were overwritten by the
+ // * solve process. We do this to be backward compatible with the
+ // * user code.
+ // */
+ // d_simple_bc.restoreDirichletData(p);
+ // }
return solver_rval;
}
More information about the CIG-COMMITS
mailing list