|
[Sponsors] |
October 19, 2009, 09:09 |
|
#21 |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
Sorry for the late reply, I've been really busy!
I'm not sure why you're getting the behaviour that you observe. Possibly U has gone out of scope or something? The write() function just writes the current U field to the 0/U file. I'd probably need to see it for myself, feel free to post your files in a tarball and I can take a quick look.
__________________
Laurence R. McGlashan :: Website |
|
October 20, 2009, 21:31 |
|
#22 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Thanks Laurence for your attention even with all your work. Well, this is the code:
Code:
// Velocity field initialization // Angular velocity scalar omega=2000; // Maximum velocity en parabolic profile scalar Vmax=2.0; // Tube radius scalar tubeR=0.05; // Cell centroid coordinates const volVectorField& centres = mesh.C(); // Coordinate system origin point origin(0, 0, 0); // Axis of rotation vector axis(0, 0, 1); // Force arm calculation vectorField palanca; palanca = centres.internalField() - ((centres.internalField()-origin) & axis)*axis; // Parabolic velocity field calculation scalarField zComp=Vmax*(1-sqr(mag(palanca)/tubeR)); // Option with rotation and the parabolic // Rotation U.internalField()=omega*(axis^palanca); // Parabolic in z direction U.internalField().replace(vector::Z,zComp); // Write to /0/U U.write(); Code:
# include "createTime.H" # include "createMesh.H" # include "createFields.H" # include "USetUp.H" As you can see, after rewriting in memory the U vector field I call the .write() method to write the field to the hard disk. The problem is that if you run the code once, the initializated U field doesn't remain in memory, i.e. the advection equation is solved with another field, maybe zero, I don't know. But, in the other hand, if you run the code some steps, then stop it and run it again with the /0/U recently written things go well. That's all. Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
October 21, 2009, 07:00 |
|
#23 |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
This worried me slightly, so I took a look, and I think I've figured it out.
The scalar transport equation takes phi as the coefficient in fvm::div, not U. So you have overwritten U, but now you have to recreate the flux. So just put Code:
#include "createPhi.H" Code:
#include "USetUp.H"
__________________
Laurence R. McGlashan :: Website |
|
December 11, 2009, 15:09 |
|
#24 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Laurence, I've been working in another things last months but I've returned to this problem. Your suggestion was right, FOAM was assembling the flux with the original U not with the one calculated by my code. I had to put the
Code:
#include "createPhi.H" Code:
#include "USetUp.H" Code:
#ifndef createPhi_H Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
December 29, 2013, 17:06 |
|
#25 |
Member
Tony
Join Date: Nov 2013
Posts: 35
Rep Power: 13 |
Dear Santiago,
I am struggling with getting a parabolic internal field for pipe flow in openfoam and I've found your post very useful. Could you please give me some hints on the line "U.internalField()=omega*(axis^palanca);" ? Another silly question, where shall I put the code, in 0/U or somewhere else? Do I need to derive my own solver for it? I really appreciate your reply. Thank you very much. Best regards, Tony Last edited by wzx1989221; December 30, 2013 at 08:29. |
|
January 2, 2014, 19:30 |
|
#26 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
FYI for future readers: Tony's question has been in essence answered here: http://www.cfd-online.com/Forums/ope...tml#post468380 @Tony: Regarding your question about Santiago's implementation: from what I can figure out from the first few posts, it seems that he created a variant of the solver scalarTransportFoam and added a new header file that includes the code discussed in this thread. It takes a while to explain it in more detail, so I suggest that you have a look at the following tutorials, in order to get a bit more perspective into the details:
Best regards, Bruno
__________________
|
|
January 2, 2014, 20:09 |
|
#27 |
Member
Tony
Join Date: Nov 2013
Posts: 35
Rep Power: 13 |
Hi, Bruno
Thank you very much for the information. I will have a look at that and get back to you if I have further questions. Best regards, Tony |
|
Tags |
set up fields, vector manipulation |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
From 2D compressible code to 3D code | David Liu | Main CFD Forum | 22 | June 26, 2012 18:59 |
code initialization - exclude pressure | edna | Siemens | 0 | January 29, 2008 11:56 |
CFD code structure (F90) | ma | Main CFD Forum | 4 | January 10, 2005 21:47 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |
State of the art in CFD technology | Juan Carlos GARCIA SALAS | Main CFD Forum | 39 | November 1, 1999 15:34 |