Yes exactly, but try to avoid using loops like this for i in range(meshb.nbpts()):
Pt=mfub.basic_dof_nodes(i) In general avoid loops in Python as much as possible. It is faster to do something like a = mfub.basic_dof_nodes()[::3,:] even if it creates a 3 times as long array in the first place. Anyway the loop is also wrong because i should be a dof, not a point index. You could for example write a = mfub.basic_dof_nodes(range(0,mfub.nb_basic_dof(),3)) BR Kostas On Wed, Jan 19, 2022 at 5:35 PM Lesage,Anne Cecile J < ajles...@mdanderson.org> wrote: > Dear all > > > > Now I understand why it prints three times, it is because mfub > (displacements) is three dimensions > > > > Thank you > > AC > > > > *From:* Lesage,Anne Cecile J > *Sent:* Wednesday, January 19, 2022 10:18 AM > *To:* getfem-users@nongnu.org > *Subject:* FW: [EXT] Re: field output size > > > > Dear Kostas > > > > I tried this to test the nodes output and its transpose > > The problem is that the nodes are printed sequentially three times in a row > > > > np.savetxt("brain_displacements_nodeslines.txt", > mfub.basic_dof_nodes(),delimiter=' ', fmt='%f') > > a = np.empty([meshb.nbpts(),3]) > > for i in range(meshb.nbpts()): > > Pt=mfub.basic_dof_nodes(i) > > a[i][0]=Pt[0] > > a[i][1]=Pt[1] > > a[i][2]=Pt[2] > > np.savetxt("brain_displacements_nodes.txt", a, delimiter=' ', fmt='%f') > > > > thank you > > Anne-Cecile > > > > > > *From:* Konstantinos Poulios <logar...@googlemail.com> > *Sent:* Wednesday, January 19, 2022 4:49 AM > *To:* Lesage,Anne Cecile J <ajles...@mdanderson.org> > *Cc:* getfem-users@nongnu.org > *Subject:* [EXT] Re: field output size > > > > *WARNING: *This email originated from outside of MD Anderson. Please > validate the sender's email address before clicking on links or attachments > as they may not be safe. > > > > Dear Anne-Cecilie > > > > You can just save the nodal values to text files, e.g. > > numpy.save_txt("brain_displacements.txt",md.variable("ub")) > > numpy.save_txt("brain_pressure.txt",md.variable("pb")) > > and so on. > > > > If you want to know the coordinates of each degree of freedom, you can > also save these in files > numpy.save_txt("brain_displacements_nodes.txt", mfub.basic_dof_nodes()) > > numpy.save_txt("brain_pressure_nodes.txt", mfpb.basic_dof_nodes()) > > > > For displacements and node coordinates you can also reshape your arrays to > having 3 columns before exporting. > > > > I hope it helps. > > > > Best regards > > Kostas > > > > > > > > > > On Tue, Jan 18, 2022 at 10:56 PM Lesage,Anne Cecile J < > ajles...@mdanderson.org> wrote: > > Dear all > > > > I am using python scripting with getfem > > > > I have a mesh with 54026 > > I output the results in a vtu format with the following script lines > > > > mfoutb = gf.MeshFem(meshb) > > mfoutb.set_classical_discontinuous_fem(2) > > > > mfoutb.export_to_vtu("PoroEResect25brain_%i.vtu" % it, > > mfub, md.variable("ub"), "Displacements", > > mfpb, md.variable("pb"), "Pressure") > > > > when I save the spreadsheet of the results with paraview, I can the > results on 2646060 > > Ideally I would like to have the results only on the 54026 nodes > > Is there a way to correct my definition of mfoutb that corrects that? > > > > I am preforming an inverse method on the material parameter typically on > 700+ simulations, I need my results files to be smaller > > > > Thank you > > Regards > > Anne-Cecile > > The information contained in this e-mail message may be privileged, > confidential, and/or protected from disclosure. This e-mail message may > contain protected health information (PHI); dissemination of PHI should > comply with applicable federal and state laws. If you are not the intended > recipient, or an authorized representative of the intended recipient, any > further review, disclosure, use, dissemination, distribution, or copying of > this message or any attachment (or the information contained therein) is > strictly prohibited. If you think that you have received this e-mail > message in error, please notify the sender by return e-mail and delete all > references to it and its contents from your systems. > > The information contained in this e-mail message may be privileged, > confidential, and/or protected from disclosure. This e-mail message may > contain protected health information (PHI); dissemination of PHI should > comply with applicable federal and state laws. If you are not the intended > recipient, or an authorized representative of the intended recipient, any > further review, disclosure, use, dissemination, distribution, or copying of > this message or any attachment (or the information contained therein) is > strictly prohibited. If you think that you have received this e-mail > message in error, please notify the sender by return e-mail and delete all > references to it and its contents from your systems. >