{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pyphasefield as ppf\n",
    "\n",
    "#in jupyter notebook, run this code in a separate cell to initialize once and (potentially) use multiple times\n",
    "tdbc = ppf.TDBContainer(\"Ni-Cu_Ideal.tdb\", [\"FCC_A1\", \"LIQUID\"], [\"CU\", \"NI\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pyphasefield.Engines as engines\n",
    "\n",
    "sim = engines.Diffusion(dimensions=[200, 200, 200])\n",
    "\n",
    "#initialize non-array parameters\n",
    "sim.set_framework(\"CPU_SERIAL\")\n",
    "sim.set_dx(1.)\n",
    "sim.set_dt(0.1)\n",
    "sim.set_time_step_counter(0)\n",
    "sim.set_temperature_type(\"ISOTHERMAL\")\n",
    "sim.set_temperature_initial_T(1584.)\n",
    "sim.set_temperature_dTdx(100000.)\n",
    "sim.set_temperature_dTdy(0.)\n",
    "sim.set_temperature_dTdz(0.)\n",
    "sim.set_temperature_dTdt(-3000000.)\n",
    "sim.set_temperature_dTdt(0.)\n",
    "sim.set_temperature_path(\"T.hdf5\")\n",
    "sim.set_t_file_offset_cells([4000, 8000, 10000]) #this or below\n",
    "sim.set_t_file_offset_units([0.00025, 0.00008, 0.00043]) #this or above\n",
    "sim.set_t_file_min(1500.)\n",
    "sim.set_t_file_max(2800.)\n",
    "sim.set_temperature_units(\"K\")\n",
    "sim.set_tdb_container(tdbc)\n",
    "sim.set_tdb_path(\"Ni-Cu_Ideal.tdb\")\n",
    "sim.set_tdb_phases([\"FCC_A1\", \"LIQUID\"])\n",
    "sim.set_tdb_components([\"CU\", \"NI\"])\n",
    "sim.set_save_path(\"data/test_simulation\")\n",
    "sim.set_autosave_flag(True)\n",
    "sim.set_autosave_save_images_flag(False)\n",
    "sim.set_autosave_rate(40000)\n",
    "sim.set_boundary_conditions(\"NEUMANN\")\n",
    "sim.set_ghost_rows(32)\n",
    "\n",
    "data = {\n",
    "\n",
    "}\n",
    "sim.set_user_data(data)\n",
    "\n",
    "#initialize simulation arrays, all parameter changes should be BEFORE this point!\n",
    "sim.initialize_engine()\n",
    "\n",
    "#change array data here, for custom simulations\n",
    "\n",
    "#run simulation\n",
    "for i in range(1):\n",
    "    sim.simulate(1000)\n",
    "    sim.plot_simulation()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
