00001 #include "elasticfem.h"
00002 #include "assemblyorthomeshsystem.h"
00003 #include "hdf5orthowriter.h"
00004 #include "gnuplotanim.h"
00005
00006
00007 ElasticFEM::ElasticFEM(OrthoMesh &mesh, VecDouble &cK,double &fYoung, double &fPoisson,Function3D &fD, Function3D &fN)
00008 :m_mesh(mesh),m_cK(cK),m_eqvar(mesh,cK,fYoung,fPoisson,fD,fN),m_fN(fN)
00009 {
00010 AssemblyOrthoMeshSystem<IsotropicElasticEqVar> assembler;
00011 m_vRHS.reinit(m_eqvar.n_dofs());
00012 m_sol.reinit(m_eqvar.n_dofs());
00013 m_sparsity.reinit(m_eqvar.n_dofs(),m_eqvar.n_dofs(),m_eqvar.n_max_dof_coupling());
00014 assembler.buildSparsityPattern(m_sparsity,m_mesh,m_eqvar);
00015 m_sparsity.compress();
00016 m_M.reinit(m_sparsity);
00017 assembler.setBoundaryValue(m_mesh,m_eqvar,fD,dirichlet_bc_map);
00018
00019 }
00020
00021
00022
00023 void ElasticFEM::iterate(TransportBase &trans)
00024 {
00025 AssemblyOrthoMeshSystem<IsotropicElasticEqVar> assembler;
00026 assembler.buildGlobalMatrix(m_M,m_mesh, m_eqvar);
00027 assembler.buildGlobalRhs(m_vRHS,m_mesh,m_eqvar);
00028 assembler.applyBoundaryValue(dirichlet_bc_map,m_M);
00029 assembler.applyBoundaryValue(dirichlet_bc_map,m_vRHS);
00030
00031 m_sol=m_vRHS;
00032 m_sol.print();
00033 solveA.factorize(m_M);
00034 solveA.solve(m_sol);
00035
00036 }
00037 void ElasticFEM::printOutput()
00038 {
00039 if (m_debugLevel > 0)
00040 {
00041 HDF5OrthoWriter &hdf5 = HDF5OrthoWriter::getHDF5OrthoWriter();
00042 hdf5.writeScalarField(m_sol,"P");
00043
00044 GnuPlotAnim &plot = GnuPlotAnim::getGnuPlotAnim();
00045
00046
00047
00048 plot.set("yrange","[0:1]");
00049 plot.plotVerticeValuesAtFixedZ(m_mesh,m_sol,"Sc","with lines",5);
00050 plot.NextScene();
00051 }
00052 }
00053
00054
00055 void ElasticFEM::getVelocitiesAtFaces(Matrix& M)
00056 {
00057 throw new Exception("ElasticFEM::getVelocitiesAtFaces Not implemented for this class\n");
00058 }