diff --git a/test/multidomain/2cnistokes2p2cni/README.sh b/test/multidomain/2cnistokes2p2cni/README.sh new file mode 100755 index 0000000000000000000000000000000000000000..45e2bd9530f795930e61762c692aca558be3880f --- /dev/null +++ b/test/multidomain/2cnistokes2p2cni/README.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +# First create and enter a folder for the dune and dumux modules +# If desired, you can enter this folder and execute this script for a DUNE and DUMUX installation. +# For that purpose, you can comment/uncomment required lines below, +# currently only the DUNE modules are checked out. +# Following dune components should be available in the described versions: + +# dune-multidomain (master branch): +git clone git://gitorious.org/dune-multidomain/dune-multidomain.git +cd dune-multidomain +git checkout deac3cecfc6697c1f5316d55c0fadd74f51d92bc +cd .. + +# dune-multidomaingrid (master branch): +git clone git://gitorious.org/dune-multidomaingrid/dune-multidomaingrid.git +cd dune-multidomaingrid +git checkout 30ff14d6b49c8adabf9e5cec67f20fcb3270a77e +cd .. + +# dune-pdelab (master branch): +git clone http://git.dune-project.org/repositories/dune-pdelab +cd dune-pdelab +git checkout 1de21a0859e10914ba5c3b70f67c5517573ac70e +cd .. + +# tested DUNE modules: +svn checkout -r 7436 https://svn.dune-project.org/svn/dune-common/trunk dune-common +svn checkout -r 489 https://svn.dune-project.org/svn/dune-geometry/trunk dune-geometry +svn checkout -r 8930 https://svn.dune-project.org/svn/dune-grid/trunk dune-grid +svn checkout -r 1910 https://svn.dune-project.org/svn/dune-istl/trunk dune-istl +svn checkout -r 1206 https://svn.dune-project.org/svn/dune-localfunctions/trunk dune-localfunctions + +# DUMUX +#ssh-add +# for an external installation, use +# svn co --username=anonymous --password=’ ’ svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk dumux + +#svn checkout svn+ssh://luftig/home/svn/DUMUX/dumux/trunk dumux-stable +#svn checkout svn+ssh://luftig/home/svn/DUMUX/dune-mux/trunk dumux-devel +#svn checkout svn+ssh://luftig/home/svn/DUMUX/external/trunk external + +# patch m4 folder in dumux-stable for compatibility with the DUNE modules above +#patch -p0 < patches/dumux-m4.patch + +# install the external modules: UG and SuperLU or PARDISO are required +#cd external +#./installExternal.sh ug +#./installExternal.sh blas +#./installExternal.sh superlu +#cd .. + +# dune-pdelab/dune/pdelab/backend/istlvectorbackend.hh has to be replaced by the one in the subfolder additionalfiles +cp dumux-stable/test/multidomain/2cnistokes2p2cni/additionalfiles/istlvectorbackend.hh dune-pdelab/dune/pdelab/backend/ + +# in dumux/freeflow/new_stokes/stokeslocalresidual: +# if the pressure is set on the entire right boundary, the interpolation at the lower right corner has to be switched off; +# therefore, comment in interpolateCornerPoints the local vertex 1 (lower right corner of Stokes domain); + +# run dunecontrol +# ./dune-common/bin/dunecontrol PATH_TO_OPTS all + +# the problem hardly converges with BiCGSTAB; use a direct solver like SuperLU or PARDISO diff --git a/test/multidomain/2cnistokes2p2cni/additionalfiles/istlvectorbackend.hh b/test/multidomain/2cnistokes2p2cni/additionalfiles/istlvectorbackend.hh new file mode 100644 index 0000000000000000000000000000000000000000..29f9c1eb1cbfe5dd6602fd6d77e4954901efa48e --- /dev/null +++ b/test/multidomain/2cnistokes2p2cni/additionalfiles/istlvectorbackend.hh @@ -0,0 +1,265 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +#ifndef DUNE_ISTLVECTORBACKEND_HH +#define DUNE_ISTLVECTORBACKEND_HH + +#include<vector> + +#include<dune/common/fvector.hh> +#include<dune/istl/bvector.hh> + +#include "backendselector.hh" +#include "istlmatrixbackend.hh" + +namespace Dune { + namespace PDELab { + + template<int> class ISTLVectorBackend; + + template<typename T, typename E, int BLOCKSIZE> + class ISTLBlockVectorContainer + { + public: + typedef E ElementType; + typedef Dune::BlockVector< Dune::FieldVector<E,BLOCKSIZE> > ContainerType; + typedef ContainerType BaseT; + typedef typename ContainerType::field_type field_type; + typedef typename ContainerType::iterator iterator; + typedef typename ContainerType::const_iterator const_iterator; + typedef typename ContainerType::const_iterator ConstIterator; + typedef typename ContainerType::block_type block_type; + typedef typename ContainerType::size_type size_type; + typedef ISTLVectorBackend<BLOCKSIZE> Backend; + + ISTLBlockVectorContainer () + {} + ISTLBlockVectorContainer (const T& t_) : container(t_.globalSize()/BLOCKSIZE) + {} + ISTLBlockVectorContainer (const T& t_, const E& e) : container(t_.globalSize()/BLOCKSIZE) + { + container=e; + } + + size_type N() const + { + return container.N(); + } + + + ISTLBlockVectorContainer& operator= (const E& e) + { + container=e; + return *this; + } + + ISTLBlockVectorContainer& operator*= (const E& e) + { + container*=e; + return *this; + } + + + ISTLBlockVectorContainer& operator+= (const E& e) + { + container+=e; + return *this; + } + + ISTLBlockVectorContainer& operator+= (const ISTLBlockVectorContainer& e) + { + container+=e; + return *this; + } + + ISTLBlockVectorContainer& operator-= (const ISTLBlockVectorContainer& e) + { + container-=e; + return *this; + } + + block_type& operator[](std::size_t i) + { + return container[i]; + } + + const block_type& operator[](std::size_t i) const + { + return container[i]; + } + + E two_norm() const + { + return container.two_norm(); + } + + E two_norm2() const + { + return container.two_norm2(); + } + + E one_norm() const + { + return container.one_norm(); + } + + E infinity_norm() const + { + return container.infinity_norm(); + } + + E operator*(const ISTLBlockVectorContainer& y) const + { + return container*y.base(); + } + + E dot(const ISTLBlockVectorContainer& y) const + { + return container.dot(y.base()); + } + + ISTLBlockVectorContainer& axpy(const E& a, const ISTLBlockVectorContainer& y) + { + container.axpy(a, y); + return *this; + } + + // for debugging and AMG access + ContainerType& base () + { + return container; + } + + const ContainerType& base () const + { + return container; + } + + operator ContainerType&() + { + return container; + } + + operator const ContainerType&() const + { + return container; + } + + iterator begin() + { + return container.begin(); + } + + + const_iterator begin() const + { + return container.begin(); + } + + iterator end() + { + return container.end(); + } + + + const_iterator end() const + { + return container.end(); + } + + size_t flatsize() const + { + return container.size()*BLOCKSIZE; + } + + size_t dim() const + { + return container.dim(); + } + + size_t size() const + { + return container.size(); + } + + void resize(size_t n) + { + container.resize(n); + } + + template<typename X> + void std_copy_to (std::vector<X>& x) const + { + size_t n = flatsize(); + x.resize(n); + for (size_t i=0; i<n; i++) + x[i] = container[i/BLOCKSIZE][i%BLOCKSIZE]; + } + + template<typename X> + void std_copy_from (const std::vector<X>& x) + { + //test if x has the same size as the container + assert (x.size() == flatsize()); + for (size_t i=0; i<flatsize(); i++) + container[i/BLOCKSIZE][i%BLOCKSIZE] = x[i]; + } + + private: + Dune::BlockVector< Dune::FieldVector<E,BLOCKSIZE> > container; + }; + + + //! ISTL backend for FunctionSpace + template<int BLOCKSIZE=1> + class ISTLVectorBackend + { + public: + enum{ + //! \brief export the block size + BlockSize = BLOCKSIZE + }; + + //export Matrix Backend Type + typedef ISTLBCRSMatrixBackend<BLOCKSIZE,BLOCKSIZE> MatrixBackend; + + //! container construction + + // extract type of container element + template<class C> + struct Value + { + typedef typename C::field_type Type; + }; + + //! The size type + typedef typename Dune::BlockVector< Dune::FieldVector<float,BLOCKSIZE> >::size_type size_type; + + // get const_reference to container element + // note: this method does not depend on T! + template<typename C> + static const typename C::field_type& access (const C& c, size_type i) + { + return c.base()[i/BLOCKSIZE][i%BLOCKSIZE]; + } + + // get non const_reference to container element + // note: this method does not depend on T! + template<typename C> + static typename C::field_type& access (C& c, size_type i) + { + return c.base()[i/BLOCKSIZE][i%BLOCKSIZE]; + } + }; + + template<int BLOCKSIZE,typename T, typename E> + struct BackendVectorSelectorHelper<ISTLVectorBackend<BLOCKSIZE>, T, E> + { + typedef ISTLBlockVectorContainer<T,E,BLOCKSIZE> Type; + }; + + + + } // namespace PDELab +} // namespace Dune + +#endif