|
[Sponsors] |
July 31, 2014, 10:14 |
|
#21 |
Member
Ananda Kannan
Join Date: Feb 2014
Location: Göteborg, Sweden
Posts: 55
Rep Power: 12 |
Hi Foamers!!
I am working with the DPMFoam solver and I have made some changes to some of the libraries that this solver depends on. I want to be able to track these changes I have made. For instance, I have a made a change to the -/llagrangian (-lagrangian/intermediate) libraries and I want to write some of these modified parameters into a file for every time step. The file that I have edited is - Code:
src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallSpringSliderDashpot/WallSpringSliderDashpot.C. Code:
// Hard-coding vibrational wall scalar rho_wall = 8000; // Steel density in kg/m3 scalar m_wall = (rho_wall*(3.14/6.0))*(p.d()*p.d()*p.d()); //scalar Ux = 0; //scalar Uy = 1; //scalar Uz = 0; vector v_wa = vector(Uwx_, Uwy_, Uwz_); scalar tperiod = this->owner().mesh().time().timeOutputValue(); scalar sine_factor = (1+a_*sin(2*3.14*f_*tperiod)); vector v_w = sine_factor*v_wa; vector U_PW = p.U() - v_w; scalar r_PW_mag = mag(r_PW); scalar normalOverlapMag = max(pREff - r_PW_mag, 0.0); vector rHat_PW = r_PW/(r_PW_mag + VSMALL); // Effective radius scalar R = 0.5*p.d(); // Effective mass //scalar M = p.mass()*m_wall/(p.mass() + m_wall); //scalar kN = (4.0/3.0)*sqrt(R)*Estar_; scalar etaN = alpha_*sqrt(p.mass()*kN)*pow025(normalOverlapMag); I have tried looking into ostream functions used in other related lagrangian libraries, but I am just not able to comprehend them . Do any of you have any suggestions?? Thanks in advance! BR ansubru |
|
July 31, 2014, 10:22 |
|
#22 |
Senior Member
|
Ansubru,
for me all standard IO functions with openning and appending data to the file worked very well. You question is too general! To solve your problem you should check your compilation errors and include corresponding header files and libraries to your Lagrangian solver to resolve those errors.
__________________
Best regards, Dr. Alexander VAKHRUSHEV Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics" Simulation and Modelling of Metallurgical Processes Department of Metallurgy University of Leoben http://smmp.unileoben.ac.at |
|
February 12, 2017, 10:13 |
|
#23 |
Senior Member
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18 |
Hi,
I think my question is a step further above! I have created a volScalarField in my own turbulence model using IOobject (not in createFields.H !!). The value calculated and outputted correctly using runTime.write. The problem is that I cannot find a way to time-average this scalar field using functionObject in controlDict, as it only identifies the fields constructed in createFields.H. So, the question is how to do time-averaging for fields created outside createFields.H?! Can I use swak4Foam for this purpose?! Syavash |
|
February 13, 2017, 09:13 |
|
#24 |
New Member
Hasan Shetabivash
Join Date: Jan 2017
Location: Montreal
Posts: 17
Rep Power: 12 |
Hi ansubru
Only objects that are registered into time object will be written automatically at specified time steps. Besides, you only can register objects that are of regIoObject type. In your case the vector class is not an regIoObject so it's impossible to register it. However, I just came up with two solutions: 1. Use Info and write your parameters into a log file. 2. Define a dictionary that includes all your parameters. You can register dictionaries and write them in specified time steps. |
|
February 13, 2017, 18:21 |
|
#25 |
New Member
Hasan Shetabivash
Join Date: Jan 2017
Location: Montreal
Posts: 17
Rep Power: 12 |
Dear syavash,
You can use functionObjects for all registered fields. In order to check that your field is registered and available, use banana trick described in the following link. https://openfoamwiki.net/index.php/T...gisteredObject |
|
March 15, 2017, 16:19 |
|
#26 | |
Member
Linyan X
Join Date: Dec 2015
Posts: 43
Rep Power: 11 |
Quote:
After reading your problem and solution, I have a quick question regarding the volVectorField that you've gotten, named volVectorField 'ST'. How can you implement this volVectorField term into the equation that you want to solve? Like, for example, UEqn.H in interFoam. I want to add the force vector term into the UEqn.H, written as 'interpolate(F)'. But the system will always complain about the format of this vector term. Hence, I guess you may know this after reading your post. Really appreciate your help for any hints. Regards, Linyan |
||
May 7, 2018, 21:33 |
runTime_.outputTime() at converged time step
|
#27 | |
New Member
sethu
Join Date: Oct 2011
Posts: 7
Rep Power: 15 |
Quote:
runTime_.outputTime() works fine. But, if my solution is converged and when it is not in output interval, the VolScalarFileld is not written. (e.g: writeInterval 100; It is writing it for every 100 iterations. But when my solution is converged at 357 iteration, the volScalarField is not written) Im using the latest OF version (5.0) The following is my code, if(runTime.outputTime()) { volScalarField FFR ( IOobject ( "FFR", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), p/max(p) ); FFR.write(); //runTime.write(); } Am I missing something in the code.?? |
||
December 11, 2019, 12:57 |
|
#28 |
Member
David Andersson
Join Date: Oct 2019
Posts: 46
Rep Power: 7 |
Hi all,
First of all - thanks for a very informative and good thread! I am doing something similar - I am doing some computations on the pressure values for each face for some patches and I want to create a field from these values that I can visualize in paraview. I created a volScalarField in createFields.H like: Code:
volScalarField myField ( IOobject ( "myField", mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("myField", dimEnergy/dimVolume, 0.0) ) I have already written a functionObject that reads the pressure values for the faces of some specified patches, does some computations and saves them to a List<double>. Is it possible to reach my "myField" from my functionObject and save my values there instead or do I need to move my computations over to the solver? Furthermore, is it possible to create a field for only some faces? btw, I am using pimpleFoam. I am grateful for any help on this. Cheers, David Last edited by sippanspojk; December 11, 2019 at 14:25. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Critical errors during OpenFoam installation in OpenSuse 11.0 | amscosta | OpenFOAM | 5 | May 1, 2009 15:06 |
Problem installing OpenFOAM 1.5 installation on RHEL 4. | vwsj84 | OpenFOAM Installation | 4 | April 23, 2009 05:48 |
2009 OpenFOAM Summer School in Zagreb, Croatia | hjasak | OpenFOAM Announcements from Other Sources | 0 | March 27, 2009 13:08 |
Adventure of fisrst openfoam installation on Ubuntu 710 | jussi | OpenFOAM Installation | 0 | April 24, 2008 15:25 |
OpenFOAM Training and Workshop | Hrvoje Jasak | Main CFD Forum | 0 | October 7, 2005 08:14 |