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

Hydrodynamic coupling between FNPF and CFD modules in REEF3D

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By FelixD

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 17, 2022, 08:10
Question Hydrodynamic coupling between FNPF and CFD modules in REEF3D
  #1
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
G'day,

Thanks for reading my post!

I am trying to do a simple 2D simulation of waves in an empty numerical wave tank as per Wang et al. in the paper: Hydrodynamic Coupling of Viscous and Nonviscous Numerical Wave Solutions Within the Open-Source Hydrodynamics Framework REEF3D).

I have managed to run the potential flow solver successfully but am unsure of how to incorporate this into the CFD module and what files are required from the FNPF simulation.

The output files/folders I have from the FNPF simulation are:
DIVEMesh_Decomp (folder)
DIVEMesh_log (folder)
DIVEMesh_Paraview (folder)
REEF3D_FNPF_VTP_BED (folder)
REEF3D_FNPF_VTU (folder)
REEF3D_FNPF_WSF (folder)
REEF3D_FNPF_WSFLINE (folder)
REEF3D_FNPF_WSFLINE_Y (folder)
grid-000001
grid-000002
grid-000003
grid-000004

The CFD control.txt file I am using is:
C 11 6
C 12 3
C 13 3
C 14 7
C 15 21
C 16 3

B 1 0.04
B 10 0.0 40.0 0.0 0.1 0.0 4.0

H 10 4
H 21 60.0
H 22 0.0
H 23 0.0
H 31 100
H 32 180

M 10 4
M 20 2

It is not working though as I need to provide some files from the FNPF simulation. I have not been able to work out which files are required in the directory.

Any help is greatly appreciated,
Cheers from Australia!
keshav_20 likes this.
FelixD is offline   Reply With Quote

Old   August 18, 2022, 04:27
Default
  #2
Senior Member
 
Arun Kamath
Join Date: Nov 2014
Location: Trondheim, Norway
Posts: 265
Rep Power: 14
kamath is on a distinguished road
Hi Felix,

For your FNPF input (ctrl.txt), you will need to add
P 40 1
P 41 1

this results in a folder REEF3D_FNPF_State
being printed which has the state files.

Then when you run Divemesh to generate the mesh for the CFD simulation,
add
H 10 4
When you run Divemesh now, it will read the output from the State files from the FNPF output and generate the grid. Here, you can provide just a truncated part of the wave tank using B 10.
Eg. if in FNPF control.txt
B 10 0.0 25.0 0.0 0.5 0.0 1.0
then
the CFD control.txt
B 10 10.0 15.0 0.0 0.5 0.0 1.0
will create a CFD numerical wave tank of only 5 m in the x-direction.

Optional: You can also include
H 31 start_time
H 32 end_time

This will create the input only between these times, without this the entire FNPF simulation is available for coupling (but will take longer to form the grid and input).
Successful run will result in a folder REEF3D_HDC_Input.

In the CFD ctrl.txt then,

use
B 92 61 (to generate waves based on the hydrodynamic information in the state files)
B 98 4 (relaxation method also works, but you have more "inactive cells" in the CFD NWT reserved for wave gen, which defeats the purpose somewhat)

I 30 1 (fully initialises the CFD NWT based on FNPF state at start_time)
I 241 start_time

Now run REEF3D.

Hope that helps










I will add a set of files to the github tutorials folder soon.
__________________
Arun
X years with REEF3D
kamath is offline   Reply With Quote

Old   August 18, 2022, 05:51
Default
  #3
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Wow! Thank you so much for the very detailed response Arun.

That is very helpful and more than I could have hoped for. Fingers crossed I'll be able to get it all working now!
FelixD is offline   Reply With Quote

Old   August 19, 2022, 04:23
Default
  #4
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Quote:
Originally Posted by kamath View Post
Hi Felix,

For your FNPF input (ctrl.txt), you will need to add
P 40 1
P 41 1

this results in a folder REEF3D_FNPF_State
being printed which has the state files.

Then when you run Divemesh to generate the mesh for the CFD simulation,
add
H 10 4
When you run Divemesh now, it will read the output from the State files from the FNPF output and generate the grid. Here, you can provide just a truncated part of the wave tank using B 10.
Eg. if in FNPF control.txt
B 10 0.0 25.0 0.0 0.5 0.0 1.0
then
the CFD control.txt
B 10 10.0 15.0 0.0 0.5 0.0 1.0
will create a CFD numerical wave tank of only 5 m in the x-direction.

