Skip to content

Commit

Permalink
Add generic function calls, place all code in functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcelisgarza committed Sep 3, 2020
1 parent 1fe3aa0 commit 3e4e690
Show file tree
Hide file tree
Showing 73 changed files with 3,248 additions and 3,385 deletions.
164 changes: 80 additions & 84 deletions input/FRS_111_generator.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,111 +3,107 @@
global Bscrew Bedge Beclimb Bline

bmag = 2.74E-4; %microns
mumag = 160e3; % MPa
l = 0.5/bmag;
b = 1/2*[1 1 1];
mumag = 160e3; % MPa
l = 0.5 / bmag;
b = 1/2 * [1 1 1];

side1 = [1 1 1] / sqrt(3);

side1 = [1 1 1]/sqrt(3);


n = [-1 0 1] %cross(side2,b);
n = [-1 0 1]%cross(side2,b);

%start from center of grid

%P1 = [0.52 0.52 1.7]/bmag; %exiting top
%P1 = [0.52 0.1 0.52]/bmag; %lateral
dx=5; %microns
dy=2; %microns
dz=2; %microns
ns= 10 %number of sources

P1 = [dx 0.5*dy, 0.8*dz]/bmag;
P2m = P1 + l*side1*0.5;
P2 = P1 + l*side1;


P3 = [0.05*dx 0.5*dy, 0.2*dz]/bmag;
P3m = P3 + l*side1*0.5;
P4 = P3 + l*side1;


rn = [
P1, 7;
P2m, 0;
P2, 7;
P3, 7;
P3m, 0;
P4, 7;
];

links = [ 1 2 b n;
2 3 b n;
4 5 b n;
5 6 b n;
];

MU = 1;
NU = 0.305;
maxconnections=4;
lmax = 1000;
lmin = 100;
dx = 5; %microns
dy = 2; %microns
dz = 2; %microns
ns = 10%number of sources

P1 = [dx 0.5 * dy, 0.8 * dz] / bmag;
P2m = P1 + l * side1 * 0.5;
P2 = P1 + l * side1;

P3 = [0.05 * dx 0.5 * dy, 0.2 * dz] / bmag;
P3m = P3 + l * side1 * 0.5;
P4 = P3 + l * side1;

rn = [
P1, 7;
P2m, 0;
P2, 7;
P3, 7;
P3m, 0;
P4, 7;
];

links = [1 2 b n;
2 3 b n;
4 5 b n;
5 6 b n;
];

MU = 1;
NU = 0.305;
maxconnections = 4;
lmax = 1000;
lmin = 100;
coplanar_tol = 10;
areamin=lmin*lmin*sin(60/180*pi)*0.5;
areamax=20*areamin;
a=lmin/sqrt(3)*0.5;
Ec = MU/(4*pi)*log(a/0.1);
dt0=1e7;
mobility='mobbcc0';
areamin = lmin * lmin * sin(60/180 * pi) * 0.5;
areamax = 20 * areamin;
a = lmin / sqrt(3) * 0.5;
Ec = MU / (4 * pi) * log(a / 0.1);
dt0 = 1e7;
mobility = 'mobbcc0';

intSimTime = 0;
sinTime = 0;
dtplot=5e6;
doplot=1;% frame recording: 1 == on, 0 == off
dtplot = 5e6;
doplot = 1; % frame recording: 1 == on, 0 == off
totalSimTime = 0.3e12;
curstep = 0;
simTime = 0;

Bscrew=1e0;
Bedge=1e0;
Beclimb=1e10;
Bline=1.0e-4*min(Bscrew,Bedge);

integrator='int_trapezoid';
rann = 0.5*a;
rntol = 0.5*rann;
doremesh=1; %flat set to 0 or 1 that turns the remesh functions off or on
docollision=1; %flat set to 0 or 1 that turns collision detection off or on
doseparation=1; %flat set to 0 or 1 that turns splitting algorithm for highly connected node off or on
dovirtmesh=1; %flat set to 0 or 1 that turns remeshing of virtual nodes off or on
plotfreq=100;
plim=7000;
viewangle=[-35,15];
printfreq=1;
printnode=2;
rmax=100; %maximum distance a node may travel in one cycle
Bscrew = 1e0;
Bedge = 1e0;
Beclimb = 1e10;
Bline = 1.0e-4 * min(Bscrew, Bedge);

