Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
openfpm_pdata
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openfpm
openfpm_pdata
Commits
be2e3215
Commit
be2e3215
authored
Dec 18, 2019
by
foggia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing average in parallel
parent
807a2f80
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
302 additions
and
309 deletions
+302
-309
example/Numerics/Stoke_flow/0_2D_incompressible/main_petsc.cpp
...le/Numerics/Stoke_flow/0_2D_incompressible/main_petsc.cpp
+301
-308
openfpm_numerics
openfpm_numerics
+1
-1
No files found.
example/Numerics/Stoke_flow/0_2D_incompressible/main_petsc.cpp
View file @
be2e3215
...
...
@@ -42,6 +42,7 @@
#include "FiniteDifference/eq.hpp"
#include "Solvers/petsc_solver.hpp"
#include "Solvers/petsc_solver.hpp"
#include "FiniteDifference/operators.hpp"
struct
lid_nn
{
...
...
@@ -111,14 +112,6 @@ const bool lid_nn::boundary[] = {NON_PERIODIC,NON_PERIODIC};
//! \cond [def equation] \endcond
// Constant Field
struct
eta
{
typedef
void
const_field
;
static
float
val
()
{
return
1.0
;}
};
// Convenient constants
constexpr
unsigned
int
v
[]
=
{
0
,
1
};
constexpr
unsigned
int
P
=
2
;
...
...
@@ -126,31 +119,6 @@ constexpr unsigned int ic = 2;
constexpr
int
x
=
0
;
constexpr
int
y
=
1
;
// Create field that we have v_x, v_y, P
typedef
Field
<
v
[
x
],
lid_nn
>
v_x
;
// Definition 1 v_x
typedef
Field
<
v
[
y
],
lid_nn
>
v_y
;
// Definition 2 v_y
typedef
Field
<
P
,
lid_nn
>
Prs
;
// Definition 3 Prs
// Eq1 V_x
typedef
mul
<
eta
,
Lap
<
v_x
,
lid_nn
>
,
lid_nn
>
eta_lap_vx
;
// Step 1
typedef
D
<
x
,
Prs
,
lid_nn
>
p_x
;
// Step 2
typedef
minus
<
p_x
,
lid_nn
>
m_p_x
;
// Step 3
typedef
sum
<
eta_lap_vx
,
m_p_x
,
lid_nn
>
vx_eq
;
// Step 4
// Eq2 V_y
typedef
mul
<
eta
,
Lap
<
v_y
,
lid_nn
>
,
lid_nn
>
eta_lap_vy
;
typedef
D
<
y
,
Prs
,
lid_nn
>
p_y
;
typedef
minus
<
p_y
,
lid_nn
>
m_p_y
;
typedef
sum
<
eta_lap_vy
,
m_p_y
,
lid_nn
>
vy_eq
;
// Eq3 Incompressibility
typedef
D
<
x
,
v_x
,
lid_nn
,
FORWARD
>
dx_vx
;
// Step 5
typedef
D
<
y
,
v_y
,
lid_nn
,
FORWARD
>
dy_vy
;
// Step 6
typedef
sum
<
dx_vx
,
dy_vy
,
lid_nn
>
ic_eq
;
// Step 7
//! \cond [def equation] \endcond
/*!
...
...
@@ -187,15 +155,6 @@ typedef sum<dx_vx,dy_vy,lid_nn> ic_eq; // Step 7
//! \cond [bond def eq] \endcond
// Equation for boundary conditions
// Directional Avg
typedef
Avg
<
x
,
v_y
,
lid_nn
>
avg_vy
;
typedef
Avg
<
y
,
v_x
,
lid_nn
>
avg_vx
;
typedef
Avg
<
x
,
v_y
,
lid_nn
,
FORWARD
>
avg_vy_f
;
typedef
Avg
<
y
,
v_x
,
lid_nn
,
FORWARD
>
avg_vx_f
;
// Usefull constants (as MACRO)
#define EQ_1 0
#define EQ_2 1
...
...
@@ -232,6 +191,40 @@ int main(int argc, char* argv[])
// Initialize
openfpm_init
(
&
argc
,
&
argv
);
// Names for the positions in cell
std
::
initializer_list
<
char
>
cc
=
{
0
,
0
};
std
::
initializer_list
<
char
>
ll
=
{
0
,
-
1
};
std
::
initializer_list
<
char
>
bl
=
{
-
1
,
-
1
};
std
::
initializer_list
<
char
>
bb
=
{
-
1
,
0
};
//! \cond [def equation] \endcond
// Create field that we have v_x, v_y, P
Field
<
v
[
x
],
lid_nn
>
v_x
{
ll
};
// Definition 1 v_x
Field
<
v
[
y
],
lid_nn
>
v_y
{
bb
};
// Definition 2 v_y
Field
<
P
,
lid_nn
>
Prs
{
cc
};
// Definition 3 Prs
coeff
<
double
,
lid_nn
>
eta
{
1.0
,
bl
};
// Coefficient
// Create the derivatives and Laplacians that are needed
Laplacian
<
lid_nn
,
CENTRAL
>
lap
;
Der
<
x
,
lid_nn
,
CENTRAL
>
dx
;
Der
<
y
,
lid_nn
,
CENTRAL
>
dy
;
Der
<
x
,
lid_nn
,
FORWARD
>
dx_f
;
Der
<
y
,
lid_nn
,
FORWARD
>
dy_f
;
// Equations
auto
vx_eq
=
eta
*
lap
(
v_x
)
-
dx
(
Prs
);
// Eq1 V_x
auto
vy_eq
=
eta
*
lap
(
v_y
)
-
dy
(
Prs
);
// Eq2 V_y
auto
ic_eq
=
dx_f
(
v_x
)
+
dy_f
(
v_y
);
// Eq3 Incom
Avg
<
x
,
decltype
(
v_y
)
>
avg_vy
{
v_y
};
Avg
<
y
,
decltype
(
v_x
)
>
avg_vx
{
v_x
};
Avg
<
x
,
decltype
(
v_y
),
FORWARD
>
avg_vy_f
{
v_y
};
Avg
<
y
,
decltype
(
v_x
),
FORWARD
>
avg_vx_f
{
v_x
};
//! \cond [def equation] \endcond
// velocity in the grid is the property 0, pressure is the property 1
constexpr
int
velocity
=
0
;
constexpr
int
pressure
=
1
;
...
...
@@ -324,27 +317,27 @@ int main(int argc, char* argv[])
//! \cond [impose eq dom] \endcond
fd
.
impose
(
ic_eq
(),
0.0
,
EQ_3
,
{
0
,
0
},{
sz
[
0
]
-
2
,
sz
[
1
]
-
2
}
,
true
);
fd
.
impose
(
Prs
(),
0.0
,
EQ_3
,
{
0
,
0
},{
0
,
0
}
);
fd
.
impose
<
EQ_3
>
(
ic_eq
,
0.0
,{
0
,
0
},{
sz
[
0
]
-
2
,
sz
[
1
]
-
2
},
cc
,
true
);
fd
.
impose
<
EQ_3
>
(
Prs
,
0.0
,{
0
,
0
},{
0
,
0
},
cc
);
// Here we impose the Eq1 and Eq2
fd
.
impose
(
vx_eq
(),
0.0
,
EQ_1
,
{
1
,
0
},{
sz
[
0
]
-
2
,
sz
[
1
]
-
2
}
);
fd
.
impose
(
vy_eq
(),
0.0
,
EQ_2
,
{
0
,
1
},{
sz
[
0
]
-
2
,
sz
[
1
]
-
2
}
);
fd
.
impose
<
EQ_1
>
(
vx_eq
,
0.0
,{
1
,
0
},{
sz
[
0
]
-
2
,
sz
[
1
]
-
2
},
ll
);
fd
.
impose
<
EQ_2
>
(
vy_eq
,
0.0
,{
0
,
1
},{
sz
[
0
]
-
2
,
sz
[
1
]
-
2
},
bb
);
// v_x and v_y
// Imposing B1
fd
.
impose
(
v_x
(),
0.0
,
EQ_1
,
{
0
,
0
},{
0
,
sz
[
1
]
-
2
}
);
fd
.
impose
(
avg_vy_f
(),
0.0
,
EQ_2
,
{
-
1
,
0
},{
-
1
,
sz
[
1
]
-
1
}
);
fd
.
impose
<
EQ_1
>
(
v_x
,
0.0
,{
0
,
0
},{
0
,
sz
[
1
]
-
2
},
ll
);
fd
.
impose
<
EQ_2
>
(
avg_vy_f
,
0.0
,{
-
1
,
0
},{
-
1
,
sz
[
1
]
-
1
},
bb
);
// Imposing B2
fd
.
impose
(
v_x
(),
0.0
,
EQ_1
,
{
sz
[
0
]
-
1
,
0
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
2
}
);
fd
.
impose
(
avg_vy
(),
1.0
,
EQ_2
,
{
sz
[
0
]
-
1
,
0
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
1
}
);
fd
.
impose
<
EQ_1
>
(
v_x
,
0.0
,{
sz
[
0
]
-
1
,
0
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
2
},
ll
);
fd
.
impose
<
EQ_2
>
(
avg_vy
,
1.0
,{
sz
[
0
]
-
1
,
0
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
1
},
bb
);
// Imposing B3
fd
.
impose
(
avg_vx_f
(),
0.0
,
EQ_1
,
{
0
,
-
1
},{
sz
[
0
]
-
1
,
-
1
}
);
fd
.
impose
(
v_y
(),
0.0
,
EQ_2
,
{
0
,
0
},{
sz
[
0
]
-
2
,
0
}
);
fd
.
impose
<
EQ_1
>
(
avg_vx_f
,
0.0
,{
0
,
-
1
},{
sz
[
0
]
-
1
,
-
1
},
ll
);
fd
.
impose
<
EQ_2
>
(
v_y
,
0.0
,{
0
,
0
},{
sz
[
0
]
-
2
,
0
},
bb
);
// Imposing B4
fd
.
impose
(
avg_vx
(),
0.0
,
EQ_1
,
{
0
,
sz
[
1
]
-
1
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
1
}
);
fd
.
impose
(
v_y
(),
0.0
,
EQ_2
,
{
0
,
sz
[
1
]
-
1
},{
sz
[
0
]
-
2
,
sz
[
1
]
-
1
}
);
fd
.
impose
<
EQ_1
>
(
avg_vx
,
0.0
,{
0
,
sz
[
1
]
-
1
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
1
},
ll
);
fd
.
impose
<
EQ_2
>
(
v_y
,
0.0
,{
0
,
sz
[
1
]
-
1
},{
sz
[
0
]
-
2
,
sz
[
1
]
-
1
},
bb
);
// When we pad the grid, there are points of the grid that are not
// touched by the previous condition. Mathematically this lead
...
...
@@ -353,14 +346,14 @@ int main(int argc, char* argv[])
//
// Padding pressure
fd
.
impose
(
Prs
(),
0.0
,
EQ_3
,
{
-
1
,
-
1
},{
sz
[
0
]
-
1
,
-
1
}
);
fd
.
impose
(
Prs
(),
0.0
,
EQ_3
,
{
-
1
,
sz
[
1
]
-
1
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
1
}
);
fd
.
impose
(
Prs
(),
0.0
,
EQ_3
,
{
-
1
,
0
},{
-
1
,
sz
[
1
]
-
2
}
);
fd
.
impose
(
Prs
(),
0.0
,
EQ_3
,
{
sz
[
0
]
-
1
,
0
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
2
}
);
fd
.
impose
<
EQ_3
>
(
Prs
,
0.0
,{
-
1
,
-
1
},{
sz
[
0
]
-
1
,
-
1
},
cc
);
fd
.
impose
<
EQ_3
>
(
Prs
,
0.0
,{
-
1
,
sz
[
1
]
-
1
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
1
},
cc
);
fd
.
impose
<
EQ_3
>
(
Prs
,
0.0
,{
-
1
,
0
},{
-
1
,
sz
[
1
]
-
2
},
cc
);
fd
.
impose
<
EQ_3
>
(
Prs
,
0.0
,{
sz
[
0
]
-
1
,
0
},{
sz
[
0
]
-
1
,
sz
[
1
]
-
2
},
cc
);
// Impose v_x Padding Impose v_y padding
fd
.
impose
(
v_x
(),
0.0
,
EQ_1
,
{
-
1
,
-
1
},{
-
1
,
sz
[
1
]
-
1
}
);
fd
.
impose
(
v_y
(),
0.0
,
EQ_2
,
{
-
1
,
-
1
},{
sz
[
0
]
-
1
,
-
1
}
);
fd
.
impose
<
EQ_1
>
(
v_x
,
0.0
,{
-
1
,
-
1
},{
-
1
,
sz
[
1
]
-
1
},
cc
);
fd
.
impose
<
EQ_2
>
(
v_y
,
0.0
,{
-
1
,
-
1
},{
sz
[
0
]
-
1
,
-
1
},
cc
);
//! \cond [impose eq dom] \endcond
...
...
openfpm_numerics
@
3017eaf9
Compare
761522af
...
3017eaf9
Subproject commit
761522af3952e282fc05ebefa7702bc9cf64e2a5
Subproject commit
3017eaf926c3b502f87873e26275c508277f5f2e
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment