mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
@ -107,7 +107,7 @@ Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
|
||||
forAll(alphaNames_, i)
|
||||
{
|
||||
dimensionedScalar aPhase("a", dimless/dimLength, aCoeff_[i]);
|
||||
a += max(alpha(alphaNames_[i]), 0.0)*aPhase;
|
||||
a += max(alpha(alphaNames_[i]), scalar(0))*aPhase;
|
||||
}
|
||||
|
||||
return ta;
|
||||
@ -140,7 +140,7 @@ Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
|
||||
forAll(alphaNames_, i)
|
||||
{
|
||||
dimensionedScalar ePhase("e", dimless/dimLength, eCoeff_[i]);
|
||||
e += max(alpha(alphaNames_[i]), 0.0)*ePhase;
|
||||
e += max(alpha(alphaNames_[i]), scalar(0))*ePhase;
|
||||
}
|
||||
|
||||
return te;
|
||||
@ -179,7 +179,7 @@ Foam::radiation::localDensityAbsorptionEmission::ECont(const label bandI) const
|
||||
ECoeff_[i]
|
||||
);
|
||||
|
||||
E += max(alpha(alphaNames_[i]), 0.0)*EPhase;
|
||||
E += max(alpha(alphaNames_[i]), scalar(0))*EPhase;
|
||||
}
|
||||
|
||||
return tE;
|
||||
|
||||
@ -139,7 +139,7 @@ bool Foam::functionObjects::vtkCloud::writeCloud
|
||||
label nTotParcels = pointsPtr->size();
|
||||
reduce(nTotParcels, sumOp<label>());
|
||||
|
||||
if (!nTotParcels)
|
||||
if (pruneEmpty_ && !nTotParcels)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -331,6 +331,7 @@ Foam::functionObjects::vtkCloud::vtkCloud
|
||||
writeOpts_(vtk::formatType::INLINE_BASE64),
|
||||
printf_(),
|
||||
useVerts_(false),
|
||||
pruneEmpty_(false),
|
||||
selectClouds_(),
|
||||
selectFields_(),
|
||||
dirName_("VTK"),
|
||||
@ -396,6 +397,7 @@ bool Foam::functionObjects::vtkCloud::read(const dictionary& dict)
|
||||
// useTimeName_ = dict.lookupOrDefault<bool>("useTimeName", false);
|
||||
|
||||
useVerts_ = dict.lookupOrDefault<bool>("cellData", false);
|
||||
pruneEmpty_ = dict.lookupOrDefault<bool>("prune", false);
|
||||
|
||||
|
||||
//
|
||||
|
||||
@ -59,6 +59,7 @@ Usage
|
||||
directory | The output directory name | no | VTK
|
||||
width | Padding width for file name | no | 8
|
||||
format | ascii or binary format | no | binary
|
||||
prune | suppress writing of empty clouds | no | false
|
||||
writePrecision | write precision in ascii | no | same as IOstream
|
||||
\endtable
|
||||
|
||||
@ -125,6 +126,9 @@ class vtkCloud
|
||||
//- Write lagrangian as cell data (verts) instead of point data
|
||||
bool useVerts_;
|
||||
|
||||
//- Suppress writing of empty clouds
|
||||
bool pruneEmpty_;
|
||||
|
||||
//- Requested names of clouds to process
|
||||
wordRes selectClouds_;
|
||||
|
||||
|
||||
@ -424,14 +424,18 @@ void Foam::particle::locate
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Put the particle at the cell centre and in a random tet
|
||||
coordinates_ = barycentric(1, 0, 0, 0);
|
||||
// Put the particle at (almost) the cell centre and in a random tet.
|
||||
// Note perturbing the cell centre to make sure we find at least one
|
||||
// tet containing it. With start point exactly at the cell centre very
|
||||
// occasionally it would not get found in any of the tets
|
||||
coordinates_ = barycentric(1-3*SMALL, SMALL, SMALL, SMALL);
|
||||
tetFacei_ = mesh_.cells()[celli_][0];
|
||||
tetPti_ = 1;
|
||||
facei_ = -1;
|
||||
|
||||
// Track to the injection point
|
||||
track(position - mesh_.cellCentres()[celli_], 0);
|
||||
track(position - this->position(), 0);
|
||||
|
||||
if (!onFace())
|
||||
{
|
||||
return;
|
||||
|
||||
@ -235,7 +235,14 @@ Foam::scalar Foam::faceAreaIntersect::triangleIntersect
|
||||
// Cut source triangle with all inward pointing faces of target triangle
|
||||
// - triangles in workTris1 are inside target triangle
|
||||
|
||||
const scalar t = sqrt(triArea(src));
|
||||
const scalar srcArea(triArea(src));
|
||||
if (srcArea < ROOTVSMALL)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// Typical length scale
|
||||
const scalar t = sqrt(srcArea);
|
||||
|
||||
// Edge 0
|
||||
{
|
||||
@ -243,10 +250,29 @@ Foam::scalar Foam::faceAreaIntersect::triangleIntersect
|
||||
// workTris1 list
|
||||
|
||||
scalar s = mag(tgt1 - tgt0);
|
||||
//plane pl0(tgt0, tgt1, tgt1 + s*n);
|
||||
plane pl0(tgt0, (tgt0 - tgt1)^(-s*n), true);
|
||||
if (s < ROOTVSMALL)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// Note: outer product with n pre-scaled with edge length. This is
|
||||
// purely to avoid numerical errors because of drastically
|
||||
// different vector lengths.
|
||||
const vector n0((tgt0 - tgt1)^(-s*n));
|
||||
const scalar magSqrN0(magSqr(n0));
|
||||
if (magSqrN0 < ROOTVSMALL)
|
||||
{
|
||||
// Triangle either zero edge length (s == 0) or
|
||||
// perpendicular to face normal n. In either case zero
|
||||
// overlap area
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
plane pl0(tgt0, n0/Foam::sqrt(magSqrN0), false);
|
||||
triSliceWithPlane(src, pl0, workTris1, nWorkTris1, t);
|
||||
}
|
||||
}
|
||||
|
||||
if (nWorkTris1 == 0)
|
||||
{
|
||||
@ -259,8 +285,23 @@ Foam::scalar Foam::faceAreaIntersect::triangleIntersect
|
||||
// workTris2 list (re-use tris storage)
|
||||
|
||||
scalar s = mag(tgt2 - tgt1);
|
||||
//plane pl1(tgt1, tgt2, tgt2 + s*n);
|
||||
plane pl1(tgt1, (tgt1 - tgt2)^(-s*n), true);
|
||||
if (s < ROOTVSMALL)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
const vector n1((tgt1 - tgt2)^(-s*n));
|
||||
const scalar magSqrN1(magSqr(n1));
|
||||
|
||||
if (magSqrN1 < ROOTVSMALL)
|
||||
{
|
||||
// Triangle either zero edge length (s == 0) or
|
||||
// perpendicular to face normal n. In either case zero
|
||||
// overlap area
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
plane pl1(tgt1, n1/Foam::sqrt(magSqrN1), false);
|
||||
|
||||
nWorkTris2 = 0;
|
||||
|
||||
@ -274,6 +315,7 @@ Foam::scalar Foam::faceAreaIntersect::triangleIntersect
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Edge 2
|
||||
{
|
||||
@ -281,8 +323,23 @@ Foam::scalar Foam::faceAreaIntersect::triangleIntersect
|
||||
// workTris1 list (re-use workTris1 storage)
|
||||
|
||||
scalar s = mag(tgt2 - tgt0);
|
||||
//plane pl2(tgt2, tgt0, tgt0 + s*n);
|
||||
plane pl2(tgt2, (tgt2 - tgt0)^(-s*n), true);
|
||||
if (s < ROOTVSMALL)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
const vector n2((tgt2 - tgt0)^(-s*n));
|
||||
const scalar magSqrN2(magSqr(n2));
|
||||
|
||||
if (magSqrN2 < ROOTVSMALL)
|
||||
{
|
||||
// Triangle either zero edge length (s == 0) or
|
||||
// perpendicular to face normal n. In either case zero
|
||||
// overlap area
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
plane pl2(tgt2, n2/Foam::sqrt(magSqrN2), false);
|
||||
|
||||
nWorkTris1 = 0;
|
||||
|
||||
@ -313,6 +370,7 @@ Foam::scalar Foam::faceAreaIntersect::triangleIntersect
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
19
tutorials/lagrangian/reactingParcelFoam/filter/Allrun-parallel
Executable file
19
tutorials/lagrangian/reactingParcelFoam/filter/Allrun-parallel
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||
|
||||
restore0Dir
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication topoSet
|
||||
|
||||
runApplication createBaffles -overwrite
|
||||
|
||||
runApplication decomposePar
|
||||
|
||||
runParallel $(getApplication)
|
||||
|
||||
runApplication reconstructPar
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -51,5 +51,9 @@ maxCo 1.0;
|
||||
|
||||
maxDeltaT 1;
|
||||
|
||||
functions
|
||||
{
|
||||
#include "vtkCloud"
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,9 +27,6 @@ preserveFaceZones
|
||||
coeffs
|
||||
{
|
||||
n (2 2 1);
|
||||
//delta 0.001; // default=0.001
|
||||
//order xyz; // default=xzy
|
||||
dataFile "";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
cloudWrite
|
||||
{
|
||||
type vtkCloud;
|
||||
libs ("liblagrangianFunctionObjects.so");
|
||||
log true;
|
||||
|
||||
writeControl writeTime;
|
||||
|
||||
// cloud reactingCloud1;
|
||||
clouds ( ".*" );
|
||||
|
||||
// Fields to output (words or regex)
|
||||
fields ( U T d "Y.*" );
|
||||
|
||||
//- Output format (ascii | binary) - default = binary
|
||||
// format binary;
|
||||
|
||||
// format ascii;
|
||||
// writePrecision 12;
|
||||
|
||||
//- Suppress writing of empty clouds - default = false
|
||||
// prune true;
|
||||
|
||||
//- Output directory name - default = "VTK"
|
||||
// directory "VTK";
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user