KVSlab / turtleFSI

Monolithic Fluid-Structure Interaction (FSI) solver
https://turtlefsi2.readthedocs.io/en/latest/
GNU General Public License v3.0
63 stars 24 forks source link

xdmf issues #16

Closed jack-kcl closed 2 years ago

jack-kcl commented 2 years ago

Hi- I've been having trouble opening the xdmf files the code generates from the simulations in Paraview. This is in contrast to the mesh files provided, which load up just fine. I suppose the h5 files are problematic in some way? Looking around the web, it seems to be a common issue for a lot of people. Would you be able to suggest a workaround or a suitable alternative format to use? Thank you.

keiyamamo commented 2 years ago

Hi @jack-kcl

I have no problem opening xdmf files from the simulations in Paraview. Which version of paraview are you using? Maybe could you provide your xdmf file so that I can test on my computer?

Best, Kei

jack-kcl commented 2 years ago

Dear Kei,

Thank you so much for getting back to me quickly. I have tried this with Paraview 5.4.1 (Linux), 5.11.0-RC1 (Linux), and I think 5.10.1 on mac. With the xdmf3readerS or T, loading this file results in an immediate crash. With the XDMF Reader, it reports an error and loads nothing. These are identical symptoms to those reported in e.g. https://discourse.paraview.org/t/failure-to-read-xdmf-files-generated-by-fenics/4928

The files generated from a demo problem are attached. Thank you for your help.

Best wishes, Jack


From: Kei Yamamoto @.> Sent: 14 October 2022 10:10 To: KVSlab/turtleFSI @.> Cc: Lee, Jack @.>; Mention @.> Subject: Re: [KVSlab/turtleFSI] xdmf issues (Issue #16)

You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

Hi @jack-kclhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjack-kcl&data=05%7C01%7Cjack.lee%40kcl.ac.uk%7C1f093b128b5440effe7508daadc3f3ed%7C8370cf1416f34c16b83c724071654356%7C0%7C0%7C638013354367890565%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=HVfapsGsaCBjgE%2FdUO4Or5GrLxk%2BSqdlPcytJJWZ4GQ%3D&reserved=0

I have no problem opening xdmf files from the simulations in Paraview. Which version of paraview are you using? Maybe could you provide your xdmf file so that I can test on my computer?

Best, Kei

— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKVSlab%2FturtleFSI%2Fissues%2F16%23issuecomment-1278717958&data=05%7C01%7Cjack.lee%40kcl.ac.uk%7C1f093b128b5440effe7508daadc3f3ed%7C8370cf1416f34c16b83c724071654356%7C0%7C0%7C638013354367890565%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=RWKm4oOUnzCWnkyyDtNnzNJubkCX8RwbWGv%2BLSctqw0%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMUB5XOWGULSPRM5EGUREBDWDEPQVANCNFSM6AAAAAARERYX3A&data=05%7C01%7Cjack.lee%40kcl.ac.uk%7C1f093b128b5440effe7508daadc3f3ed%7C8370cf1416f34c16b83c724071654356%7C0%7C0%7C638013354367890565%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=adyqTAcFKrGAiG%2B4PEbYd1C6VLBFPciyw%2BlacVVF33U%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

keiyamamo commented 2 years ago

HI @jack-kcl

Maybe you forgot to attach the file? I can’t seem to find the attached files. Anyway, I use 5.10.1 on my Mac and never experienced such a problem... I usually select xdmf3readerS and that works fine for me. May I also ask which version of FEniCS you are using? I use 2019.1.0.

jack-kcl commented 2 years ago

displacement.zip

Sorry about that! Should be attached this time.

I have tried two different ways, first installing turtleFSI from conda,-forge so the fenics was automatically added and I think the version is 2019.1.0. I also tried explicitly installing that version first, then building turtleFSI from source after that and the outcomes were the same.

keiyamamo commented 2 years ago

Hi @jack-kcl

Yes, I can reproduce the problem. However, it’s very weird because I have no problem opening displacement.xdmf when I run the demo problem on my computer.

Did you run the demo problem until the end of the simulation? If you stop the simulation before it finishes, that might cause the problem...

jack-kcl commented 2 years ago

Yes I ran the demo until it finished, with no error. I suspected the parallel write might be causing the issue so I've tried forcing mpirun -n 1 but the problem didn't go away. There was another thread I found that pointed out that setting the "flush_output" to True will fix this, but I can see that monolithic.py is already doing it. Puzzling.

I think I might wipe everything and start from beginning again. Can I ask you whether your fenics was built from source? Perhaps there's something going on with the binaries on conda-forge.

keiyamamo commented 2 years ago

Yes, you are absolutely right. I saw the same thread but turtleFSI already has “flush_output” to be True. I think I used conda-forge and did not build from the source, but I’m not 100% sure as it was long time ago.

Another option that might work is to replace d_file.write v_file.write p_file.write to d_file.write_checkpoint (and so on). This is the link for the line that you may want to change: https://github.com/KVSlab/turtleFSI/blob/23d21198a49c37dc6795417336ec6839791d7729/turtleFSI/problems/__init__.py#L296 and the explanation for write_checkpoint: https://fenicsproject.org/olddocs/dolfin/2017.2.0/python/programmers-reference/cpp/io/XDMFFile.html#dolfin.cpp.io.XDMFFile.write_checkpoint

keiyamamo commented 2 years ago

I’m not sure if this will solve the problem as I’m really not sure what’s causing the problem..

jack-kcl commented 2 years ago

Thank you for the suggestion, I will try it and report back.

Han10th commented 2 years ago

Hi, may I know if this problem is solved? I met the same issue.

keiyamamo commented 2 years ago

Hi @Han10th I do not know yet if what I suggested worked out, and I can not really test it myself since the output I get from turtleFSI does not have any issues... Sorry I can not be any help at the moment.

Han10th commented 2 years ago

Thanks for the reply. I reinstalled FENICS and turtleFSI. The problem is fixed. However, I met another problem the result doesn't deform as illustrated in the attached GIF in the readme page. Could you tell me how should I import the XDMF and H5 file to ParaView?

jack-kcl commented 2 years ago

Hi sorry I've had some deadlines. I was about to try out the write_checkpoint() however I remembered the code dumps out a Checkpoint folder already so I tried to load those files in and the same error occurred -- I figured there's no point modifying the code because I'd only be copying the checkpoint function anyway.

I'm also trying to reinstall fenics by building it from source, however, there seem to be something breaking.

@Han10th would you mind sharing the details of what you did to reinstall fenics and turtleFSI? Did you use conda, or some other route? As per importing in paraview, perhaps this link will be useful: https://jorgensd.github.io/dolfinx-tutorial/chapter1/membrane_paraview.html#using-paraview-for-visualization

Han10th commented 2 years ago

Thanks for the reference.

For solving the issue. I pip uninstall turtleFSI, and conda uninstall FEniCS, fenicstool.

Then, reinstall fenics by "conda install -c conda-forge fenics". Then, download turtleFSI from source via "git clone ...." and "python setup.py -install" according to the document.

Han10th commented 2 years ago

I use Ubuntu 18, BTW.

keiyamamo commented 2 years ago

Hi @jack-kcl Not sure if you solved the problem, but it seems like the xdmf issue is now fixed in the latest conda. Please see here: https://fenicsproject.discourse.group/t/xdmf-file-causes-a-crash-but-pvd-files-work/9864/4?u=kei_yamamoto

jack-kcl commented 2 years ago

Hi Thank you very much for following up on this issue! I had to build from source to make the issue go away, but I also found that the conda 2018 version didn't suffer from this issue. I guess now the latest legacy version will work too.