Commit 7d116a64 authored by sniklas142's avatar sniklas142
Browse files

vorticity and velocity from ou can replace modes

parent 61f3bcc3
......@@ -177,9 +177,16 @@ void ornstein_uhlenbeck_process<rnumber, be>::let_converge(void)
template <class rnumber, field_backend be>
void ornstein_uhlenbeck_process<rnumber,be>::add_to_field_replace(
field<rnumber, be, THREE> *src)
field<rnumber, be, THREE> *src, std::string uv)
{
assert(src->real_space_representation==false);
assert((uv == "vorticity") || (uv == "velocity"));
field<rnumber, be, THREE> *field_to_replace;
if (uv == "vorticity") field_to_replace = this->ou_field_vort;
else field_to_replace = this->ou_field;
this->kk->CLOOP_K2(
[&](ptrdiff_t cindex,
ptrdiff_t xindex,
......@@ -193,7 +200,7 @@ void ornstein_uhlenbeck_process<rnumber,be>::add_to_field_replace(
for(int cc=0; cc < 3; cc++){
for(int imag=0; imag < 2; imag++){
tmp = this->ou_field->cval(cindex,cc,imag);
tmp = field_to_replace->cval(cindex,cc,imag);
src->cval(cindex,cc,imag) = tmp;
}
}
......
......@@ -60,7 +60,7 @@ class ornstein_uhlenbeck_process{
void add_to_field_sharp(
field<rnumber,be,THREE> *src);
void add_to_field_replace(
field<rnumber,be,THREE> *src);
field<rnumber,be,THREE> *src, std::string uv);
void calc_ou_vorticity(void);
......
......@@ -111,7 +111,7 @@ void ornstein_uhlenbeck_test<rnumber>::test_summation()
this->nx,this->ny,this->nz, MPI_COMM_WORLD, FFTW_ESTIMATE);
*test_f = 0.0;
test_f->dft();
this->ou->add_to_field_replace(test_f);
this->ou->add_to_field_replace(test_f, "velocity");
test_f->symmetrize();
test_f->ift();
test_f->io("add_ou_test_field.h5", "ou_field", 0, false);
......
......@@ -19,7 +19,7 @@ void ou_vorticity_equation<rnumber, be>::omega_nonlin(int src)
assert(src >= 0 && src < 3);
this->compute_velocity(this->v[src]);
this->add_ou_forcing();
this->add_ou_forcing_velocity();
// TIME STEP?!?!?!!?! TODO
/* get fields from Fourier space to real space */
......@@ -70,10 +70,18 @@ void ou_vorticity_equation<rnumber, be>::omega_nonlin(int src)
}
template <class rnumber, field_backend be>
void ou_vorticity_equation<rnumber, be>::add_ou_forcing()
void ou_vorticity_equation<rnumber, be>::add_ou_forcing_velocity()
{
if (this->ou_forcing_type == "replace"){
this->ou->add_to_field_replace(this->u);
this->ou->add_to_field_replace(this->u,"velocity");
}
}
template <class rnumber, field_backend be>
void ou_vorticity_equation<rnumber, be>::add_ou_forcing_vorticity()
{
if (this->ou_forcing_type == "replace"){
this->ou->add_to_field_replace(this->cvorticity,"vorticity");
}
}
......
......@@ -43,7 +43,8 @@ class ou_vorticity_equation : public vorticity_equation<rnumber, be>
void omega_nonlin(int src);
void add_ou_forcing(void);
void add_ou_forcing_velocity(void);
void add_ou_forcing_vorticity(void);
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment