//! Compute the number of dof of given FEM void set ( const getfem::mesh_fem & mf_Ut, const getfem::mesh_fem & mf_Pt, const std::vector<getfem::mesh_fem> & mf_Uv, const getfem::mesh_fem & mf_Pv, const getfem::mesh_fem & mf_coeft, const getfem::mesh_fem & mf_coefv ) { Ut_ = mf_Ut.nb_dof(); Pt_ = mf_Pt.nb_dof(); ct_ = mf_coeft.nb_dof(); Uv_ = 0; for (size_type i = 0; i<mf_Uv.size(); ++i) Uv_ += mf_Uv[i].nb_dof(); Pv_ = mf_Pv.nb_dof(); cv_ = mf_coefv.nb_dof(); tissue_ = Pt_ + Ut_; vessel_ = Pv_ + Uv_; tot_ = tissue_ + vessel_; }
bool acoustics_problem::solve(void) { cout << "Solving Problem..." << endl; // define the model to solve getfem::model model; // Main unknown of the problem model.add_fem_variable("u", mf_u, 2); plain_vector K(1); K[0] = k2; model.add_initialized_fixed_size_data("k2", K); getfem::add_Helmholtz_brick(model, mim, "u", "k2", omega); // TODO: model and boundary conditions definition /*// Laplacian with constant model.add_initialized_scalar_data("c2", c2); getfem::add_generic_elliptic_brick(model, mim, "u", "c2", omega); // other term in the Helmholtz equation model.add_initialized_scalar_data("k2", k2); getfem::add_mass_brick(model, mim, "u", "k2"); */ plain_vector G; gmm::resize(G, mf_rhs.nb_dof()); // Neumann Boundary condition getfem::interpolation_function(mf_u, G, sol_g, a4); model.add_initialized_fem_data("g", mf_u, G); getfem::add_normal_source_term_brick(model, mim, "u", "g", a4); getfem::add_normal_source_term_brick(model, mim, "u", "g", gama); gmm::iteration iter(residual, 0, 40000); model.first_iter(); // Null initial value gmm::resize(U, mf_u.nb_dof()); gmm::clear(U); gmm::copy(U, model.set_real_variable("u", 1)); // exporting to vtk format getfem::stored_mesh_slice sl; sl.build(mesh, getfem::slicer_none(), 4); getfem::vtk_export exp(datafilename + ".vtk"); exp.exporting(mf_u); exp.write_point_data(mf_u, U, "sound"); plain_vector F; gmm::resize(F, mf_rhs.nb_dof()); getfem::interpolation_function(mf_rhs, F, sol_g); gmm::copy(F, model.set_real_variable("g")); iter.init(); getfem::standard_solve(model, iter); gmm::copy(model.real_variable("u"), U); exp.write_point_data(mf_u, U, "sound"); return (iter.converged()); }