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

Mixture/species transport model API should replicate behavior of materials change/create API #2275

Open
ansjsia opened this issue Nov 23, 2023 · 1 comment
Labels
enhancement Improve any current implemented feature Fluent Requires changes in Fluent

Comments

@ansjsia
Copy link
Collaborator

ansjsia commented Nov 23, 2023

📝 Description of the feature

The settings API calls to create new mixtures for the species transport model should be made consistent with that of the materials change/create API. Currently, it is not possible to create new mixtures without resorting to TUI commands.

💡 Steps for implementing the feature

These are the changes that would need to be implemented, as far as I can tell at this time:

  • Fix the volumetric_species.delete() method (Error in deleting species from mixture template (species transport) #2259), so that existing species in a mixture can be deleted. Currently, it is only possible to add species.
  • Create a settings API method to copy a mixture from Fluent's database, similar to copy_by_name() for species. Currently, the only non-GUI way is to execute /define/materials/change-create in the TUI.
  • Allow new mixtures to be created from an empty dictionary by executing root.setup.materials.mixture['my-mixture'] = {} in the same way that you can for species (this currently throws an error: Creating new mixture with empty dictionary breaks mixture API #2274). mixture-template could be used as the default for any empty fields.
  • Allow new mixtures to be created by calling root.setup.materials.mixture.create() on them, to replicate the same behavior as seen for fluids and solids.

🔗 Useful links and references

No response

@ansjsia ansjsia added the enhancement Improve any current implemented feature label Nov 23, 2023
@dnwillia-work
Copy link
Collaborator

dnwillia-work commented Nov 23, 2023

Thanks @ansjsia. I did spend a tiny bit of time trying this myself. I loaded up a single phase case without the species model activated and found the following:

#
# Copy the materials in from the database to make a custom mixture (this works)
#
solver.setup.materials.database.copy_by_name(name="methane", type="fluid")
solver.setup.materials.database.copy_by_name(name="propane", type="fluid")

#
# Turn on species, it works but it also deletes the materials I just copied in from the database
#
solver.setup.models.species.model.option = "species-transport"

#
# Copy the materials again, this seems to work ok
#
solver.setup.materials.database.copy_by_name(name="methane", type="fluid")
solver.setup.materials.database.copy_by_name(name="propane", type="fluid")

#
# Make handles to the newly copied materials
#
methane = solver.setup.materials.fluid["methane"]
propane = solver.setup.materials.fluid["propane"]

#
# Now try and make a mixutre out of those two, this does not work.
#
# This gives that error message and leaves a mixture called 'comgas' in the group
# with three materials: water-vapor, oxygen and nitrogen
#
solver.setup.materials.mixture["comgas"] = { "meth" : methane, "prop" : propane }
RuntimeError: Key 'meth' is invalid

#
# I'm able to delete the incorrectly configured mixture
#
>>> solver.setup.materials.mixture.delete(name_list=["comgas"])

#
# Tried creating like this but it also does not work
#
>>> solver.setup.materials.mixture["comgas"].species.volumetric_species = { "meth" : methane, "prop" : propane }
KeyError: 'comgas is not an allowed Settings objects name.\n'

#
# Tried this to get a blank setup but it also does not work. You get the material with 
# three components: water-vapor, nitrogen and oxygen
#
solver.setup.materials.mixture["comgas"] = {}

So, it's not really clear to me how this is supposed to be working. Related to this are #2016 and #2259.

@github-actions github-actions bot removed the Fluent label Jan 23, 2025
@hpohekar hpohekar added the Fluent Requires changes in Fluent label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve any current implemented feature Fluent Requires changes in Fluent
Projects
None yet
Development

No branches or pull requests

3 participants