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

Defining a new constant field

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By dlahaye

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 2, 2024, 22:16
Question Defining a new constant field
  #1
New Member
 
Andrew Arnold
Join Date: Apr 2024
Posts: 10
Rep Power: 2
instanton is on a distinguished road
Hi everyone-

I'm using OF v2312 buoyantBoussinesqPimpleFoam, and I would like to add a drag term to the momentum equation dependent on velocity with spatially-varying coefficients.

I've been successful in implementing a spatially-uniform drag term that depends on velocity through codedSource in fvOptions, and I believe I know how to implement spatial dependence as well. However, I think it would be useful to define constant scalar fields (D1, D2, etc., for the coefficients of the first-degree term in velocity, second-degree, etc.) for the purpose of visualization and data-logging. The idea is to take in Fourier coefficients describing the scalar fields and use them to initialize the coefficient fields.

I'm open to the prospect of modifying source code, particularly the createFields.H file, but I would appreciate feedback regarding the best approach here--is this a necessary step? In the future, I'm also interested in adding spatially-varying thermal-diffusivity, as well, so I figure this general approach will be useful for tackling that problem.


Thoughts? Thanks.
instanton is offline   Reply With Quote

Old   July 3, 2024, 07:40
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
In similar cases in which the additional field does *not* affect computations and serves visualization purpose *only*, we found it more convenient to seek ways to perform visualisation in Paraview.
instanton likes this.
dlahaye is offline   Reply With Quote

Old   July 3, 2024, 19:04
Default
  #3
New Member
 
Andrew Arnold
Join Date: Apr 2024
Posts: 10
Rep Power: 2
instanton is on a distinguished road
Hi dlahaye-


Thanks for the advice. The additional field does affect computations by providing a source term to the momentum equation; and later, I hope to extend the spatial-heterogeneity to include material properties, as well, so the field will enter the equations in a more substantive way as a coefficient instead of an additive term.


I'm proceeding with modifying the source code following the examples of the OpenFOAM Technology Primer--at any rate, it's helping me learn OpenFOAM on a deeper level.


Any further advice will be greatly appreciated, but I might return with more specific questions rather than seeking general guidance.


Cheers
instanton is offline   Reply With Quote

Reply

Tags
createfields.h, fvoptions


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
problems after decomposing for running alessio.nz OpenFOAM 7 March 5, 2021 05:49
[swak4Foam] swakExpression not writing to log alexfells OpenFOAM Community Contributions 3 March 16, 2020 19:19
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
problem in defining the field 13msmemusman OpenFOAM Programming & Development 14 March 18, 2015 13:49
Defining pressure field function aniramzee STAR-CCM+ 0 March 12, 2013 11:41


All times are GMT -4. The time now is 16:24.