From f433ed84490742dd23109de61f2485cd37b5dc2a Mon Sep 17 00:00:00 2001
From: Lars Hubatsch <hubatsch@pks.mpg.de>
Date: Mon, 9 Nov 2020 22:18:42 +0100
Subject: [PATCH] Enabling Stefanos mobility scaling. Not tested in Matlab.

---
 @Ternary_model/Ternary_model.m | 2 +-
 @Ternary_model/create_mesh.m   | 2 +-
 flory_hugg_pde.m               | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/@Ternary_model/Ternary_model.m b/@Ternary_model/Ternary_model.m
index 42ac268..0c1928f 100644
--- a/@Ternary_model/Ternary_model.m
+++ b/@Ternary_model/Ternary_model.m
@@ -21,7 +21,7 @@ classdef Ternary_model < handle
         b = 0.025;
         u0 = 0.05;
         e = 0.4;
-        e_g0 = 0.16;
+        e_g0 = 0.16; % mobility spread. Also used in square mobility ansatz.
         ic_c = 0; % initial concentration inside droplet
         u_g0 = 0.2;
         system_size = 300;
diff --git a/@Ternary_model/create_mesh.m b/@Ternary_model/create_mesh.m
index fc3686c..35884d8 100644
--- a/@Ternary_model/create_mesh.m
+++ b/@Ternary_model/create_mesh.m
@@ -2,7 +2,7 @@ function create_mesh(T)
 %CREATE_MESH creates mesh for solving Ternary_model.
 %   Mesh density larger for steeper gradients.
 
-if strcmp(T.mode, 'Constituent') | T.v == 0
+if strcmp(T.mode, 'Constituent') || strcmp(T.mode, 'Const_mob') || T.v == 0
 % Start with left side of mesh, at r=0/x=0, with a given step size
     x = linspace(0, -0.75*T.a, 40);
     x = [x, x(end)+0.001/T.precision];
diff --git a/flory_hugg_pde.m b/flory_hugg_pde.m
index 981342d..1afe3b9 100644
--- a/flory_hugg_pde.m
+++ b/flory_hugg_pde.m
@@ -11,6 +11,10 @@ c = 1;
 if strcmp(mode, 'Constituent')
     g0 = Ternary_model.gamma0(x, a+t*v, b, e_g0, u_g0, v*t);
     f = g0.*(1-pt)./pt.*(pt.*dudx-u.*gra_a);
+elseif strcmp(mode, 'Const_mob')
+    % Using Stefano's mobility ansatz (1-phi_tot+a*phi_tot^2) to obtain a
+    % certain ratio of D_in/D_out.
+    f = (1-pt+e_g0*pt^2)./pt.*(pt.*dudx-u.*gra_a);
 elseif strcmp(mode, 'Client')
     g0 = 0.5;
     chi_phi = -4.530864768482371;
-- 
GitLab