Commit 18be5aee authored by grandper's avatar grandper
Browse files

This commit contains:

-The normal Dirichlet boundary conditions (parallel version)
-A patch to avoid problems related to the matrix multiplication with Trilinos
parent 9fdb789c
......@@ -2,19 +2,19 @@
# DO NOT EDIT : generated automatically by update-headers
#
LIFECORE_HDRS=life/lifecore/switch.hpp life/lifecore/GetPot.hpp life/lifecore/util_string.hpp life/lifecore/fortran_wrap.hpp life/lifecore/dataString.hpp life/lifecore/lifeassert.hpp life/lifecore/lifemacros.hpp life/lifecore/debug.hpp life/lifecore/about.hpp life/lifecore/singleton.hpp life/lifecore/policy.hpp life/lifecore/chrono.hpp life/lifecore/lifeversion.hpp life/lifecore/SmartAssert.hpp life/lifecore/factory.hpp life/lifecore/typeInfo.hpp life/lifecore/displayer.hpp life/lifecore/life.hpp life/lifecore/application.hpp
LIFECORE_HDRS=life/lifecore/GetPot.hpp life/lifecore/SmartAssert.hpp life/lifecore/about.hpp life/lifecore/application.hpp life/lifecore/chrono.hpp life/lifecore/dataString.hpp life/lifecore/debug.hpp life/lifecore/displayer.hpp life/lifecore/factory.hpp life/lifecore/fortran_wrap.hpp life/lifecore/life.hpp life/lifecore/lifeassert.hpp life/lifecore/lifemacros.hpp life/lifecore/lifeversion.hpp life/lifecore/policy.hpp life/lifecore/singleton.hpp life/lifecore/switch.hpp life/lifecore/typeInfo.hpp life/lifecore/util_string.hpp
LIFEARRAY_HDRS=life/lifearray/EpetraVector.hpp life/lifearray/elemVec.hpp life/lifearray/VBRMatrix.hpp life/lifearray/RNM.hpp life/lifearray/SimpleVect.hpp life/lifearray/tab.hpp life/lifearray/blockMatrix.hpp life/lifearray/RNM_op.hpp life/lifearray/MSRMatrix.hpp life/lifearray/RNM_tpl.hpp life/lifearray/pattern.hpp life/lifearray/sparseArray.hpp life/lifearray/EpetraMatrix.hpp life/lifearray/variables.hpp life/lifearray/CSRMatrix.hpp life/lifearray/MixedMatrix.hpp life/lifearray/connectivity.hpp life/lifearray/elemMat.hpp life/lifearray/boostmatrix.hpp life/lifearray/RNM_opc.hpp life/lifearray/vecUnknown.hpp
LIFEARRAY_HDRS=life/lifearray/CSRMatrix.hpp life/lifearray/EpetraMatrix.hpp life/lifearray/EpetraVector.hpp life/lifearray/MSRMatrix.hpp life/lifearray/MixedMatrix.hpp life/lifearray/RNM.hpp life/lifearray/RNM_op.hpp life/lifearray/RNM_opc.hpp life/lifearray/RNM_tpl.hpp life/lifearray/SimpleVect.hpp life/lifearray/VBRMatrix.hpp life/lifearray/blockMatrix.hpp life/lifearray/boostmatrix.hpp life/lifearray/connectivity.hpp life/lifearray/elemMat.hpp life/lifearray/elemVec.hpp life/lifearray/pattern.hpp life/lifearray/sparseArray.hpp life/lifearray/tab.hpp life/lifearray/variables.hpp life/lifearray/vecUnknown.hpp
LIFEALG_HDRS=life/lifealg/newton.hpp life/lifealg/algebraic_facto.hpp life/lifealg/cblas.hpp life/lifealg/gmres.hpp life/lifealg/SolverAztec.hpp life/lifealg/MLPreconditioner.hpp life/lifealg/inexactLU.hpp life/lifealg/EpetraMap.hpp life/lifealg/SolverPETSC.hpp life/lifealg/SolverAmesos.hpp life/lifealg/picard.hpp life/lifealg/linesearch_parabolic.hpp life/lifealg/nonLinRichardson.hpp life/lifealg/saddlePointCG.hpp life/lifealg/SolverBase.hpp life/lifealg/EpetraPreconditioner.hpp life/lifealg/dataAztec.hpp life/lifealg/PressureMatrixSolver.hpp life/lifealg/generalizedAitken.hpp life/lifealg/clapack.hpp life/lifealg/SolverTrilinos.hpp life/lifealg/triDiagLU.hpp life/lifealg/iteration.hpp life/lifealg/preconditioner.hpp life/lifealg/linesearch_cubic.hpp life/lifealg/IfpackPreconditioner.hpp life/lifealg/SolverUMFPACK.hpp life/lifealg/dataNewton.hpp life/lifealg/givens.hpp life/lifealg/triDiagCholesky.hpp
LIFEALG_HDRS=life/lifealg/EpetraMap.hpp life/lifealg/EpetraPreconditioner.hpp life/lifealg/IfpackPreconditioner.hpp life/lifealg/MLPreconditioner.hpp life/lifealg/PressureMatrixSolver.hpp life/lifealg/SolverAmesos.hpp life/lifealg/SolverAztec.hpp life/lifealg/SolverBase.hpp life/lifealg/SolverPETSC.hpp life/lifealg/SolverTrilinos.hpp life/lifealg/SolverUMFPACK.hpp life/lifealg/algebraic_facto.hpp life/lifealg/cblas.hpp life/lifealg/clapack.hpp life/lifealg/dataAztec.hpp life/lifealg/dataNewton.hpp life/lifealg/generalizedAitken.hpp life/lifealg/givens.hpp life/lifealg/gmres.hpp life/lifealg/inexactLU.hpp life/lifealg/iteration.hpp life/lifealg/linesearch_cubic.hpp life/lifealg/linesearch_parabolic.hpp life/lifealg/newton.hpp life/lifealg/nonLinRichardson.hpp life/lifealg/picard.hpp life/lifealg/preconditioner.hpp life/lifealg/saddlePointCG.hpp life/lifealg/triDiagCholesky.hpp life/lifealg/triDiagLU.hpp
LIFEMESH_HDRS=life/lifemesh/partitionMesh.hpp life/lifemesh/meshEntity.hpp life/lifemesh/regionMesh2D.hpp life/lifemesh/geoElement.hpp life/lifemesh/regionMesh1D.hpp life/lifemesh/identifier.hpp life/lifemesh/subDomainNeighbors.hpp life/lifemesh/mesh_util_base.hpp life/lifemesh/dataMesh.hpp life/lifemesh/basicOneDMesh.hpp life/lifemesh/markers.hpp life/lifemesh/markers_base.hpp life/lifemesh/regionMesh3D.hpp life/lifemesh/bareItems.hpp life/lifemesh/basisElSh.hpp life/lifemesh/geo0D.hpp life/lifemesh/geoND.hpp
LIFEMESH_HDRS=life/lifemesh/bareItems.hpp life/lifemesh/basicOneDMesh.hpp life/lifemesh/basisElSh.hpp life/lifemesh/dataMesh.hpp life/lifemesh/geo0D.hpp life/lifemesh/geoElement.hpp life/lifemesh/geoND.hpp life/lifemesh/identifier.hpp life/lifemesh/markers.hpp life/lifemesh/markers_base.hpp life/lifemesh/meshEntity.hpp life/lifemesh/mesh_util_base.hpp life/lifemesh/partitionMesh.hpp life/lifemesh/regionMesh1D.hpp life/lifemesh/regionMesh2D.hpp life/lifemesh/regionMesh3D.hpp life/lifemesh/subDomainNeighbors.hpp
LIFEFEM_HDRS=life/lifefem/regionMesh3D_ALE.hpp life/lifefem/refFEDG.hpp life/lifefem/currentFE.hpp life/lifefem/currentBFDG.hpp life/lifefem/dofInterfaceHandler.hpp life/lifefem/dofInterfaceBase.hpp life/lifefem/assemb.hpp life/lifefem/values.hpp life/lifefem/refEle.hpp life/lifefem/dofInterface3Dto3D.hpp life/lifefem/refFE.hpp life/lifefem/bdf.hpp life/lifefem/dofByFace.hpp life/lifefem/dofInterface3Dto2D.hpp life/lifefem/bdf_template.hpp life/lifefem/currentBdFE.hpp life/lifefem/refEleDG.hpp life/lifefem/currentBdDG.hpp life/lifefem/interpolate.hpp life/lifefem/bdfNS_template.hpp life/lifefem/postProc.hpp life/lifefem/elemOper_ext.hpp life/lifefem/currentHdivFE.hpp life/lifefem/bcCond.hpp life/lifefem/bcFunction.hpp life/lifefem/staticBdFE.hpp life/lifefem/dof.hpp life/lifefem/bcHandler.hpp life/lifefem/dataTime.hpp life/lifefem/elemOper.hpp life/lifefem/v2elemVec.hpp life/lifefem/localDofPattern.hpp life/lifefem/FESpace.hpp life/lifefem/bcVector.hpp life/lifefem/currentIFDG.hpp life/lifefem/geoMapDG.hpp life/lifefem/geoMap.hpp life/lifefem/Operator01.hpp life/lifefem/bdfNS.hpp life/lifefem/currentFEDG.hpp life/lifefem/quadRule.hpp life/lifefem/bcManage.hpp life/lifefem/dataTransient.hpp life/lifefem/refHdivFE.hpp life/lifefem/dofDG.hpp life/lifefem/assembGeneric.hpp life/lifefem/sobolevNorms.hpp life/lifefem/refHybridFE.hpp
LIFEFEM_HDRS=life/lifefem/FESpace.hpp life/lifefem/Operator01.hpp life/lifefem/assemb.hpp life/lifefem/assembGeneric.hpp life/lifefem/bcCond.hpp life/lifefem/bcFunction.hpp life/lifefem/bcHandler.hpp life/lifefem/bcManage.hpp life/lifefem/bcVector.hpp life/lifefem/bdf.hpp life/lifefem/bdfNS.hpp life/lifefem/bdfNS_template.hpp life/lifefem/bdf_template.hpp life/lifefem/currentBFDG.hpp life/lifefem/currentBdDG.hpp life/lifefem/currentBdFE.hpp life/lifefem/currentFE.hpp life/lifefem/currentFEDG.hpp life/lifefem/currentHdivFE.hpp life/lifefem/currentIFDG.hpp life/lifefem/dataTime.hpp life/lifefem/dataTransient.hpp life/lifefem/dof.hpp life/lifefem/dofByFace.hpp life/lifefem/dofDG.hpp life/lifefem/dofInterface3Dto2D.hpp life/lifefem/dofInterface3Dto3D.hpp life/lifefem/dofInterfaceBase.hpp life/lifefem/dofInterfaceHandler.hpp life/lifefem/elemOper.hpp life/lifefem/elemOper_ext.hpp life/lifefem/geoMap.hpp life/lifefem/geoMapDG.hpp life/lifefem/interpolate.hpp life/lifefem/localDofPattern.hpp life/lifefem/postProc.hpp life/lifefem/quadRule.hpp life/lifefem/refEle.hpp life/lifefem/refEleDG.hpp life/lifefem/refFE.hpp life/lifefem/refFEDG.hpp life/lifefem/refHdivFE.hpp life/lifefem/refHybridFE.hpp life/lifefem/regionMesh3D_ALE.hpp life/lifefem/sobolevNorms.hpp life/lifefem/staticBdFE.hpp life/lifefem/v2elemVec.hpp life/lifefem/values.hpp life/lifefem/BCNormalManager.hpp
LIFESOLVER_HDRS=life/lifesolver/AFSolvers.hpp life/lifesolver/fluidToMaster.hpp life/lifesolver/VenantKirchhofSolver.hpp life/lifesolver/darcySolver.hpp life/lifesolver/bidomainSolver.hpp life/lifesolver/HarmonicExtensionSolver.hpp life/lifesolver/darcySolverBase.hpp life/lifesolver/steklovPoincareBase.hpp life/lifesolver/monodomainSolver.hpp life/lifesolver/AdvectionDiffusionReaction.hpp life/lifesolver/FSIOperator.hpp life/lifesolver/reducedLinFluid.hpp life/lifesolver/AdvectionDiffusionReactionSolver.hpp life/lifesolver/sdStabilization.hpp life/lifesolver/convDiffReactHandler.hpp life/lifesolver/Oseen.hpp life/lifesolver/nsipterms.hpp life/lifesolver/parabolicSolver.hpp life/lifesolver/dataADR.hpp life/lifesolver/dataMonodomain.hpp life/lifesolver/dataNavierStokes.hpp life/lifesolver/NavierStokesSolverPC.hpp life/lifesolver/OseenShapeDerivative.hpp life/lifesolver/ionicSolver.hpp life/lifesolver/timeSolver.hpp life/lifesolver/dataConvDiffReact.hpp life/lifesolver/fixedPointBase.hpp life/lifesolver/ElasticStructureHandler.hpp life/lifesolver/NavierStokesWithFlux.hpp life/lifesolver/convDiffReactSolverPC.hpp life/lifesolver/ipStabilization.hpp life/lifesolver/dataElasticStructure.hpp life/lifesolver/exactJacobianBase.hpp life/lifesolver/dataDarcy.hpp life/lifesolver/NavierStokesAleSolver.hpp life/lifesolver/dataBidomain.hpp life/lifesolver/NavierStokesAleSolverPC.hpp life/lifesolver/NavierStokesAleSolverCT.hpp life/lifesolver/NavierStokesSolver.hpp life/lifesolver/dataIonic.hpp life/lifesolver/darcyHandler.hpp life/lifesolver/dataSimplifiedStructure.hpp life/lifesolver/NavierStokesAleHandler.hpp life/lifesolver/nsip.hpp life/lifesolver/FSISolver.hpp life/lifesolver/simplifiedStructure.hpp life/lifesolver/NavierStokesHandler.hpp
LIFESOLVER_HDRS=life/lifesolver/AFSolvers.hpp life/lifesolver/AdvectionDiffusionReaction.hpp life/lifesolver/AdvectionDiffusionReactionSolver.hpp life/lifesolver/ElasticStructureHandler.hpp life/lifesolver/FSIOperator.hpp life/lifesolver/FSISolver.hpp life/lifesolver/HarmonicExtensionSolver.hpp life/lifesolver/NavierStokesAleHandler.hpp life/lifesolver/NavierStokesAleSolver.hpp life/lifesolver/NavierStokesAleSolverCT.hpp life/lifesolver/NavierStokesAleSolverPC.hpp life/lifesolver/NavierStokesHandler.hpp life/lifesolver/NavierStokesSolver.hpp life/lifesolver/NavierStokesSolverPC.hpp life/lifesolver/NavierStokesWithFlux.hpp life/lifesolver/Oseen.hpp life/lifesolver/OseenShapeDerivative.hpp life/lifesolver/VenantKirchhofSolver.hpp life/lifesolver/bidomainSolver.hpp life/lifesolver/convDiffReactHandler.hpp life/lifesolver/convDiffReactSolverPC.hpp life/lifesolver/darcyHandler.hpp life/lifesolver/darcySolver.hpp life/lifesolver/darcySolverBase.hpp life/lifesolver/dataADR.hpp life/lifesolver/dataBidomain.hpp life/lifesolver/dataConvDiffReact.hpp life/lifesolver/dataDarcy.hpp life/lifesolver/dataElasticStructure.hpp life/lifesolver/dataIonic.hpp life/lifesolver/dataMonodomain.hpp life/lifesolver/dataNavierStokes.hpp life/lifesolver/dataSimplifiedStructure.hpp life/lifesolver/exactJacobianBase.hpp life/lifesolver/fixedPointBase.hpp life/lifesolver/fluidToMaster.hpp life/lifesolver/ionicSolver.hpp life/lifesolver/ipStabilization.hpp life/lifesolver/monodomainSolver.hpp life/lifesolver/nsip.hpp life/lifesolver/nsipterms.hpp life/lifesolver/parabolicSolver.hpp life/lifesolver/reducedLinFluid.hpp life/lifesolver/sdStabilization.hpp life/lifesolver/simplifiedStructure.hpp life/lifesolver/steklovPoincareBase.hpp life/lifesolver/timeSolver.hpp
LIFEFILTERS_HDRS=life/lifefilters/gmv_wrtrs.hpp life/lifefilters/openDX_wrtrs.hpp life/lifefilters/mesh_util.hpp life/lifefilters/postProc.hpp life/lifefilters/medit.hpp life/lifefilters/hdf5exporter.hpp life/lifefilters/ensight.hpp life/lifefilters/ensight7Writer.hpp life/lifefilters/medit_wrtrs.hpp life/lifefilters/readMesh3D.hpp life/lifefilters/vtk_wrtrs.hpp life/lifefilters/noexport.hpp life/lifefilters/importer.hpp life/lifefilters/gmsh_wrtrs.hpp life/lifefilters/selectMarker.hpp life/lifefilters/readMesh2D.hpp life/lifefilters/exporter.hpp
LIFEFILTERS_HDRS=life/lifefilters/ensight.hpp life/lifefilters/ensight7Writer.hpp life/lifefilters/exporter.hpp life/lifefilters/gmsh_wrtrs.hpp life/lifefilters/gmv_wrtrs.hpp life/lifefilters/hdf5exporter.hpp life/lifefilters/importer.hpp life/lifefilters/medit.hpp life/lifefilters/medit_wrtrs.hpp life/lifefilters/mesh_util.hpp life/lifefilters/noexport.hpp life/lifefilters/openDX_wrtrs.hpp life/lifefilters/postProc.hpp life/lifefilters/readMesh2D.hpp life/lifefilters/readMesh3D.hpp life/lifefilters/selectMarker.hpp life/lifefilters/vtk_wrtrs.hpp
nobase_include_HEADERS=lifeconfig.h\
$(LIFECORE_HDRS)\
......
......@@ -35,6 +35,10 @@ EpetraMap::EpetraMap(int NumGlobalElements,
M_exporter(),
M_importer()
{
//Sort MyGlobalElements to avoid a bug in Trilinos (9?) when multiplying two matrices (A * B^T)
std::sort (MyGlobalElements, MyGlobalElements + NumMyElements);
createMap( NumGlobalElements,
NumMyElements,
MyGlobalElements,
......@@ -188,7 +192,8 @@ EpetraMap::EpetraMap(const Epetra_BlockMap& _blockMap, const int offset, const i
const int maxMyElements = std::min(maxid, _blockMap.NumMyElements());
MyGlobalElements.reserve(maxMyElements);
//Sort MyGlobalElements to avoid a bug in Trilinos (9?) when multiplying two matrices (A * B^T)
std::sort (MyGlobalElements.begin(), MyGlobalElements.end());
// We consider that the source Map may not be ordered
for (int i(0); i < _blockMap.NumMyElements(); ++i)
......
......@@ -180,13 +180,6 @@ public:
// Epetra_Map* getRepeatedEpetra_Map(){return M_repeatedEpetra_Map;}
// createMap does not call createImportExport
void createMap(int NumGlobalElements,
int NumMyElements,
int* MyGlobalElements,
int IndexBase,
const Epetra_Comm &Comm) ;
map_ptrtype const & getMap ( EpetraMapType maptype) const;
//! This methods create a pointer to a EpetraMap that has points only on processor root
......@@ -205,8 +198,17 @@ public:
// EpetraMap& uniqueMap();
private:
// createMap does not call createImportExport
void createMap(int NumGlobalElements,
int NumMyElements,
int* MyGlobalElements,
int IndexBase,
const Epetra_Comm &Comm) ;
/*
Epetra_Map const * getRepeatedEpetra_Map() const
{return M_repeatedEpetra_Map;}
......
This diff is collapsed.
......@@ -104,6 +104,11 @@ BCBase::BCBase( const std::string& name,
_M_comp.push_back( i );
}
break;
case Directional:
nComp = 1;
_M_comp.reserve( nComp );
_M_comp.push_back( nDimensions );
break;
default:
ERROR_MSG( "BCBase::BCBase: You should use a more specific constructor for this mode" );
}
......@@ -214,6 +219,11 @@ BCBase::BCBase( const std::string& name,
_M_comp.reserve( nComp );
_M_comp.push_back( nDimensions );
break;
case Directional:
nComp = 1;
_M_comp.reserve( nComp );
_M_comp.push_back( nDimensions );
break;
default:
ERROR_MSG( "BCBase::BCBase: You should use a more specific constructor for this mode" );
......@@ -319,6 +329,11 @@ BCBase::BCBase( const std::string& name,
_M_comp.reserve( nComp );
_M_comp.push_back( nDimensions );
break;
case Directional:
nComp = 1;
_M_comp.reserve( nComp );
_M_comp.push_back( nDimensions );
break;
default:
ERROR_MSG( "BCBase::BCBase: You should use a more specific constructor for this mode" );
}
......
......@@ -35,7 +35,7 @@
-# a type (Essential, Natural, Mixte),
-# a mode of implementation (Scalar, Full, Component, Normal,
Tangential),
Tangential,Resistance,Directional),
-# a functor holding the data function,
......@@ -70,7 +70,7 @@ namespace LifeV
/** Boundary condition basic types
Essential, Natural, Mixte, Flux, Resistance,
*/
enum BCType{Essential, Natural, Mixte, Flux, Resistance};
enum BCType{Essential, Natural, Mixte, Flux, Resistance};
// ,UDepEssential,UDepNatural,UDepMixte};
/** Type for boundary conditions application modes
......@@ -85,7 +85,7 @@ namespace LifeV
-# Tangential: for vector problems dealing with tangential components
*/
enum BCMode{Scalar, Full, Component, Normal, Tangential};
enum BCMode{Scalar, Full, Component, Normal, Tangential,Directional};
/*!
\class BCBase
......@@ -422,13 +422,13 @@ public:
//! Returns the liste size
UInt list_size() const;
//! Returns the liste size of IdGlobal
//! Returns the liste size of IdGlobal
UInt list_size_IdGlobal() const;
//! Returns element of list_IdGlobal
int IdGlobal( int id) const;
//! Set the offset
void setOffset(int offset) {_M_offset = offset;}
......@@ -491,7 +491,7 @@ private:
//! to which the BC applies
std::set<boost::shared_ptr<IdentifierBase>, identifierComp> listIdGlobal;
//! the list of IdGlobal
//! the list of IdGlobal
std::vector<int> _M_IdGlobal;
//! container for id's when the list is finalised
......@@ -511,7 +511,7 @@ private:
//! Transfert between list and vector containers
void finalise();
//! Transfert between list and vector containers
void finaliseIdGlobal();
};
......
......@@ -192,6 +192,45 @@ const bool __bcUDepMixte = FactoryCloneBCFunctionUDep::instance().registerProduc
typeid(BCFunctionUDepMixte), &createBCFunctionUDepMixte );
//
// BCFunctionDirectional
//
BCFunctionDirectional::BCFunctionDirectional( const BCFunctionDirectional& bcf )
:
BCFunctionBase( bcf ),
_M_vectFct( bcf._M_vectFct )
{
}
BCFunctionDirectional::BCFunctionDirectional( function_type g, function_type vectFct )
:
BCFunctionBase( g ),
_M_vectFct( vectFct )
{
}
//! set the functions after having built it.
void
BCFunctionDirectional::setFunctions_Directional( function_type g, function_type vectFct )
{
setFunction( g );
_M_vectFct = vectFct;
}
Real
BCFunctionDirectional::vectFct( const Real& t, const Real& x, const Real& y,
const Real& z, const ID& icomp ) const
{
return _M_vectFct( t, x, y, z, icomp );
}
BCFunctionBase*
createBCFunctionDirectional( BCFunctionBase const* __bc )
{
return new BCFunctionDirectional( ( BCFunctionDirectional const& )*__bc );
}
// register BCFunctionMixte in factory for cloning
const bool __bcdirectional = FactoryCloneBCFunction::instance().registerProduct( typeid(BCFunctionDirectional), &createBCFunctionDirectional );
} //End of namespace LifeV
......@@ -188,8 +188,8 @@ 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
really I don't like that class BCFunctionBase has fixed function_type
prototype in the base class, but I conform
*/
class BCFunctionUDepBase
{
......@@ -234,7 +234,71 @@ typedef LifeV::singleton< LifeV::factoryClone< BCFunctionUDepBase > > FactoryClo
/* now I can store this in a BCBase */
}
/*!
\class BCFunctionDirectional
Class (STL functor) that holds the user defined fonctions for a directional Dirichlet bc
The data funcitions given by the user must have the following declaration
Real g(const Real& time, const Real& x, const Real& y, const Real& z, const ID& icomp)
*/
class BCFunctionDirectional
:
public BCFunctionBase
{
public:
typedef BCFunctionBase::function_type function_type;
//! Default constructor
/*!
The user must supply a function by calling setFunction(..)
*/
BCFunctionDirectional()
{}
//! Constructing from user defined functions
/*!
\param g user defined function
\param vectFct user defined function to defined the direction where the Dirichlet condition is imposed
*/
BCFunctionDirectional( function_type g, function_type vectFct );
//! Constructing from a user defined functor
/*!
\param bcf user defined functor
*/
BCFunctionDirectional( const BCFunctionDirectional& bcf );
//! Set the functions in the mixte case (beware : plural!)
/*!
\param g : the user defined function
\param vectFct user defined function to defined the direction where the Dirichlet condition is imposed
*/
void setFunctions_Directional( function_type g, function_type vectFct );
//! Method to call the auxiliary user defined function
/*!
\param t time
\param x coordinate
\param y coordinate
\param z coordinate
\param i component of the vector function
\return i-component of the user defined fonction evaluted in (t,x,y,z)
*/
Real vectFct( const Real& t, const Real& x, const Real& y,
const Real& z, const ID& i ) const;
private:
//! user defined function
function_type _M_vectFct;
};
}//End of namespace LifeV
#endif
......
......@@ -454,6 +454,9 @@ bool BCHandler::listHasOnlyEssential() const
case Tangential:
status.setTangential();
break;
case Directional:
status.setDirectional();
break;
default:
{
std::ostringstream __ex;
......
......@@ -376,6 +376,7 @@ private:
}
void setNormal() { M_normal = true; }
void setTangential() { M_tangential = true; }
void setDirectional() {M_directional = true;}
bool isEssential() const
{
bool result = true;
......@@ -390,6 +391,7 @@ private:
bool M_components[nDimensions];
bool M_normal;
bool M_tangential;
bool M_directional;
};
//! set of markers which are in the mesh but not in the list
......@@ -422,6 +424,7 @@ BCHandler::bdUpdate( Mesh& mesh, CurrentBdFE& feBd, const Dof& dof )
UInt numBElements = mesh.numBElements(); // number of boundary elements
EntityFlag marker; //will store the marker of each geometric entity
EntityFlag elementMarker; //will store the marker of the element
typedef typename GeoShape::GeoBShape GeoBShape;
......@@ -461,6 +464,7 @@ BCHandler::bdUpdate( Mesh& mesh, CurrentBdFE& feBd, const Dof& dof )
iBElEl = mesh.bElement( iBoundaryElement ).pos_first(); // local id of the face in its adjacent element
feBd.updateMeas( mesh.bElement( iBoundaryElement ) ); // updating finite element information
elementMarker = mesh.bElement( iBoundaryElement ).marker(); // We keep the element marker (added by Gwenol Grandperrin)
// ===================================================
// Vertex based Dof
......@@ -612,7 +616,7 @@ BCHandler::bdUpdate( Mesh& mesh, CurrentBdFE& feBd, const Dof& dof )
iEdEl = GeoShape::fToE( iBElEl, iLocalBElement ).first; // local edge number (in element)
#endif
marker = mesh.boundaryEdge( mesh.localEdgeId( iElAd, iEdEl ) ).marker(); // edge marker
if(marker!= elementMarker){continue;}
// Finding this marker on the BC list
whereList.clear();
where = M_bcList.begin();
......
......@@ -31,7 +31,6 @@
namespace LifeV
{
void bcCalculateTangentVectors(std::map< ID,std::vector< Real > > &triad)
{
// Author: Gwenol Grandperrin
......@@ -91,4 +90,56 @@ void bcCalculateTangentVectors(std::map< ID,std::vector< Real > > &triad)
}
}
void bcExportTriadToParaview(std::map< ID,std::vector< Real > > &triad,std::string filename)
{
//Initialization of the map to store the normal vectors
std::map< ID,std::vector< Real > >::iterator mapIt;
filename.append(".vtk");
std::ofstream file(filename.c_str());
//Is the file open?
if (file.fail())
{
cerr << "Error: The file is not opened " << std::endl;
}
else
{
//To define herein
unsigned int nbPoints(triad.size());
//Writing the header
file << "# vtk DataFile Version 2.0" << std::endl;
file << "Normal directions" << std::endl;
file << "ASCII" << std::endl;
//Writing the points
file << "DATASET POLYDATA" << std::endl;
file << "POINTS " << nbPoints << " float" << std::endl;
for ( mapIt=triad.begin() ; mapIt != triad.end(); mapIt++ )
file << (*mapIt).second[9] << "\t" << (*mapIt).second[10] << "\t" << (*mapIt).second[11] << std::endl;
//Starting the data part of the file
file << "POINT_DATA " << nbPoints << std::endl;
//Writing t1
file << "VECTORS cell_tangent_1 float" << std::endl;
for ( mapIt=triad.begin() ; mapIt != triad.end(); mapIt++ )
file << (*mapIt).second[0] << "\t" << (*mapIt).second[1] << "\t" << (*mapIt).second[2] << std::endl;
//Writing t2
file << "VECTORS cell_tangent_2 float" << std::endl;
for ( mapIt=triad.begin() ; mapIt != triad.end(); mapIt++ )
file << (*mapIt).second[3] << "\t" << (*mapIt).second[4] << "\t" << (*mapIt).second[5] << std::endl;
//Writing n
file << "VECTORS cell_normals float" << std::endl;
for ( mapIt=triad.begin() ; mapIt != triad.end(); mapIt++ )
file << (*mapIt).second[6] << "\t" << (*mapIt).second[7] << "\t" << (*mapIt).second[8] << std::endl;
//Closing the file
file.close();
}
}
} //End of namespace LifeV
......@@ -37,10 +37,12 @@
#include <life/lifefem/bcHandler.hpp>
#include <life/lifefem/dof.hpp>
#include "life/lifefem/FESpace.hpp"
#include <life/lifefem/BCNormalManager.hpp>
namespace LifeV
{
// ===================================================
//!@file Boundary conditions treatment
// ===================================================
......@@ -54,10 +56,6 @@ void bcManage( Real (*mu)(Real t,Real x, Real y, Real z, Real u),
{
VectorType bRepeated(b.getMap(),Repeated);
// triad is the triple (\tau_1, \tau_2, n)
//(cf Gwenol Grandperrin Master Thesis)
std::map< ID,std::vector< Real > > triad;
bool globalassemble=false;
// Loop on boundary conditions
for ( Index_t i = 0; i < BCh.size(); ++i )
......@@ -66,6 +64,11 @@ void bcManage( Real (*mu)(Real t,Real x, Real y, Real z, Real u),
{
case Essential: // Essential boundary conditions (Dirichlet)
globalassemble=true;
if ( (BCh[ i ].mode() == Tangential) || (BCh[ i ].mode() == Normal) || (BCh[ i ].mode() == Directional) )
{
ERROR_MSG( "This BC mode is not yet implemented for this setting" );
}
break;
case Natural: // Natural boundary conditions (Neumann)
if(BCh[ i ].isUDep())
......@@ -126,6 +129,10 @@ void bcManageMtimeUDep( MatrixType& M, const Dof& dof,
if( BCh[ i ].type()==Essential )
{
if ( (BCh[ i ].mode() == Tangential) || (BCh[ i ].mode() == Normal) || (BCh[ i ].mode() == Directional) )
{
ERROR_MSG( "This BC mode is not yet implemented for this setting" );
}
const BCBase& BCb=BCh[i];
ID idDof;
......@@ -178,12 +185,7 @@ void bcManage( MatrixType& A, VectorType& b, const MeshType& mesh, const Dof& do
VectorType bRepeated(b.getMap(),Repeated);
bool globalassemble=false;
// triad is the triple (\tau_1, \tau_2, n)
//(cf Gwenol Grandperrin Master Thesis)
std::map< ID,std::vector< Real > > triad;
// changingBasis is a bool to see if we need to change the local reference system
bool changingBasis=false;
BCNormalManager<MeshType,MatrixType> normalConditions(mesh);
// Loop on boundary conditions
......@@ -194,10 +196,9 @@ void bcManage( MatrixType& A, VectorType& b, const MeshType& mesh, const Dof& do
{
case Essential: // Essential boundary conditions (Dirichlet)
//Normal (or Tangential) essential boundary conditions
if ( (BCh[ i ].mode() == Tangential) || (BCh[ i ].mode() == Normal) )
if ( (BCh[ i ].mode() == Tangential) || (BCh[ i ].mode() == Normal) || (BCh[ i ].mode() == Directional) )
{
bcBuildTriad(mesh, BCh[ i ],bdfem, triad,BCh.offset());
changingBasis=true;
normalConditions.init(BCh[ i ],t);
}
globalassemble=true;
break;
......@@ -223,15 +224,12 @@ void bcManage( MatrixType& A, VectorType& b, const MeshType& mesh, const Dof& do
if(globalassemble)
A.GlobalAssemble();
// Rotation Matrix for the local change of reference system
MatrixType rotMat( createRMatrix(dof, A, triad,BCh.offset()) );
//Build the internal structure
normalConditions.build(dof,bdfem,A,BCh.offset(),b.Comm());
normalConditions.exportToParaview("normalAndTangents");
//Applying the basis changement
if( changingBasis )
{
// MatrixType rotMat( createRMatrix(dof, A, triad,BCh.offset()) );
bcShiftToNormalTangentialCoordSystem(A, b, rotMat);
}
normalConditions.bcShiftToNormalTangentialCoordSystem(A, b);
// Loop on boundary conditions
for ( Index_t i = 0; i < BCh.size(); ++i )
......@@ -244,7 +242,7 @@ void bcManage( MatrixType& A, VectorType& b, const MeshType& mesh, const Dof& do
case Natural: // Natural boundary conditions (Neumann)
case Mixte: // Mixte boundary conditions (Robin)
case Flux:
case Resistance:
case Resistance:
break;
default:
ERROR_MSG( "This BC type is not yet implemented" );
......@@ -252,12 +250,7 @@ void bcManage( MatrixType& A, VectorType& b, const MeshType& mesh, const Dof& do
}
//Return back to the initial basis
if ( changingBasis )
{
bcShiftToCartesianCoordSystem(A, b, rotMat);
//A.removeZeros();
}
normalConditions.bcShiftToCartesianCoordSystem(A, b);
}
......@@ -282,6 +275,10 @@ void bcManageMatrix( MatrixType& A,
{
case Essential: // Essential boundary conditions (Dirichlet)
globalassemble=true;
if ( (BCh[ i ].mode() == Tangential) || (BCh[ i ].mode() == Normal) || (BCh[ i ].mode() == Directional) )
{
ERROR_MSG( "This BC mode is not yet implemented for this setting" );
}
break;
case Natural: // Natural boundary conditions (Neumann)
break;
......@@ -341,6 +338,10 @@ void bcManageVector( VectorType& b,
switch ( BCh[ i ].type() )
{
case Essential: // Essential boundary conditions (Dirichlet)
if ( (BCh[ i ].mode() == Tangential) || (BCh[ i ].mode() == Normal) || (BCh[ i ].mode() == Directional) )
{
ERROR_MSG( "This BC mode is not yet implemented for this setting" );
}
bcEssentialManageVector( b, dof, BCh[ i ], t, coef, BCh.offset() );
break;
case Natural: // Natural boundary conditions (Neumann)
......@@ -377,6 +378,10 @@ void bcManageVector( VectorType& b,
switch ( BCh[ i ].type() )
{
case Essential: // Essential boundary conditions (Dirichlet)
if ( (BCh[ i ].mode() == Tangential) || (BCh[ i ].mode() == Normal) || (BCh[ i ].mode() == Directional) )
{
ERROR_MSG( "This BC mode is not yet implemented for this setting" );
}
bcEssentialManageVector( b, fespace.dof(), BCh[ i ], t, coef, BCh.offset() );
break;
case Natural: // Natural boundary conditions (Neumann)
......@@ -414,6 +419,10 @@ void bcManage( MatrixType1& C, MatrixType2& trD, VectorType& b,
switch ( BCh[ i ].type() )
{
case Essential: // Essential boundary conditions (Dirichlet)
if ( (BCh[ i ].mode() == Tangential) || (BCh[ i ].mode() == Normal) || (BCh[ i ].mode() == Directional) )
{
ERROR_MSG( "This BC mode is not yet implemented for this setting" );
}
bcEssentialManage( C, trD, b, mesh, dof, BCh[ i ], bdfem, coef, t, BCh.offset() );
break;
case Natural: // Natural boundary conditions (Neumann)
......@@ -448,6 +457,10 @@ void bcManage( MatrixType1& C, MatrixType2& trD, MatrixType3& D,
switch ( BCh[ i ].type() )
{
case Essential: // Essential boundary conditions (Dirichlet)
if ( (BCh[ i ].mode() == Tangential) || (BCh[ i ].mode() == Normal) || (BCh[ i ].mode() == Directional) )
{
ERROR_MSG( "This BC mode is not yet implemented for this setting" );
}
bcEssentialManage( C, trD, D, b, bp, mesh, dof, BCh[ i ], bdfem, coef, t, BCh.offset() );
break;
case Natural: // Natural boundary conditions (Neumann)
......@@ -2261,344 +2274,5 @@ void bcResistanceManage( MatrixType& A, VectorType& b, const MeshType& mesh, con
}
// ===================================================
// Defining boundary conditions on the normal and
// the tangential directions
// Author: Gwenol Grandperrin
// Date: 23.09.09
// ===================================================
template <typename MeshType>
void bcCalculateNormals(const MeshType& mesh,CurrentBdFE& bdfem,
std::map< ID,std::vector< Real > > &triad)