activating field Averages
Hello all
there are some field averaging subroutines for example on MDTOOLS on src/lagrangian/molecularDynamics/molecule/mdTools which are not in effect in the tutorial files and i found no clue who to make them work. has anyone got any idea what to do? thanks in advance. |
Hello Mehdi,
To get the field averaging working I included the following header files in the main solver file i.e. mdFoam.C: # include "createMDFields.H" # include "calculateMDFields.H" # include "averageMDFields.H" # include "resetMDFields.H" in the following places: #include "fvCFD.H" #include "md.H" int main(int argc, char *argv[]) { # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" potential pot(mesh); moleculeCloud molecules(mesh, pot); # include "temperatureAndPressureVariables.H" label nAveragingSteps = 0; # include "createMDFields.H" Info << "\nStarting time loop\n" << endl; while (runTime.loop()) { nAveragingSteps++; Info << "Time = " << runTime.timeName() << endl; molecules.evolve(); # include "meanMomentumEnergyAndNMols.H" # include "temperatureAndPressure.H" # include "calculateMDFields.H" # include "averageMDFields.H" # include "resetMDFields.H" runTime.write(); if (runTime.outputTime()) { nAveragingSteps = 0; } Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info << "End\n" << endl; return 0; } Cheers, Erik |
Thanks alot . i will test it ASAP.
|
Did so and all seems to be going all well , isn't there any need to call the functions in the Control Dict or any other places ? why isnt there any new variables added to data like Density , bulk velocity and so forth ?? plus is it needed to re make the edited solver file ? Can the averaging parameters such as bin sizes and so on be changed for a run ?
|
HI Mehdi,
After you added these lines did you compile the solver by running "wclean" and then "wmake" in the same folder as you have the Make directory. This needs to be done in order for any changes to be made. If this does not work then maybe you need to compile the molecule library as well by running "wclean libso" and then "wmake libso". cheers, Erik |
i did the wclean libso and wmake libso after wards in the folder relating to mdfoam.c and here is the result :
HTML Code:
cd /home/mehdi/OpenFOAM/OpenFOAM-1.6/applications/solvers/discreteMethods/molecularDynamics/mdFoam/ |
in the folder of mdFoam.C you should only type "wclean" and then "wmake" the commands "wclean libso" and "wmake libso" should only be used in case you are compiling a library e.g. the molecule library.
|
ok did that in the mdfoam directory and here is the result :
HTML Code:
mehdi@mehdi-laptop:~/OpenFOAM/OpenFOAM-1.6/applications/solvers/discreteMethods/molecularDynamics/mdFoam$ wclean |
there seems nothing especial happens after compiling the solver and library and when i run the mdFoam for my problem there goes the same as before and no averaging or volume field or etc is calculated :confused:
|
Ok, sorry I forgot that some changes need to be made to the molecule library. You therefore need to go to the directory:
$(LIB_SRC)/lagrangian/molecularDynamics/molecule and do the following changes: in createMDfields.H and resetMDfields.H you need to search and replace potential() with pot(). in calculateMDfields.H the representation of velocity U is now represented by v and the mass is no longer a molecular attribute but a property defined in the molecularPropertiesDict: therefore, in the same file, you need to replace: allSpeciesM_RU[molId][cell] += mol->mass(); with the two lines: const molecule::constantProperties& constProp = molecules.constProps(molId); allSpeciesM_RU[molId][cell] += constProp.mass(); After this you get to use commands "wclean libso" and then "wmake libso" to compile the library. Then navigate to the directory of the solver and compile using wclean and wmake. It is neater however if you copy the solver and and molecule directories to your user folder and make the changes there. That way you preserve the original OF the default way. For this later issue I would consult the userguide. good luck, Erik |
Quote:
HTML Code:
In file included from mdFoam.C:67: |
Hi,
The error message that you show says that U is unknown still. So you should replace U with v. |
hi , thanks for your replies.
so i did the replacement the calculateMDFiels.H now is like this HTML Code:
const List<DynamicList<molecule*> >& cellOccupancy = molecules.cellOccupancy(); |
No worries,
It should work now. molU can remain molU since it is declared and used locally. |
so as i perform wclean and subsequently wmake here is the result :confused:
HTML Code:
/usr/lib/crt1.o: In function `_start': |
I think you are trying to use wclean and wmake commands for compiling the molecule class. This does not work since it does not have main in it. The molecule class should be compiled using wclean libso and then wmake libso. Then navigate to the solver and use the wclean and wmake commands.
|
Thanks alot. it finally solve the problem. just one other question to ask . is it possible to change the binning size for the calculation of average values ?
|
No problem. The averaging is done cell wise so these bins sizes are determined from the blockMeshDict file.
|
followed your leads and all seems to work fine . there remains but two questions of you could help i would be most grateful.
First of all when modeling a simple nano pressure driven channel with a gravity like .5 along the channel and periodic inlet / outlet the simulation never reaches a steady state even after 5*10^-11 seconds. why is it so ? Second is that averages Calculated for run are very mesh size dependent as anticipated but there seems to be no appropriate mesh size to create smooth profiles for density , velocity and so forth ? what is wrong wish cell averaging ? must i resume with some other methods ? Thanks in advance . |
All times are GMT -4. The time now is 23:36. |