From 8b34e232a7b02871436232a824eba9bf1c13f0e5 Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Tue, 4 Sep 2018 16:00:17 +0200
Subject: [PATCH] Phasefield

- simpler function to init N phase model
---
 phasefield/phasefieldstep.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/phasefield/phasefieldstep.py b/phasefield/phasefieldstep.py
index 45a0fba8..d15a6558 100644
--- a/phasefield/phasefieldstep.py
+++ b/phasefield/phasefieldstep.py
@@ -274,6 +274,12 @@ class PhaseFieldStep:
             for i in range(phi.shape[-1]):
                 b[self.phi_field_name][..., i] = phi[i]
 
+    def set_single_concentration(self, slice_obj, phase_idx, value=1):
+        num_phases = self.concentration[:, :, :].shape[-1]
+        zeros = [0] * num_phases
+        zeros[phase_idx] = value
+        self.set_concentration(slice_obj, zeros)
+
     def set_density(self, slice_obj, value):
         for b in self.data_handling.iterate(slice_obj):
             for i in range(self.num_order_parameters):
-- 
GitLab