Commit 0ec98d1e authored by mm0's avatar mm0
Browse files

Modified Files:

 	Makefile.am NEWS admin/lifev_check_compilers.m4
 	life/lifealg/SolverAztec.cpp life/lifealg/SolverAztec.hpp
 	life/lifearray/MSRMatrix.hpp life/lifefem/assemb.hpp
 	life/lifefem/bcCond.cpp life/lifefem/bcCond.hpp
 	life/lifefem/bcFunction.cpp life/lifefem/bcFunction.hpp
 	life/lifefem/bcHandler.cpp life/lifefem/bcHandler.hpp
 	life/lifefem/bcManage.hpp life/lifefem/dof.cpp
 	life/lifefem/elemOper.cpp life/lifefem/elemOper.hpp
 	life/lifefilters/readMesh3D.hpp life/lifesolver/Makefile.am
 	testsuite/Makefile.am testsuite/testsuite.at
 Added Files:
 	life/lifesolver/parabolicSolver.hpp
	life/lifesolver/timeSolver.cpp life/lifesolver/timeSolver.hpp
 	testsuite/lifesolver/Makefile.am testsuite/lifesolver/data
 	testsuite/lifesolver/main.cpp
 	testsuite/lifesolver/testsuite.at
 	testsuite/lifesolver/ud_functions.hpp
 ----------------------------------------------------------------------