integrator = 'int_trapezoid';
rann = 0.5 * a;
rntol = 0.5 * rann;
doremesh = 1; %flat set to 0 or 1 that turns the remesh functions off or on
docollision = 1; %flat set to 0 or 1 that turns collision detection off or on
doseparation = 1; %flat set to 0 or 1 that turns splitting algorithm for highly connected node off or on
dovirtmesh = 1; %flat set to 0 or 1 that turns remeshing of virtual nodes off or on
plotFreq = 100;
plim = 7000;
viewangle = [-35, 15];
printfreq = 1;
printnode = 2;
rmax = 100; %maximum distance a node may travel in one cycle

%FEM CANTILEVER PARAMETERS

% dx=12; %microns
% dy=2; %microns
% dy=2; %microns
% dz=2; %microns
%tungsten "a" is 0.000274
dx = dx/bmag;
dy = dy/bmag;
dz = dz/bmag;

mx=30; % number of elements along beam length
loading=1;
vertices = [0,0,0;...
dx,0,0;...
0,dy,0;...
dx,dy,0;...
0,0,dz;...
dx,0,dz;...
0,dy,dz;...
dx,dy,dz];
dx = dx / bmag;
dy = dy / bmag;
dz = dz / bmag;

mx = 30; % number of elements along beam length
loading = 1;
vertices = [0, 0, 0; ...
dx, 0, 0; ...
0, dy, 0; ...
dx, dy, 0; ...
0, 0, dz; ...
dx, 0, dz; ...
0, dy, dz; ...
dx, dy, dz];

%plotnodes(rn,links,plim,vertices);
hold on;
plot3(rn(:,1), rn(:,2), rn(:,3),'ko'); %nodes
plot3(rn(:, 1), rn(:, 2), rn(:, 3), 'ko'); %nodes
110 changes: 55 additions & 55 deletions input/gen_110m111.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,43 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
%% SOURCE GENERATION PARAMETERS
amag=3.18e-4;
mumag = 145E3; % MPa only used for plotting
amag = 3.18e-4;
mumag = 145E3; % MPa only used for plotting

CRYSTAL_STRUCTURE = 'bcc';
NUM_SOURCES = 1;
DIST_SOURCE = 0.26/amag;
DIST_SOURCE = 0.26 / amag;

%% FEM PARAMETERS
%Cantilever

dx=15/amag; %10micron
dy=5/amag; %2micron
dz=5/amag; %2micron

mx=40; % number of elements along beam length
loading=1;
vertices = [0,0,0;...
dx,0,0;...
0,dy,0;...
dx,dy,0;...
0,0,dz;...
dx,0,dz;...
0,dy,dz;...
dx,dy,dz];
dx = 15 / amag; %10micron
dy = 5 / amag; %2micron
dz = 5 / amag; %2micron

mx = 40; % number of elements along beam length
loading = 1;
vertices = [0, 0, 0; ...
dx, 0, 0; ...
0, dy, 0; ...
dx, dy, 0; ...
0, 0, dz; ...
dx, 0, dz; ...
0, dy, dz; ...
dx, dy, dz];

%% MATERIAL CONSTANTS

%MU = 160E9; %160GPa
MU = 1;
NU = 0.28;
NU = 0.28;

%% DDLab PARAMETERS

% c=1/amag;
% x=0.25/(amag*sqrt(6));
% y=0.25/(amag*sqrt(3));
%
%
% rn=[ 3.7*c 2.7*c+2*x-y 0.25*c 0;
% 3.7*c+x 2.7*c-y 0.25*c+x 0;
% 3.7*c+2*x 2.7*c-2*x-y 0.25*c+2*x 0;
Expand All @@ -68,21 +68,21 @@
% 3.7*c+x+2*y 2.7*c+y 0.25*c+x+2*y 0;
% 3.7*c+2*y 2.7*c+2*x+y 0.25*c+2*y 0;
% 3.7*c+y 2.7*c+2*x 0.25*c+y 0];
%
%
% b1=[-1 -1 -1]/sqrt(3);
% n1=[-1 0 1]/sqrt(2);
% n2=[1 0 -1]/sqrt(2);
%
%
% links=[1 2 b1 n1;
% 2 3 b1 n1;
% 3 4 b1 n1;
% 3 4 b1 n1;
% 4 5 b1 n1;
% 5 6 b1 n1;
% 6 7 b1 n1;
% 7 8 b1 n1;
% 8 1 b1 n1];
[rn,links] = input_110m111(NUM_SOURCES,DIST_SOURCE,dx,dy,dz);

