Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
myc2d.h
Go to the documentation of this file.
1
/** @file myc2d.h
2
*/
3
#define NOT_ZERO 1e-30
4
5
/*-----------------------------------------------------*
6
*MYC - Mixed Youngs and Central Scheme (2D) *
7
*-----------------------------------------------------*/
8
coord
mycs
(
Point
point
,
scalar
c
)
9
{
10
int
ix
;
11
double
c_t
,
c_b
,
c_r
,
c_l
;
12
double
mx0
,
my0
,
mx1
,
my1
,
mm1
,
mm2
;
13
14
/* top, bottom, right and left sums of c values */
15
c_t
=
c
[-1,1] +
c
[0,1] +
c
[1,1];
16
c_b
=
c
[-1,-1] +
c
[0,-1] +
c
[1,-1];
17
c_r
=
c
[1,-1] +
c
[1,0] +
c
[1,1];
18
c_l
=
c
[-1,-1] +
c
[-1,0] +
c
[-1,1];
19
20
/* consider two lines: sgn(my) Y = mx0 X + alpha,
21
and: sgn(mx) X = my0 Y + alpha */
22
mx0
= 0.5*(
c_l
-
c_r
);
23
my0
= 0.5*(
c_b
-
c_t
);
24
25
/* minimum coefficient between mx0 and my0 wins */
26
if
(
fabs
(
mx0
) <=
fabs
(
my0
)) {
27
my0
=
my0
> 0. ? 1. : -1.;
28
ix
= 1;
29
}
30
else
{
31
mx0
=
mx0
> 0. ? 1. : -1.;
32
ix
= 0;
33
}
34
35
/* Youngs' normal to the interface */
36
mm1
=
c
[-1,-1] + 2.0*
c
[-1,0] +
c
[-1,1];
37
mm2
=
c
[1,-1] + 2.0*
c
[1,0] +
c
[1,1];
38
mx1
=
mm1
-
mm2
+
NOT_ZERO
;
39
mm1
=
c
[-1,-1] + 2.0*
c
[0,-1] +
c
[1,-1];
40
mm2
=
c
[-1,1] + 2.0*
c
[0,1] +
c
[1,1];
41
my1
=
mm1
-
mm2
+
NOT_ZERO
;
42
43
/* choose between the best central and Youngs' scheme */
44
if
(
ix
) {
45
mm1
=
fabs
(
my1
);
46
mm1
=
fabs
(
mx1
)/
mm1
;
47
if
(
mm1
>
fabs
(
mx0
)) {
48
mx0
=
mx1
;
49
my0
=
my1
;
50
}
51
}
52
else
{
53
mm1
=
fabs
(
mx1
);
54
mm1
=
fabs
(
my1
)/
mm1
;
55
if
(
mm1
>
fabs
(
my0
)) {
56
mx0
=
mx1
;
57
my0
=
my1
;
58
}
59
}
60
61
/* normalize the set (mx0,my0): |mx0|+|my0|=1 and
62
write the two components of the normal vector */
63
mm1
=
fabs
(
mx0
) +
fabs
(
my0
);
64
coord
n
= {
mx0
/
mm1
,
my0
/
mm1
, 0};
65
66
return
n
;
67
}
x
int x
Definition
common.h:76
point
Point point
Definition
conserving.h:86
n
else return n
Definition
curvature.h:101
mycs
coord mycs(Point point, scalar c)
Definition
myc2d.h:8
NOT_ZERO
#define NOT_ZERO
Definition
myc2d.h:3
Point
Definition
linear.h:21
coord
Definition
common.h:78
scalar
Definition
common.h:44
c
scalar c
Definition
vof.h:57
myc2d.h
Generated by
1.9.8