I've added some classes for non constant coefficient in equations
and coefficients/bc depending on solution, solved with iteration
*UDep,TimeSolver,ParabolicSolver,testsuite/lifesolver
parent aa56241d
......@@ -74,3 +74,15 @@ upload-api:
-cd doc/ && rsync -avz api/ `whoami`@cmcsforge.epfl.ch:/var/lib/gforge/chroot/home/groups/lifev/htdocs/api-$(LIFEV_MAJOR_VERSION).$(LIFEV_MINOR_VERSION).$(LIFEV_MICRO_VERSION)
MOSTLYCLEANFILES = ChangeLog
$(top_srcdir)/acinclude.m4:
@echo 'm4_include([admin/ac_check_aztec.m4])' > acinclude.m4
@echo 'm4_include([admin/ac_check_boost.m4])' >> acinclude.m4
@echo 'm4_include([admin/ac_check_lapack.m4])' >> acinclude.m4
@echo 'm4_include([admin/ac_check_mpi.m4])' >> acinclude.m4
@echo 'm4_include([admin/ac_check_parmetis.m4])' >> acinclude.m4
@echo 'm4_include([admin/ac_check_petsc.m4])' >> acinclude.m4
@echo 'm4_include([admin/ac_check_umfpack.m4])' >> acinclude.m4
@echo 'm4_include([admin/ac_find_file.m4])' >> acinclude.m4
@echo 'm4_include([admin/lifev_check_compilers.m4])'>>acinclude.m4
......@@ -47,6 +47,7 @@ New in 0.5.0:
** use boost::shared_ptr<> for safe memory management
[lifesolver]
* Added ParabolicSolver, TimeSolver, *UDep (MM)
* Templated the darcy classes.(VM)
** use of DataMesh class requires a change in data files
* Abstraction and interface for darcy Solver (CP, VM)
......@@ -60,6 +61,7 @@ New in 0.5.0:
* Added frontend for mesh readers (CP)
[testsuite]
* Added test for ParabolicSolver in lifesolver
* Added test for 3D/0D coupling (AM)
* Moved files of test_darcy in lifesolver (VM, CP)
** hex and tet tests
......
......@@ -40,7 +40,7 @@ namespace LifeV
UInt SolverAztec::S_solverNumber = 100;
SolverAztec::SolverAztec()
SolverAztec::SolverAztec(std::string filename)
: M_matrix( 0 ), M_precond( 0 ), M_tempPattern( 0 ), M_tempMatrix( 0 )
{
M_dataOrg[ AZ_N_internal ] = 0;
......@@ -51,7 +51,7 @@ SolverAztec::SolverAztec()
AZ_set_proc_config( M_procConfig, AZ_NOT_MPI );
// let dataAztec set the defaults
GetPot dataFile;
GetPot dataFile(filename.c_str());
DataAztec dataAztec( dataFile, "aztec" );
dataAztec.aztecOptionsFromDataFile( M_options, M_params );
......
......@@ -63,7 +63,7 @@ public:
//@{
//! default constructor
SolverAztec();
SolverAztec(std::string filename="data");
//! create a new instance
static SolverAztec* New();
......
......@@ -26,6 +26,8 @@
\author Christophe Prud'homme <christophe.prudhomme@epfl.ch>
\date 2004-10-26
*/
namespace LifeV
{
......@@ -196,6 +198,12 @@ public:
//! in place scaling operator
MSRMatr & operator*=( const DataType num );
/*! set this matrix to numM*M + numA*A of two matrices scaling plus addition
* @return numM*M + numA*A
*/
MSRMatr & flop( const DataType numM, MSRMatr<DataType> & M,
const DataType numA,MSRMatr<DataType> & A );
/*! set this matrix to num*M + A of two matrices scaling plus addition
* @return num*M + A
*/
......@@ -433,7 +441,7 @@ template <class DataType>
MSRMatr<DataType>
MSRMatr<DataType>::operator*( const DataType num )
{
UInt stop = _Patt->nNz();
UInt stop = _Patt->nNz()+1;
MSRMatr<DataType> ans( *this );
for ( UInt i = 0;i < stop;++i )
......@@ -441,13 +449,25 @@ MSRMatr<DataType>::operator*( const DataType num )
return ans;
}
template <class DataType>
MSRMatr<DataType>&
MSRMatr<DataType>::flop( const DataType numM, MSRMatr<DataType> & M,
const DataType numA,MSRMatr<DataType> & A )
{
UInt stop = _Patt->nNz()+1;
// ASSERT(M.Patt()==A.Patt,"Error in summing matrices");
for ( UInt i = 0;i < stop;++i )
_value[ i ] = numM * M.value() [ i ] + numA*A.value() [ i ];
return *this;
}
template <class DataType>
MSRMatr<DataType>&
MSRMatr<DataType>::flop( const DataType num, MSRMatr<DataType>& M, MSRMatr<DataType>& A )
{
/* AIM: Matrix = num*M + A */
UInt stop = _Patt->nNz();
UInt stop = _Patt->nNz()+1;
// ASSERT(M.Patt()==A.Patt,"Error in summing matrices");
for ( UInt i = 0;i < stop;++i )
......@@ -461,7 +481,7 @@ MSRMatr<DataType>&
MSRMatr<DataType>::flop( const DataType num, MSRMatr<DataType>& M )
{
/* AIM: Matrix = num*M + Matrix */
UInt stop = _Patt->nNz();
UInt stop = _Patt->nNz()+1;
// ASSERT(M.Patt()==A.Patt,"Error in summing matrices");
for ( UInt i = 0;i < stop;++i )
......@@ -475,7 +495,7 @@ template<class DataType>
MSRMatr<DataType>&
MSRMatr<DataType>::operator* (const DataType num, MSRMatr<DataType>& M)
{
UInt stop=_Patt->nNz();
UInt stop=_Patt->nNz()+1;
for (UInt i=0;i<stop;++i)
_value[i]=num*M.value()[i];
......@@ -762,4 +782,7 @@ MSRMatr<DataType>::zeros()
fill( start, end, 0.0 );
}
}
......@@ -1193,7 +1193,7 @@ void compute_vec_stab( OperFct& fct, ElemVec& elvec, const CurrentFE& fe, Real t
template <typename DOF, typename Vector, typename ElemVec>
void
assemb_vec( Vector& V, ElemVec& elvec, const CurrentFE& fe, const DOF& dof, int iblock )
assemb_vec( Vector& V, ElemVec& elvec, const CurrentFE& fe, const DOF& dof, int iblock=0 )
{
UInt totdof = dof.numTotalDof();
typename ElemVec::vector_view vec = elvec.block( iblock );
......
......@@ -37,6 +37,7 @@ BCBase::BCBase( const std::string& name, const EntityFlag& flag,
const BCType& type, const BCMode& mode,
BCFunctionBase& bcf, const std::vector<ID>& comp )
:
_M_isUDep(false),
_M_name( name ),
_M_flag( flag ),
_M_type( type ),
......@@ -54,6 +55,7 @@ BCBase::BCBase( const std::string& name, const EntityFlag& flag,
BCBase::BCBase( const std::string& name, const EntityFlag& flag, const BCType& type, const BCMode& mode,
BCFunctionBase& bcf )
:
_M_isUDep(false),
_M_name( name ),
_M_flag( flag ),
_M_type( type ),
......@@ -93,6 +95,7 @@ BCBase::BCBase( const std::string& name, const EntityFlag& flag, const BCType& t
const BCMode& mode, BCFunctionBase& bcf, const UInt& nComp )
:
_M_isUDep(false),
_M_name( name ),
_M_flag( flag ),
_M_type( type ),
......@@ -117,11 +120,12 @@ BCBase::BCBase( const std::string& name, const EntityFlag& flag, const BCType& t
BCBase::BCBase( const std::string& name, const EntityFlag& flag, const BCType& type, const BCMode& mode,
BCVectorBase& bcv, const std::vector<ID>& comp )
:
_M_isUDep(false),
_M_name( name ),
_M_flag( flag ),
_M_type( type ),
_M_mode( mode ),
_M_bcf(),
_M_bcf(),_M_bcfUDep(),
_M_bcv( FactoryCloneBCVector::instance().createObject( &bcv ) ),
_M_dataVector( true ),
_M_comp(comp),
......@@ -135,11 +139,12 @@ BCBase::BCBase( const std::string& name, const EntityFlag& flag, const BCType& t
BCBase::BCBase( const std::string& name, const EntityFlag& flag, const BCType& type, const BCMode& mode,
BCVectorBase& bcv )
:
_M_isUDep(false),
_M_name( name ),
_M_flag( flag ),
_M_type( type ),
_M_mode( mode ),
_M_bcf(),
_M_bcf(),_M_bcfUDep(),
_M_bcv( FactoryCloneBCVector::instance().createObject( &bcv ) ),
_M_dataVector( true ),
_M_comp(),
......@@ -177,11 +182,12 @@ BCBase::BCBase( const std::string& name, const EntityFlag& flag, const BCType& t
BCBase::BCBase( const std::string& name, const EntityFlag& flag, const BCType& type,
const BCMode& mode, BCVectorBase& bcv, const UInt& nComp )
:
_M_isUDep(false),
_M_name( name ),
_M_flag( flag ),
_M_type( type ),
_M_mode( mode ),
_M_bcf(),
_M_bcf(),_M_bcfUDep(),
_M_bcv( FactoryCloneBCVector::instance().createObject( &bcv ) ),
_M_dataVector( true ),
_M_comp(),
......@@ -195,6 +201,86 @@ BCBase::BCBase( const std::string& name, const EntityFlag& flag, const BCType& t
_M_comp.push_back( i );
}
BCBase::BCBase( const std::string& name, const EntityFlag& flag,
const BCType& type, const BCMode& mode,
BCFunctionUDepBase& bcf, const std::vector<ID>& comp )
:
_M_isUDep(true),
_M_name( name ),
_M_flag( flag ),
_M_type( type ),
_M_mode( mode ),
_M_bcfUDep( FactoryCloneBCFunctionUDep::instance().createObject( &bcf ) ),
_M_dataVector( false ),
_M_comp( comp ),
_M_finalised( false )
{
if ( _M_mode != Component )
ERROR_MSG( "You should use a more specific constructor for this mode" );
}
BCBase::BCBase( const std::string& name, const EntityFlag& flag,
const BCType& type, const BCMode& mode,
BCFunctionUDepBase& bcf)
:
_M_isUDep(true),
_M_name( name ),
_M_flag( flag ),
_M_type( type ),
_M_mode( mode ),
_M_bcfUDep( FactoryCloneBCFunctionUDep::instance().createObject( &bcf ) ),
_M_dataVector( false ),
_M_comp(),
_M_finalised( false )
{
UInt nComp;
switch ( _M_mode = mode )
{
case Scalar:
nComp = 1;
_M_comp.reserve( nComp );
_M_comp.push_back( 1 );
break;
case Tangential:
nComp = nDimensions - 1;
_M_comp.reserve( nComp );
for ( ID i = 1; i <= nComp; ++i )
_M_comp.push_back( i );
break;
case Normal:
nComp = 1;
_M_comp.reserve( nComp );
_M_comp.push_back( nDimensions );
break;
default:
ERROR_MSG( "You should use a more specific constructor for this mode" );
}
}
BCBase::BCBase( const std::string& name, const EntityFlag& flag,
const BCType& type, const BCMode& mode,
BCFunctionUDepBase& bcf, const UInt& nComp )
:
_M_isUDep(true),
_M_name( name ),
_M_flag( flag ),
_M_type( type ),
_M_mode( mode ),
_M_bcfUDep( FactoryCloneBCFunctionUDep::instance().createObject( &bcf ) ),
_M_dataVector( false ),
_M_comp(),
_M_finalised( false )
{
if ( _M_mode != Full )
ERROR_MSG( "You should use a more specific constructor for this mode" );
_M_comp.reserve( nComp );
for ( ID i = 1; i <= nComp; ++i )
_M_comp.push_back( i );
}
//! Destructor (we have a vector of pointers to ID's and Functors)
BCBase::~BCBase()
......@@ -214,10 +300,12 @@ BCBase & BCBase::operator=( const BCBase& BCb )
_M_mode = BCb._M_mode;
_M_finalised = BCb._M_finalised;
_M_dataVector = BCb._M_dataVector;
_M_bcfUDep=BCb._M_bcfUDep;
_M_bcv = BCb._M_bcv;
_M_bcf = BCb._M_bcf;
_M_comp = BCb._M_comp;
_M_isUDep=BCb._M_isUDep;
// Important!!: The set member list0 is always empty at this
// point, it is just an auxiliary container used at the moment of
......@@ -233,11 +321,13 @@ BCBase & BCBase::operator=( const BCBase& BCb )
//! Copy constructor for BC (we have a vector of pointers to ID's and a pointer to user defined functions)
BCBase::BCBase( const BCBase& BCb )
:
_M_isUDep(BCb._M_isUDep),
_M_name( BCb._M_name ),
_M_flag( BCb._M_flag ),
_M_type( BCb._M_type ),
_M_mode( BCb._M_mode ),
_M_bcf( BCb._M_bcf ),
_M_bcfUDep(BCb._M_bcfUDep),
_M_bcv( BCb._M_bcv ),
_M_dataVector( BCb._M_dataVector ),
_M_comp( BCb._M_comp ),
......@@ -274,6 +364,10 @@ BCMode BCBase::mode() const
{
return _M_mode;
}
bool BCBase::isUDep() const
{
return _M_isUDep;
}
//! Returns the number of components involved in this boundary condition
UInt BCBase::numberOfComponents() const
......@@ -301,6 +395,17 @@ Real BCBase::operator() ( const Real& t, const Real& x, const Real& y,
return _M_bcf->operator() ( t,x, y, z, i );
}
//! Overloading function operator by calling the (*_M_bcf)() user specified function
/* new overloading for BCFunctionUDepending */
Real BCBase::operator() ( const Real& t, const Real& x, const Real& y,
const Real& z, const ID& i, const Real& u ) const
{
/* is there a better way ? */
Debug(800)<<"debug800 in BCBase::operator(6x)\n";
return _M_bcfUDep->operator()(t,x, y, z, i, u);
Debug(800)<<"debug800 out BCBase::operator(6x)\n";
}
//! Returns a pointer to the user defined STL functor
......@@ -315,6 +420,12 @@ const BCVectorBase* BCBase::pointerToBCVector() const
return _M_bcv.get();
}
//! Returns a pointer to the user defined STL functor
const BCFunctionUDepBase* BCBase::pointerToFunctorUDep() const
{
return _M_bcfUDep.get();
}
//! True is a data vector has been provided
bool BCBase::dataVector() const
{
......@@ -326,6 +437,7 @@ BCBase::setBCVector( BCVectorBase& __v )
{
_M_bcv = boost::shared_ptr<BCVectorBase>( FactoryCloneBCVector::instance().createObject( &__v ) );
_M_dataVector = true;
_M_isUDep=false;
}
void
......@@ -333,6 +445,15 @@ BCBase::setBCFunction( BCFunctionBase& __f )
{
_M_bcf = boost::shared_ptr<BCFunctionBase>( FactoryCloneBCFunction::instance().createObject( &__f ) );
_M_dataVector = false;
_M_isUDep=false;
}
void
BCBase::setBCFunction( BCFunctionUDepBase& __f )
{
_M_bcfUDep = boost::shared_ptr<BCFunctionUDepBase>( FactoryCloneBCFunctionUDep::instance().createObject( &__f ) );
_M_dataVector = false;
_M_isUDep=true;
}
Real BCBase::operator() ( const ID& iDof, const ID& iComp ) const
......
......@@ -70,6 +70,7 @@ namespace LifeV
Essential, Natural or Mixte
*/
enum BCType{Essential, Natural, Mixte};
// ,UDepEssential,UDepNatural,UDepMixte};
/** Type for boundary conditions application modes
......@@ -198,7 +199,6 @@ public:
BCFunctionBase& bcf,
const UInt& nComp );
//! Constructor for BC with data vector
/*!
\param name the name of the boundary condition
......@@ -245,6 +245,26 @@ public:
BCVectorBase& bcv,
const UInt& nComp );
/* constructors for BCFunctionUDepBase ... */
BCBase( const std::string& name,
const EntityFlag& flag,
const BCType& type,
const BCMode& mode,
BCFunctionUDepBase& bcf,
const std::vector<ID>& comp );
BCBase( const std::string& name,
const EntityFlag& flag,
const BCType& type,
const BCMode& mode,
BCFunctionUDepBase& bcf);
BCBase( const std::string& name,
const EntityFlag& flag,
const BCType& type,
const BCMode& mode,
BCFunctionUDepBase& bcf,
const UInt& nComp );
//! Copy constructor for BC (we have a vector of pointers to ID's and a pointer to user defined functions)
/*!
......@@ -305,6 +325,10 @@ public:
*/
Real operator() ( const Real& t, const Real& x, const Real& y,
const Real& z, const ID& i ) const;
/* new overloading for BCFunctionUDepending */
Real operator() ( const Real& t, const Real& x, const Real& y,
const Real& z, const ID& i, const Real& u ) const;
//! Returns a pointer to the user defined STL functor
......@@ -313,6 +337,8 @@ public:
//! Returns a pointer to the BCVector
const BCVectorBase* pointerToBCVector() const;
const BCFunctionUDepBase* pointerToFunctorUDep() const;
//! True if a data vector has been provided
bool dataVector() const;
......@@ -322,6 +348,11 @@ public:
//! use function boundary conditions
void setBCFunction( BCFunctionBase& __f );
//! use function boundary conditions
void setBCFunction( BCFunctionUDepBase& __f );
bool isUDep() const;
//! Returns a pointer to the i-th elements in the (finalised) list
//! (counting from 1 ' a la FORTRAN')
......@@ -368,6 +399,8 @@ public:
}
private:
bool _M_isUDep;
//! name identifying a specific BC
std::string _M_name;
......@@ -383,6 +416,8 @@ private:
//! Pointer to a user defined functor
boost::shared_ptr<BCFunctionBase> _M_bcf;
boost::shared_ptr<BCFunctionUDepBase> _M_bcfUDep;
//! Pointer to a user given data vector
boost::shared_ptr<BCVectorBase> _M_bcv;
......
......@@ -114,5 +114,84 @@ createBCFunctionMixte( BCFunctionBase const* __bc )
// register BCFunctionMixte in factory for cloning
const bool __bcmixte = FactoryCloneBCFunction::instance().registerProduct( typeid(BCFunctionMixte), &createBCFunctionMixte );
}
namespace LifeV
{
BCFunctionUDepBase::BCFunctionUDepBase(function_type g ):_M_g(g)
{
}
BCFunctionUDepBase::BCFunctionUDepBase(const BCFunctionUDepBase& bcf ):
_M_g(bcf._M_g)
{
}
void
BCFunctionUDepBase::setFunction(function_type g)
{
_M_g=g;
}
Real
BCFunctionUDepBase::operator()(const Real& t, const Real& x, const Real& y,
const Real& z, const ID& i, const Real& u ) const
{
return _M_g(t,x,y,z,i,u);
}
BCFunctionUDepBase*
createBCFunctionUDep( BCFunctionUDepBase const* __bc )
{
return new BCFunctionUDepBase( ( BCFunctionUDepBase const& )*__bc );
}
const bool __bcUDepBase = FactoryCloneBCFunctionUDep::instance().registerProduct(
typeid(BCFunctionUDepBase), &createBCFunctionUDep );
BCFunctionUDepMixte::BCFunctionUDepMixte(function_type g,function_type coef):
BCFunctionUDepBase(g),_M_coef(coef)
{
}
BCFunctionUDepMixte::BCFunctionUDepMixte(const BCFunctionUDepMixte& bcf):
BCFunctionUDepBase(bcf),_M_coef(bcf._M_coef)
{
}
void
BCFunctionUDepMixte::setFunctions_Mixte(function_type g, function_type coef )
{
setFunction(g);
_M_coef=coef;
}
Real
BCFunctionUDepMixte::coef(const Real& t, const Real& x, const Real& y,
const Real& z, const ID& icomp, const Real& u ) const
{
return _M_coef( t, x, y, z, icomp, u );
}
BCFunctionUDepBase*
createBCFunctionUDepMixte( BCFunctionUDepBase const* __bc )
{
return new BCFunctionUDepMixte( ( BCFunctionUDepMixte const& )*__bc );
}
const bool __bcUDepMixte = FactoryCloneBCFunctionUDep::instance().registerProduct(
typeid(BCFunctionUDepMixte), &createBCFunctionUDepMixte );
}
......@@ -170,8 +170,74 @@ private:
function_type _M_coef;
};
typedef LifeV::singleton< LifeV::factoryClone< BCFunctionBase > > FactoryCloneBCFunction;
}
namespace LifeV
{
/* much similar to BCFunctionBase but different func prototipe
for bc, I derive BCFunctionBaseUDepending from BCFunctionBase
only becouse BCBase and BCHandler can work with us with little change,
really I don't like that class BCFunctionBase has fixed function_type
prototype in the base class, but I conform
*/
class BCFunctionUDepBase
{
public:
//Real g(t,x,y,z,ID,U)
typedef boost::function<Real ( const Real&, const Real&, const Real&, const Real&, const ID&, const Real& )> function_type;
BCFunctionUDepBase(function_type g );
BCFunctionUDepBase(const BCFunctionUDepBase& bcf );
void setFunction(function_type g);
Real operator()(const Real& t, const Real& x, const Real& y,
const Real& z, const ID& i, const Real& U ) const;
protected:
function_type _M_g;
};
class BCFunctionUDepMixte: public BCFunctionUDepBase
{
public:
typedef BCFunctionUDepBase::function_type function_type;
BCFunctionUDepMixte(function_type g,function_type coef);
BCFunctionUDepMixte(const BCFunctionUDepMixte& bcf);
void setFunctions_Mixte(function_type g, function_type coef );