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 #include "SimpleNonlinearEllipticSolver.hpp"
00030
00031 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00032 c_matrix<double,1*(ELEMENT_DIM+1),1*(ELEMENT_DIM+1)> SimpleNonlinearEllipticSolver<ELEMENT_DIM,SPACE_DIM>::ComputeMatrixTerm(
00033 c_vector<double, ELEMENT_DIM+1>& rPhi,
00034 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rGradPhi,
00035 ChastePoint<SPACE_DIM>& rX,
00036 c_vector<double,1>& rU,
00037 c_matrix<double,1,SPACE_DIM>& rGradU,
00038 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00039 {
00040 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> ret;
00041
00042 c_matrix<double, SPACE_DIM, SPACE_DIM> f_of_u = mpNonlinearEllipticPde->ComputeDiffusionTerm(rX, rU(0));
00043 c_matrix<double, SPACE_DIM, SPACE_DIM> f_of_u_prime = mpNonlinearEllipticPde->ComputeDiffusionTermPrime(rX, rU(0));
00044
00045
00046 double forcing_term_prime = mpNonlinearEllipticPde->ComputeNonlinearSourceTermPrime(rX, rU(0));
00047
00048
00049
00050 matrix_row< c_matrix<double, 1, SPACE_DIM> > r_gradu_0(rGradU, 0);
00051 c_vector<double, SPACE_DIM> temp1 = prod(f_of_u_prime, r_gradu_0);
00052 c_vector<double, ELEMENT_DIM+1> temp1a = prod(temp1, rGradPhi);
00053
00054 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> integrand_values1 = outer_prod(temp1a, rPhi);
00055 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp2 = prod(f_of_u, rGradPhi);
00056 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> integrand_values2 = prod(trans(rGradPhi), temp2);
00057 c_vector<double, ELEMENT_DIM+1> integrand_values3 = forcing_term_prime * rPhi;
00058
00059 ret = integrand_values1 + integrand_values2 - outer_prod( scalar_vector<double>(ELEMENT_DIM+1), integrand_values3);
00060
00061 return ret;
00062 }
00063
00064 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00065 c_vector<double,1*(ELEMENT_DIM+1)> SimpleNonlinearEllipticSolver<ELEMENT_DIM,SPACE_DIM>::ComputeVectorTerm(
00066 c_vector<double, ELEMENT_DIM+1>& rPhi,
00067 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rGradPhi,
00068 ChastePoint<SPACE_DIM>& rX,
00069 c_vector<double,1>& rU,
00070 c_matrix<double,1,SPACE_DIM>& rGradU,
00071 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00072 {
00073 c_vector<double, 1*(ELEMENT_DIM+1)> ret;
00074
00075
00076
00077
00078 double forcing_term = mpNonlinearEllipticPde->ComputeLinearSourceTerm(rX);
00079 forcing_term += mpNonlinearEllipticPde->ComputeNonlinearSourceTerm(rX, rU(0));
00080
00081 c_matrix<double, ELEMENT_DIM, ELEMENT_DIM> FOfU = mpNonlinearEllipticPde->ComputeDiffusionTerm(rX, rU(0));
00082
00083
00084
00085 matrix_row< c_matrix<double, 1, SPACE_DIM> > rGradU0(rGradU, 0);
00086 c_vector<double, ELEMENT_DIM+1> integrand_values1 =
00087 prod(c_vector<double, ELEMENT_DIM>(prod(rGradU0, FOfU)), rGradPhi);
00088
00089 ret = integrand_values1 - (forcing_term * rPhi);
00090 return ret;
00091 }
00092
00093
00094 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00095 SimpleNonlinearEllipticSolver<ELEMENT_DIM,SPACE_DIM>::SimpleNonlinearEllipticSolver(
00096 AbstractTetrahedralMesh<ELEMENT_DIM, SPACE_DIM>* pMesh,
00097 AbstractNonlinearEllipticPde<SPACE_DIM>* pPde,
00098 BoundaryConditionsContainer<ELEMENT_DIM, SPACE_DIM, 1>* pBoundaryConditions,
00099 unsigned numQuadPoints)
00100 : AbstractNonlinearAssemblerSolverHybrid<ELEMENT_DIM,SPACE_DIM,1>(pMesh,pBoundaryConditions,numQuadPoints),
00101 mpNonlinearEllipticPde(pPde)
00102 {
00103 assert(pPde!=NULL);
00104 }
00105
00107
00109
00110 template class SimpleNonlinearEllipticSolver<1,1>;
00111 template class SimpleNonlinearEllipticSolver<2,2>;
00112 template class SimpleNonlinearEllipticSolver<3,3>;