36 #include "SimpleNonlinearEllipticSolver.hpp" 38 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
40 c_vector<double, ELEMENT_DIM+1>& rPhi,
41 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rGradPhi,
43 c_vector<double,1>& rU,
44 c_matrix<double,1,SPACE_DIM>& rGradU,
47 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> ret;
49 c_matrix<double, SPACE_DIM, SPACE_DIM> f_of_u = mpNonlinearEllipticPde->ComputeDiffusionTerm(rX, rU(0));
50 c_matrix<double, SPACE_DIM, SPACE_DIM> f_of_u_prime = mpNonlinearEllipticPde->ComputeDiffusionTermPrime(rX, rU(0));
53 double forcing_term_prime = mpNonlinearEllipticPde->ComputeNonlinearSourceTermPrime(rX, rU(0));
57 matrix_row< c_matrix<double, 1, SPACE_DIM> > r_gradu_0(rGradU, 0);
58 c_vector<double, SPACE_DIM> temp1 = prod(f_of_u_prime, r_gradu_0);
59 c_vector<double, ELEMENT_DIM+1> temp1a = prod(temp1, rGradPhi);
61 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> integrand_values1 = outer_prod(temp1a, rPhi);
62 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp2 = prod(f_of_u, rGradPhi);
63 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> integrand_values2 = prod(trans(rGradPhi), temp2);
64 c_vector<double, ELEMENT_DIM+1> integrand_values3 = forcing_term_prime * rPhi;
66 ret = integrand_values1 + integrand_values2 - outer_prod( scalar_vector<double>(ELEMENT_DIM+1), integrand_values3);
71 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
73 c_vector<double, ELEMENT_DIM+1>& rPhi,
74 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rGradPhi,
76 c_vector<double,1>& rU,
77 c_matrix<double,1,SPACE_DIM>& rGradU,
80 c_vector<double, 1*(ELEMENT_DIM+1)> ret;
85 double forcing_term = mpNonlinearEllipticPde->ComputeLinearSourceTerm(rX);
86 forcing_term += mpNonlinearEllipticPde->ComputeNonlinearSourceTerm(rX, rU(0));
88 c_matrix<double, ELEMENT_DIM, ELEMENT_DIM> FOfU = mpNonlinearEllipticPde->ComputeDiffusionTerm(rX, rU(0));
92 matrix_row< c_matrix<double, 1, SPACE_DIM> > rGradU0(rGradU, 0);
93 c_vector<double, ELEMENT_DIM+1> integrand_values1 =
94 prod(c_vector<double, ELEMENT_DIM>(prod(rGradU0, FOfU)), rGradPhi);
96 ret = integrand_values1 - (forcing_term * rPhi);
100 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
106 mpNonlinearEllipticPde(pPde)
108 assert(pPde!=
nullptr);
virtual c_matrix< double, 1 *(ELEMENT_DIM+1), 1 *(ELEMENT_DIM+1)> ComputeMatrixTerm(c_vector< double, ELEMENT_DIM+1 > &rPhi, c_matrix< double, SPACE_DIM, ELEMENT_DIM+1 > &rGradPhi, ChastePoint< SPACE_DIM > &rX, c_vector< double, 1 > &rU, c_matrix< double, 1, SPACE_DIM > &rGradU, Element< ELEMENT_DIM, SPACE_DIM > *pElement)
virtual c_vector< double, 1 *(ELEMENT_DIM+1)> ComputeVectorTerm(c_vector< double, ELEMENT_DIM+1 > &rPhi, c_matrix< double, SPACE_DIM, ELEMENT_DIM+1 > &rGradPhi, ChastePoint< SPACE_DIM > &rX, c_vector< double, 1 > &rU, c_matrix< double, 1, SPACE_DIM > &rGradU, Element< ELEMENT_DIM, SPACE_DIM > *pElement)
SimpleNonlinearEllipticSolver(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, AbstractNonlinearEllipticPde< SPACE_DIM > *pPde, BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 1 > *pBoundaryConditions)