
[Sponsors] 
Double Inner Product of Two Second Rank Tensors 

LinkBack  Thread Tools  Search this Thread  Display Modes 
December 8, 2020, 10:50 
Double Inner Product of Two Second Rank Tensors

#1 
New Member
idrees khan
Join Date: Jun 2019
Posts: 27
Rep Power: 3 
Hello,
sorry to say i post so many times but no one is going to answer my question. I'm going to add Temperature equation to viscoelasticFluidFoam solver(screenshort is attached). fvScalarMatrix TEqn ( fvm::ddt(T) + fvm::div(phi,T)  fvm::laplacian(DT,T)  1.0/rho/Cv * (gamma*visco.tau() && Foam::symm(fvc::grad(U))+ (Foam::exp( C11*(T  To) / (C21 + T  To) )*etaS*Foam::symm(fvc::grad(U)))&& Foam:fvc::grad(U))) ); TEqn.relax(); TEqn.solve(); when i add and compile with "wmake" getting error's(screenshort is attached) after this i removed the term "&& Foam:fvc::grad(U)))" and compile with wmake it work. kindly any one who know guide me that i may fix this problem. regards idrees 

December 8, 2020, 14:06 

#2 
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 116
Rep Power: 4 
Well, the error message is telling you that you are trying to do the double inner product of a double (ie scalar) and a tensor. Unsurprisingly it can't do this.
Also not surprising is that the code compiles when you remove the part that follows the &&, since that just leaves the left hand side of the && which is a scalar. The question you need to ask yourself now is: why is the left hand side a scalar and not a tensor? It's impossible to debug from your partial listing  but here are a few pieces of advice. Start by stripping back the equation and feed terms in from the right hand side. E.g. start with the symm(grad(U))&&grad(U) term, and note that one is a symm tensor, the other isn't. Get that to work, then start adding the other terms. Look for examples of similar coding in the library applications  do a grep on symm(grad(U)) for example to find these. Read the error messages carefully and think about what it's telling you  I know there's a lot of text there ... but within the text often hides the solution. Good luck. 

December 9, 2020, 05:04 

#3  
New Member
idrees khan
Join Date: Jun 2019
Posts: 27
Rep Power: 3 
Quote:
Bundle thanks for your reply. Actually I'm going to review the paper (link for the paper doi:10.1016/j.cnsns.2010.07.006 Author: T. Chinyoka at University of Cape Town ). here solvent viscosity etaS(T) = Foam::exp( C11*(T  To) / (C21 + T  To) )*etaS,which is basically a scalar, polymeric viscosity etaP(T) and relaxation Time Lambda(T) for the simplicity instead of Arrhenius law i"m going to use WLF to update parameters like viscosity and relaxation time. (Foam::exp( C11*(T  To) / (C21 + T  To) )*etaS*Foam::symm(fvc::grad(U)))&& Foam:fvc::grad(U))) it is basically given in the paper like so (please have a look the temperature equation in paper) but what i know that the value of etaS(T) is scalar and Foam::symm(fvc::grad(U)) tensor of rank 2 when i multiply it should be tensor again.but i don't why its scalar. Also I'll try what you suggest me. regards Idrees 

December 12, 2020, 12:01 

