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