Optional: You can also include
H 31 start_time
H 32 end_time

This will create the input only between these times, without this the entire FNPF simulation is available for coupling (but will take longer to form the grid and input).
Successful run will result in a folder REEF3D_HDC_Input.

In the CFD ctrl.txt then,

use
B 92 61 (to generate waves based on the hydrodynamic information in the state files)
B 98 4 (relaxation method also works, but you have more "inactive cells" in the CFD NWT reserved for wave gen, which defeats the purpose somewhat)

I 30 1 (fully initialises the CFD NWT based on FNPF state at start_time)
I 241 start_time

Now run REEF3D.

Hope that helps










I will add a set of files to the github tutorials folder soon.
Hello Arun,

I have followed your instructions and have been able to generate the state files after the FNPF simulations and the ./DiveMESH command runs without error on the CFD control.txt file without any errors and generates a REEF3D_CFD_HDC_Input directory. However, when running the ctrl.txt file for the CFD HDC simulation, after the first iteration, all velocities become very large and I receive the message:
EMERGENCY STOP -- velocities exceeding critical value N 61

I have tried making a number of changes to my ctrl file yet cannot seem to avoid this error. The FNPF simulation is running without any problems and matches the wave theory closely so I don't think that is the issue. I suspect it is in either or both of my control.txt or ctrl.txt scripts for the CFD HDC simulation.

I will attach the files I am currently using for the CFD HDC simulation.

Any help is greatly appreciated,
Thank you!
Attached Files
File Type: txt control.txt (177 Bytes, 5 views)
File Type: txt ctrl.txt (303 Bytes, 5 views)
FelixD is offline   Reply With Quote

Old   August 19, 2022, 04:32
Default
  #5
Senior Member
 
Arun Kamath
Join Date: Nov 2014
Location: Trondheim, Norway
Posts: 265
Rep Power: 14
kamath is on a distinguished road
Won't be able to fully analyse without your fnpf inputs, but the problem could be with your H 21, 22, 23 calls.
Since you use B 10 from a truncated domain, you don't need to issue those.
Try that, if it still fails, upload the fnpf controls, I can have a look.
__________________
Arun
X years with REEF3D
kamath is offline   Reply With Quote

Old   August 19, 2022, 04:39
Default
  #6
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Thanks Arun,

I'll try that
FelixD is offline   Reply With Quote

Old   August 21, 2022, 22:37
Default
  #7
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Quote:
Originally Posted by kamath View Post
Won't be able to fully analyse without your fnpf inputs, but the problem could be with your H 21, 22, 23 calls.
Since you use B 10 from a truncated domain, you don't need to issue those.
Try that, if it still fails, upload the fnpf controls, I can have a look.
Hi Arun,

I have looked through my H 21, 22 and 23 cells and all seem to mark the correct location of the origin of the CFD domain within the FNPF domain.

I may be wrong here but I tried running my CFD ctrl file without the B 10 command and was met with an error and the mesh could not be generated. I have noticed that the R3D files in my REEF3D_CFD_HDC_Input folder all all 0 KB, except for the 4 input headers, which I am guessing are for each of the 4 processors I am using, which are 93 KB each. I thought that detail was odd.

I have attached a zip file containing my ctrl and control files for the fnpf simulation titled fnpf_files and a zip file containing the same files for the HDC CFD simulation titled cfd_files and hope you can see where I am going wrong here.

Thanks for all the help so far, hopefully I am not far from figuring this one out!

Kind Regards,
Felix
Attached Files
File Type: zip cfd_files.zip (458 Bytes, 6 views)
File Type: zip fnpf_files.zip (411 Bytes, 6 views)
FelixD is offline   Reply With Quote

Old   August 22, 2022, 04:55
Default
  #8
Senior Member
 
Arun Kamath
Join Date: Nov 2014
Location: Trondheim, Norway
Posts: 265
Rep Power: 14
kamath is on a distinguished road
In your fnpf files
(these might effect the quality of the waves)
control.txt: you stretch the grid a little too much.
You could follow an accurate grid stretching based on your input waves as described by Pakozdi et al. 2021.
If not just don't use B 113 more than 2.0 or 3.0

in ctrl.txt, for fnpf simulations N 47 1.0 is just fine (faster as well)

In the CFD input
control.txt

