CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Very Imortant for every one using OpenFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 24, 2010, 06:02
Post "nu" term in UEqn
  #1
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 16
T.D. is on a distinguished road
1- Is how to change the "nu" in the icOFoam solver to a new one nu_new that depends on another scalarField C which also to be solved.
For example:

In UEqn i have the "fvm::laplacian(nu, U)"
but i need to put nu = 1-C/5;
where C is another Scalarfield to be solved after PISO loop in the C_scalar_Equation:

solve
(
ddt(C)+div(phi,C)=div(J);
)

2-How to do if i need to define the BC for the C field, where one of the patches is (J=0), J exists in the C_scalar_Equation and it is a vectorField.

3-Does in the PISO loop , it does for just one dt, or it does it for all, so if at each time step i want to update my C, it is OK to solve C_scalar_Equation after the PISO loop, or what?

thanks a lot

Last edited by T.D.; September 27, 2010 at 06:02.
T.D. is offline   Reply With Quote

Old   September 24, 2010, 11:55
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21
marupio is on a distinguished road
1. I don't have the source handy right now but I believe fvm::laplacian can take the first argument as either a scalar or a volScalarField.

I would define nu_new as a volScalarField, according to your equation there. You will run into dimensional problems... what are the dimensions of C? If C has dimensions, you also have to give dimensions to the "1" in the 1-5/C equation. You could do an ugly work around with a dimensionless C using:

Code:
// nu_new is created previously
    dimensionSet nu_newDims(nu_new.dimensions());
    nu_new.dimensions().reset(dimless);
    nu_new = 1 - 5 / C;
    nu_new.dimensions().reset(nu_newDims);
Also, I think the 1-5/C part needs to change... I think the 1 needs to be something with pTraits:ne, or something like that (again, no source in front of me at the moment).

2 - Depends on the physics. If it is a scalar, just use zeroGradient, unless it is an inlet, then use a value you expect from the freestream.

3 - Not sure what you mean. You can do anything you want just before the runTime.write(), and you shouldn't interfere with the PISO loop.
marupio is offline   Reply With Quote

Old   September 24, 2010, 12:32
Default Hi
  #3
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 16
T.D. is on a distinguished road
Quote:
Originally Posted by marupio View Post
1. I don't have the source handy right now but I believe fvm::laplacian can take the first argument as either a scalar or a volScalarField.

I would define nu_new as a volScalarField, according to your equation there. You will run into dimensional problems... what are the dimensions of C? If C has dimensions, you also have to give dimensions to the "1" in the 1-5/C equation. You could do an ugly work around with a dimensionless C using:

Code:
// nu_new is created previously
    dimensionSet nu_newDims(nu_new.dimensions());
    nu_new.dimensions().reset(dimless);
    nu_new = 1 - 5 / C;
    nu_new.dimensions().reset(nu_newDims);
Also, I think the 1-5/C part needs to change... I think the 1 needs to be something with pTraits:ne, or something like that (again, no source in front of me at the moment).

2 - Depends on the physics. If it is a scalar, just use zeroGradient, unless it is an inlet, then use a value you expect from the freestream.

3 - Not sure what you mean. You can do anything you want just before the runTime.write(), and you shouldn't interfere with the PISO loop.

Hi

really, my nu_new has the dimension of another predefined dimensionedScalar nu0, where nu_new=nu0*(1-5/C), and my C is dimensionless volScalarField, so can i multiply a dimensinedScalar term with another dimensoinless volScalarField, knowing later i am going to use the nu_new in the laplacian(nu_new,U)
??
What about using a new viscosityModel and implement it, that you advice? it is better, but if it can be solved without that it will be much more easier to me.

thanks a lot
T.D. is offline   Reply With Quote

Old   September 25, 2010, 17:22
Default
  #4
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Using appropriate titles makes me more willing to answer...

Btw, you asked the same question in another thread already.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   September 26, 2010, 15:34
Post nu as function of another field in UEqn, + BC problem
  #5
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 16
T.D. is on a distinguished road
Hi
execuse me for my repetition in other threads, and sorry for my titles
but the reason is that i am new here, and i am excited to learn


anyway thanks a lot, thank you so much alberto
I tried what you told me for nuEff, but i did not understand what you said about to Update nuEff?
so, i attached all my code, can you please just look at, and check if ok? thanks

I have another questions concerning , my term J, how can i apply a Patch for "c" but that depends on "J" value, for example BC for a wall for "c" field is [J=0]

Does My "c" field" in the code, is going to be updated at each dt?

Thanks a lot

T.D.

Quote:
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.

Application
icoFoam

Description
Transient solver for incompressible, laminar flow of Newtonian fluids.

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "setRootCase.H"

#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

#include "readPISOControls.H"
#include "CourantNo.H"



scalar cm=0.68;

scalar alpha=2;

scalar Kn=0.75;



volScalarField nuEff
(
IOobject
(
"nuEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
nu
);

nuEff = nu * pow((1-(c/cm)),-2);

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nuEff, U)
);


solve(UEqn == -fvc::grad(p));

// --- PISO loop

for (int corr=0; corr<nCorr; corr++)
{
volScalarField rUA = 1.0/UEqn.A();

U = rUA*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);

adjustPhi(phi, U, p);

for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUA, p) == fvc::div(phi)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();

if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}

#include "continuityErrs.H"

U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();







}



volTensorField Gr=fvc::grad(U);
volSymmTensorField E = symm(Gr);
gammadot = sqrt( (2*(E && E)) );



tensor Q(1.0, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, 0.0, 0.5);



volScalarField B=-nu*Kn*sqr(c/cm)*pow((1-(c/cm)),-2);
volTensorField SigmaL = (B * gammadot * Q);


volScalarField C=2*nu*(1-pow((1-(c/cm)),-2));
volSymmTensorField SigmaR = (C * E);


volTensorField SigmaP = (SigmaL + SigmaR);


volScalarField A = ((2*sqr(a))/(9*nu))*(1-(c/cm))*pow((1-c),alpha-1);

volVectorField J = A*fvc::div(SigmaP);

//My Transport Equation
solve
(
fvm::ddt(c) + fvm::div(phi,c) == -fvc::div(J)
);







runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return 0;
}


// ************************************************** *********************** //

Last edited by T.D.; September 26, 2010 at 18:12. Reason: add something+
T.D. is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 05:36
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 3 September 8, 2010 06:25
Modified OpenFOAM Forum Structure and New Mailing-List pete Site News & Announcements 0 June 29, 2009 05:56
Adventure of fisrst openfoam installation on Ubuntu 710 jussi OpenFOAM Installation 0 April 24, 2008 14:25
OpenFOAM Debian packaging current status problems and TODOs oseen OpenFOAM Installation 9 August 26, 2007 13:50


All times are GMT -4. The time now is 03:39.