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

Judge the value of div(U)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 25, 2022, 05:08
Default Judge the value of div(U)
  #1
New Member
 
Madong
Join Date: Jan 2021
Posts: 4
Rep Power: 5
Mdong is on a distinguished road
Hi,everyone
According to the sign of div(U), I want to choose different viscosity coefficients(mu) in rhoCentralFoan. But I compiled it and found that the judgment didn't work.Please give me some advice.
Thanks

This is my way:add volScalarField divU and D in createFields.H,then use divU and D in rhoCentralFoam.C
//add div(U)

volScalarField divU
(
IOobject
(
"divU",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
fvc::div(U)
);

volScalarField D
(
IOobject
(
"D",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("D", dimless, 1.0)
);

//
//Judge the divergence of velocity

forAll(divU,totCells)
{
if(divU[totCells] < 0.0)
{
D[totCells]= 1;
}
else
{
D[totCells]= 2;
}
}

//chose diffirent muEff
volScalarField muEff("muEff", D*turbulence->muEff());
volTensorField tauMC("tauMC", muEff*dev2(Foam::T(fvc::grad(U))));
Attached Files
File Type: h createFields.H (1.9 KB, 0 views)
File Type: c rhoCentralFoam.C (8.2 KB, 0 views)
Mdong is offline   Reply With Quote

Reply


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
postProcess div(U) jagan1mohan OpenFOAM 1 July 5, 2020 05:37
Incompressible div(U) validation errors steampunc OpenFOAM Post-Processing 5 April 21, 2020 04:00
[OpenFOAM] Take derivative of mean velocity in paraFoam hiuluom ParaView 13 April 26, 2016 06:44
Derivative of velocity and mean velocity hiuluom OpenFOAM Post-Processing 1 May 29, 2015 23:42
Reducing div(U) in PIMPLE algorithm hrushi.397 OpenFOAM Running, Solving & CFD 0 April 19, 2015 05:12


All times are GMT -4. The time now is 10:00.