|
[Sponsors] |
March 7, 2021, 14:35 |
|
#21 |
Member
Andrea Di Ronco
Join Date: Nov 2016
Location: Milano, Italy
Posts: 57
Rep Power: 9 |
The momentum equation in UEqn.H calls the function
Code:
turbulence->divDevReff(U) I never did it myself, but I'm pretty sure that if you look at the corresponding source code, you'll find it calls nu at some point. Andrea |
|
March 7, 2021, 20:39 |
|
#22 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
Ok, below is my scalar transport equation with my desired source term added to my modified version of the simpleFoam:
Code:
while (simple.correctNonOrthogonal()) { fvScalarMatrix DEqn ( fvm::ddt(D) + fvm::div(phi, D) - fvm::laplacian(DT, D) == sqrt((turbulence -> nu())/6) *sqrt( pow((2*fvc::grad(U).ref().component(tensor::XX))-(2*fvc::grad(U).ref().component(tensor::YY)),2) + pow((2*fvc::grad(U).ref().component(tensor::YY))-(2*fvc::grad(U).ref().component(tensor::ZZ)),2) + pow((2*fvc::grad(U).ref().component(tensor::ZZ))-(2*fvc::grad(U).ref().component(tensor::XX)),2) + 6*pow((fvc::grad(U).ref().component(tensor::XY) + fvc::grad(U).ref().component(tensor::YX)),2) + 6*pow((fvc::grad(U).ref().component(tensor::XZ) + fvc::grad(U).ref().component(tensor::ZX)),2) + 6*pow((fvc::grad(U).ref().component(tensor::YZ) + fvc::grad(U).ref().component(tensor::ZY)),2) ) + fvOptions(D) ); But when I apply it to a simple pipe flow (straight converging pipe), it spits out following error: Code:
--> FOAM FATAL ERROR: [D[0 0 -1 1 0 0 0] ] + [(sqrt((nu|6))*sqrt((((((pow(((2*grad(U).component(0))-(2*grad(U).component(4))),2)+pow(((2*grad(U).component(4))-(2*grad(U).component(8))),2))+pow(((2*grad(U).component(8))-(2*grad(U).component(0))),2))+(6*pow((grad(U).component(1)+grad(U).component(3)),2)))+(6*pow((grad(U).component(2)+grad(U).component(6)),2)))+(6*pow((grad(U).component(5)+grad(U).component(7)),2)))))[0 1 -1.5 0 0 0 0] ] From void Foam::checkMethod(const Foam::fvMatrix<Type>&, const Foam::DimensionedField<Type, Foam::volMesh>&, const char*) [with Type = double] in file /opt/OpenFOAM/OpenFOAM-v2006/src/finiteVolume/lnInclude/fvMatrix.C at line 1352. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::exitOrAbort(int, bool) at ??:? #2 void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam::DimensionedField<double, Foam::volMesh> const&, char const*) at ??:? #3 ? at ??:? #4 ? at ??:? #5 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 #6 ? at ??:? Aborted (core dumped) |
|
March 7, 2021, 20:45 |
|
#23 | |
Senior Member
Alejandro
Join Date: Jan 2014
Location: Argentina
Posts: 128
Rep Power: 12 |
Quote:
|
||
March 7, 2021, 21:27 |
|
#24 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
Ok, thanks;
It seems like I am not gonna give up asking questions :-) Based on what you said, assuming that D in my case is unitless, I cannot use a scalar as a source term in my right hand side, because a scalar is unitless, while the left hand side would have a unit of 1/time, right? Meaning that I should first define a dimensioned scalar with the unit of 1/time and then use it in the right hand side as a source term, right? |
|
March 8, 2021, 18:10 |
|
#25 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
I wanted to thank you both, Alejandro and Andrea for your help guys;
My new solver with a scalar transport equation is compiling fine and my sample pipe flow simulation runs successfully. |
|
March 9, 2021, 11:00 |
|
#26 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
Hi Alejandro (ancolli);
I have a question about the dimensions in OpenFOAM, related to my new solver discussed here; Say I have a scalar transport equation (transported scalar is D) with zero diffusion (so pure convection), that has a source term which has the form: Source = C * (mag(U))^0.185 Note that this source term has been obtained experimentally and thus the C and 0.185 are empirical constants. What I would do is to set the dimension of D as (assuming C is unitless): [0 0.185 1.185 0 0 0 0] to make sure both RHS and LHS of the transport eqn are of the same dimension. (Note that the LHS would have the dimension of D divided by time) The solver compiles fine and I can successfully run it on a sample pipe flow. The problem starts when I want to load it up in paraview. Paraview doesn't like this dimension in D file (i.e. [0 0.185 1.185 0 0 0 0]). How can I work around it? |
|
March 21, 2021, 18:40 |
|
#27 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
If you write your own code for the source term, you could e.g. use the value() method to get dimensionless cell values. Or you access the fields e. g. as volScalarField which neither does have dimension.
Or you change your equation to Source = C * (mag(U)/C2)^0.185 with C2 being a uniformDimensionedScalarField. See https://github.com/OpenFOAM/OpenFOAM...sionedFields.H |
|
March 21, 2021, 18:59 |
|
#28 | |
Senior Member
Alejandro
Join Date: Jan 2014
Location: Argentina
Posts: 128
Rep Power: 12 |
Quote:
U can not assume that C is unitless... u should give dimensions to C. Then paraview will not complain, and like this ur problem is well posed const dimensionedScalar C("C",dimensionSet(kg,m,s,K,mol,A,cd), 1000);//[kg m s K mol A cd] C = 1000 |
||
February 4, 2022, 15:08 |
|
#29 |
New Member
Join Date: Dec 2016
Posts: 5
Rep Power: 9 |
I have case where I want to specify a volumetric heat source (W/m3) as a function of space say heSource[i] = 1.0*x[i]*V[i]; I am trying to see if there is a way to integrate the volumetric heat source over volume so that I know what the total power is in Watts.
|
|
October 14, 2022, 10:48 |
|
#30 |
New Member
Ujjwal
Join Date: Sep 2022
Posts: 1
Rep Power: 0 |
Hey can,anybody help me to have source term as a function of space in laplacian foam
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Tabulated thermophysicalProperties library | chriss85 | OpenFOAM Community Contributions | 62 | October 2, 2022 03:50 |
Source Term due to evaporation in energy transport equation | styleworker | OpenFOAM Programming & Development | 3 | September 7, 2022 03:09 |
polynomial BC | srv537 | OpenFOAM Pre-Processing | 4 | December 3, 2016 09:07 |
"parabolicVelocity" in OpenFoam 2.1.0 ? | sawyer86 | OpenFOAM Running, Solving & CFD | 21 | February 7, 2012 11:44 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 01:24 |