diff options
Initialize at openlb-1-3
Diffstat (limited to 'src/particles/forces')
46 files changed, 3044 insertions, 0 deletions
diff --git a/src/particles/forces/MakeHeader b/src/particles/forces/MakeHeader new file mode 100644 index 0000000..96b8e6b --- /dev/null +++ b/src/particles/forces/MakeHeader @@ -0,0 +1,36 @@ +# This file is part of the OpenLB library +# +# Copyright (C) 2007 Mathias Krause +# E-mail contact: info@openlb.net +# The most recent release of OpenLB can be downloaded at +# <http://www.openlb.net/> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + + +generic := + +precompiled := force3D \ + stokesDragForce3D \ + weightForce3D \ + buoyancyForce3D \ + hertzMindlinDeresiewicz3D \ + transferExternalForce3D \ + magneticForceFromHField3D \ + linearDampingForceForMagDipoleMoment3D \ + magneticForceForMagP3D \ + interpMagForceForMagP3D + diff --git a/src/particles/forces/buoyancyForce3D.cpp b/src/particles/forces/buoyancyForce3D.cpp new file mode 100644 index 0000000..450597a --- /dev/null +++ b/src/particles/forces/buoyancyForce3D.cpp @@ -0,0 +1,35 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2016 Mathias J. Krause, Marie-Luise Maier + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "dynamics/latticeDescriptors.h" + +#include "particles/particle3D.h" +#include "particles/particle3D.hh" +#include "buoyancyForce3D.h" +#include "buoyancyForce3D.hh" + +namespace olb { + +template class BuoyancyForce3D<double,Particle3D,descriptors::D3Q19<>>; + +} // namespace olb diff --git a/src/particles/forces/buoyancyForce3D.h b/src/particles/forces/buoyancyForce3D.h new file mode 100644 index 0000000..27bb41a --- /dev/null +++ b/src/particles/forces/buoyancyForce3D.h @@ -0,0 +1,58 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2013 Thomas Henn, Mathias J. Krause + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef BUOYANCYFORCE3D_H_ +#define BUOYANCYFORCE3D_H_ + +#include "particles/particleSystem3D.h" +#include "forces.h" +#include "core/unitConverter.h" +//#include "../../functors/superLatticeLocalF3D.h" + + +namespace olb { + +template<typename T, template<typename U> class PARTICLETYPE> +class ParticleSystem3D; + +template<typename T, template<typename U> class PARTICLETYPE, typename DESCRIPTOR> +class BuoyancyForce3D: public Force3D<T, PARTICLETYPE> { + +public: + BuoyancyForce3D(UnitConverter<T,DESCRIPTOR> const& converter, std::vector<T> direction, + T g = 9.81); + ~BuoyancyForce3D() override { }; + void applyForce(typename std::deque<PARTICLETYPE<T> >::iterator p, int pInt, + ParticleSystem3D<T, PARTICLETYPE>& psSys) override; + +// void computeForce(int pInt, ParticleSystem3D<T, PARTICLETYPE>* psSys, +// T force[3]); +private: + std::vector<T> _direction; + T _g; + T _physDensity; +}; + +} + +#endif /* BUOYANCYFORCE3D_H_ */ diff --git a/src/particles/forces/buoyancyForce3D.hh b/src/particles/forces/buoyancyForce3D.hh new file mode 100644 index 0000000..b05dada --- /dev/null +++ b/src/particles/forces/buoyancyForce3D.hh @@ -0,0 +1,67 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2016 Thomas Henn + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef BUOYANCYFORCE_3D_HH +#define BUOYANCYFORCE_3D_HH + +#include <cmath> +#include "buoyancyForce3D.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +namespace olb { + +template<typename T, template<typename U> class PARTICLETYPE, typename DESCRIPTOR> +BuoyancyForce3D<T, PARTICLETYPE, DESCRIPTOR>::BuoyancyForce3D( + UnitConverter<T,DESCRIPTOR> const& converter, + std::vector<T> direction, T g) : + Force3D<T, PARTICLETYPE>(), + _direction(direction), _g(g), _physDensity(converter.getPhysDensity() ) +{ + T directionNorm = sqrt( + pow(_direction[0], 2.) + pow(_direction[1], 2.) + + pow(_direction[2], 2.)); + for (int i = 0; i < 3; ++i) { + _direction[i] /= directionNorm; + } +} + +template<typename T, template<typename U> class PARTICLETYPE, typename DESCRIPTOR> +void BuoyancyForce3D<T, PARTICLETYPE, DESCRIPTOR>::applyForce( + typename std::deque<PARTICLETYPE<T> >::iterator p, int pInt, + ParticleSystem3D<T, PARTICLETYPE>& psSys) +{ + // weight force of fluid in similar volume like particle that replaces the fluid + // acts in direction opposite to weight force of particle + + T factor = 4. / 3. * M_PI * std::pow(p->getRad(), 3) * _g + * _physDensity; + for (int j = 0; j < 3; ++j) { + p->getForce()[j] -= factor * _direction[j]; + } +} + +} +#endif /* BUOYANCYFORCE_3D_HH */ diff --git a/src/particles/forces/force3D.cpp b/src/particles/forces/force3D.cpp new file mode 100644 index 0000000..e716730 --- /dev/null +++ b/src/particles/forces/force3D.cpp @@ -0,0 +1,34 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2016 Mathias J. Krause, Marie-Luise Maier + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include"particles/particle3D.h" +#include"particles/particle3D.hh" +#include"force3D.h" +#include"force3D.hh" + +namespace olb { + +template class Force3D<double,Particle3D>; +template class Force3D<double,MagneticParticle3D>; + +} // namespace olb diff --git a/src/particles/forces/force3D.h b/src/particles/forces/force3D.h new file mode 100644 index 0000000..4073363 --- /dev/null +++ b/src/particles/forces/force3D.h @@ -0,0 +1,58 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2016 Thomas Henn + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + + +#ifndef FORCE_3D_H +#define FORCE_3D_H + +#include <deque> +#include "io/ostreamManager.h" +#include "particles/particleSystem3D.h" + +namespace olb { + +template<typename T, template<typename U> class PARTICLETYPE> +class ParticleSystem3D; + + +/** + * Prototype for all particle forces + */ + +template<typename T, template<typename U> class PARTICLETYPE> +class Force3D { +public: + Force3D(); + Force3D(Force3D<T, PARTICLETYPE>&); + Force3D(const Force3D<T, PARTICLETYPE>&); + + virtual ~Force3D() {}; + virtual void applyForce(typename std::deque<PARTICLETYPE<T> >::iterator p, int pInt, ParticleSystem3D<T, PARTICLETYPE>& psSys)=0; + +protected: + mutable OstreamManager clout; + +}; + +} +#endif /* FORCE3D_H */ diff --git a/src/particles/forces/force3D.hh b/src/particles/forces/force3D.hh new file mode 100644 index 0000000..0e27d25 --- /dev/null +++ b/src/particles/forces/force3D.hh @@ -0,0 +1,50 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2016 Thomas Henn + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + + +#ifndef FORCE_3D_HH +#define FORCE_3D_HH + +#include "force3D.h" + +namespace olb { + +template<typename T, template<typename U> class PARTICLETYPE> +Force3D<T, PARTICLETYPE>::Force3D(Force3D<T, PARTICLETYPE>& f) : + clout(f.clout) +{ +} + +template<typename T, template<typename U> class PARTICLETYPE> +Force3D<T, PARTICLETYPE>::Force3D(const Force3D<T, PARTICLETYPE>& f) : + clout(f.clout) +{ +} + +template<typename T, template<typename U> class PARTICLETYPE> +Force3D<T, PARTICLETYPE>::Force3D(): clout(std::cout,"Force3D") +{ +} + +} +#endif /* FORCE3D_HH */ diff --git a/src/particles/forces/forceFromExtField3D.cpp b/src/particles/forces/forceFromExtField3D.cpp new file mode 100644 index 0000000..7bd7d20 --- /dev/null +++ b/src/particles/forces/forceFromExtField3D.cpp @@ -0,0 +1,35 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2018 Marie-Luise Maier + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "dynamics/latticeDescriptors.h" + +#include "particles/particle3D.h" +#include "particles/particle3D.hh" +#include "forceFromExtField3D.h" +#include "forceFromExtField3D.hh" + +namespace olb { + +template class ForceFromExtField3D<double, Particle3D, descriptors::D3Q19<>>; + +} // namespace olb diff --git a/src/particles/forces/forceFromExtField3D.h b/src/particles/forces/forceFromExtField3D.h new file mode 100755 index 0000000..20cbaa6 --- /dev/null +++ b/src/particles/forces/forceFromExtField3D.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2018 Marie-Luise Maier + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef ForceFromExtField3D_H +#define ForceFromExtField3D_H + +#include "functors/lattice/superLatticeLocalF3D.h" +#include "particles/particleSystem3D.h" +#include "force3D.h" + +namespace olb { + +template<typename T, template<typename U> class PARTICLETYPE> +class ParticleSystem3D; + +template<typename T, template<typename U> class PARTICLETYPE, typename DESCRIPTOR> +class ForceFromExtField3D: public Force3D<T, PARTICLETYPE> { + +public: + // todo rename in ForceFromFunction3D or create new force + ForceFromExtField3D( +// SuperLattice3D<T, DESCRIPTOR>& sLattice, + //SuperLatticeField3D<T, DESCRIPTOR>& sLatticeForceField, + AnalyticalFfromSuperF3D<T>& analyticalExternalField, + T scale = T(1.) ); + ~ForceFromExtField3D() override {}; + void applyForce(typename std::deque<PARTICLETYPE<T> >::iterator p, int pInt, + ParticleSystem3D<T, PARTICLETYPE>& psSys) override; +private: +// SuperLattice3D<T, DESCRIPTOR>& _sLattice; +// SuperLatticeField3D<T, DESCRIPTOR>& _sLatticeForceField; + AnalyticalFfromSuperF3D<T>& _analyticalExternalField; + T _scale; +}; + +} + +#endif diff --git a/src/particles/forces/forceFromExtField3D.hh b/src/particles/forces/forceFromExtField3D.hh new file mode 100755 index 0000000..1f9c567 --- /dev/null +++ b/src/particles/forces/forceFromExtField3D.hh @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2018 Marie-Luise Maier + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef ForceFromExtField3D_HH +#define ForceFromExtField3D_HH + +#include "forceFromExtField3D.h" + +namespace olb { + +template<typename T, template<typename U> class PARTICLETYPE, typename DESCRIPTOR> +ForceFromExtField3D<T, PARTICLETYPE, DESCRIPTOR>::ForceFromExtField3D( +// SuperLattice3D<T, DESCRIPTOR>& sLattice, + // SuperLatticeField3D<T, DESCRIPTOR>& sLatticeForceField, + AnalyticalFfromSuperF3D<T>& analyticalExternalField, + T scale) : + Force3D<T, PARTICLETYPE>(), +// _sLattice(sLattice), + //_sLatticeForceField(sLatticeForceField), + _analyticalExternalField(analyticalExternalField), + _scale(scale) +{ } + +template<typename T, template<typename U> class PARTICLETYPE, typename DESCRIPTOR> +void ForceFromExtField3D<T, PARTICLETYPE, DESCRIPTOR>::applyForce( + typename std::deque<PARTICLETYPE<T> >::iterator p, int pInt, + ParticleSystem3D<T, PARTICLETYPE>& pSys) { + +// int glob = p->getCuboid(); +// int latticePos[3] = { 0, 0, 0 }; +// +// _sLattice.getCuboidGeometry().get(p->getCuboid()).getLatticeR(latticePos, +// &p->getPos()[0]); +// +// int X[4] = { glob, latticePos[0], latticePos[1], latticePos[2] }; +// + T F[3] = { T(), T(), T() }; +// _sLatticeForceField(F, X); + + _analyticalExternalField(F, &p->getPos()[0]); + p->getForce()[0] += F[0] * _scale; + p->getForce()[1] += F[1] * _scale; + p->getForce()[2] += F[2] * _scale; +} + +} +#endif diff --git a/src/particles/forces/forces.h b/src/particles/forces/forces.h new file mode 100644 index 0000000..e84d830 --- /dev/null +++ b/src/particles/forces/forces.h @@ -0,0 +1,42 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2016 Thomas Henn, Mathias J. Krause + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +/** \file + * Groups all the include .h-files for 3D particles forces in + * the particles forces directory. + */ + +#include "force3D.h" +#include "stokesDragForce3D.h" +#include "weightForce3D.h" +#include "buoyancyForce3D.h" +#include "hertzMindlinDeresiewicz3D.h" +#include "transferExternalForce3D.h" +#include "interpMagForceForMagP3D.h" +#include "magneticForceForMagP3D.h" +#include "linearDampingForceForMagDipoleMoment3D.h" +#include "stokesDragForceForHomVelField3D.h" +#include "magneticForceFromHField3D.h" +#include "forceFromExtField3D.h" + + diff --git a/src/particles/forces/forces.hh b/src/particles/forces/forces.hh new file mode 100644 index 0000000..52c0b90 --- /dev/null +++ b/src/particles/forces/forces.hh @@ -0,0 +1,40 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2016 Thomas Henn, Mathias J. Krause + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * <http://www.openlb.net/> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without |