Skip to content

Commit f4d2fef

Browse files
authored
Make Nutils participant micro-nutils in the two-scale-heat-conduction tutorial faster (#516)
* Use 4 processors and remove the initial Allen Cahn solving step * Save porosity value in initialize so that it used in the first solve call * Formatting * Revert to running the Micro Manager with 2 processors, as the runtime is ~10 minutes * Remove excess radius factor to account for correction of the diffuse interface width
1 parent 3a659f9 commit f4d2fef

File tree

1 file changed

+8
-8
lines changed
  • two-scale-heat-conduction/micro-nutils

1 file changed

+8
-8
lines changed

two-scale-heat-conduction/micro-nutils/micro.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ def initialize(self):
7575
target_porosity = 1 - math.pi * self._r_initial ** 2
7676
print("Target amount of void space = {}".format(target_porosity))
7777

78-
dt_initial = 1E-3
79-
8078
# Solve Allen-Cahn equation till we reach target porosity value
81-
psi = 0
82-
while psi < target_porosity:
83-
print("Solving Allen-Cahn equation to achieve initial target grain structure")
84-
solphi = self._solve_allen_cahn(self._topo, solphi, 0.5, dt_initial)
85-
psi = self._get_avg_porosity(self._topo, solphi)
79+
# dt_initial = 1E-3
80+
# psi = 0
81+
# while psi < target_porosity:
82+
# print("Solving Allen-Cahn equation to achieve initial target grain structure")
83+
# solphi = self._solve_allen_cahn(self._topo, solphi, 0.5, dt_initial)
84+
# psi = self._get_avg_porosity(self._topo, solphi)
8685

8786
self._solphi = solphi # Save solution of phi
87+
psi = self._get_avg_porosity(self._topo, solphi)
8888
self._psi_nm1 = psi # Average porosity value of last time step
8989

9090
# Solve the heat cell problem
@@ -127,7 +127,7 @@ def _reinitialize_namespace(self, topo):
127127

128128
@staticmethod
129129
def _analytical_phasefield(x, y, r, lam):
130-
return 1. / (1. + np.exp(-4. / lam * (np.sqrt(x ** 2 + y ** 2) - r + 0.001)))
130+
return 1. / (1. + np.exp(-4. / lam * (np.sqrt(x ** 2 + y ** 2) - r)))
131131

132132
@staticmethod
133133
def _get_analytical_phasefield(topo, ns, degree_phi, lam, r):

0 commit comments

Comments
 (0)