|
[Sponsors] |
November 6, 2016, 08:08 |
|
#21 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
Dear wyldcat,
thank you very much for help. I rewrote the sources according to your remarks, but the problem remains the same: serial runs OK, parallel - fails. The test case is here: https://yadi.sk/d/jsG0qm_dyA9Mj The sources are here: https://yadi.sk/d/wp7xIpUZyA9VK Remarks to test case: ./compute_all-spline.sh will setup a case and run a pimpleFoam in parallel. After this you can run pimpleFoam in serial and you will see that it works fine. ./clear.sh will remove all processor and time directories. |
|
November 6, 2016, 08:14 |
|
#22 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
And by the way, nu field is not saved in time folders, like 0.001, 0.002 and so on
|
|
November 6, 2016, 09:43 |
|
#23 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
Is it an issue for bug tracker ?
|
|
November 6, 2016, 12:07 |
|
#24 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22 |
||
November 6, 2016, 12:41 |
|
#25 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
Dear Zeppo,
unfortunately Code:
IOobject::AUTO_WRITE |
|
November 6, 2016, 13:01 |
|
#26 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22 |
Code:
//- Return the laminar viscosity virtual tmp<volScalarField> nu() const { nu_.write(); //- force writing to test if it ever works return nu_; } |
|
November 6, 2016, 13:15 |
|
#27 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
Yes, in this case it writes tnu field. But it writes it as dictionary! Just look on the attached file.
|
|
November 6, 2016, 13:17 |
|
#28 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
The internal field have to contain point by point values. But instead of this it simply writes one value for internalField...
|
|
November 6, 2016, 13:30 |
|
#29 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22 |
it means that is uniform oll over the cells as if it was calculated only once with default uniform falue of stress rate (which is calculated based on value of U-field). Secondly, why is it tnu when it should be nu?
Code:
FoamFile { version 2.0; format binary; class volScalarField; location "0.005"; object tnu; } Code:
//- Correct the laminar viscosity virtual void correct() { nu_ = calcNu(); Info << "nu corrected" << endl; nu_.write(); } |
|
November 6, 2016, 13:39 |
|
#30 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
I've simply passed "tnu" string param to constructor of tNu object. Now I've changed this string back to "nu" and modified code of correct() method according to your remark.
Unfortunately the output for "nu" is still the same: only one value for internal field! |
|
November 6, 2016, 13:54 |
|
#31 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quick answer: Although it took me some considerable time to do this, it was a good training exercise.
Attached is the package "Spline_v2.tar.gz" that contains the working code. I changed the construction to this: Code:
nu_ ( IOobject ( name, U_.time().timeName(), U_.db(), IOobject::NO_READ, IOobject::AUTO_WRITE ), calcNu() ) Code:
tmp<volScalarField> tstrain_Rate = strainRate(); volScalarField& strain_Rate = tstrain_Rate.ref(); tmp<volScalarField> tNu ( new volScalarField ( IOobject ( "tmpNu", U_.time().timeName(), U_.db(), IOobject::NO_READ, IOobject::NO_WRITE, false ), U_.mesh(), dimensionedScalar ( "oneNu", sqr(dimLength)*strain_Rate.dimensions(), visc->value(250.0) ) ) ); volScalarField& nu = tNu.ref(); nu.primitiveFieldRef() = visc->value(strainRate()); In order to initialize the values on the boundaries, I defined directly in the creation of the field. As for the problem when running in parallel, it may have been do to who the boundary values were defined. The attached package has the following commented code that should work: Code:
//alter the boundary values: volScalarField::Boundary& bNu = nu.boundaryFieldRef(); forAll(bNu, patchi) { if(!isA<processorFvPatch>(bNu[patchi])) { scalarField& pNu = bNu[patchi]; // patch field pNu = visc->value(250); } } |
|
November 6, 2016, 14:46 |
|
#32 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22 |
Bruno, can you explain to us what was wrong with the initially proposed code. I don't get it.
|
|
November 6, 2016, 15:52 |
|
#33 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quote:
edit: When in doubt, look for examples in OpenFOAM's source code Ideas for searching strategies: http://openfoamwiki.net/index.php/In...hing_for_files Last edited by wyldckat; November 6, 2016 at 15:53. Reason: see "edit:" |
||
November 6, 2016, 16:12 |
|
#34 | |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22 |
Quote:
|
||
November 6, 2016, 16:24 |
|
#35 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quote:
But feel free to test it out yourself The package that I attached in the other post is ready to be built and can be added to "system/controlDict" inside the "libs" list as "libCustomTransport.so", if I remember correctly... make sure to double-check the name in "Spline/Make/files". |
||
November 6, 2016, 17:11 |
|
#36 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22 |
Well, now Svensen has the last word on the matter of applicability of Bruno's code. Svensen, did it work for you?
|
|
November 6, 2016, 17:47 |
|
#37 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
On the first two simulations it worked fine. However I will test it carefully in the nearest time using more sophisticated cases.
I will report the results as soon as possible. |
|
November 8, 2016, 17:15 |
|
#38 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
Dear wyldcat,
I've tested a Spline model on four different flow ratios between main pipe and branch (branch / main pipe). The ratios was 0.3; 0.5; 0.7 and 0.9. For the flow ratios 0.3; 0.5 and 0.9 all was OK. The simulation successfully ran in parallel mode. However for ratio 0.7 the simulation crashes in parallel mode at time step 0.016. Meanwhile, the serial execution works fine. I really don't know what is so special in this ratio, because I've tested the code on 0.3 ratio, where velocity in branch is lower and on 0.9 ratio, where velocity is higher in comparison with 0.7 ratio. It looks strange that 0.7 ratio is not working. I've attached the project files for 0.7 ratio as well as Spline viscosity sources here: https://yadi.sk/d/A3Ktekm3yHUcd Thanks. |
|
November 13, 2016, 12:34 |
|
#39 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quick answer @Svensen: Did you always use 12 cores for all of the tests you've mentioned?
Because the problem is specifically triggered due to the number of faces that exist between processors, as reported by decomposePar: Code:
Processor 0 Number of cells = 10411 Number of faces shared with processor 1 = 197 Number of faces shared with processor 4 = 84 Number of processor patches = 2 Number of processor faces = 281 Number of boundary faces = 5102 [...] Processor 4 Number of cells = 10513 Number of faces shared with processor 0 = 84 Number of faces shared with processor 5 = 492 Number of processor patches = 2 Number of processor faces = 576 Number of boundary faces = 4138 Code:
nCellsInCoarsestLevel 100; Code:
nCellsInCoarsestLevel 80; This seems to suggest that there is a bug in OpenFOAM, but this case is too complicated for isolating the real origin of the bug Nonetheless, I do have an idea of what might help track this down... I'll check what I have in mind and get back to this when I have more details. Either way, the solution for your problem is already provided above. |
|
November 13, 2016, 12:53 |
|
#40 |
Senior Member
Join Date: Jan 2015
Posts: 150
Rep Power: 11 |
Dear wyldcat,
yes, the same number of cores was used for testing. For every case only the boundary conditions were different. |
|
Tags |
openfoam-dev, viscosity model |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with divergence | TDK | FLUENT | 13 | December 14, 2018 07:00 |
New Viscosity Model - Best Practice for Temporary Values | MaSch | OpenFOAM Programming & Development | 6 | March 16, 2018 04:51 |
Time constant in Herschel-Bulkley viscosity model | Mikel6 | Main CFD Forum | 0 | October 17, 2016 05:52 |
Viscosity ratio in gamma-theta transition model based on k-w sst turb model | Qiaol618 | Main CFD Forum | 8 | June 9, 2012 07:43 |
How to modify the viscosity model | mpml | OpenFOAM Running, Solving & CFD | 4 | October 13, 2010 08:44 |