CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

new scalar field in dynSmagorinsky

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 18, 2011, 17:51
Default new scalar field in dynSmagorinsky
  #1
New Member
 
Matt James
Join Date: Jun 2010
Location: Marinette,WI, USA
Posts: 25
Rep Power: 7
mdjames is on a distinguished road
Hi all,

This seems like it could be really easy for some of you here... However, it evades me.

I'm trying to declare a scalar field, I'll call it "j", within dynSmagorinsky.C

I'd like to solve a transport equation for j, so i just need some way to define initial and boundary conditions. The rest of the code seems to compile fine...just not this seemingly mundane detail.

I tried letting an H file open it up but it seems to complain about not knowing anything about the mesh, which i suppose makes sense to me. Correcting that problem was leading me down a dark and winding path. I thought surely there's an elegant way.

Can anyone help me out here?

Thanks a lot!
mdjames is offline   Reply With Quote

Old   January 20, 2011, 06:03
Default
  #2
Senior Member
 
Nakul
Join Date: Apr 2010
Location: India
Posts: 147
Rep Power: 7
nakul is on a distinguished road
Hi,

All such changes to field are made when they are defined in createFields.H

Define your scalar field in this file just the way p or T are defined and everything should work fine.
nakul is offline   Reply With Quote

Old   January 20, 2011, 16:14
Default
  #3
New Member
 
Matt James
Join Date: Jun 2010
Location: Marinette,WI, USA
Posts: 25
Rep Power: 7
mdjames is on a distinguished road
Nakul,

Thank you very much for your reply.

I would agree, and have done this when adding a field to solver. However, the fields in the dynSmagorinsky model code are generated within the code, since they are derived from the U and k fields. The problem thus arises in establishing a new field within the code. In short, there is no createFields.H included in dynSmagorinsky.C . Also, I tried to include a new H file to accomplish what createFields.H does in a solver, but to no avail.

dynSmagorinsky.C includes dynSmagorinsky.H, which appears to collect the U, phi and k fields from somewhere (eventually the solver?). So, it seems I should be similarly declaring my new volScalarField here.

Any thoughts?
mdjames is offline   Reply With Quote

Old   January 21, 2011, 03:34
Default
  #4
Member
 
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 7
tonyuprm is on a distinguished road
Hi Matt,

I'm not sure how to do a scalar field, but this is how you can do a volVectorField:


volVectorField j
(
IOobject
(
"j",
U.time().constant(),
U.mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
U.mesh(),
dimensionedVector("j",dimForce/dimVolume/dimDensity,vector::zero)
);

Hope this helps you out.

Tony
tonyuprm is offline   Reply With Quote

Old   January 21, 2011, 10:40
Default
  #5
Senior Member
 
Nakul
Join Date: Apr 2010
Location: India
Posts: 147
Rep Power: 7
nakul is on a distinguished road
Hi

I don't have this model in my version of OF so if you could just upload the source code of this solver and point out your problem, I'll have a look.
nakul is offline   Reply With Quote

Old   January 27, 2012, 18:06
Default
  #6
New Member
 
David Theriault
Join Date: Jan 2012
Posts: 5
Rep Power: 5
Davidlt is on a distinguished road
Hi Matt & everyone

I was wondering if you have succeeded on what you're looking for. I'm also interested to add a new scalarfield in a sgs model which is computed by the solver and refreshed for each time step. So if you have any thoughts...

Thx
Davidlt is offline   Reply With Quote

Old   January 30, 2012, 05:02
Default
  #7
Member
 
Dejan Morar
Join Date: Nov 2010
Posts: 78
Rep Power: 7
morard is on a distinguished road
Hi everyone.

Matt and David, I hope that you are succeeded up to now, but if you are not,
this is the way how I did it.

In .H file of your model I just added a new function:

dimensionedScalar c1(const volSymmTensorField& D) const;

and then in .C

dimensionedScalar nameOfYourModel::c1(const volSymmTensorField& D) const
{
.... some code
}

At each time step I calculate c1, use this value to calculate some other variables
which are later used for temperature equation...

Maybe you can use something similar to this...
morard is offline   Reply With Quote

Old   January 31, 2012, 16:56
Default
  #8
New Member
 
David Theriault
Join Date: Jan 2012
Posts: 5
Rep Power: 5
Davidlt is on a distinguished road
Thank you for the answer.

But unfortunately, the scalarfield needed is computed by the solver and not in the sgs library itself. So I concluded that I need to modify LESModel.H and GenEddyVisc.H to transfer the information between the solver and the libraries used.

I'll try this.

David
Davidlt is offline   Reply With Quote

Old   February 1, 2012, 03:28
Default
  #9
Member
 
Dejan Morar
Join Date: Nov 2010
Posts: 78
Rep Power: 7
morard is on a distinguished road
No problem, it is straightforward.
First you have to add scalar field to turbulenceModel (add new variable, change constructor,...), then adjust LESModel, GenEddyVisc and finally your own model.
Maybe also something else but I cannot remember at the moment.

Just copy the whole folder (incompressible or compressible), change name, and
inside you can do whatever you want...

Dejan
morard is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dieselFoam problem!! trying to introduce a new heat transfer model vivek070176 OpenFOAM Programming & Development 10 December 24, 2014 00:48
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51
from a vecor field to get a gradient of scalar dusky.he Main CFD Forum 4 March 30, 2007 09:08
How to create a vector field out of scalar fields anja OpenFOAM Pre-Processing 7 May 31, 2006 11:56


All times are GMT -4. The time now is 14:49.