Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
DiffusionReaction_def.hpp
1#ifndef DIFFUSIONREACTION_def_hpp
2#define DIFFUSIONREACTION_def_hpp
3#include "DiffusionReaction_decl.hpp"
12
13namespace FEDD {
14
15template<class SC,class LO,class GO,class NO>
16DiffusionReaction<SC,LO,GO,NO>::DiffusionReaction(const DomainConstPtr_Type &domain, std::string FEType, ParameterListPtr_Type parameterList, vec2D_dbl_Type diffusionTensor, RhsFunc_Type reactionFunc, bool vectorDiffusion):
17Problem<SC,LO,GO,NO>(parameterList, domain->getComm()),
18vectorDiffusion_(vectorDiffusion),
19A_(),
20u_rep_(),
21reactionFunc_()
22{
23
24 this->addVariable( domain , FEType , "u" , 1);
25 this->dim_ = this->getDomain(0)->getDimension();
26
27 diffusionTensor_ = diffusionTensor;
28
29 funcParameter_.push_back(this->parameterList_->sublist("Parameter").get("E0",1.0));
30 funcParameter_.push_back(this->parameterList_->sublist("Parameter").get("E1",0.5));
31
32 reactionFunc_ = reactionFunc;
33
34 u_rep_ = Teuchos::rcp( new MultiVector_Type( this->getDomain(0)->getMapRepeated() ) );
35
36 // Test for exception!!
37
38}
39
40template<class SC,class LO,class GO,class NO>
41DiffusionReaction<SC,LO,GO,NO>::~DiffusionReaction(){
42
43}
44
45template<class SC,class LO,class GO,class NO>
46void DiffusionReaction<SC,LO,GO,NO>::info(){
47 this->infoProblem();
48}
49
54template<class SC,class LO,class GO,class NO>
56
57 if (this->verbose_)
58 std::cout << "-- Assembly Laplace with Diffusion Tensor ... " << std::flush;
59
60 A_.reset(new Matrix_Type( this->getDomain(0)->getMapUnique(), this->getDomain(0)->getApproxEntriesPerRow() ) );
61
62 this->feFactory_->assemblyLaplaceDiffusion(this->dim_, this->domain_FEType_vec_.at(0), 2, A_, this->diffusionTensor_ );
63
64 if (this->system_.is_null())
65 this->system_.reset(new BlockMatrix_Type(1));
66
67 this->system_->addBlock(A_,0,0);
68
69 //this->assembleSourceTerm( 0. );
70 //this->addToRhs( this->sourceTerm_ );
71
72 if (this->verbose_)
73 std::cout << "done -- " << std::endl;
74}
75
80
81template<class SC,class LO,class GO,class NO>
82void DiffusionReaction<SC,LO,GO,NO>::assemble( std::string type ) const{
83
84 if (type=="") {
85 if (this->verbose_)
86 std::cout << "-- Assembly Diffusion ... " << std::endl;
87
89 if (this->verbose_)
90 std::cout << "done -- " << std::endl;
91 }
92 //else
93 // reAssemble( type );
94 // Here we would enter the reaction component. Since it is dependent on u it would need an update. So probably an update RHS thing.
95
96}
97
98template<class SC,class LO,class GO,class NO>
99typename DiffusionReaction<SC,LO,GO,NO>::MatrixPtr_Type DiffusionReaction<SC,LO,GO,NO>::getMassMatrix() const{
100
101 MatrixPtr_Type A;
102 A = Teuchos::rcp(new Matrix_Type( this->domainPtr_vec_.at(0)->getMapUnique(), this->getDomain(0)->getApproxEntriesPerRow() ) );
103 this->feFactory_->assemblyMass(this->dim_,this->domain_FEType_vec_.at(0),"Scalar", A);
104
105 return A;
106
107}
108
109}
110#endif
virtual void assemble(std::string type="") const
Definition DiffusionReaction_def.hpp:82
void assembleConstantMatrices(std::string type="") const
assemble constant matrices, that remain the same
Definition DiffusionReaction_def.hpp:55
Definition Problem_decl.hpp:38
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5