Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
63a73e75
Commit
63a73e75
authored
9 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
add utitility functions
parent
b90e0a5e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/fluid_solver.cpp
+33
-12
33 additions, 12 deletions
src/fluid_solver.cpp
src/fluid_solver.hpp
+4
-2
4 additions, 2 deletions
src/fluid_solver.hpp
with
37 additions
and
14 deletions
src/fluid_solver.cpp
+
33
−
12
View file @
63a73e75
...
...
@@ -171,27 +171,48 @@ fluid_solver<R>::~fluid_solver() \
} \
\
template<> \
void fluid_solver<R>::omega_nonlin( \
int src) \
void fluid_solver<R>::compute_vorticity() \
{ \
this->low_pass_Fourier(this->cu, 3, this->kM); \
CLOOP( \
this->cvorticity[cindex*3+0][0] = (this->ky[yindex]*this->cu[cindex*3+2][1] - this->kz[zindex]*this->cu[cindex*3+1][1]); \
this->cvorticity[cindex*3+1][0] = (this->kz[zindex]*this->cu[cindex*3+0][1] - this->kx[xindex]*this->cu[cindex*3+2][1]); \
this->cvorticity[cindex*3+2][0] = (this->kx[xindex]*this->cu[cindex*3+1][1] - this->ky[yindex]*this->cu[cindex*3+0][1]); \
this->cvorticity[cindex*3+0][1] = (this->ky[yindex]*this->cu[cindex*3+2][0] - this->kz[zindex]*this->cu[cindex*3+1][0]); \
this->cvorticity[cindex*3+1][1] = (this->kz[zindex]*this->cu[cindex*3+0][0] - this->kx[xindex]*this->cu[cindex*3+2][0]); \
this->cvorticity[cindex*3+2][1] = (this->kx[xindex]*this->cu[cindex*3+1][0] - this->ky[yindex]*this->cu[cindex*3+0][0]); \
); \
this->impose_zero_modes(); \
this->symmetrize(this->cvorticity, 3); \
} \
\
template<> \
void fluid_solver<R>::compute_velocity(C *vorticity) \
{ \
assert(src >= 0 && src < 3); \
double k2; \
/* compute velocity field */
\
this->low_pass_Fourier(this->cv[src], 3, this->kM); \
std::fill_n((R*)this->cu, this->cd->local_size*2, 0); \
this->low_pass_Fourier(vorticity, 3, this->kM); \
CLOOP( \
k2 = (this->kx[xindex]*this->kx[xindex] + \
this->ky[yindex]*this->ky[yindex] + \
this->kz[zindex]*this->kz[zindex]); \
this->cu[cindex*3+0][0] =
(
(this->ky[yindex]*
this->cv[src]
[cindex*3+2][1] - this->kz[zindex]*
this->cv[src]
[cindex*3+1][1]) / k2
)
; \
this->cu[cindex*3+1][0] =
(
(this->kz[zindex]*
this->cv[src]
[cindex*3+0][1] - this->kx[xindex]*
this->cv[src]
[cindex*3+2][1]) / k2
)
; \
this->cu[cindex*3+2][0] =
(
(this->kx[xindex]*
this->cv[src]
[cindex*3+1][1] - this->ky[yindex]*
this->cv[src]
[cindex*3+0][1]) / k2
)
; \
this->cu[cindex*3+0][1] =
(
(this->ky[yindex]*
this->cv[src]
[cindex*3+2][0] - this->kz[zindex]*
this->cv[src]
[cindex*3+1][0]) / k2
)
; \
this->cu[cindex*3+1][1] =
(
(this->kz[zindex]*
this->cv[src]
[cindex*3+0][0] - this->kx[xindex]*
this->cv[src]
[cindex*3+2][0]) / k2
)
; \
this->cu[cindex*3+2][1] =
(
(this->kx[xindex]*
this->cv[src]
[cindex*3+1][0] - this->ky[yindex]*
this->cv[src]
[cindex*3+0][0]) / k2
)
; \
this->cu[cindex*3+0][0] = (this->ky[yindex]*
vorticity
[cindex*3+2][1] - this->kz[zindex]*
vorticity
[cindex*3+1][1]) / k2; \
this->cu[cindex*3+1][0] = (this->kz[zindex]*
vorticity
[cindex*3+0][1] - this->kx[xindex]*
vorticity
[cindex*3+2][1]) / k2; \
this->cu[cindex*3+2][0] = (this->kx[xindex]*
vorticity
[cindex*3+1][1] - this->ky[yindex]*
vorticity
[cindex*3+0][1]) / k2; \
this->cu[cindex*3+0][1] = (this->ky[yindex]*
vorticity
[cindex*3+2][0] - this->kz[zindex]*
vorticity
[cindex*3+1][0]) / k2; \
this->cu[cindex*3+1][1] = (this->kz[zindex]*
vorticity
[cindex*3+0][0] - this->kx[xindex]*
vorticity
[cindex*3+2][0]) / k2; \
this->cu[cindex*3+2][1] = (this->kx[xindex]*
vorticity
[cindex*3+1][0] - this->ky[yindex]*
vorticity
[cindex*3+0][0]) / k2; \
); \
this->impose_zero_modes(); \
this->symmetrize(this->cu, 3); \
} \
\
template<> \
void fluid_solver<R>::omega_nonlin( \
int src) \
{ \
assert(src >= 0 && src < 3); \
/* compute velocity */
\
this->compute_velocity(this->cv[src]); \
/* get fields from Fourier space to real space */
\
FFTW(execute)(*((FFTW(plan)*)this->c2r_velocity )); \
FFTW(execute)(*((FFTW(plan)*)this->vc2r[src])); \
...
...
This diff is collapsed.
Click to expand it.
src/fluid_solver.hpp
+
4
−
2
View file @
63a73e75
...
...
@@ -70,11 +70,13 @@ class fluid_solver:public fluid_solver_base<rnumber>
double
DKX
=
1.0
,
double
DKY
=
1.0
,
double
DKZ
=
1.0
);
~
fluid_solver
();
~
fluid_solver
(
void
);
void
compute_vorticity
(
void
);
void
compute_velocity
(
rnumber
(
*
vorticity
)[
2
]);
void
omega_nonlin
(
int
src
);
void
step
(
double
dt
);
void
impose_zero_modes
();
void
impose_zero_modes
(
void
);
};
#endif//FLUID_SOLVER
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment