-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathShearTemplate.c
executable file
·45 lines (42 loc) · 1.33 KB
/
ShearTemplate.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "mdoodz.h"
#include "stdio.h"
#include "stdlib.h"
int SetPhase(MdoodzInput *input, Coordinates coordinates) {
const double radius = input->model.user1 / input->scaling.L;
if (coordinates.x * coordinates.x + coordinates.z * coordinates.z < radius * radius) {
return 1;
} else {
return 0;
}
}
double SetDensity(MdoodzInput *input, Coordinates coordinates, int phase) {
const double T_init = (input->model.user0 + zeroC) / input->scaling.T;
if (1 == 0) {
return input->materials.rho[phase] * (1 - input->materials.alp[phase] * (T_init - input->materials.T0[phase]));
} else {
return input->materials.rho[phase];
}
}
int main(int nargs, char *args[]) {
// Input file name
char *input_file;
if ( nargs < 2 ) {
asprintf(&input_file, DefaultTextFilename(__FILE__)); // Default
}
else {
asprintf(&input_file, "%s", args[1]); // Custom
}
printf("Running MDoodz7.0 using %s\n", input_file);
MdoodzSetup setup = {
.SetParticles = &(SetParticles_ff){
.SetPhase = SetPhase,
.SetDensity = SetDensity,
},
.SetBCs = &(SetBCs_ff){
.SetBCVx = SetPureOrSimpleShearBCVx,
.SetBCVz = SetPureOrSimpleShearBCVz,
},
};
RunMDOODZ(input_file, &setup);
free(input_file);
}