From 20bd2dbb51a6f78e18aa6a64db07b256644fc5cd Mon Sep 17 00:00:00 2001
From: Lars Hubatsch <hubatsch@pks.mpg.de>
Date: Thu, 4 Feb 2021 19:58:41 +0100
Subject: [PATCH] Better meshing around x0 for Gaussian initial condition.

---
 @Ternary_model/create_mesh.m | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/@Ternary_model/create_mesh.m b/@Ternary_model/create_mesh.m
index f29f7b8..8ffca12 100644
--- a/@Ternary_model/create_mesh.m
+++ b/@Ternary_model/create_mesh.m
@@ -25,9 +25,7 @@ if strcmp(T.mode, 'Constituent') || strcmp(T.mode, 'Const_mob') || T.v == 0
     % Fine mesh close to x0 if ic = 'Gauss'
     [~, ind] = min(abs(T.x-T.x0));
     if (T.x(ind+20)-T.x(ind) > 0.1) && strcmp(T.ic, 'Gauss')
-        T.x = [T.x(1:ind-21), linspace(T.x(ind-20), T.x(ind+20),...
-                                       ceil((T.x(ind+20)-T.x(ind-20))*200)),...
-               T.x(ind+21:end)];
+        T.x = unique(sort([T.x, linspace(T.x0-0.099, T.x0+0.099, 200)]));
     end
 elseif strcmp(T.mode, 'Client') && T.v ~= 0
 %     T.x = linspace(0, T.system_size, 24000);
-- 
GitLab