B 1 0.04
B 10 60.0 100.0 0.0 0.04 0.0 4.0
(remember you are running a 2D simulation, y-max= B 1)
H 10 4
H 31 50.0
H 32 150.0

and
ctrl.txt
All that is required for wave generation
B 90 1
B 92 61
B 98 4
B 99 3

Remove F 42, not required.

With these changes, your files work for me.
__________________
Arun
X years with REEF3D
kamath is offline   Reply With Quote

Old   August 24, 2022, 05:27
Default
  #9
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Quote:
Originally Posted by kamath View Post
In your fnpf files
(these might effect the quality of the waves)
control.txt: you stretch the grid a little too much.
You could follow an accurate grid stretching based on your input waves as described by Pakozdi et al. 2021.
If not just don't use B 113 more than 2.0 or 3.0

in ctrl.txt, for fnpf simulations N 47 1.0 is just fine (faster as well)

In the CFD input
control.txt

B 1 0.04
B 10 60.0 100.0 0.0 0.04 0.0 4.0
(remember you are running a 2D simulation, y-max= B 1)
H 10 4
H 31 50.0
H 32 150.0

and
ctrl.txt
All that is required for wave generation
B 90 1
B 92 61
B 98 4
B 99 3

Remove F 42, not required.

With these changes, your files work for me.
Hi Arun,

I have made all of the changes that you have suggested but am now finding an error when running the control.txt file for the CFD model. The error is:

"malloc(): corrupted top size
Aborted (core dumped)"

I have tried every combination of small changes I can make to the scripts and ensured that the EOL conversion is correct but still consistently get this error. Have you seen this before and do you have any ideas what I am doing wrong?

I have again attached zip files of the control and ctrl files I am using.

Again, thank you so much for your ongoing support and help on this problem.

Cheers
Felix
Attached Files
File Type: zip fnpf_files.zip (418 Bytes, 7 views)
File Type: zip cfd_files.zip (439 Bytes, 5 views)
FelixD is offline   Reply With Quote

Old   August 24, 2022, 05:57
Default
  #10
Senior Member
 
Arun Kamath
Join Date: Nov 2014
Location: Trondheim, Norway
Posts: 265
Rep Power: 14
kamath is on a distinguished road
"malloc(): corrupted top size
Aborted (core dumped)"

is a memory allocation problem. Your system doesn't seem to have sufficient RAM for the decomposition.
Somehow this affects the Ubuntu on Windows a lot.

We had recently optimised memory usage for Divemesh recently, so if you don't have the latest RC, please do get that.

If not, I am not sure how much more RAM optimisation we can implement, so for now, you will have to reduce the number of cells.

Another alternative of course is to use a strictly Unix machine (and not through Windows)
__________________
Arun
X years with REEF3D
kamath is offline   Reply With Quote

Old   August 27, 2022, 03:29
Default
  #11
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Quote:
Originally Posted by kamath View Post
"malloc(): corrupted top size
Aborted (core dumped)"

is a memory allocation problem. Your system doesn't seem to have sufficient RAM for the decomposition.
Somehow this affects the Ubuntu on Windows a lot.

We had recently optimised memory usage for Divemesh recently, so if you don't have the latest RC, please do get that.

If not, I am not sure how much more RAM optimisation we can implement, so for now, you will have to reduce the number of cells.

Another alternative of course is to use a strictly Unix machine (and not through Windows)
Thanks for getting back Arun,

Over the last few days, I've been trying alternative methods to reduce the memory required on my laptop but have not had any success yet. I have tried to run Linux on a virtual machine but still get the same 'malloc():' error so I believe I may just not have enough RAM all together.

My computer has 8 GB (6.96 GB) of useable RAM and the most I could run on the virtual machine was about 6GB. I am now trying to get my hands on a computer with more memory and was wondering how much memory you had when you were able to run the simulations successfully as I'll use that as a benchmark.

Kind Regards and thanks again for all the help.

Felix
FelixD is offline   Reply With Quote

Old   September 12, 2022, 20:25
Default Malloc Issue Solved
  #12
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Hi Arun,

Thanks so much for all your help. I've finally managed to make my simulation work.

The memory issue was occurring because the states folder was too large. I was writing the states to the file every 100 iterations and this was far to large for my computer to handle. By reducing the frequency of this I am able to complete the simulations.

Of course reducing this frequency will have a negative effect on accuracy but this is something for me to analyse and optimise.

