VirtualFluids
0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
ChangeRandomQs.hpp
Go to the documentation of this file.
1
//=======================================================================================
2
// ____ ____ __ ______ __________ __ __ __ __
3
// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4
// \ \ | | | | | |_) | | | | | | | / \ | |
5
// \ \ | | | | | _ / | | | | | | / /\ \ | |
6
// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7
// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8
// \ \ | | ________________________________________________________________
9
// \ \ | | | ______________________________________________________________|
10
// \ \| | | | __ __ __ __ ______ _______
11
// \ | | |_____ | | | | | | | | | _ \ / _____)
12
// \ | | _____| | | | | | | | | | | \ \ \_______
13
// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14
// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15
//
16
// This file is part of VirtualFluids. VirtualFluids is free software: you can
17
// redistribute it and/or modify it under the terms of the GNU General Public
18
// License as published by the Free Software Foundation, either version 3 of
19
// the License, or (at your option) any later version.
20
//
21
// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24
// for more details.
25
//
26
// SPDX-License-Identifier: GPL-3.0-or-later
27
// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28
//
33
//=======================================================================================
34
35
#ifndef ChangeRandomQs_h__
36
#define ChangeRandomQs_h__
37
38
#include "
LBMKernel.h
"
39
#include "
IntegrateValuesHelper.h
"
40
#include "BoundaryConditions.h"
41
#include "
BCArray3D.h
"
42
#include "
BCSet.h
"
43
44
namespace
utilities
45
{
46
void
ChangeRandomQs
(
SPtr<IntegrateValuesHelper>
integrateValues)
47
{
48
std::vector<IntegrateValuesHelper::CalcNodes> cnodes = integrateValues->getCNodes();
49
50
for
(
IntegrateValuesHelper::CalcNodes
cn
: cnodes)
51
{
52
SPtr<LBMKernel>
kernel =
cn
.block->getKernel();
53
SPtr<BCArray3D>
bcArray = kernel->getBCSet()->getBCArray();
54
for
(
UbTupleInt3
node :
cn
.nodes)
55
{
56
SPtr<BoundaryConditions>
bc = bcArray->getBC(
val<1>
(node),
val<2>
(node),
val<3>
(node));
57
if
(bc)
58
{
59
for
(
int
fdir
=d3q27_system::FSTARTDIR;
fdir
<=d3q27_system::FENDDIR;
fdir
++)
60
{
61
if
(bc->hasNoSlipBoundaryFlag(
fdir
))
62
{
63
const
int
invDir
=
d3q27_system::INVDIR
[
fdir
];
64
float
q = bc->getQ(
invDir
);
65
//double r = (double)UbRandom::rand(-50, 50);
66
float
r
= (
float
)
UbRandom::rand
(-10, 10);
67
float
q_temp
= q + q/
r
;
68
if
(
q_temp
< 0.0)
69
{
70
q_temp
= 0.0001f;
71
}
72
else
if
(
q_temp
> 1.0)
73
{
74
q_temp
= 0.9999f;
75
}
76
bc->setQ(
q_temp
,
fdir
);
77
}
78
}
79
}
80
}
81
}
82
}
83
84
}
85
#endif
// ChangeRandomQs_h__
86
BCArray3D.h
BCSet.h
IntegrateValuesHelper.h
LBMKernel.h
UbRandom::rand
static int rand(const int &min, const int &max)
Definition
UbRandom.h:72
UbTuple< int, int, int >
SPtr
std::shared_ptr< T > SPtr
Definition
PointerDefinitions.h:39
d3q27_system::INVDIR
const int INVDIR[]
Definition
D3Q27System.cpp:54
utilities
Definition
ChangeRandomQs.hpp:45
utilities::ChangeRandomQs
void ChangeRandomQs(SPtr< IntegrateValuesHelper > integrateValues)
Definition
ChangeRandomQs.hpp:46
IntegrateValuesHelper::CalcNodes
Definition
IntegrateValuesHelper.h:61
src
cpu
core
Utilities
ChangeRandomQs.hpp
Generated on Wed Nov 18 2026 00:03:21 for VirtualFluids by
1.9.8