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

Reading Source-term Data From a Text File

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2022, 04:54
Default Reading Source-term Data From a Text File
  #1
New Member
 
Gaurav
Join Date: Jul 2013
Location: India
Posts: 25
Rep Power: 13
gaurav11 is on a distinguished road
Hi. I am working on a research project. I need to add a spatially varying source term in the X-momentum equation, for incompressible Navier-Stokes simulation. What I want to do is to run a loop over all the points and add a different source term at each point. The source term data has to be read from a file. Could anyone please help me to understand what part of SU2 code I need to modify to achieve this? Thank You.
gaurav11 is offline   Reply With Quote

Old   April 14, 2022, 11:55
Default
  #2
Member
 
na
Join Date: Jul 2018
Posts: 90
Rep Power: 8
TKatt is on a distinguished road
Hi gaurav11,


do you try to model fully developed flow (or: streamwise periodic flow) by any chance? That feature would already exist.


But otherwise, source terms are implemented in flow_sources.cpp and are called in CIncEulerSolver.cpp::Source_Residual. A loop goes over all points in the domain and calls a ComputeResidual function (which is implemented in flow_sources.cpp) that computes the Residual contribution for that specific point. For a quick proof-of-concept you might want to read your file in that CIncEulerSolver.cpp::Source_Residual and just compute and set the Residual contribution right there without the flow_sources stuff.. might make it bit easier to handle as a first try.


Hope that helps a little bit, Tobi
TKatt is offline   Reply With Quote

Old   May 30, 2022, 05:17
Default Changes Made in SU2 Source-Code
  #3
New Member
 
Gaurav
Join Date: Jul 2013
Location: India
Posts: 25
Rep Power: 13
gaurav11 is on a distinguished road
Hi Tobi,

I have made some changes to the SU2 source code for solving my problem. I have attached here a file containing the changes. Regarding the loop over all points in the domain in CIncEulerSolver.cpp, should I get the global point index?

My understanding is that the loop is running over all the volume and "iPoint" refers to the index of the volume in the ongoing loop iteration, so distribution over the processor will still refer to the right index. Is it correct?

Also, is it possible to use the new source-term values in the adjoint solver? I need to optimize the source-term values at each grid point using the following procedure.

1. Guess source values at grid points.
2. Run a RANS solution
3. Compare the RANS velocity field with the measured field
4. Use loss function = (u_rans-u_measure)^2
5. Use adjoint optimization to get the updated source field
6. Repeat 2-5 until convergence (Loss<set_threshold)

Thank You
Attached Files
File Type: pdf Changes made in su2 source-code-compressed.pdf (178.6 KB, 9 views)
gaurav11 is offline   Reply With Quote

Reply

Tags
file reading, incompressible flows, source term, su2


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
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 02:22
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 12:32
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 04:23
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 13:41
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59


All times are GMT -4. The time now is 13:22.