I have one question about the program. Does the program interpolate between the two states for the CFD simulation or hold the dirichelet boundary constant until the next state is read?

I hope if anyone else has this issue, this thread can be of help.

Cheers,
Felix
FelixD is offline   Reply With Quote

Old   September 13, 2022, 04:33
Default
  #13
Senior Member
 
Arun Kamath
Join Date: Nov 2014
Location: Trondheim, Norway
Posts: 265
Rep Power: 14
kamath is on a distinguished road
Hi Felix,
Yes, of course, the number of files written to state can also be a cause of malloc. I didn't think about it.

Yes, you are correct. The CFD Input produced will interpolate between the state files from fnpf.
I have so far only generated CFD input based on fnpf state printed every iteration. It would be very interesting to see how the results are effected by the "coarser" information in coupled wave generation in the CFD sim.

Let us know
__________________
Arun
X years with REEF3D
kamath is offline   Reply With Quote

Old   September 19, 2022, 02:37
Default
  #14
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Hi Arun,

I have noticed that earlier in this thread you said that the parameter I 242 specifies the start time for the CFD simulation when coupling. This is in the CFD ctrl.txt file.

In the REEF3D guide, it says:
"I 241 double Delta t for FlowFile inflow and hydrodynamic coupling"

I just wanted to double check if this I241 parameter should be the start time (that should correlate to H 31 in DiveMESH), or if it some kind of time step.

Thanks,

Felix
FelixD is offline   Reply With Quote

Old   September 19, 2022, 04:40
Default
  #15
Senior Member
 
Arun Kamath
Join Date: Nov 2014
Location: Trondheim, Norway
Posts: 265
Rep Power: 14
kamath is on a distinguished road
You are correct.
I 241 == H 31
if you want to start your CFD simulation from the point where you have CFD Input from HDC State files.

The H 31 -32 options in DiveMESH help you reduce the file output by extracting CFD Input only for a desired input.

I 241 lets you start the simulation from an arbitrary point. As long as I 241 is within the period defined by H 31-32, you have a coupled simulation starting.

This is to say I 241 can also be higher than H 31 if you would like (but lower than H 32), but not lower than H 31 (and not higher than H 32).
__________________
Arun
X years with REEF3D
kamath is offline   Reply With Quote

Old   September 19, 2022, 07:33
Default
  #16
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Thanks Arun,

I have just noticed that in my printouts each iteration for my CFD simulation, it shows, "t/T: inf".

I was wondering what this actually refers to and if this is problematic. I have not been able to determine what it actually is in reference to.

Kind Regards,
Felix
FelixD is offline   Reply With Quote

Old   September 20, 2022, 05:56
Default
  #17
Senior Member
 
Arun Kamath
Join Date: Nov 2014
Location: Trondheim, Norway
Posts: 265
Rep Power: 14
kamath is on a distinguished road
That is a little strange for an HDC case.
(It is normal for a CFD simulation where you run the case with time series input)

If you upload your files, I can take a look at them
__________________
Arun
X years with REEF3D
kamath is offline   Reply With Quote

Old   September 20, 2022, 18:51
Default
  #18
New Member
 
Felix Daddo
Join Date: Aug 2022
Location: Sydney, Australia
Posts: 25
Rep Power: 4
FelixD is on a distinguished road
Thanks Arun,

I have attached my current files. Hopefully you can see what is going on. I am not printing the state files every iteration so that could have some effect.

Let me know.

Cheers,
Felix
Attached Files
File Type: zip fnpf files.zip (460 Bytes, 8 views)
File Type: zip cfd files.zip (477 Bytes, 9 views)
FelixD is offline   Reply With Quote

Reply

Tags
cfd, fnpf, hdc, hydrodyamic coupling, reef3d


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
REEF3D 22.03 & DIVEMesh 22.03 valgrinda REEF3D News & Announcements 0 March 26, 2022 08:50
REEF3D FAQ kamath REEF3D 3 March 1, 2022 05:17
REEF3D 21.10 & DIVEMesh 21.10 valgrinda REEF3D News & Announcements 0 October 31, 2021 16:24
REEF3D 21.09 & DIVEMesh 21.09 valgrinda REEF3D News & Announcements 7 October 8, 2021 13:22
Reef3d 21.05 valgrinda REEF3D News & Announcements 0 June 1, 2021 16:42


All times are GMT -4. The time now is 03:57.