00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "SimpleNonlinearEllipticSolver.hpp"
00037
00038 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00039 c_matrix<double,1*(ELEMENT_DIM+1),1*(ELEMENT_DIM+1)> SimpleNonlinearEllipticSolver<ELEMENT_DIM,SPACE_DIM>::ComputeMatrixTerm(
00040 c_vector<double, ELEMENT_DIM+1>& rPhi,
00041 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rGradPhi,
00042 ChastePoint<SPACE_DIM>& rX,
00043 c_vector<double,1>& rU,
00044 c_matrix<double,1,SPACE_DIM>& rGradU,
00045 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00046 {
00047 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> ret;
00048
00049 c_matrix<double, SPACE_DIM, SPACE_DIM> f_of_u = mpNonlinearEllipticPde->ComputeDiffusionTerm(rX, rU(0));
00050 c_matrix<double, SPACE_DIM, SPACE_DIM> f_of_u_prime = mpNonlinearEllipticPde->ComputeDiffusionTermPrime(rX, rU(0));
00051
00052
00053 double forcing_term_prime = mpNonlinearEllipticPde->ComputeNonlinearSourceTermPrime(rX, rU(0));
00054
00055
00056
00057 matrix_row< c_matrix<double, 1, SPACE_DIM> > r_gradu_0(rGradU, 0);
00058 c_vector<double, SPACE_DIM> temp1 = prod(f_of_u_prime, r_gradu_0);
00059 c_vector<double, ELEMENT_DIM+1> temp1a = prod(temp1, rGradPhi);
00060
00061 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> integrand_values1 = outer_prod(temp1a, rPhi);
00062 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp2 = prod(f_of_u, rGradPhi);
00063 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> integrand_values2 = prod(trans(rGradPhi), temp2);
00064 c_vector<double, ELEMENT_DIM+1> integrand_values3 = forcing_term_prime * rPhi;
00065
00066 ret = integrand_values1 + integrand_values2 - outer_prod( scalar_vector<double>(ELEMENT_DIM+1), integrand_values3);
00067
00068 return ret;
00069 }
00070
00071 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00072 c_vector<double,1*(ELEMENT_DIM+1)> SimpleNonlinearEllipticSolver<ELEMENT_DIM,SPACE_DIM>::ComputeVectorTerm(
00073 c_vector<double, ELEMENT_DIM+1>& rPhi,
00074 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rGradPhi,
00075 ChastePoint<SPACE_DIM>& rX,
00076 c_vector<double,1>& rU,
00077 c_matrix<double,1,SPACE_DIM>& rGradU,
00078 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00079 {
00080 c_vector<double, 1*(ELEMENT_DIM+1)> ret;
00081
00082
00083
00084
00085 double forcing_term = mpNonlinearEllipticPde->ComputeLinearSourceTerm(rX);
00086 forcing_term += mpNonlinearEllipticPde->ComputeNonlinearSourceTerm(rX, rU(0));
00087
00088 c_matrix<double, ELEMENT_DIM, ELEMENT_DIM> FOfU = mpNonlinearEllipticPde->ComputeDiffusionTerm(rX, rU(0));
00089
00090
00091
00092 matrix_row< c_matrix<double, 1, SPACE_DIM> > rGradU0(rGradU, 0);
00093 c_vector<double, ELEMENT_DIM+1> integrand_values1 =
00094 prod(c_vector<double, ELEMENT_DIM>(prod(rGradU0, FOfU)), rGradPhi);
00095
00096 ret = integrand_values1 - (forcing_term * rPhi);
00097 return ret;
00098 }
00099
00100
00101 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00102 SimpleNonlinearEllipticSolver<ELEMENT_DIM,SPACE_DIM>::SimpleNonlinearEllipticSolver(
00103 AbstractTetrahedralMesh<ELEMENT_DIM, SPACE_DIM>* pMesh,
00104 AbstractNonlinearEllipticPde<SPACE_DIM>* pPde,
00105 BoundaryConditionsContainer<ELEMENT_DIM, SPACE_DIM, 1>* pBoundaryConditions)
00106 : AbstractNonlinearAssemblerSolverHybrid<ELEMENT_DIM,SPACE_DIM,1>(pMesh,pBoundaryConditions),
00107 mpNonlinearEllipticPde(pPde)
00108 {
00109 assert(pPde!=NULL);
00110 }
00111
00113
00115
00116 template class SimpleNonlinearEllipticSolver<1,1>;
00117 template class SimpleNonlinearEllipticSolver<2,2>;
00118 template class SimpleNonlinearEllipticSolver<3,3>;