[asl] 103/177: Fixing LBGK BC bug
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Aug 27 09:22:45 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository asl.
commit 4f66e69802fdc5ce121c918ac79b872284569701
Author: Avtech Scientific <AvtechScientific at users.noreply.github.com>
Date: Mon Jul 20 13:57:27 2015 +0300
Fixing LBGK BC bug
---
examples/flow/locomotive_in_tunnel.cc | 8 ++---
examples/flow/locomotive_stability.cc | 2 +-
src/num/aslLBGKBC.cxx | 66 +++++++++++++++++++++++++----------
3 files changed, 53 insertions(+), 23 deletions(-)
diff --git a/examples/flow/locomotive_in_tunnel.cc b/examples/flow/locomotive_in_tunnel.cc
index 35e4bc5..b0d687e 100644
--- a/examples/flow/locomotive_in_tunnel.cc
+++ b/examples/flow/locomotive_in_tunnel.cc
@@ -99,8 +99,8 @@ int main(int argc, char* argv[])
it is recommended to use the notation of the Boost::Units library). */
asl::Parameter<FlT> dx(0.08, "dx", "space step", "m");
asl::Parameter<FlT> dt(1., "dt", "time step", "s");
- asl::Parameter<FlT> nu(.001, "nu", "kinematic viscosity", "m^2 s^-1");
- asl::Parameter<unsigned int> iterations(20001, "iterations number", "");
+ asl::Parameter<FlT> nu(.001, "nu", "kinematic viscosity", "m^2/s");
+ asl::Parameter<unsigned int> iterations(20001, "iterations", "iterations number");
/* Load previously declared Parameters from command line and/or
parameters file. Use default values if neither is provided. */
@@ -117,7 +117,7 @@ int main(int argc, char* argv[])
// Define dimensionless viscosity value
FlT nuNum(nu.v() * dt.v() / dx.v() / dx.v());
- cout << "Data initialization..." << endl;
+ cout << "Data initialization... " << flush;
// Read geometry of the locomotive from the file
auto locomotive(asl::readSurface("locomotive.stl", bl));
@@ -137,7 +137,7 @@ int main(int argc, char* argv[])
cout << "Finished" << endl;
- cout << "Numerics initialization..." << endl;
+ cout << "Numerics initialization... " << flush;
// NOTE: the problem is considered in the reference frame related to the locomotive
diff --git a/examples/flow/locomotive_stability.cc b/examples/flow/locomotive_stability.cc
index 55b688e..53aca08 100644
--- a/examples/flow/locomotive_stability.cc
+++ b/examples/flow/locomotive_stability.cc
@@ -130,7 +130,7 @@ int main(int argc, char* argv[])
std::cout << "Finished" << endl;
- std::cout << "Computing...";
+ std::cout << "Computing..." << endl;
asl::WriterVTKXML writer("locomotive_stability");
writer.addScalars("train", *object);
diff --git a/src/num/aslLBGKBC.cxx b/src/num/aslLBGKBC.cxx
index 834e458..99594c4 100644
--- a/src/num/aslLBGKBC.cxx
+++ b/src/num/aslLBGKBC.cxx
@@ -59,6 +59,7 @@ namespace asl
kernels[i].reset(new acl::Kernel(acl::KERNEL_BASIC));
}
+
void BCLBGKCommon::sortDirections()
{
sortTwoVectors(directions, indices);
@@ -74,7 +75,8 @@ namespace asl
directionGroupsSizes[i]=directionGroupsSizes[i]<0 ? 0 : directionGroupsSizes[i];
}
}
-
+
+
void BCLBGKCommon::execute()
{
km->compute();
@@ -84,7 +86,8 @@ namespace asl
BCNoSlip::BCNoSlip(SPLBGK nm):
BCLBGKCommon(nm)
{}
-
+
+
void BCNoSlip::init()
{
@@ -109,6 +112,7 @@ namespace asl
km->setup();
}
+
BCConstantPressure::BCConstantPressure(SPLBGK nm, const acl::VectorOfElements & p):
BCLBGKCommon(nm),
pressure(p)
@@ -234,7 +238,7 @@ namespace asl
auto vGhost(subVE(fX->getEContainer(), i));
int directionShift(block.c2i(templ->vectors[i]));
- auto vBulk(subVE(num->getF()->getEContainer(),
+ auto vBulk(subVE(fX->getEContainer(),
templ->invertVectors[i]));
vBulk[0] = acl::generateShiftedElement(vBulk[0],directionShift);
kk << (acl::assignmentSafe(vGhost, select(vGhost, vBulk, isBoundary, type)));
@@ -312,7 +316,7 @@ namespace asl
{
kk << (isBoundary = isComputationNode(i) );
int directionShift(block.c2i(templ->vectors[i]));
- auto vBulk(subVE(num->getF()->getEContainer(),
+ auto vBulk(subVE(fX->getEContainer(),
templ->invertVectors[i]));
vBulk[0] = acl::generateShiftedElement(vBulk[0],directionShift);
auto w(templ->quasiparticlesCoefs[i]);
@@ -480,7 +484,7 @@ namespace asl
{
kk << (isBoundary = isComputationNode(i) );
int directionShift(block.c2i(templ->vectors[i]));
- auto vBulk(subVE(num->getF()->getEContainer(),
+ auto vBulk(subVE(fX->getEContainer(),
templ->invertVectors[i]));
vBulk[0] = acl::generateShiftedElement(vBulk[0],directionShift);
auto w(templ->quasiparticlesCoefs[i]);
@@ -564,7 +568,7 @@ namespace asl
{
kk << (isBoundary = isComputationNode(i) );
int directionShift(block.c2i(templ->vectors[i]));
- auto vBulk(subVE(num->getF()->getEContainer(),
+ auto vBulk(subVE(fX->getEContainer(),
templ->invertVectors[i]));
vBulk[0] = acl::generateShiftedElement(vBulk[0],directionShift);
auto w(templ->quasiparticlesCoefs[i]);
@@ -604,7 +608,7 @@ namespace asl
SPDataWithGhostNodesACLData fF,
SPAbstractDataWithGhostNodes map):
BCondWithMap(map,nm->vectorTemplate),
-// kernel(new acl::Kernel(acl::KERNEL_SIMDUA)),//< Important _BASIC has better performance
+// kernel(new acl::Kernel(acl::KERNEL_SIMDUA)), //< Important _BASIC has better performance
kernel(new acl::Kernel(acl::KERNEL_BASIC)),
num(nm),
fluxField(fF)
@@ -634,7 +638,7 @@ namespace asl
unsigned int nDir(templ->vectors.size());
auto & block(fX->getBlock());
- kk<< (flux = acl::generateVEConstant(0));
+ kk << (flux = acl::generateVEConstant(0));
for(unsigned int i(1); i < nDir; ++i)
{
kk << (isBoundary0 = isGhostNode(0) && isComputationNode(i) );
@@ -642,7 +646,7 @@ namespace asl
auto f0(subVE(fX->getEContainer(), i));
int directionShift(block.c2i(templ->vectors[i]));
- auto fI(subVE(num->getF()->getEContainer(),
+ auto fI(subVE(fX->getEContainer(),
templ->invertVectors[i]));
fI[0] = acl::generateShiftedElement(fI[0],directionShift);
@@ -664,7 +668,9 @@ namespace asl
void ComputeSurfaceFluxMap::execute()
{
kernel->compute();
- }
+ }
+
+
ComputeSurfaceForceMap::ComputeSurfaceForceMap(SPLBGK nm,
SPDataWithGhostNodesACLData fF,
SPAbstractDataWithGhostNodes map):
@@ -676,6 +682,7 @@ namespace asl
{
}
+
ComputeSurfaceForceMap::~ComputeSurfaceForceMap()
{
}
@@ -710,7 +717,7 @@ namespace asl
auto f0(subVE(fX->getEContainer(), i));
int directionShift(block.c2i(templ->vectors[i]));
- auto fI(subVE(num->getF()->getEContainer(),
+ auto fI(subVE(fX->getEContainer(),
templ->invertVectors[i]));
fI[0] = acl::generateShiftedElement(fI[0],directionShift);
auto wc((templ->quasiparticlesCoefs[i]*AVec<double>(templ->vectors[i])));
@@ -741,8 +748,20 @@ namespace asl
auto bc(make_shared<BCNoSlip>(nm));
addSlices(*bc, sl);
return bc;
+ }
+
+/*
+ SPBCond generateBCNoSlipVel(SPLBGK nm,
+ const std::vector<SlicesNames> & sl)
+ {
+ unsigned int nd(nD(nm->getVectorTemplate()->vectors[0]));
+ return generateBCConstantValueMiddlePoint(nm->getVelocity(),
+ AVec<double>(nd,0.),
+ sl,
+ nearestNeigboursVT(nd));
}
+*/
SPBCond generateBCConstantVelocity(SPLBGK nm,
AVec<> v,
@@ -754,6 +773,7 @@ namespace asl
}
+
SPBCond generateBCConstantPressure(SPLBGK nm,
double p,
const std::vector<SlicesNames> & sl)
@@ -764,6 +784,7 @@ namespace asl
}
+
SPBCond generateBCConstantPressureVelocity(SPLBGK nm,
double p,
AVec<> v,
@@ -775,13 +796,15 @@ namespace asl
addSlices(*bc, sl);
return bc;
}
-
+
+
SPNumMethod generateBCNoSlip(SPLBGK nm,
SPAbstractDataWithGhostNodes map)
{
return make_shared<BCNoSlipMap>(nm,map);
}
+
SPNumMethod generateBCNoSlipVel(SPLBGK nm,
SPAbstractDataWithGhostNodes map)
{
@@ -792,6 +815,7 @@ namespace asl
nm->vectorTemplate);
}
+
SPNumMethod generateBCNoSlipRho(SPLBGK nm,
SPAbstractDataWithGhostNodes map)
{
@@ -801,7 +825,8 @@ namespace asl
map,
nm->vectorTemplate);
}
-
+
+
SPNumMethod generateBCVelocity(SPLBGK nm,
SPPositionFunction v,
SPAbstractDataWithGhostNodes map)
@@ -809,6 +834,7 @@ namespace asl
return make_shared<BCVelocityMap>(nm,v,map);
}
+
SPNumMethod generateBCVelocity(SPLBGK nm,
SPPositionFunction v,
SPAbstractDataWithGhostNodes map,
@@ -816,14 +842,16 @@ namespace asl
{
return make_shared<BCVelocityMap>(nm,v,map,computationalDomain);
}
-
+
+
SPNumMethod generateBCVelocityVel(SPLBGK nm,
SPPositionFunction v,
SPAbstractDataWithGhostNodes map)
{
return generateBCConstantValue(nm->getVelocity(), v, map);
}
-
+
+
SPNumMethod generateBCConstantPressure(SPLBGK nm,
double p,
SPAbstractDataWithGhostNodes map)
@@ -833,6 +861,7 @@ namespace asl
}
+
SPNumMethod generateBCConstantPressureVelocity(SPLBGK nm,
double p,
AVec<> v,
@@ -845,6 +874,7 @@ namespace asl
return bc;
}
+
SPNumMethod generateBCTransportLimitedDeposition(SPLBGK nm,
double p0,
double limitingFactor,
@@ -857,6 +887,7 @@ namespace asl
return bc;
}
+
SPNumMethod generateBCKineticsLimitedDeposition(SPLBGK nm,
double p0,
double limitingFactor,
@@ -880,6 +911,7 @@ namespace asl
return a;
}
+
SPNumMethod generateComputeSurfaceForce(SPLBGK nm,
SPDataWithGhostNodesACLData fF,
SPAbstractDataWithGhostNodes map)
@@ -887,7 +919,5 @@ namespace asl
auto a(make_shared<ComputeSurfaceForceMap>(nm, fF, map));
return a;
}
-
-
-} // asl
+} // asl
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/asl.git
More information about the debian-science-commits
mailing list