Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

febioStruct2xml #24

Closed
jinookus opened this issue Jun 26, 2018 · 8 comments
Closed

febioStruct2xml #24

jinookus opened this issue Jun 26, 2018 · 8 comments

Comments

@jinookus
Copy link

jinookus commented Jun 26, 2018

Hello,

I have recently installed GIBBON code onto a different pc and found my existing code did not work, realized some information in the output xml file differs from input FEB struct.

As one example from my code, in Matlab the input FEB struct was,

FEB_struct.febio_spec.Contact.contact{1, 1}.surface{1, 1}.tri3
ans =
struct with fields:
VAL: ' 1, 3, 2'
ATTR: [1×1 struct]

FEB_struct.febio_spec.Contact.contact{1, 1}.surface{1, 1}.tri3.ATTR.id
ans =
'1'

which outputs .feb file as in:

      <tri3 id="49">32, 32, 32, 32, 32, 49, 44, 32, 32, 32, 32, 32, 51, 44, 32, 32, 32, 32, 32, 50</tri3>

When I changed back to febioStruct2xml from my older pc, this issue did not occur.

Thank you!

@Kevin-Mattheus-Moerman
Copy link
Member

Thanks for posting this issue. To try to understand what is going on, can you tell me the versions for MATLAB, GIBBON and FEBio on both computers? Is there a demo that you used to make your code? If so what demo did you use?

My guess is that this is due to a different FEBio (and GIBBON) version. There have been some changes in the way contact is defined. I'll highlight it below.

First of all, I should say there are old demos and new demos. The file names for the old ones starts with DEMO_FEBio.... the file names for the new ones start with DEMO_febio_xxxx... where the x-s stand for numbers. I recommend to only use the new ones. Perhaps the new demo DEMO_febio_0006_sphere_indentation is a good one to look at. In there you'll see how to first define master and slave surfaces in a surface section like this:

% -> Surfaces
febio_spec.Geometry.Surface{1}.ATTR.name='contact_master';
febio_spec.Geometry.Surface{1}.tri3.ATTR.lid=(1:1:size(F_contact_master,1))';
febio_spec.Geometry.Surface{1}.tri3.VAL=F_contact_master;

febio_spec.Geometry.Surface{2}.ATTR.name='contact_slave';
febio_spec.Geometry.Surface{2}.quad4.ATTR.lid=(1:1:size(F_contact_slave,1))';
febio_spec.Geometry.Surface{2}.quad4.VAL=F_contact_slave;

Then you add these to the contact section like this:

febio_spec.Contact.contact{1}.ATTR.surface_pair=febio_spec.Geometry.SurfacePair{1}.ATTR.name;

@Kevin-Mattheus-Moerman
Copy link
Member

Let me know how you get on

@jinookus
Copy link
Author

Hi,

Matlab on the original PC is R2017b, on the new one is R2017a, and FEBio on both pcs is version 2.7.1. I am doing some parametric studies and using GIBBON to automate the process. I did not look at the demos to create the geometry in MATLAB, but created initial geometries in PreView (v 2.0.0) , then imported it into MATLAB using xml2struct from GIBBON. When I compared the two output feb files from different febioStruct2xml to detect differences, the contact surface information (shown above) + a line in element information was altered.

Thank you for your quick response.

@Kevin-Mattheus-Moerman
Copy link
Member

xml2struct is a general MATLAB function. I think it does import stuff as structs even if it should just contain some numbers.
If your geometry is easily coded then building it in MATLAB might be the best way to do it. Can you share what type of geometry you have? If it is a simple cube or sphere like geometry there are simple functions to generate those. Also if you have import e.g. STL derived geometry those can be imported too. Let me know if I can help.

I've also opened #25 to create the inverse of febioStruct2xml i.e. a function to import the feb file into the proper structure. But it may take some time to finish that.

@jinookus
Copy link
Author

Oh, I remember now I had to create another function to get rid of other imported structs to match the proper febio structure. My geometry simply is a slice with layers having different material properties welded together under a rigid body. I can share .feb file if that makes it more clearer. Thanks.

@Kevin-Mattheus-Moerman
Copy link
Member

Let me know if that extra step you mention solves your issue. I think this is not a bug but simply an XML import issue. It sounds like you can fix it but let me know if you need help.

BTW If you do want to code the model (in which case you can easily manipulate mesh density and other parameters) you could check out: DEMO_febio_00014_cube_varying_material. That demo has spatially varying mechanical properties on the elements (essentially using a for loop on the element materials).

@jinookus
Copy link
Author

The extra step was implemented within my code both before and after switching to newer febioStruct2xml before reporting this issue. But I do agree XML import maybe the issue here as my function altering imported xml was written roughly to get rid of excess structures. Thank you for leading me to the Demo, I will see if I can apply my geometry as shown.

@Kevin-Mattheus-Moerman
Copy link
Member

I'll close this issue for now. Let me know if you need more help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants