View Issue Details

IDProjectCategoryView StatusLast Update
0002332OpenFOAMContributionpublic2016-11-17 22:46
ReporterSvensenAssigned Tohenry 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version14.04
Product Versiondev 
Fixed in Versiondev 
Summary0002332: new viscosity model
DescriptionSuggested a new viscosity model for the non-Newtonian fluid - Pointwise model.

It allows to specify a viscosity function as a set of (shear rate, viscosity) pairs. It can be useful when available viscosity functions shows high approximation error.

The attached testcase contains an example of T-joint with an example transportProperties file for blood viscosity. Testcase: https://yadi.sk/d/Uye5Y66qyXUef
Tagscontribution, non-Newtonian, viscosity

Activities

Svensen

2016-11-13 15:08

reporter  

Pointwise.tar.gz (1,887 bytes)

Svensen

2016-11-13 15:12

reporter   ~0007181

The possible workflow to specify a viscosity curve would be the following:
1) collect a measured viscosity data in the csv file
2) apply a "spline" utility with a given precision, i.e. "spline -n 1000 visc.csv > pointwiseVisc.csv"
3) reformat the pointwiseVisc.csv to the "(shear rate \t viscosity)\n," format
4) copy and paste formatted data to the transportProperties file

henry

2016-11-13 15:26

manager   ~0007183

Could you clarify why this model is named "PointWise"? Is it related to the PointWise mesher? It looks like it is simply a Function1-based model which provides an option for interpolating tabulated data but also provides analytical functions.

Svensen

2016-11-13 15:39

reporter   ~0007184

"Is it related to the PointWise mesher?" - No.

"Could you clarify why this model is named "PointWise"?". Because it specify a viscosity on the point-by-point basis instead of a function.

"... which provides an option for interpolating tabulated data but also provides analytical functions"

Current implementation does not support analytical functions. It should be extended.

henry

2016-11-13 15:51

manager   ~0007188

I think "PointWise" does not describe the model very well.

Function1 supports analytical functions; what have you done to disable this functionality and why?

wyldckat

2016-11-13 16:28

updater   ~0007189

To give a bit more clarity to the original report, in a nutshell:

  1. The code was originally posted on the forum, where I did some of the coding work for using Function1, although it's just a quick hack to get Svensen started with something that works properly.

  2. I had suggested renaming from "Spline" to "Uniform", but Svensen went with the idea of PointWise without first checking with me...

  3. The code still needs more work, to make it more generic, so that it can also use vectors and tensors as lookup data, not just scalars.



----