[rn, links] = input_110m111(NUM_SOURCES, DIST_SOURCE, dx, dy, dz);
% [rn]=[dx-0.5*dx,dy-0.5*dy,dz-0.5*dz,7;
% dx-0.5*dx,dy-0.5*dy,dz-0.55*dz,7;
% dx-0.49*dx,dy-0.5*dy,dz-0.55*dz,7];
Expand All @@ -95,67 +95,67 @@
% links_mirror = links;
% links_mirror(:,1) = links(:,2) + max(max(links(:,1:2)));
% links_mirror(:,2) = links(:,1) + max(max(links(:,1:2)));
%
%
% rn = vertcat(rn,rn_mirror);
% links = vertcat(links,links_mirror);

%%
%Edge and screw glide and climb mobility parameters
mobility='Hmobbcc10rotation';
mobility = 'Hmobbcc10rotation';
global Bscrew Bedge Beclimb Bline
%Bedge=1e-4; %Pa s
%Bscrew=1e-5; %Pa s
%Beclimb=1e5; %Pa s - really big
%Bline=1e-4*min(Bscrew,Bedge);
Bedge=1;
Bscrew=2;
Beclimb=1e10;
Bline=1e-4*min(Bscrew,Bedge);
Bedge = 1;
Bscrew = 2;
Beclimb = 1e10;
Bline = 1e-4 * min(Bscrew, Bedge);

%Meshing
maxconnections=4;
lmax =0.5/amag;
lmin = 0.1/amag;
areamin=lmin*lmin*sin(60/180*pi)*0.5;
areamax=20*areamin;
doremesh=1; %flat set to 0 or 1 that turns the remesh functions off or on
docollision=1; %flat set to 0 or 1 that turns collision detection off or on
doseparation=1; %flat set to 0 or 1 that turns splitting algorithm for highly connected node off or on
dovirtmesh=1; %flat set to 0 or 1 that turns remeshing of virtual nodes off or on
maxconnections = 4;
lmax = 0.5 / amag;
lmin = 0.1 / amag;
areamin = lmin * lmin * sin(60/180 * pi) * 0.5;
areamax = 20 * areamin;
doremesh = 1; %flat set to 0 or 1 that turns the remesh functions off or on
docollision = 1; %flat set to 0 or 1 that turns collision detection off or on
doseparation = 1; %flat set to 0 or 1 that turns splitting algorithm for highly connected node off or on
dovirtmesh = 1; %flat set to 0 or 1 that turns remeshing of virtual nodes off or on

%Simulation time
dt0=1E10;
dt0 = 1E10;

intSimTime = 0;
sinTime = 0;
%dtplot=2E-9; %2ns
dtplot=5E4;
doplot=1; % frame recording: 1 == on, 0 == off
totalSimTime = (2/amag)/(0.0001*1E3*dx*(1E-4/160E9));
dtplot = 5E4;
doplot = 1; % frame recording: 1 == on, 0 == off
totalSimTime = (2 / amag) / (0.0001 * 1E3 * dx * (1E-4/160E9));
curstep = 0;
simTime = 0;

%Integrator
integrator='int_trapezoid_bb';
integrator = 'int_trapezoid_bb';
%integrator='int_trapezoid_stoc'; %in development
a=lmin/sqrt(3)*0.5;
Ec = MU/(4*pi)*log(a/0.1);
rann = 0.5*a;
rntol = 0.5*rann; % need to do convergence studies on all these parameters
a = lmin / sqrt(3) * 0.5;
Ec = MU / (4 * pi) * log(a / 0.1);
rann = 0.5 * a;
rntol = 0.5 * rann; % need to do convergence studies on all these parameters
rmax = lmax;

%Plotting
plotfreq=10E7;
plim=12/amag; %12microns
viewangle=[-35,15];
printfreq=500;
printnode=2;
plotFreq = 10E7;
plim = 12 / amag; %12microns
viewangle = [-35, 15];
printfreq = 500;
printnode = 2;

%GPU Setup
use_gpu = 0;
n_threads=256;
n_threads = 256;

% tractions
a_trac = 1;

save('./mat_files/test')
save('./mat_files/test')
Loading

0 comments on commit 3e4e690

Please sign in to comment.