From: Yujie <rec...@gm...> - 2007-10-04 16:51:58
|
Dear Roy: Thank you very much. Because I have several variables in my system. I think the following codes should be better. It is from equation_systems::build_discontious_solution_vector(): 0573 for (; pos != end; ++pos) 00574 { 00575 const System& system = *(pos->second); 00576 const unsigned int nv_sys = system.n_vars(); 00577 00578 system.update_global_solution (sys_soln, 0); 00579 00580 if (_mesh.processor_id() == 0) 00581 { 00582 std::vector<Number> elem_soln; // The finite element solution 00583 std::vector<Number> nodal_soln; // The FE solution interpolated to the nodes 00584 std::vector<unsigned int> dof_indices; // The DOF indices for the finite element 00585 00586 for (unsigned int var=0; var<nv_sys; var++) 00587 { 00588 const FEType& fe_type = system.variable_type(var); 00589 00590 MeshBase::element_iterator it = _mesh.active_elements_begin(); 00591 const MeshBase::element_iterator end = _mesh.active_elements_end(); 00592 00593 unsigned int nn=0; 00594 00595 for ( ; it != end; ++it) 00596 { 00597 const Elem* elem = *it; 00598 system.get_dof_map().dof_indices (elem, dof_indices, var); 00599 00600 elem_soln.resize(dof_indices.size()); 00601 00602 for (unsigned int i=0; i<dof_indices.size(); i++) 00603 elem_soln[i] = sys_soln[dof_indices[i]]; 00604 00605 FEInterface::nodal_soln (dim, 00606 fe_type, 00607 elem, 00608 elem_soln, 00609 nodal_soln); 00610 00611 #ifdef ENABLE_INFINITE_ELEMENTS 00612 // infinite elements should be skipped... 00613 if (!elem->infinite()) 00614 #endif 00615 { 00616 assert (nodal_soln.size() == elem->n_nodes()); 00617 00618 for (unsigned int n=0; n<elem->n_nodes(); n++) 00619 { 00620 soln[nv*(nn++) + (var + var_num)] += 00621 nodal_soln[n]; 00622 } 00623 } 00624 } 00625 } 00626 } 00627 00628 var_num += nv_sys; 00629 } I am wondering that I shoud not use 00605 FEInterface::nodal_soln (dim, 00606 fe_type, 00607 elem, 00608 elem_soln, 00609 nodal_soln); Because I use First-order Lagrange Element. I always want to confirm whether the reference element in FE:inverse_map() is isoparameter element? We will integrate on the isoparameter element. The integrate results on the physical element can be obtained by the values times Jacobian. Inverse_map() want to get point (physical element)'s position (reference element). if the FEtype is first-order lagrange. I think it is simple to get such corresponding relationship. If the FEtype is complicated, it will be difficulat to perform inverse_map(). Is it right? Thanks a lot. Regards, Yujie On 10/3/07, Roy Stogner <roy...@ic...> wrote: > > On Wed, 3 Oct 2007, Yujie wrote: > > > I have added system::update() function before I output the results. > However, > > it doesn't work. Is it wrong? > > System::update() updates the current_local_solution vector from the > solution vector, but it only updates "ghost" values on each processor > - values which are stores on elements which neighbor that processor's > partition. We don't create any serial vectors by default, so if you > want to get all your solution values on a single processor you'll need > to do it yourself. See the "global_displacement" vector in > examples/ex8.C for the simplest code to do this. > --- > Roy > |