On Wed, Apr 15, 2015 at 7:55 PM, ernestol <[email protected]> wrote: > Hi all, > > I wonder if there is a simple way to get the global solution when > running the code in parallel? > > I tried: > > const System& system = es.get_system("System"); > const unsigned short int variable_num = > system.variable_number("variable"); > const unsigned int dim = mesh.mesh_dimension(); > std::vector<Number> sys_soln; > system.update_global_solution (sys_soln, 0); > > And also created this function > > void Solution(const EquationSystems& es,const MeshBase& mesh,string s){ > std::vector<Number> soln; > std::vector<std::string> names; > es.build_variable_names(names); > es.build_solution_vector(soln); > ofstream myfile; > myfile.open(s); > for(unsigned int i=0;i<mesh.n_nodes();i++){ > const unsigned int n_vars = names.size(); > for(unsigned int c=0;c<n_vars;c++){ > myfile << scientific << " " << soln[i*n_vars + c]; > } > myfile << endl; > } > myfile.close(); > } > > However both only work in serial. The first in parallel gives me only 0 > so sys_soln and the second gives me an error with PESTC when in > parallel. >
Out of curiosity, what does calling system.solution->print_global(); do? I'm a bit skeptical about your loop over nodes and vars... it might work for this one case, but be aware that it probably won't work if there are element and/or scalar dofs in the solution vector. -- John ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ Libmesh-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-users