#4 
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 116
Rep Power: 4 
Dear Idrees
I am running on the foundation version of OpenFOAM and so don't have direct access to viscoelasticFluidFoam, so I added the following coding to pisoFoam. As a result, I have had to hard code in some of the variables like tau etc. Regardless, this compiles fine and should show you how to modify your code. Note the way that I started testing syntax with variables tgradU, tmp1, tmp2 etc. This is a good, methodical debugging approach that is worth you copying. Code:
//define some dimensioned variables first dimensionedScalar DT("DT", dimensionSet(0, 2, 1, 0, 0, 0, 0), 0.002); dimensionedScalar rho("rho", dimensionSet(1, 3, 0, 0, 0, 0, 0), 1.0); dimensionedScalar Cp("Cp", dimensionSet(0, 2, 2, 1, 0, 0, 0), 1000); dimensionedScalar muS("muS", dimensionSet(1, 1, 1, 0, 0, 0, 0), 0.00001); dimensionedScalar muP("muP", dimensionSet(1, 1, 1, 0, 0, 0, 0), 0.00001); scalar gamma(1.0); //test syntax volTensorField tgradU = fvc::grad(U); volSymmTensorField tmp1 = symm(tgradU); volScalarField tmp2 = tmp1 && tgradU; volScalarField tmp3 = symm(tgradU) && tgradU; volScalarField tmp4 = symm(fvc::grad(U)) && fvc::grad(U); //define main quantities volSymmTensorField S = symm(fvc::grad(U)); volSymmTensorField tau = muP*symm(fvc::grad(U)); volScalarField Q = gamma*(tau && S) + muS*(S && fvc::grad(U)); //attempt at T equation, using above variables fvScalarMatrix TEqn ( fvm::ddt(T) + fvm::div(phi,T)  fvm::laplacian(DT,T)  (1.0/rho/Cp) * Q ); //alternate T equation, without unnecessary additional variables (storage) fvScalarMatrix TEqn2 ( fvm::ddt(T) + fvm::div(phi,T)  fvm::laplacian(DT,T)  (1.0/rho/Cp) * (gamma*(muP*symm(fvc::grad(U)) && symm(fvc::grad(U))) + muS*(symm(fvc::grad(U)) && fvc::grad(U))) ); 

December 14, 2020, 09:20 

#5 
New Member
raihan
Join Date: Feb 2015
Posts: 4
Rep Power: 7 
Tobermory you are awsome. Every advice you gave are pure gold. I hope young CFD people will learn a lot from this.


December 14, 2020, 10:20 

#6 
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 116
Rep Power: 4 
That's very kind  thank you; I am glad you appreciate my posts. This forum is a fantastic collection of people and their experiences, and I get out as much as I put in!


December 15, 2020, 11:19 

#7  
New Member
idrees khan
Join Date: Jun 2019
Posts: 27
Rep Power: 3 
Quote:
Dear Tobermory Thank so much i add your techniques and compile it with "wmake" now i added some other terms in temperature equation according to paper ( screenshort is attached) and compile it it work's. but when i run solver (name viscoelasticFluidFoamUser) it gives me an error(screenshort is attached.) please have a look the paper which i send it to you. regards idrees khan 

December 15, 2020, 11:31 

#8 
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 116
Rep Power: 4 
Good news Idrees  it looks like you are pretty close. The error message
Code:
Argument of trancendental function not dimensionless Looking at your snapshot of your code, you have Code:
exp(E/(R*T) 

December 17, 2020, 11:16 

#9  
New Member
idrees khan
Join Date: Jun 2019
Posts: 27
Rep Power: 3 
Quote:
Dear Tobermory Thank you I check that and exactly the problem was in exp(E/(R*T) means in dimensions. but now when i run it gives me the problem which seems that still some terms are not dimensionally correct. regards Idrees 

December 17, 2020, 11:19 

#10 
New Member
idrees khan
Join Date: Jun 2019
Posts: 27
Rep Power: 3 
Sorry i did't attached the screenshort here is screenshort of the erorr.


Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
fvOptions  npatricia  OpenFOAM  6  May 23, 2018 06:21 
CFD by anderson, chp 10.... supersonic flow over flat plate  varunjain89  Main CFD Forum  18  May 11, 2018 08:31 
Warning message C4133 while compiling  Arminius  Fluent UDF and Scheme Programming  0  October 2, 2017 12:44 
Missing math.h header  Travis  FLUENT  4  January 15, 2009 12:48 
REAL GAS UDF  brian  FLUENT  6  September 11, 2006 09:23 