is there a way to custom new materials?

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

Post Reply
valerie
Posts: 1
Joined: Thu Aug 25, 2022 11:56 am

is there a way to custom new materials?

Post by valerie »

I'am using Argon. So each time I make a new simulation, I have to replace Air by Argon and insert mannually the Argon constants. Is there a way to add and save a new material to the fluids list (as we can do in FEM)?
Thanks
Valerie
KAKM
Posts: 100
Joined: Tue May 04, 2021 12:17 am

Re: is there a way to custom new materials?

Post by KAKM »

I don't think there is at the moment, but it should be straightforward to implement, so I'm going to take a stab at it. In the time between now and getting that written/merged, you might consider recording a macro that includes adding Argon properties and any other standard steps you use for setting up simulations (e.g., solver selection, mesh settings).

Edit: it looks like you can go into the FEM tool and save it into Mod/CfdOf/Data/CfdMaterialProperties. I think that will bring it up in the menu, but I can't currently verify that because I've somehow managed to delete my CfdOF installation and when I try to reinstall it, FreeCAD crashes. (Pretty sure it's an add-on manager issue)
KAKM
Posts: 100
Joined: Tue May 04, 2021 12:17 am

Re: is there a way to custom new materials?

Post by KAKM »

Okay, so it turns out if you use the material editor in the FEM workbench to "save as" a material into Mod/CfdOf/Data/CfdMaterialProperties but don't use add a property to add a 'Type' property, it throws a key error and you can't open the material selection dialog. (the type property is supposed to indicate which physics the material is associated with (e.g., isothermal, compressible))

@oliveroxtoby, there are several different ways I could approach resolving this:
  • Remove the type matching requirement to add a material to the dropdown list
  • Allow it to add materials with no type, but mark them as such
  • Add a checkbox to allow untyped materials
  • Create a CfdOF material editor based on the FEM one that makes type a required field
Thoughts on which approach to take?
User avatar
oliveroxtoby
Posts: 653
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: is there a way to custom new materials?

Post by oliveroxtoby »

KAKM wrote: Thu Sep 22, 2022 2:08 am @oliveroxtoby, there are several different ways I could approach resolving this:
  • Remove the type matching requirement to add a material to the dropdown list
  • Allow it to add materials with no type, but mark them as such
  • Add a checkbox to allow untyped materials
  • Create a CfdOF material editor based on the FEM one that makes type a required field
Thoughts on which approach to take?
Great that you're planning to take this on - thanks!

As much as it's a shame to duplicate functionality, I think we would need to do this independently in CfdOF since we had to add quite a lot of unique fields for fluids due to the different inputs accepted by OpenFOAM (aside from Isothermal and Compressible types, there is 'Incompressible' as well where polynomial coefficients are given...so the formatting is quite unique). In other words I think the issue of incompatibility will go beyond just the presence or absence of the 'Type' field.

Hopefully this can be done just by adding a 'Save' option to the existing material properties task panel rather than making a whole new editor...unless I'm missing something?
KAKM
Posts: 100
Joined: Tue May 04, 2021 12:17 am

Re: is there a way to custom new materials?

Post by KAKM »

No, you're right, that should work. I might be able to steal the save function from FEM (plus or minus a bit of tweaking) depending on how exactly it was written. Though, honestly, looking at the format of the .FCMat files, this isn't going to be a big deal to write from scratch.

What's the difference between FCMat and FCdMat? That seems like it might be important.
User avatar
oliveroxtoby
Posts: 653
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: is there a way to custom new materials?

Post by oliveroxtoby »

KAKM wrote: Fri Sep 23, 2022 10:55 pm What's the difference between FCMat and FCdMat? That seems like it might be important.
I haven't come across that before. Please feel welcome to run with this and take whichever direction seems best!
KAKM
Posts: 100
Joined: Tue May 04, 2021 12:17 am

Re: is there a way to custom new materials?

Post by KAKM »

oliveroxtoby wrote: Mon Sep 26, 2022 6:52 am I haven't come across that before.
Then I guess it probably isn't particularly important, or it would have broken something by now :D . It's part of the file, and I can't tell any difference between water (which is FCdMat) and everything else (which is FCMat).
Screen Shot 2022-09-26 at 8.45.08 PM.png
Screen Shot 2022-09-26 at 8.45.08 PM.png (16.06 KiB) Viewed 63 times
User avatar
oliveroxtoby
Posts: 653
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: is there a way to custom new materials?

Post by oliveroxtoby »

KAKM wrote: Tue Sep 27, 2022 12:48 am Then I guess it probably isn't particularly important, or it would have broken something by now :D . It's part of the file, and I can't tell any difference between water (which is FCdMat) and everything else (which is FCMat). Screen Shot 2022-09-26 at 8.45.08 PM.png
I suspect it's just a typo! :D
Post Reply