51 #if !defined(KRATOS_MOVE_PART_UTILITY_FLUID_ONLY_DIFF2_INCLUDED )
52 #define KRATOS_MOVE_PART_UTILITY_FLUID_ONLY_DIFF2_INCLUDED
77 #include "utilities/geometry_utilities.h"
103 template<
unsigned int TDim>
167 KRATOS_WATCH(
"Gathering Information From Topographic Domain ")
169 double delta_t = CurrentProcessInfo[DELTA_TIME];
172 const unsigned int max_results = 1000;
180 vector<unsigned int> node_partition;
182 int number_of_threads = omp_get_max_threads();
184 int number_of_threads = 1;
189 #pragma omp parallel for
190 for(
int kkk=0; kkk<number_of_threads; kkk++)
196 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
198 if ( (results.size()) !=max_results)
199 results.resize(max_results);
202 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
203 Element::Pointer pelement(*ielem.base());
207 int & number_of_particles_in_elem=ielem->GetValue(NUMBER_OF_PARTICLES);
211 is_found =
FindNodeOnMesh(position,
N ,pelement,result_begin,MaxNumberOfResults);
242 array_1d<double,3>& position,
243 array_1d<double,TDim+1>&
N,
245 Element::Pointer & pelement,
247 const unsigned int MaxNumberOfResults)
251 const array_1d<double,3>& coords = position;
252 array_1d<double,TDim+1> aux_N;
256 Geometry<Node >& geom_default = pelement->GetGeometry();
258 if(is_found_1 ==
true)
290 for (
unsigned int i=0;
i!=(neighb_elems.
size());
i++)
292 if(neighb_elems(
i).get()!=
nullptr)
294 Geometry<Node >& geom = neighb_elems[
i].GetGeometry();
298 pelement=Element::Pointer(((neighb_elems(
i))));
315 Geometry<Node >& geom = (*(result_begin+
i))->GetGeometry();
328 pelement=Element::Pointer((*(result_begin+
i).base()));
344 const double xc,
const double yc,
const double zc,
348 double x0 = geom[0].X();
349 double y0 = geom[0].Y();
350 double x1 = geom[1].X();
351 double y1 = geom[1].Y();
352 double x2 = geom[2].X();
353 double y2 = geom[2].Y();
356 double inv_area = 0.0;
362 inv_area = 1.0 / area;
371 if (
N[0] >= 0.0 &&
N[1] >= 0.0 &&
N[2] >= 0.0 &&
N[0] <= 1.0 &&
N[1] <= 1.0 &&
N[2] <= 1.0)
381 const double xc,
const double yc,
const double zc,
386 double x0 = geom[0].X();
387 double y0 = geom[0].Y();
388 double z0 = geom[0].Z();
389 double x1 = geom[1].X();
390 double y1 = geom[1].Y();
391 double z1 = geom[1].Z();
392 double x2 = geom[2].X();
393 double y2 = geom[2].Y();
394 double z2 = geom[2].Z();
395 double x3 = geom[3].X();
396 double y3 = geom[3].Y();
397 double z3 = geom[3].Z();
399 double vol =
CalculateVol(x0, y0, z0,
x1, y1, z1,
x2, y2, z2, x3, y3, z3);
401 double inv_vol = 0.0;
402 if (vol < 0.0000000000001)
410 N[0] =
CalculateVol(
x1, y1, z1, x3, y3, z3,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
411 N[1] =
CalculateVol(x0, y0, z0,
x1, y1, z1,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
412 N[2] =
CalculateVol(x3, y3, z3,
x1, y1, z1, x0, y0, z0,
xc,
yc, zc) * inv_vol;
413 N[3] =
CalculateVol(x3, y3, z3, x0, y0, z0,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
416 if (
N[0] >= 0.0 &&
N[1] >= 0.0 &&
N[2] >= 0.0 &&
N[3] >= 0.0 &&
417 N[0] <= 1.0 &&
N[1] <= 1.0 &&
N[2] <= 1.0 &&
N[3] <= 1.0)
425 const double x1,
const double y1,
426 const double x2,
const double y2
429 return 0.5 * ((
x1 - x0)*(y2 - y0)- (y1 - y0)*(
x2 - x0));
434 inline double CalculateVol(
const double x0,
const double y0,
const double z0,
435 const double x1,
const double y1,
const double z1,
436 const double x2,
const double y2,
const double z2,
437 const double x3,
const double y3,
const double z3
440 double x10 =
x1 - x0;
441 double y10 = y1 - y0;
442 double z10 = z1 - z0;
444 double x20 =
x2 - x0;
445 double y20 = y2 - y0;
446 double z20 = z2 - z0;
448 double x30 = x3 - x0;
449 double y30 = y3 - y0;
450 double z30 = z3 - z0;
452 double detJ = x10 * y20 * z30 - x10 * y30 * z20 + y10 * z20 * x30 - y10 * x20 * z30 + z10 * x20 * y30 - z10 * y20 * x30;
453 return detJ * 0.1666666666666666666667;
Short class definition.
Definition: bins_dynamic_objects.h:57
Geometry base class.
Definition: geometry.h:71
size_type size() const
Definition: global_pointers_vector.h:307
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
ElementsContainerType::ContainerType & ElementsArray(IndexType ThisIndex=0)
Definition: model_part.h:1209
Definition: transfer_utility.h:105
Configure::ResultContainerType ResultContainerType
Definition: transfer_utility.h:114
Configure::ResultIteratorType ResultIteratorType
Definition: transfer_utility.h:116
Configure::IteratorType IteratorType
Definition: transfer_utility.h:113
KRATOS_CLASS_POINTER_DEFINITION(TransferUtility)
void GatherInformationFromTopographicDomain()
Definition: transfer_utility.h:164
TransferUtility(ModelPart &calculation_model_part, ModelPart &topographic_model_part)
Definition: transfer_utility.h:126
Configure::ContainerType ContainerType
Definition: transfer_utility.h:111
SpatialContainersConfigure< TDim > Configure
Definition: transfer_utility.h:108
Configure::PointType PointType
Definition: transfer_utility.h:109
~TransferUtility()
Definition: transfer_utility.h:160
Point class.
Definition: point.h:59
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
bool CalculatePosition(Geometry< Node > &geom, const double xc, const double yc, const double zc, array_1d< double, 3 > &N)
Definition: transfer_utility.h:343
double CalculateVol(const double x0, const double y0, const double x1, const double y1, const double x2, const double y2)
Definition: transfer_utility.h:424
ModelPart & mcalculation_model_part
Definition: transfer_utility.h:458
ModelPart & mtopographic_model_part
Definition: transfer_utility.h:459
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
class Kratos::MoveParticleUtilityDiffFluidOnly FindNodeOnMesh(array_1d< double, 3 > &position, array_1d< double, TDim+1 > &N, Element::Pointer &pelement, ResultIteratorType result_begin, const unsigned int MaxNumberOfResults)
Definition: transfer_utility.h:241
BinsObjectDynamic< Configure >::Pointer mpBinsObjectDynamic
Definition: transfer_utility.h:461
x2
Definition: generate_frictional_mortar_condition.py:122
x1
Definition: generate_frictional_mortar_condition.py:121
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
float delta_t
Definition: rotatingcone_PureConvectionBenchmarking.py:129
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17
Configure::ResultIteratorType ResultIteratorType
Definition: transfer_utility.h:252