|
[Sponsors] |
Particle injection with normal distribution of density |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 28, 2023, 03:36 |
Particle injection with normal distribution of density
|
#1 |
New Member
Italy
Join Date: Apr 2022
Posts: 12
Rep Power: 4 |
Hello guys, I'm trying to implement into my kinematicCloudProperties file normal distribution of particle density. Trying with this code but it doesn't work.
Code:
constantProperties { rho0 { type normal; normalDistribution { mu 1300; sigma 50; minValue 1150; maxValue 1450; } } alphaMax 0.99; } Code:
--> FOAM FATAL IO ERROR: (openfoam-2212 patch=230110) Attempt to return dictionary entry as a primitive file: constant/kinematicCloudProperties.constantProperties.rho0 at line 54 to 60. |
|
April 28, 2023, 20:10 |
|
#2 |
Member
Utkan Caliskan
Join Date: Aug 2014
Posts: 42
Rep Power: 12 |
That is not supported in OpenFOAM. You need to modify the code. If you will do that then I think it would be easier to implement it under the injection model instead of using constantProperties dictionary.
|
|
May 10, 2023, 16:24 |
|
#3 |
New Member
Italy
Join Date: Apr 2022
Posts: 12
Rep Power: 4 |
||
May 11, 2023, 04:10 |
|
#4 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29 |
Hello,
There are examples in the tutorials, for instance here: https://develop.openfoam.com/Develop...loudProperties Hope this helps, Yann |
|
May 11, 2023, 06:46 |
|
#5 | |
New Member
Italy
Join Date: Apr 2022
Posts: 12
Rep Power: 4 |
Quote:
Code:
injectionModels { model1 { type manualInjection; massTotal 0; parcelBasisType fixed; nParticle 1; SOI 0; positionsFile "kinematicCloudPositions"; U0 (0 0 0); rho0 { sizeDistribution { type normal; normalDistribution { mu 1300; sigma 50; minValue 1150; maxValue 1450; } } } sizeDistribution { type uniform; uniformDistribution { minValue 2e-4; maxValue 7e-4; } } } } |
||
May 11, 2023, 19:21 |
|
#6 |
Member
Utkan Caliskan
Join Date: Aug 2014
Posts: 42
Rep Power: 12 |
The attached PatchInjection code assigns density value within the injection model definition, but it must be a scalar value, so constant. You may go from there.
In the same file, the following part of the code is responsible for the size distribution Code:
sizeDistribution_ ( distributionModel::New ( this->coeffDict().subDict("sizeDistribution"), owner.rndGen() ) ) Code:
// set particle diameter parcel.d() = sizeDistribution_->sample(); Code:
densityDistribution_ ( distributionModel::New ( this->coeffDict().subDict("densityDistribution"), owner.rndGen() ) ) Code:
// set particle density parcel.rho() = densityDistribution_->sample(); // rho0_ |
|
May 12, 2023, 10:06 |
|
#7 | |
New Member
Italy
Join Date: Apr 2022
Posts: 12
Rep Power: 4 |
Quote:
Code:
{ // If rho0 is given in the const properties if (constProps_.rho0() != -1) { parcel.rho() = constProps_.rho0(); } } |
||
May 12, 2023, 16:04 |
|
#8 |
Member
Utkan Caliskan
Join Date: Aug 2014
Posts: 42
Rep Power: 12 |
The files I attached have the density update, so you can reference that. Those are the modifications I made. You'll add 3 lines in ManualInjection.C file and 1 line in ManualInjection.H file.
The density is set with the value in constantProperties, though that won't matter because the density update in the injection model will overwrite it. |
|
May 12, 2023, 18:01 |
|
#9 | |
New Member
Italy
Join Date: Apr 2022
Posts: 12
Rep Power: 4 |
Quote:
Code:
constantProperties { } subModels { particleForces { gravity; interface { C -10; alpha alpha.water; } } injectionModels { model1 { type manualInjection; massTotal 0; parcelBasisType fixed; nParticle 1; SOI 0; positionsFile "kinematicCloudPositions"; U0 (0 0 0); densityDistribution { type uniform; uniformDistribution { minValue 1350; maxValue 1600; } } sizeDistribution { type uniform; uniformDistribution { minValue 2e-4; maxValue 7e-4; } } } } Code:
... Selecting U integration scheme Euler Selecting turbulence model type laminar Selecting laminar stress model Stokes No MRF models present No finite volume options present DICPCG: Solving for pcorr, Initial residual = 1, Final residual = 8.60384e-06, No Iterations 44 time step continuity errors : sum local = 1, global = 1, cumulative = 1 Courant Number mean: 0.0403565 max: 1.83827 Starting time loop Courant Number mean: 0.00403565 max: 0.183827 Interface Courant Number mean: 0 max: 0 deltaT = 0.05 Time = 0.05 Evolving kinematicCloud Solving3-D cloud kinematicCloud openfoam2212:.... |
||
May 12, 2023, 19:34 |
|
#10 |
Member
Utkan Caliskan
Join Date: Aug 2014
Posts: 42
Rep Power: 12 |
The code is doing nothing for the density. Try adding the following in "setProperties" function.
Code:
// set particle diameter parcel.rho() = densityDistribution_->sample(); |
|
May 13, 2023, 04:08 |
|
#11 |
New Member
Italy
Join Date: Apr 2022
Posts: 12
Rep Power: 4 |
Still, unfortunately it's not affecting anything. The injection won't start unless I set rho0 to some value.
|
|
May 14, 2023, 05:18 |
|
#12 |
Member
Utkan Caliskan
Join Date: Aug 2014
Posts: 42
Rep Power: 12 |
You should define something for rho0 but since the sampling using the density distribution object in ManualInjection will overwrite that value, I'd expect different densities in the simulation.
|
|
May 25, 2023, 12:13 |
|
#13 | |
New Member
Italy
Join Date: Apr 2022
Posts: 12
Rep Power: 4 |
Quote:
Thanks |
||
May 31, 2023, 07:41 |
|
#14 |
Senior Member
Alain Islas
Join Date: Nov 2019
Location: Mexico
Posts: 142
Rep Power: 7 |
May I ask why do you want to inject particles with different densities? What is the purpose? To represent different materials? If you do so, not only the density will change, but also the other particle properties, like cp, epsilon0, f0, composition, etc...
PLease keep in mind that based on your total mass to inject, parcelBasisType and particle diameter, OpenFOAM adjusts the nParticles in each parcel. IF you really want to inject different materials I wouldnt change rho0, because by default in OpenFOAM this is meant to be a constant property for particles (except for reactive particles). I would simply inject additional clouds, and change rho0 there. Also I think you are missing the flag "duration" to tell OpenFOAM for how long your particles will be injected. |
|
August 13, 2023, 12:15 |
|
#15 |
New Member
Italy
Join Date: Apr 2022
Posts: 12
Rep Power: 4 |
Could the definition of rho_ be changed within "KinematicParcelI.H" file? I've tried with a couple of different ways, but it doesn't work. This should work?
Code:
template<class ParcelType> inline Foam::KinematicParcel<ParcelType>::KinematicParcel ( const polyMesh& owner, const barycentric& coordinates, const label celli, const label tetFacei, const label tetPti, const label typeId, const scalar nParticle0, const scalar d0, const scalar dTarget0, const vector& U0, const constantProperties& constProps ) : ParcelType(owner, coordinates, celli, tetFacei, tetPti), active_(true), typeId_(typeId), nParticle_(nParticle0), d_(d0), dTarget_(dTarget0), U_(U0), rho_(constProps.rho0()), age_(0.0), tTurb_(0.0), UTurb_(Zero) { std::random_device rd; std::mt19937 gen(rd()); std::normal_distribution<> normalDist(constProps.rho0(), 10.0); rho_ = normalDist(gen); } Last edited by lolo7331; August 16, 2023 at 12:07. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Lagrangian] Injection model for two density classes within one cloud | m.kurjata | OpenFOAM Pre-Processing | 4 | November 6, 2022 14:12 |
[snappyHexMesh] Invalid Normals for source face to target face while making AMI? | Sorabh | OpenFOAM Meshing & Mesh Conversion | 1 | August 3, 2021 07:35 |
Need help setting up chtMultiRegion | OskarT | OpenFOAM Pre-Processing | 1 | September 25, 2019 16:51 |
particle size distribution -Introduce the Log Normal Distribution- | souria | FLUENT | 0 | January 25, 2016 08:35 |
Particle velocity - Injection With Line Weighting | Danuta | CFX | 0 | October 10, 2007 07:21 |