Law2_ScGeom_CapillaryPhys_Capillarity.hpp 7.8 KB
Newer Older
1
//
2
// C++ Interface: Law2_ScGeom_CapillaryPhys_Capillarity
3
/*************************************************************************
4
5
*  Copyright (C) 2006 by luc Scholtes                                    *
*  luc.scholtes@hmg.inpg.fr                                              *
6
7
8
9
10
*                                                                        *
*  This program is free software; it is licensed under the terms of the  *
*  GNU General Public License v2 or later. See file LICENSE for details. *
*************************************************************************/

Janek Kozicki's avatar
Janek Kozicki committed
11
#pragma once
12

13
#include <core/GlobalEngine.hpp>
14

15
/**
16
This law allows one to take into account capillary forces/effects between spheres coming from the presence of interparticular liquid bridges (menisci).
17
18
19
refs:
- (french, lot of documentation) L. Scholtes, PhD thesis -> http://tel.archives-ouvertes.fr/tel-00363961/en/
- (english, less...) L. Scholtes et al. Micromechanics of granular materials with capillary effects. International Journal of Engineering Science 2009,(47)1, 64-75 
20

21
The law needs ascii files M(r=i) with i=R1/R2 to work (downloaded from https://yade-dem.org/wiki/CapillaryTriaxialTest). They contain a set of results from the resolution of the Laplace-Young equation for different configurations of the interacting geometry (assuming a null wetting angle) and must be placed in the bin directory (where yade exec file is situated) to be taken into account.
22
The control parameter is the capillary pressure (or suction) Delta_u, defined as the difference between gas and liquid pressure: Delta_u = u_gas - u_liquid
23
24
25
26
27
28
29
30
31
Liquid bridges properties (volume V, extent over interacting grains delta1 and delta2) are computed as a result of Delta_u and the interacting geometry (spheres radii and interparticular distance)

Rk: - the formulation is valid only for pendular menisci involving two grains (pendular regime).
    - an algorithm was developed by B. Chareyre to identify menisci overlaps on each spheres (menisci fusion).
    - some assumptions can be made to reduce capillary forces when menisci overlap (binary->F_cap=0 if at least 1 overlap, linear->F_cap=F_cap/numberOfOverlaps)
*/

/// !!! This version is deprecated. It should be updated to the new formalism -> ToDo !!!

32
/// a class to store meniscus parameters -> Rk: is it really needed since CapillaryPhys exist?
Bruno Chareyre's avatar
   
Bruno Chareyre committed
33
34
35
class MeniscusParameters
{
public :
36
37
38
39
	Real V; // adimentionnal volume of the meniscus : true volume / Rmax^3, see Annexe 1 of Scholtes2009d
	Real F; // adimentionnal capillary force for this meniscus : true force / ( 2 * pi * Rmax * superficial tension), (30) of Annexe1 of Scholtes2009d
	Real delta1; // angle defined Fig 2.5 Scholtes2009d
	Real delta2; // angle defined Fig 2.5 Scholtes2009d
Bruno Chareyre's avatar
   
Bruno Chareyre committed
40
41
42
43
44
45
46
	int index1;
	int index2;

	MeniscusParameters();
	MeniscusParameters(const MeniscusParameters &source);
	~MeniscusParameters();
};
47

48
/// R = ratio(RadiusParticle1 on RadiusParticle2). Here, 10 R values from interpolation files (yade/extra/capillaryFiles), R = 1, 1.1, 1.25, 1.5, 1.75, 2, 3, 4, 5, 10
49
50
const int NB_R_VALUES = 10;

51
class capillarylaw; // fait appel a la classe def plus bas //TODO: translate this in english
Bruno Chareyre's avatar
   
Bruno Chareyre committed
52
53
class Interaction;

54
///This container class is used to check if meniscii overlap. Wet interactions are put in a series of lists, with one list per body.
Bruno Chareyre's avatar
   
Bruno Chareyre committed
55
56
57
58
59
60
61
62
63
class BodiesMenisciiList
{
	private:
		vector< list< shared_ptr<Interaction> > > interactionsOnBody;
		
		//shared_ptr<Interaction> empty;
		
	public:
		BodiesMenisciiList();
64
65
		BodiesMenisciiList(Scene*,bool);
		bool prepare(Scene*,bool);
66
67
68
		bool insert(const shared_ptr<Interaction>&);
		bool remove(const shared_ptr<Interaction>&);
		list< shared_ptr<Interaction> >& operator[] (int);
Bruno Chareyre's avatar
   
Bruno Chareyre committed
69
70
		int size();
		void display();
71
		void checkLengthBuffer(const shared_ptr<Interaction>&);
Bruno Chareyre's avatar
   
Bruno Chareyre committed
72
73
74
75
		
		bool initialized;
};

