From 6f1e511531c5486bfe2dbbeac0148a6081e67660 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 20 Nov 2012 11:14:09 +0100 Subject: [PATCH] added: method=none use this to apply no periodicity approach. useful for debugging --- dune/elasticity/elasticity_upscale.hpp | 10 +++++----- examples/upscale_elasticity.cpp | 21 +++++++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/dune/elasticity/elasticity_upscale.hpp b/dune/elasticity/elasticity_upscale.hpp index 20545cf..79f3124 100644 --- a/dune/elasticity/elasticity_upscale.hpp +++ b/dune/elasticity/elasticity_upscale.hpp @@ -157,6 +157,11 @@ class ElasticityUpscale const double* max, int n1, int n2, int p1, int p2); + //! \brief Fix corner nodes + //! \param[in] min The minimum coordinates on the grid + //! \param[in] max The maximum coordinates on the grid + void fixCorners(const double* min, const double* max); + //! \brief Assemble (optionally) stiffness matrix A and load vector //! \param[in] loadcase The strain load case. Set to -1 to skip //! \param[in] matrix Whether or not to assemble the matrix @@ -213,11 +218,6 @@ class ElasticityUpscale //! \brief Vector holding material parameters for each active grid cell std::vector materials; - //! \brief Fix corner nodes - //! \param[in] min The minimum coordinates on the grid - //! \param[in] max The maximum coordinates on the grid - void fixCorners(const double* min, const double* max); - //! \brief Extract the vertices on a given face //! \param[in] dir The direction of the face normal //! \param[in] coord The coordinate of the face plane diff --git a/examples/upscale_elasticity.cpp b/examples/upscale_elasticity.cpp index 711a74c..6fcdca1 100644 --- a/examples/upscale_elasticity.cpp +++ b/examples/upscale_elasticity.cpp @@ -53,6 +53,7 @@ void syntax(char** argv) enum UpscaleMethod { + UPSCALE_NONE = 0, UPSCALE_MPC = 1, UPSCALE_LLM = 2, UPSCALE_MORTAR = 3 @@ -102,12 +103,12 @@ struct Params { void parseCommandLine(int argc, char** argv, Params& p) { Opm::parameter::ParameterGroup param(argc, argv); - p.max[0] = param.getDefault("xmax",-1); - p.max[1] = param.getDefault("ymax",-1); - p.max[2] = param.getDefault("zmax",-1); - p.min[0] = param.getDefault("xmin",-1); - p.min[1] = param.getDefault("ymin",-1); - p.min[2] = param.getDefault("zmin",-1); + p.max[0] = param.getDefault("xmax",-1); + p.max[1] = param.getDefault("ymax",-1); + p.max[2] = param.getDefault("zmax",-1); + p.min[0] = param.getDefault("xmin",-1); + p.min[1] = param.getDefault("ymin",-1); + p.min[2] = param.getDefault("zmin",-1); p.lambda[0] = param.getDefault("lambdax", 1); p.lambda[1] = param.getDefault("lambday", 1); std::string method = param.getDefault("method","mortar"); @@ -117,6 +118,8 @@ void parseCommandLine(int argc, char** argv, Params& p) p.method = UPSCALE_LLM; if (!strcasecmp(method.c_str(),"mortar")) p.method = UPSCALE_MORTAR; + if (!strcasecmp(method.c_str(),"none")) + p.method = UPSCALE_NONE; p.Emin = param.getDefault("Emin",0.0); p.ctol = param.getDefault("ctol",1.e-8); p.ltol = param.getDefault("ltol",1.e-10); @@ -162,6 +165,8 @@ void writeOutput(const Params& p, Opm::time::StopWatch& watch, int cells, method = "llm"; if (p.method == UPSCALE_MPC) method = "mpc"; + if (p.method == UPSCALE_NONE) + method = "none"; // write log std::ofstream f; @@ -264,6 +269,10 @@ int main(int argc, char** argv) } else if (p.method == UPSCALE_MORTAR) { std::cout << "using Mortar couplings.." << std::endl; upscale.periodicBCsMortar(p.min,p.max,p.n1,p.n2,p.lambda[0], p.lambda[1]); + } else if (p.method == UPSCALE_NONE) { + std::cout << "no periodicity approach applied.." << std::endl; + upscale.fixCorners(p.min, p.max); + upscale.A.initForAssembly(); } Dune::FieldMatrix C; Dune::VTKWriter vtkwriter(grid.leafView());