|
[Sponsors] |
April 14, 2022, 04:54 |
Reading Source-term Data From a Text File
|
#1 |
New Member
Gaurav
Join Date: Jul 2013
Location: India
Posts: 25
Rep Power: 13 |
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.
|
|
April 14, 2022, 11:55 |
|
#2 |
Member
na
Join Date: Jul 2018
Posts: 90
Rep Power: 8 |
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 |
|
May 30, 2022, 05:17 |
Changes Made in SU2 Source-Code
|
#3 |
New Member
Gaurav
Join Date: Jul 2013
Location: India
Posts: 25
Rep Power: 13 |
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 |
|
Tags |
file reading, incompressible flows, source term, su2 |
|
|
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 |