76
/// This is the constitutive law
77
class Law2_ScGeom_CapillaryPhys_Capillarity : public GlobalEngine
78
79
{
	public :
80
		void checkFusion();
81
		shared_ptr<capillarylaw> capillary;
Bruno Chareyre's avatar
   
Bruno Chareyre committed
82
		BodiesMenisciiList bodiesMenisciiList;
83
		
84
		void action();
85
		void postLoad(Law2_ScGeom_CapillaryPhys_Capillarity&);
86
		
87
88
89
90
		bool hertzInitialized;
		bool hertzOn;
		bool getHertzOn();
		
91
	YADE_CLASS_BASE_DOC_ATTRS_DEPREC_INIT_CTOR_PY(Law2_ScGeom_CapillaryPhys_Capillarity,GlobalEngine,"This law allows one to take into account capillary forces/effects between spheres coming from the presence of interparticular liquid bridges (menisci).\n\nThe control parameter is the :yref:`capillary pressure<Law2_ScGeom_CapillaryPhys_Capillarity::capillaryPressure>` (or suction) Uc = Ugas - Uliquid. Liquid bridges properties (volume V, extent over interacting grains delta1 and delta2) are computed as a result of the defined capillary pressure and of the interacting geometry (spheres radii and interparticular distance).\n\nReferences: in english [Scholtes2009b]_; more detailed, but in french [Scholtes2009d]_.\n\nThe law needs ascii files M(r=i) with i=R1/R2 to work (see https://yade-dem.org/wiki/CapillaryTriaxialTest). These ASCII files contain a set of results from the resolution of the Laplace-Young equation for different configurations of the interacting geometry, assuming a null wetting angle.\n\nIn order to allow capillary forces between distant spheres, it is necessary to enlarge the bounding boxes using :yref:`Bo1_Sphere_Aabb::aabbEnlargeFactor` and make the Ig2 define define distant interactions via :yref:`interactionDetectionFactor<Ig2_Sphere_Sphere_ScGeom::interactionDetectionFactor>`. It is also necessary to disable interactions removal by the constitutive law (:yref:`Law2<Law2_ScGeom_FrictPhys_CundallStrack::neverErase>=True`). The only combinations of laws supported are currently capillary law + :yref:`Law2_ScGeom_FrictPhys_CundallStrack` and capillary law + :yref:`Law2_ScGeom_MindlinPhys_Mindlin` (and the other variants of Hertz-Mindlin).\n\nSee CapillaryPhys-example.py for an example script.",
92
	((Real,capillaryPressure,0.,,"Value of the capillary pressure Uc defined as Uc=Ugas-Uliquid"))
93
94
	((bool,fusionDetection,false,,"If true potential menisci overlaps are checked, computing :yref:`fusionNumber<CapillaryPhys.fusionNumber>` for each capillary interaction, and reducing :yref:`fCap<CapillaryPhys.fCap>` according to :yref:`binaryFusion<Law2_ScGeom_CapillaryPhys_Capillarity.binaryFusion>`"))
	((bool,binaryFusion,true,,"If true, capillary forces are set to zero as soon as, at least, 1 overlap (menisci fusion) is detected. Otherwise :yref:`fCap<CapillaryPhys.fCap>` = :yref:`fCap<CapillaryPhys.fCap>` / (:yref:`fusionNumber<CapillaryPhys.fusionNumber>` + 1 )"))
95
96
97
	((bool,createDistantMeniscii,false,,"Generate meniscii between distant spheres? Else only maintain the existing ones. For modeling a wetting path this flag should always be false. For a drying path it should be true for one step (initialization) then false, as in the logic of [Scholtes2009c]_"))
	,/*deprec*/
	((CapillaryPressure,capillaryPressure,"naming convention"))
98
99
100
101
	,,/*constructor*/
	hertzInitialized = false;
	hertzOn = false;
	,
Bruno Chareyre's avatar
Bruno Chareyre committed
102
	 );
103
104
105
106
107
108
109
};

class TableauD
{
	public:
		Real D;
		std::vector<std::vector<Real> > data;
Bruno Chareyre's avatar
   
Bruno Chareyre committed
110
		MeniscusParameters Interpolate3(Real P, int& index);
Bruno Chareyre's avatar
Bruno Chareyre committed
111
		TableauD();
112
113
114
115
  		TableauD(std::ifstream& file);
  		~TableauD();
};

116
// Fonction d'ecriture de tableau, utilisee dans le constructeur pour test //TODO: translate this in english
117
118
119
120
121
122
123
124
class Tableau;
std::ostream& operator<<(std::ostream& os, Tableau& T);

class Tableau
{	
	public: 
		Real R;
		std::vector<TableauD> full_data;
Bruno Chareyre's avatar
Bruno Chareyre committed
125
126
		MeniscusParameters Interpolate2(Real D, Real P, int& index1, int& index2);		
		std::ifstream& operator<< (std::ifstream& file);		
127
128
129
130
131
132
133
134
135
136
		Tableau();
    		Tableau(const char* filename);
    		~Tableau();
};

class capillarylaw
{
	public:
		capillarylaw();
		std::vector<Tableau> data_complete;
137
		MeniscusParameters interpolate(Real R1, Real R2, Real D, Real P, int* index);		
138
139
140
		void fill (const char* filename);
};

141
REGISTER_SERIALIZABLE(Law2_ScGeom_CapillaryPhys_Capillarity);
142

Bruno Chareyre's avatar
   
Bruno Chareyre committed
143
144