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

how to dump individual components of a vector

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 24, 2013, 16:57
Default how to dump individual components of a vector
  #1
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 199
Rep Power: 7
nandiganavishal is on a distinguished road
Hello All,

I would like to know if it is possible to get the scalar values of a vector during the course of a simulation. For instance, I would like to dump the individual scalar velocity fields Ux, Uy, Uz, of the velocity vector U on the fly as the simulation runs. I understand that the "foamCalc components U" does this after the simulation is complete. Please let me know if there is any inbuilt utility in OF. I have been trying to implement this for a while now.

Thanks

Regards
Vishal
nandiganavishal is offline   Reply With Quote

Old   March 24, 2013, 17:17
Default
  #2
Senior Member
 
Omkar Champhekar
Join Date: Nov 2009
Location: Ann Arbor, Michigan
Posts: 135
Rep Power: 6
doubtsincfd is on a distinguished road
Add this somewhere in your solver:

volScalarField Ux
(
IOobject
(
"Ux",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
U.component(vector::X)
);

Same for other two components
doubtsincfd is offline   Reply With Quote

Old   March 24, 2013, 17:18
Default
  #3
Senior Member
 
Omkar Champhekar
Join Date: Nov 2009
Location: Ann Arbor, Michigan
Posts: 135
Rep Power: 6
doubtsincfd is on a distinguished road
refer the file write.H in the laplacianFoam solver
doubtsincfd is offline   Reply With Quote

Old   March 24, 2013, 17:25
Default
  #4
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 199
Rep Power: 7
nandiganavishal is on a distinguished road
Thanks very much, Omkar.

Regards
Vishal
nandiganavishal is offline   Reply With Quote

Old   March 24, 2013, 18:58
Default
  #5
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 199
Rep Power: 7
nandiganavishal is on a distinguished road
Hi Omkar,

I am looking to implementing the following Neumann boundary condition for the velocity on the walls of a surface

du/dy = A*E_x, where E_x is the x-compoment of the electric Field which is obtained by solving another PdE and A is a constant.

Now, from your earlier suggestion, I was able to extract E_x at every time step on the fly, I would like to know how to implement the above boundary condition in OF. Please let me know if you have any suggestions.

Thanks

Regards
Vishal
nandiganavishal is offline   Reply With Quote

Old   March 26, 2013, 08:57
Default
  #6
Senior Member
 
Omkar Champhekar
Join Date: Nov 2009
Location: Ann Arbor, Michigan
Posts: 135
Rep Power: 6
doubtsincfd is on a distinguished road
I have not done this before, but I can say you might have to modify the fixedGradient bc (is du/dy the normal gradient on the surface?)

swak4FOAM might be able to implement this, but I am not sure if groovyBC reads non-standard variables. If groovyBC works, then that's the easiest way.

I can give it a shot over the weekend if you can upload or mail your files.
doubtsincfd is offline   Reply With Quote

Old   March 26, 2013, 11:03
Default
  #7
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,649
Rep Power: 36
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by doubtsincfd View Post
I have not done this before, but I can say you might have to modify the fixedGradient bc (is du/dy the normal gradient on the surface?)

swak4FOAM might be able to implement this, but I am not sure if groovyBC reads non-standard variables. If groovyBC works, then that's the easiest way.

I can give it a shot over the weekend if you can upload or mail your files.
Not sure what "non-standard variable" is. If it is a field and it is in memory (groovyBC doesn't read fields from disc - at least that is not the standard-behaviour) then groovyBC can access it by its name
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 26, 2013, 11:26
Default
  #8
Senior Member
 
Omkar Champhekar
Join Date: Nov 2009
Location: Ann Arbor, Michigan
Posts: 135
Rep Power: 6
doubtsincfd is on a distinguished road
Thanks, Bernhard. I guess then groovyBC will be able to do it.

By non-standard, I meant field variables that are not present in the standard package of openfoam i.e. user-defined field field variables
doubtsincfd is offline   Reply With Quote

Old   March 26, 2013, 13:35
Default
  #9
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,649
Rep Power: 36
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by doubtsincfd View Post
Thanks, Bernhard. I guess then groovyBC will be able to do it.

By non-standard, I meant field variables that are not present in the standard package of openfoam i.e. user-defined field field variables
As long as their name is unique and they are registered with the mesh (it is rather hard NOT to register them) groovyBC should find them
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 27, 2013, 00:21
Default
  #10
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 199
Rep Power: 7
nandiganavishal is on a distinguished road
Quote:
Originally Posted by doubtsincfd View Post
I have not done this before, but I can say you might have to modify the fixedGradient bc (is du/dy the normal gradient on the surface?)

swak4FOAM might be able to implement this, but I am not sure if groovyBC reads non-standard variables. If groovyBC works, then that's the easiest way.

I can give it a shot over the weekend if you can upload or mail your files.
Hi Omkar,

"is du/dy the normal gradient on the surface?"

Yes, it is the normal gradient.

Attached please find the source code along with the solver conditions. In the initial guess ("0") folder, I would like to implement the following boundary condition on the DNAupperwall and DNAlower wall (the geometry is given in blockMesh file)for the velocity.

du/dy (normal to the surface) = -Ex*gamma, where gamma = -2.2164

Please let me know, how to implement this.

Thanks a lot for the help.

Regards
Vishal
Attached Files
File Type: zip DNA_solve.zip (11.5 KB, 1 views)
File Type: zip DNAFoam.zip (9.5 KB, 1 views)
nandiganavishal is offline   Reply With Quote

Old   April 2, 2013, 22:19
Default
  #11
Senior Member
 
Omkar Champhekar
Join Date: Nov 2009
Location: Ann Arbor, Michigan
Posts: 135
Rep Power: 6
doubtsincfd is on a distinguished road
Hello,

Sorry for the late reply. I could achieve what you want by using groovyBC.
You will have to install swak4Foam first though.

Follow these steps:
1. untar
2. run blockMesh and DNAFoam (I have changed the timestep and endtime. Also add the ".so" files entry in controlDict) (ux gradient will be set equal to x-component of electrical field. you can modify the expression as you want)
3. run "wallGradU"
4. run "sample" (check out system/sampleDict) This will write electricField values, and value of wall gradients for the DNAupperwall patch in surfaces folder
5. Check the two values. The must be same (except for the sign)

Let me know if this helps or you need anything otherwise
Attached Files
File Type: gz DNA_solve_bc.tar.gz (7.5 KB, 2 views)
doubtsincfd is offline   Reply With Quote

Old   April 4, 2013, 00:20
Default
  #12
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 199
Rep Power: 7
nandiganavishal is on a distinguished road
Quote:
Originally Posted by doubtsincfd View Post
Hello,

Sorry for the late reply. I could achieve what you want by using groovyBC.
You will have to install swak4Foam first though.

Follow these steps:
1. untar
2. run blockMesh and DNAFoam (I have changed the timestep and endtime. Also add the ".so" files entry in controlDict) (ux gradient will be set equal to x-component of electrical field. you can modify the expression as you want)
3. run "wallGradU"
4. run "sample" (check out system/sampleDict) This will write electricField values, and value of wall gradients for the DNAupperwall patch in surfaces folder
5. Check the two values. The must be same (except for the sign)

Let me know if this helps or you need anything otherwise

Thanks, very much Omkar. I will have a look and would get back to you soon.

Thanks

Regards
Vishal
nandiganavishal is offline   Reply With Quote

Old   April 17, 2013, 01:24
Default
  #13
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 199
Rep Power: 7
nandiganavishal is on a distinguished road
Hi Omkar,

I would like to create the following geometry in openfoam.

A small circular hole is drilled through a block (cuboid in shape). Can you give me a heads up on how to create such a geometry in openfoam.

Thanks

Vishal
nandiganavishal 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
how to set periodic boundary conditions Ganesh FLUENT 13 January 22, 2014 04:11
How to define the list of vector when a vector has n components fumiya OpenFOAM 1 October 26, 2012 04:10
UDF for wall slipping HFLUENT Fluent UDF and Scheme Programming 0 April 27, 2011 12:03
Normal vector, slope and aspect angle g_niro Main CFD Forum 0 February 2, 2011 17:24
How to find the components of normal vector coul FLUENT 0 July 30, 2004 12:13


All times are GMT -4. The time now is 09:08.