MaterialsMap is Python package for mapping properties, manufacturing feasibility, and desirability. We focus on guiding materials design graphically while proving an API to underlying methods, so that others can utlize it as an engine behind their tools, like machine learning (ML) based alloy design.
It can utilize both free and open source (FOSS) pycalphad and industry-trusted Thermo-Calc for performing underlying thermodynamic calculations.
MaterialsMap uses several different methods out-of-the-box. These include thermodynamic equilibrium calculations, Scheil-Gulliver solidification, and 5 different models for predicting cracking susceptibility. The thermodynamic equilibrium calculations predict phases formed at specific conditions by minimizing the Gibbs energy of the system and are typically closer to experimnental observations of slow-colled materials, while the Scheil-Gulliver simulations capture non-equilibrium rapid solidification effects (e.g. in welding or additive manufacturing) by assuming no diffusion in solid phases, equilibrium at the solid/liquid interface, and complete mixing in the liquid phase. MaterialsMap combines these approaches to provide comprehensive phase formation predictions at the two extrema of cooling rates to determine feasibility. The five implemented crack susceptibility criteria include Freezing Range (FR), Crack Susceptibility Coefficient (CSC), Kou Criteria, Improved Crack Susceptibility Coefficient (iCSC), and Simplified Rappaz-Drezet-Gramaud (sRDG), enabling users to assess hot cracking risks from multiple perspectives / mechanisms.
Please refer to our 2024 Materialia article which discusses in detail all implemented methods, underlying thermodynamics, and their applications.
importosimporttimeimportmatplotlibasmplimportmatplotlib.pyplotaspltimportnumpyasnpimportpandasaspdfrommaterialsmap.core.compositionsimportgenerateCompositions, createCompositionfrommaterialsmap.ref_dataimportperiodic_table, materialsfrommaterialsmap.core.pycalphad_runimportpycalphad_eq, pycalphad_scheilfrommaterialsmap.core.GenerateEqScriptimportcreateEqScriptfrommaterialsmap.core.ReadEqResultimportgetEqdatafrommaterialsmap.core.GenerateScheilScriptimportcreateScheilScriptfrommaterialsmap.core.ReadScheilResultimportgetScheilSolidPhasefrommaterialsmap.plot.FeasibilityMapimportplotMaps# Create Compositionscomps= ['SS304L', 'NiCr', 'V']
eleAmountType='massFraction'pressure=101325ngridpts=41# number of points along each dimension of the composition gridTemperatureRange= (900, 2300, 10) #(lower limit, upper limit, temperature step)indep_comps= [comps[1], comps[2]] # choose them automaticallyforiincomps:
ifiinperiodic_table:
materials[i] = {i: 1}
elifinotinmaterials.keys():
materials['SS304L'] = {'Ni': 0.09611451943, 'Cr': 0.1993865031,
'Fe': 0.7044989775} # the composition of this element/alloys(in weight fractions)maxNumSim=250# maximum number of simulations in each TCM file# Equilibrium simulation settingspressure=101325database='TCFE8'# <userDatabase>.TDB or TCFE8eleAmountType='massFraction'# Candidates: massFraction massPercent moleFraction molePercentoutput_Eq=f'{TemperatureRange[0]}-{TemperatureRange[1]}-{TemperatureRange[2]}-{comps[0]}-{comps[1]}-{comps[2]}-Eq'# Create folder in curent path to store simulation resultsfromdatetimeimportdatetimecurrent_dateTime=datetime.now()
if'.tdb'indatabaseor'.TDB'indatabase:
database_name=database.split('/')
path=f'./Simulation/{datetime.now().strftime("%m-%d-%Y")}-{comps[0]}-{comps[1]}-{comps[2]}-database-{database_name[-1][:-4]}'else:
path=f'./Simulation/{datetime.now().strftime("%m-%d-%Y")}-{comps[0]}-{comps[1]}-{comps[2]}-database-{database}'isExist=os.path.exists(path)
ifnotisExist:
os.makedirs(path)
print("The new directory is created!")
# Save compostion resultscompositions_list=generateCompositions(indep_comps, ngridpts)
Compositions, numPoint, comp, numSimultion=createComposition(indep_comps, comps, compositions_list, materials, path)
settings= [TemperatureRange, numPoint, numSimultion, comp, comps, indep_comps, os.path.abspath(database), pressure, eleAmountType]
np.save(f'{path}/setting.npy', settings)
# Running with PyCalphadpycalphad_eq(path)
pycalphad_scheil(path, 2000) # temperature to start scheil if not eq results# Running with Thermo_Calc# Create TCM files with pathcreateEqScript(path)
createScheilScript(path, 2000) # temperature to start scheil if not eq results# Open TCM files with Thermo_Calc# Collect results from Thermo_CalcgetEqdata(path)
getScheilSolidPhase(path)
# Plot deleterious phase diagram and crack susceptibility map plotMaps(path, 'pycalphad')MaterialsMap can be quickly installed from PyPI with a simple:
pip install materialsmapTo install an editable development version with pip:
git clone https://github.com/HUISUN24/materialsmap.git
cd materialsmap
pip install -e .Upgrading scheil later requires you to run git pull in this directory.
Automated testing is performed on every commit to the repository, as defined in .github/workflows/lastCommit.yml workflow. On your system, you can also run it with a simple:
pytest