|
[Sponsors] |
May 30, 2020, 23:06 |
Custom definition for viscosity
|
#1 |
Member
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9 |
Hello everyone. I try to define viscosity for multi phase problem, by considering a relation. To do that I wrote the code below:
Code:
forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) { phaseModel& phase = iter(); const volScalarField& alpha = phase; phaseModel& phase2 = iter(); const volScalarField& alpha2 = phase2; dimensionedScalar ksi11a = 1 + sqrt(phase.eta()/phase.eta())*pow(phase.mol()/phase.mol(), 1.0/4.0); dimensionedScalar ksi12a = 1 + sqrt(phase.eta()/phase2.eta())*pow(phase2.mol()/phase.mol(), 1.0/4.0); dimensionedScalar ksi11 = pow(ksi11a,2)/sqrt(8* (1 + phase.mol()/phase.mol())); dimensionedScalar ksi12 = pow(ksi12a,2)/sqrt(8* (1 + phase.mol()/phase2.mol())); phase.nu() = alpha*phase.eta() / (alpha*ksi11 + alpha2*ksi12)/phase.rho(); } |
|
May 31, 2020, 02:48 |
|
#2 |
Member
alexander thierfelder
Join Date: Dec 2019
Posts: 71
Rep Power: 6 |
Your phase and phase2 are the same phases since you set them with the same iterator in the same step. So you solve ksi12a = 1+1*1 = 2 and ksi12 =4/4 =1. And the same for ksi11a but there you even divide by its own valus, so i dont get the point for these.
|
|
May 31, 2020, 06:11 |
|
#3 |
Member
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9 |
Currently yes, ksi11 and ksi12 are same; because I cannot iterate through phases. I have two phases and I need to access their phase values under the same forAllIter loop at the same time. So, somehow phase2 must be something like iter++, but I couldn't do that. I need help at that point.
|
|
May 31, 2020, 09:22 |
|
#4 |
Member
alexander thierfelder
Join Date: Dec 2019
Posts: 71
Rep Power: 6 |
Well I am currently learning OF and c++ my self, so please don't be too harsh on me if I am wrong^^. So I dont have any knowledge about these phaseModel handling and so on, but I think you can just use something like *(iter-1). I tried it for a simple List of Lists:
Code:
List<List<int>> myListList({{1, 2, 3, 4},{5, 6, 7, 8, 9},{10, 11, 12}}); forAllIter(List<List<int>>, myListList, iter) { Info << "current List" << endl; Info << (*iter)<< endl << endl; if(iter != myListList.end()-1) { Info << "next List" << endl; Info << *(iter+1) << endl << endl; } else { Info << "no next List" << endl; } } Code:
current List 4(1 2 3 4) next List 5(5 6 7 8 9) current List 5(5 6 7 8 9) next List 3(10 11 12) current List 3(10 11 12) no next List |
|
May 31, 2020, 09:47 |
|
#5 | |
Member
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 9 |
Quote:
|
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom variable definition | henriquecar | FLUENT | 0 | June 20, 2019 08:43 |
How to consider interfacial area in GUI after defining custom drag coefficient? | ssa | Fluent UDF and Scheme Programming | 0 | November 13, 2017 15:26 |
(AutoGRID 5) Problem in Geometry definition of propeller | venkat_aero2007 | Fidelity CFD | 14 | July 31, 2012 15:05 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 13:21 |
defining custom convetive terms | CFD user | CFX | 1 | February 22, 2009 23:40 |