With complete details, here are some more details about this contribution (sorry for the lengthy post, but it's to make sure that things are properly kept on record):

 - The first symptom was bug report #2316: http://bugs.openfoam.org/view.php?id=2316 - where an attempt at creating a custom "spline" transport model was being done. It was closed since it was pretty much user-support and not a bug report nor a proper feature request.

 - After interacting with Svensen on the forum, I had done a somewhat quick hack to make the code more generic and less prone to glitches when using a lookup table. The resulting code was posted here: http://www.cfd-online.com/Forums/openfoam-programming-development/179545-custom-viscosity-model-2.html#post624373 - namely post #31.

 - Svensen asked me earlier today via PM if a pull request could be done, given that this feature was something useful for others to use. I didn't given a step-by-step instruction on how to provide the contribution, but I did mention that "OpenFOAM Foundation currently tries to consolidate all contributions into the same platform, namely the bug tracker" and that "The case and the code can be in separate packages; the description about the reasoning can be provided directly in the report. Further details are provided here: http://openfoam.org/dev/how-to-contribute/ "

 - I also mentioned that:

   > I believe the code needs additional work before it can be merged into OpenFOAM, because it should be made more generic so that it can support multiple modes of loaded data, e.g. vector and tensor based. Nonetheless, you can submit it now to the bug tracker, so that either me, Henry or anyone else can contribute to these changes and improve the code.
   > And please keep in mind that an example test case also is needed, so that it can be used as a tutorial and/or for validating the code. Along with a description for the reason why this is needed, i.e. usage scenarios.

   > And I know that it was introduced some time ago into OpenFOAM-dev two conventions for transport properties, a Stokes and a Maxwell convention... I haven't managed to take a better look into it, so it might make sense to think about that as well...

   > As a side note, I actually don't think the name "Spline" is accurate, because the data is provided in tabular form. Furthermore, the use of "Function1" allows us to use tables, polynomials, constant values and CSV, as indicated in the release notes ("DataType" was renamed to "Function1" in OpenFOAM 3 or 4, not sure): http://openfoam.org/release/2-1-0/bo...ime-dependent/

   > It may need to be renamed from Spline to Uniform... But you can say that in the report.

henry

2016-11-13 16:36

manager   ~0007190

How would vectors and tensors as lookup data be use to calculate the scalar viscosity or is the plan to support tensorial viscosity forms?

wyldckat

2016-11-13 17:01

updater   ~0007191

I actually haven't thought it properly yet about how vector and tensor data would come into play, but I do believe there are several modes of viscosity that would require these kinds of models.
Further support could be added to support for Temperature or some other field(s), if this was meant to be truly generic.

Sorry, I'm probably aiming to a catch-all single-phase transport model, which is possibly overkill at the moment. The primary idea is to support experimental scalar data as input, in function of the strain rate (if I remember correctly). By using Function1, we can automatically support tabular, polynomial and so on, which already gives us a fairly broad range feature in itself.


At least in theory it seemed to me that support for tensorial viscous response was easily introduced with this... but having a tensor model providing only a scalar value as a response does seem a bit awkward, specially based on what's described on this Wikipedia article: https://en.wikipedia.org/wiki/Viscoelasticity - unfortunately I'm not familiar enough with this topic, to give a fully detailed answer on how to make it fully generalized :(

Svensen

2016-11-14 19:02

reporter   ~0007204

Can the proposed model be included in OpenFOAM as is? And maybe in the future it will be extended to support vectors/tensors.

henry

2016-11-14 19:23

manager   ~0007205

Function1 supports analytical functions; what have you done to disable this functionality and why? It would be better if this model included all of the Function1 functionality. It will also need to be renamed accordingly.

Svensen

2016-11-14 21:12

reporter   ~0007206

"what have you done to disable..." analytical functions
I didn't do anything to disable this.

"It will also need to be renamed accordingly".
initial name "SplineViscosity was cancelled, another variant - "PointwiseViscosity" also was cancelled. Maybe "tableViscosity", but it is not only a table, because you say it can support analytical functions. So, maybe "UserDefinedViscosity" ?

Do you have a variant of name for this model ?

henry

2016-11-14 21:21

manager   ~0007207

Have you tested that the model can be used with the continuous function capability of Function1?

Svensen

2016-11-14 21:27

reporter   ~0007208

No, it was tested only with a lookup data.

henry

2016-11-17 22:45

manager   ~0007233

With only such minimal testing it is not clear what the limitations of your implementation are and to avoid unnecessary maintanance overhead it is important that additions to OpenFOAM are as general as possible within reason.
To this end I have written a general implementation of a strain-rate function viscosity model based on Function1:

OpenFOAM-dev commit 1bf8014d58520fd949c17405a4e9a3a066461691

viscosityModels::strainRateFunction: New run-time selected strain-rate function non-Newtonian viscosity model

Uses 'Function1' to provide support for an extensible range of run-time
selected functions including interpolation of tabulated data etc.

henry

2016-11-17 22:46

manager   ~0007234

Resolved in OpenFOAM-dev by commit 1bf8014d58520fd949c17405a4e9a3a066461691

Issue History

Date Modified Username Field Change
2016-11-13 15:08 Svensen New Issue
2016-11-13 15:08 Svensen File Added: Pointwise.tar.gz
2016-11-13 15:08 Svensen Tag Attached: contribution
2016-11-13 15:08 Svensen Tag Attached: non-Newtonian
2016-11-13 15:08 Svensen Tag Attached: viscosity
2016-11-13 15:12 Svensen Note Added: 0007181
2016-11-13 15:26 henry Note Added: 0007183
2016-11-13 15:39 Svensen Note Added: 0007184
2016-11-13 15:51 henry Note Added: 0007188
2016-11-13 16:28 wyldckat Note Added: 0007189
2016-11-13 16:36 henry Note Added: 0007190
2016-11-13 17:01 wyldckat Note Added: 0007191
2016-11-14 19:02 Svensen Note Added: 0007204
2016-11-14 19:23 henry Note Added: 0007205
2016-11-14 21:12 Svensen Note Added: 0007206
2016-11-14 21:21 henry Note Added: 0007207
2016-11-14 21:27 Svensen Note Added: 0007208
2016-11-17 22:45 henry Note Added: 0007233
2016-11-17 22:46 henry Assigned To => henry
2016-11-17 22:46 henry Status new => resolved
2016-11-17 22:46 henry Resolution open => fixed
2016-11-17 22:46 henry Fixed in Version => dev
2016-11-17 22:46 henry Note Added: 0007234