转载自:http://www.cfd-online.com/Forums/openfoam-programming-development/129966-regarding-modified-drag-force-formulation-application-dense-flows.html
If you have a look into the classes defined in the folder "src/lagrangian/intermediate/submodels/Kinematic/ParticleForces", there is an interesting pattern:
- The sub-folder "ParticleForce" has the base class for all possible forces. It has 3 important methods:
Code:
-
//- Calculate the coupled force virtual forceSuSp calcCoupled ( const typename CloudType::parcelType& p, const scalar dt, const scalar mass, const scalar Re, const scalar muc ) const; //- Calculate the non-coupled force virtual forceSuSp calcNonCoupled ( const typename CloudType::parcelType& p, const scalar dt, const scalar mass, const scalar Re, const scalar muc ) const; //- Return the added mass virtual scalar massAdd ( const typename CloudType::parcelType& p, const scalar mass ) const;
-
- All rely in the class "forceSuSp", located in the sub-folder of the same name, which has the following description:
Quote:Code:Helper container for force Su and Sp terms. F = Sp(U - Up) + Su Explicit contribution, Su specified as a force Implicit coefficient, Sp specified as force/velocity
- For example, the sub-folder "Lift/LiftForce" has the base class structure for lift, which relies in the method "calcCoupled" and defines only the "Su" part and "Sp" is set to "0.0".
- The sub-folder "Drag" has the classes for drag, from which you've pointed out "SphereDrag". These classes also rely in the method "calcCoupled" and defines only the "Sp" part.
- The sub-folder "Gravity" has a single class that relies in the method "calcNonCoupled" and affects only "Su".
- The class in the sub-folder "PressureGradient" also relies in the method "calcCoupled" and also affects "Su" only.
It's in the class "KinematicParcel", method "calcVelocity", located in the folder "src/lagrangian/intermediate/parcels/Templates/KinematicParcel/". It relies on the class "TrackData::cloudType::forceType", where "TrackData" is a template name... OK, I got lost here, because this section is deeply based in templates, which is a considerable pain to figure out who-is-what-and-where-and-how
But the point is that this line:
Code:const forceSuSp Fcp = forces.calcCoupled(p, dt, mass, Re, mu);
- All rely in the class "forceSuSp", located in the sub-folder of the same name, which has the following description:
-
-
Hi ansu, Bruno,
I am also investigating this solver. I still have many remaining questions, but maybe the follwing gives you a starting point:
A. For information on template for class Trackdata look into /intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C.
B. If you want to include a new force to the solver, you may try the following (which I haven't tried yet):- Copy the intermediate library, recompile it to something like "mylib" in your user folder and link the new user library to your own copy of the solver (myIco... )
- in submodels/Kinematic/ParticleForces/.. copy a drag model and rename it (do not forget to rename the classes inside the file)
- In intermediate/parcels/include/makeParcelForces.H include the file "myNewForce.H" and add the force to the definition (register it to the library):
Code:... #include "myNewForce.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #define makeParcelForces(CloudType) \ \ makeParticleForceModel(CloudType); \ makeParticleForceModelType(myNewForce, CloudType); \ ...
- In the case file /constant/kinematicCloudProperties add
Code:... subModels { particleForces { sphereDrag; gravity; myNewForce; } ...
I might find some time at the weekend to implement a new force and check if the works. I will keep you updated.