Code Monkey home page Code Monkey logo

cylinder2dflowcontroldrl's People

Contributors

jerabaul29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cylinder2dflowcontroldrl's Issues

about changing the geometry

Hi, Mr.Jean,
I want to change the geometry ,change the cylinder to other geometry.Should i change the geometry_2d.template_geo file? and i want to change it directly the shape rather the code .so sorry to distract you .i would be so grateful for any suggestions.

issues about running single_runner.py

Mr. Jean, after I downloaded singularity and your container, I tried to run single_runner.py in singularity. However, it seemed something went wrong. Was it about not downloading tensorforce, python and so on successfully? Hope to get your instruction.

Singularity> exec '/home/yr/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/baseline_flow/single_runner.py'
from: can't read /var/mail/printind.printind_function
from: can't read /var/mail/env
/home/yr/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/baseline_flow/single_runner.py: line 4: import: command not found
from: can't read /var/mail/tensorforce.agents
from: can't read /var/mail/tensorforce.execution
/home/yr/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/baseline_flow/single_runner.py: line 7: import: command not found
/home/yr/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/baseline_flow/single_runner.py: line 8: import: command not found
/home/yr/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/baseline_flow/single_runner.py: line 9: import: command not found
/home/yr/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/baseline_flow/single_runner.py: line 18:
import sys
import os
cwd = os.getcwd()
sys.path.append(cwd + /../Simulation/)

Can not get the "fenics-and-more.img" file

Hello,
Thank you for sharing your code for flow control problems, it's very useful for my research. I have been working on setting up the container and I found that I couldn't get the "fenics-and-more.img" file from the following link:
https://folk.uio.no/jeanra/Informatics/fenics-and-more.img
I've tried both curl and wget but neither of them works.
I got the following information:
sminder@sminder-VirtualBox:~$ wget "https://folk.uio.no/jeanra/Informatics/fenics-and-more.img" --2020-10-21 18:52:39-- https://folk.uio.no/jeanra/Informatics/fenics-and-more.img Resolving folk.uio.no (folk.uio.no)... 129.240.118.92, 2001:700:100:118::92 Connecting to folk.uio.no (folk.uio.no)|129.240.118.92|:443... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: https://folk.universitetetioslo.no/jeanra/Informatics/fenics-and-more.img [following] --2020-10-21 18:52:40-- https://folk.universitetetioslo.no/jeanra/Informatics/fenics-and-more.img Resolving folk.universitetetioslo.no (folk.universitetetioslo.no)... 129.240.118.41, 2001:700:100:118::41 Connecting to folk.universitetetioslo.no (folk.universitetetioslo.no)|129.240.118.41|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2020-10-21 18:52:40 ERROR 404: Not Found.
Is there another method to download this image?

Many thanks.
Shaoze

How to confirm the total simulation step

Hello:
I expand the simulation area and leave the other conditions the same as before,
the simulation_duration=2.0,dt=0.0005,and I think the total simulation step=4000,however,when I run the base_line.py or single_runner.py(First I run make_mesh.py),there are more than 4000 steps ,would you like to offer any suggestions ?
Thank you,best wishes!
Simu_lift | Ep N: 0, step: 4000, Rec Area: 0.0547, drag: -0.1108, lift: 0.0021
Simu_lift | Ep N: 0, step: 4100, Rec Area: 0.0542, drag: -0.1109, lift: 0.0018
Simu_lift | Ep N: 0, step: 4200, Rec Area: 0.0544, drag: -0.1110, lift: 0.0010
Simu_lift | Ep N: 0, step: 4300, Rec Area: 0.0535, drag: -0.1113, lift: -0.0003
Simu_lift | Ep N: 0, step: 4400, Rec Area: 0.0550, drag: -0.1116, lift: -0.00

Negative drag values while training

Hi,

I've recently started using RL to fluid problems. So please excuse for naive questions. While training, the value of drag force is coming negative using fenics. Then how come Cd graph is plotted with the positive value? Can you elaborate

Lift fluctuations resulting from DRL training using the OpenFOAM platform

Hi, Mr.Jean,
At present, I want to conduct simple DRL training on The OpenFoam platform with the cylinder flow case. But in trying for a long time did not achieve the ideal control effect in your paper. And lift changes dramatically every time the action changes.
I have used the control method about speed change in your paper, but this phenomenon still occurs. May I ask how to solve it?
My training parameters are:

network_spec = [ dict(type='dense', size=512), dict(type='dense', size=512) ]

agent = dict( agent='ppo', batch_size=20, network=network_spec, learning_rate=0.001, state_preprocessing=None, entropy_regularization=0.01, likelihood_ratio_clipping=0.2, subsampling_fraction=0.2, saver=dict(directory='saved_models/checkpoint', frequency=1), summarizer=dict(directory='summary') )

deltaT=0.0005 2000epoch 80 steps every epoch The suction range is (-2,2) agent_interaction_period=0.025s Vortex shedding period=0.34s Parallel environments

The lifting drag curve is compared to the baseline as shown below:
image

动作曲线如图:

image

Using Dolphin Expression

Hello,

With the Fenics version available on their official Docker container, it seems that your definition of python JetBCValue is outdated because your are building it on top of an python Expression :

class JetBCValue(Expression):

    def __init__(self, radius, width, theta0, Q, **kwargs):
        assert width > 0 and radius > 0
        theta0 = np.deg2rad(theta0)
        assert theta0 >= 0 
        self.radius = radius
        self.width = np.deg2rad(width)
        self.theta0 = normalize_angle(theta0)

        self.Q = Q

It seems that you need to pass a UserExpression to make it work :

class JetBCValue(UserExpression):


    def __init__(self, radius, width, theta0, Q, **kwargs):
        super().__init__(**kwargs)
        assert width > 0 and radius > 0 
        theta0 = np.deg2rad(theta0)
        self.width = np.deg2rad(width)
        self.radius = radius
        self.theta0 = normalize_angle(theta0)

        self.Q = Q

the rest of the class can remain the same.

Easy confusion on non-dimensionalization

Dear professor:
I'm really sorry to bother you again! In your code ,the range_drag_plot is about from -0.175 to -0.13,and my results are totally in this range with your program.However,the drag coefficient in article is about 2 or 3.And I tried to use equation(2.3) to process data ,still can not get the same results(the range from 2 to 3). It is very kind if you can explain those!
Thank you professor!
sincerely:
best wishes!
A student!

UnicodeDecodeError on exec under Singularity's img

Hi,

I've tried to run your code on my computer and to make everything easier I wanted to use your singularity container. Everything is working fine for the container but when I run the code I got this error :

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128)

And here is the full traceback :

Traceback (most recent call last): File "single_runner.py", line 2, in <module> from env import resume_env File "/home/***/Cylinder2DFlowControlWithRL/baseline_flow/env.py", line 10, in <module> from Env2DCylinder import Env2DCylinder File "/home/***/Cylinder2DFlowControlWithRL/baseline_flow/../Env2DCylinder.py", line 3, in <module> from tensorforce.environments import Environment File "/usr/local/lib/python2.7/dist-packages/tensorforce/environments/__init__.py", line 17, in <module> from tensorforce.environments.environment import Environment File "/usr/local/lib/python2.7/dist-packages/tensorforce/environments/environment.py", line 22, in <module> import tensorforce.util File "/usr/local/lib/python2.7/dist-packages/tensorforce/util.py", line 19, in <module> import tensorflow as tf File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 82, in <module> from tensorflow.python.estimator import estimator_lib as estimator File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator_lib.py", line 41, in <module> from tensorflow.python.estimator.inputs import inputs File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/inputs/inputs.py", line 22, in <module> from tensorflow.python.estimator.inputs.numpy_io import numpy_input_fn File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/inputs/numpy_io.py", line 26, in <module> from tensorflow.python.estimator.inputs.queues import feeding_functions File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/inputs/queues/feeding_functions.py", line 40, in <module> import pandas as pd File "/usr/local/lib/python2.7/dist-packages/pandas/__init__.py", line 42, in <module> from pandas.core.api import * File "/usr/local/lib/python2.7/dist-packages/pandas/core/api.py", line 10, in <module> from pandas.core.groupby.groupby import Grouper File "/usr/local/lib/python2.7/dist-packages/pandas/core/groupby/__init__.py", line 2, in <module> from pandas.core.groupby.groupby import ( File "/usr/local/lib/python2.7/dist-packages/pandas/core/groupby/groupby.py", line 49, in <module> from pandas.core.frame import DataFrame File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 74, in <module> from pandas.core.series import Series File "/usr/local/lib/python2.7/dist-packages/pandas/core/series.py", line 80, in <module> import pandas.plotting._core as gfx File "/usr/local/lib/python2.7/dist-packages/pandas/plotting/__init__.py", line 11, in <module> from pandas.plotting._core import boxplot File "/usr/local/lib/python2.7/dist-packages/pandas/plotting/_core.py", line 45, in <module> from pandas.plotting import _converter File "/usr/local/lib/python2.7/dist-packages/pandas/plotting/_converter.py", line 8, in <module> import matplotlib.units as units File "/usr/lib/python2.7/dist-packages/matplotlib/__init__.py", line 1133, in <module> rcParams = rc_params() File "/usr/lib/python2.7/dist-packages/matplotlib/__init__.py", line 967, in rc_params fname = matplotlib_fname() File "/usr/lib/python2.7/dist-packages/matplotlib/__init__.py", line 782, in matplotlib_fname cwd = os.getcwdu() UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128)

Any help will be much appreciated !

Thibaut

New airfoil model encountered mesh convertion probelm

Dear professor,

Thanks you so much for this greak work. I repleaced the Cylinder to a NACA-0012 airfoil. When I converted the mesh by msh_convert.py file. DOLFIN encountered an error. It seem that DOLFIN can not generate a facet_region.xml, thus can not found this file. Here is the error information:

*** Error: Unable to read data from XML file.
*** Reason: Unable to open file "mesh/NACA0012_2D_facet_region.xml".
*** Where: This error was encountered inside XMLFile.cpp.
*** Process: 0


*** DOLFIN version: 2017.2.0
*** Git changeset: unknown

Actually, I am wonderring why to convert the mesh to h5 file and facet_region.xml file from 18 to 26 line in msh_convert.py:

17 mesh = Mesh(xml_file)
18 out = HDF5File(mesh.mpi_comm(), h5_file, 'w')
19 out.write(mesh, 'mesh')
20
21 for region in ('facet_region.xml', ):
22 name, _ = region.split('')
23 r_xml_file = '
'.join([root, region])
24
25 f = MeshFunction('size_t', mesh, r_xml_file)
26 out.write(f, name)

I have searched the MeshFunction in

https://fenicsproject.org/olddocs/dolfin/latest/python/_autogenerated/dolfin.cpp.mesh.html?highlight=meshfunction#dolfin.cpp.mesh.MeshFunctionSizet

However, I got no answer. And I have tried to email the [email protected] for help. But the owner of the group may have removed this group and my email was rejected.

Looking forward to your help. Thank you so much!

Here is the geo file for NACA0012, It could generate the msh file.

1 //Scirpt
2
3 Li = 50.0; Lo = 50.0; // distance of inflow and outflow boundary from origin
4 Li1 = 2.0; Lo1 = 2.0; // distance of intermediate inflow and outflow f rom origin
5
6 n = 100; // points on upper/lower surface of airfoil used to define air foil
7 // These points may not appear in the mesh.
8
9 lc1 = 10.0; lc2 = 0.00001; // characteristic lengths of elements on airf oil and at farfield
10 lc3 = 0.1; //characteristic length for the inetrmediate domain
11 m = 2n - 2; // total number of points on airfoil without repetition
12 // LE and TE points are common to upper/lower surface
13
14 nle = n; // point number of LE = no. of points on upper surface
15 // Point(1) is trailing edge
16
17 // NACA0012 profile: formula taken from http://turbmodels.larc.nasa.gov/ naca0012_val.html
18 Macro NACA0012
19 x2 = x * x;
20 x3 = x * x2;
21 x4 = x * x3;
22 y = 0.594689181
(0.298222773Sqrt(x) - 0.127125232x - 0.357907906x2 + 0.291984971x3 - 0.105174606x4);
23 Return
24
25 // put points on upper surface of airfoil
26 For i In {1:n}
27 theta = Pi * (i-1) / (n-1);
28 x = 0.5 * (Cos(theta) + 1.0);
29 Call NACA0012;
30 Point(i) = {x, y, 0.0, lc2};
31 xx[i] = x;
32 yy[i] = y;
33 EndFor
34
35 // put points on lower surface of airfoil, use upper surface points and reflect
36 For i In {n+1:m}
37 Point(i) = {xx[2
n-i], -yy[2*n-i], 0.0, lc2};
38 EndFor
39
40 Spline(1) = {1:n}; Spline(2) = {n:m,1};
41
42 Transfinite Line{1,2} = n Using Bump 0.1;
43
44 Point(1001) = { 0.0, Li, 0.0,lc1};
45 Point(1002) = { 0.0, -Li, 0.0, lc1};
46 Point(1003) = {Lo, -Li, 0.0, lc1};
47 Point(1004) = {Lo, Li, 0.0, lc1};
48
49 Line(3) = {1004, 1001};
50 Circle(4) = {1001, nle, 1002};
51 Line(5) = {1002, 1003};
52 Line(6) = {1003, 1004};
53
54 Line Loop(1) = {1,2};
55 Line Loop(2) = {3,4,5,6};
56
57 //Intermediate Domain
58 Point(2001) = { 0.0, Li1, 0.0,lc3};
59 Point(2002) = { 0.0, -Li1, 0.0, lc3};
60 Point(2003) = {Lo1, -Li1, 0.0, lc3};
61 Point(2004) = {Lo1, Li1, 0.0, lc3};
62
63 Line(13) = {2004, 2001};
64 Circle(14) = {2001, nle, 2002};
65 Line(15) = {2002, 2003};
66 Line(16) = {2003, 2004};
67
68 Line Loop(3) = {13,14,15,16};
69
70 Plane Surface(201) = {3,1};
71 Plane Surface(202) = {3,2};
72
73 //Extrude {0,0,lc1} { Surface{201,202}; Layers{1}; Recombine;}
74
75 //Define Boundary Layer
76 Field[1] = BoundaryLayer;
77 Field[1].EdgesList = {1,2};
78 Field[1].AnisoMax = 1.0;
79 Field[1].FanNodesList = {1};
80 Field[1].hfar = 0.03;
81 Field[1].hwall_n = 0.001;
82 Field[1].thickness = 0.05;
83 Field[1].ratio = 1.1;
84 Field[1].Quads = 1;
85 Field[1].IntersectMetrics = 0;
86 BoundaryLayer Field = 1;
87
88 Physical Surface(201) = {201,202}; //Periodic at z = 0
89 Physical Surface(202) = {276, 234}; //Periodic at z = lc1
90 Physical Surface(203) = {271, 275, 263, 267}; //Farfield
91 //Physical Volume(1) = {1, 2};
92
93 Mesh 2;
94 Save "NACA0012_2D.msh";

How to customize the .xdmf file for initial conditions?

Hi,
I'm trying to create a new mesh model and run that in the baseline flow. But if I just plug in my mesh model, the line XDMFFile(comm, flow_params[path]).read_checkpoint(func, name, 0) will give Segmentation fault (core dumped), where flow_params[path] is 'u_init.xdmf' file.
Could you plz give an instruction on how I can customize my own .xdmf files fitting the new mesh model?
Thanks a lot!

Problem with creating a new mesh

Hi Jean,
I want to make a new simulation with jet_angle=5. I'm using the singularity container. When i try to run make_mesh.py it outputs this

Info    : 4821 vertices 9670 elements
Info    : Writing 'mesh/turek_2d.msh'...
Info    : Done writing 'mesh/turek_2d.msh'
Info    : Stopped on Thu Feb 27 20:33:14 2020
Traceback (most recent call last):
  File "/usr/bin/dolfin-convert", line 36, in <module>
    from dolfin_utils.commands import getoutput
ModuleNotFoundError: No module named 'dolfin_utils'
Traceback (most recent call last):
  File "make_mesh.py", line 2, in <module>
    env.resume_env(plot=500, remesh=True)
  File "/home/ugr/Downloads/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/empty_simulation/env.py", line 181, in resume_env
    simu_name = simu_name)
  File "/home/ugr/Downloads/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/empty_simulation/../Env2DCylinder.py", line 132, in __init__
    self.start_class(complete_reset=True)
  File "/home/ugr/Downloads/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/empty_simulation/../Env2DCylinder.py", line 190, in start_class
    convert(msh_file, h5_file)
  File "/home/ugr/Downloads/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/empty_simulation/../msh_convert.py", line 15, in convert
    assert os.path.exists(xml_file)
AssertionError
Aborted (core dumped)

So It can't import dolfin_utils, but when i try to run
python2 -c "import dolfin_utils"
or
python2 -c "from dolfin_utils.commands import getoutput"
It does not display any errors. I also tried several versions of gmsh, including the one in your archive.

This is the command I ran to setup singularity and gmsh (Using the "built-in" version):
singularity shell ~/Downloads/fenics-and-more.img -c "export DISPLAY=:0.0 && export PATH="~/Downloads/Cylinder2DFlowControlDRL-master:$PATH" && /bin/bash"
and the version i downloaded by my own
shell ~/Downloads/fenics-and-more.img -c "export DISPLAY=:0.0 && export PATH="~/Downloads/gmsh-3.0.6-Linux64/bin:$PATH" && /bin/bash"

Also want to clarify that there are no problems running single_runner.py with ready-made mesh.

I apologize for distracting you. I would be very grateful for any help!

About changing Re

Hello,i want to use a larger Nu with your code,so i change Um from 1.5 to 4.5 ,Um=4.5,after this ,i think the Nu number is 300.At the same time ,i also change the refinement of the mesh ,dt ,something related.However,when i run make_mesh.py,there is something wrong about the drag results.(the drag results should be close between Nu=100 and Nu=300,and this is mush larger) .
are there any others factors that may cause this problem?
Thank you again!(it is embarrassed for me that lack knowledge in this respect ,please don't mind)
Simu_M005_lift | Ep N: 0, step: 1000, Rec Area: 0.0045, drag: -1.1114, lift: 0.0100
Simu_M005_lift | Ep N: 0, step: 1100, Rec Area: 0.0050, drag: -1.1644, lift: 0.0103
Simu_M005_lift | Ep N: 0, step: 1200, Rec Area: 0.0055, drag: -1.1837, lift: 0.0106
Simu_M005_lift | Ep N: 0, step: 1300, Rec Area: 0.0059, drag: -1.1701, lift: 0.0121
Simu_M005_lift | Ep N: 0, step: 1400, Rec Area: 0.0065, drag: -1.1448, lift: 0.0152
Simu_M005_lift | Ep N: 0, step: 1500, Rec Area: 0.0071, drag: -1.1253, lift: 0.0198
Simu_M005_lift | Ep N: 0, step: 1600, Rec Area: 0.0078, drag: -1.1147, lift: 0.0255
Simu_M005_lift | Ep N: 0, step: 1700, Rec Area: 0.0086, drag: -1.1090, lift: 0.0318
Simu_M005_lift | Ep N: 0, step: 1800, Rec Area: 0.0090, drag: -1.1046, lift: 0.0383
Simu_M005_lift | Ep N: 0, step: 1900, Rec Area: 0.0096, drag: -1.0996, lift: 0.0448
Simu_M005_lift | Ep N: 0, step: 2000, Rec Area: 0.0100, drag: -1.0931, lift: 0.0514
Simu_M005_lift | Ep N: 0, step: 2100, Rec Area: 0.0106, drag: -1.0850, lift: 0.0579
Simu_M005_lift | Ep N: 0, step: 2200, Rec Area: 0.0113, drag: -1.0757, lift: 0.0640
Simu_M005_lift | Ep N: 0, step: 2300, Rec Area: 0.0113, drag: -1.0663, lift: 0.0690
Simu_M005_lift | Ep N: 0, step: 2400, Rec Area: 0.0119, drag: -1.0575, lift: 0.0727
Simu_M005_lift | Ep N: 0, step: 2500, Rec Area: 0.0122, drag: -1.0500, lift: 0.0742
Simu_M005_lift | Ep N: 0, step: 2600, Rec Area: 0.0127, drag: -1.0437, lift: 0.0728
Simu_M005_lift | Ep N: 0, step: 2700, Rec Area: 0.0130, drag: -1.0382, lift: 0.0677
Simu_M005_lift | Ep N: 0, step: 2800, Rec Area: 0.0132, drag: -1.0332, lift: 0.0585
Simu_M005_lift | Ep N: 0, step: 2900, Rec Area: 0.0140, drag: -1.0287, lift: 0.0448
Simu_M005_lift | Ep N: 0, step: 3000, Rec Area: 0.0141, drag: -1.0245, lift: 0.0263
Simu_M005_lift | Ep N: 0, step: 3100, Rec Area: 0.0144, drag: -1.0207, lift: 0.0031

How the reward function working

Hello:
Here is a question when I used the deep reinforcement learning.I got the reward,and I wonder how does this reward guide the PPO to train the ANNs?In other words,how can I connect the reward and the PPO,and which part of this program show this proess!
Thank you

could not connect to display ":0.0"

Conversion done mesh_file = mesh/turek_2d.h5 -0.2 0.21 total_number_of_probes = 151 No protocol specified No protocol specified Traceback (most recent call last): File "make_mesh.py", line 2, in <module> env.resume_env(plot=500, remesh=True) File "/home/yufeimei/Downloads/singularity-2.5.1/my img/ellipse/ellipse_y/baseline_flow/env.py", line 181, in resume_env simu_name = simu_name) File "/home/yufeimei/Downloads/singularity-2.5.1/my img/ellipse/ellipse_y/baseline_flow/../Env2DCylinder.py", line 132, in __init__ self.start_class(complete_reset=True) File "/home/yufeimei/Downloads/singularity-2.5.1/my img/ellipse/ellipse_y/baseline_flow/../Env2DCylinder.py", line 286, in start_class self.visual_inspection() File "/home/yufeimei/Downloads/singularity-2.5.1/my img/ellipse/ellipse_y/baseline_flow/../Env2DCylinder.py", line 461, in visual_inspection plt.subplots(total_number_subplots, 1) File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 1177, in subplots fig = figure(**fig_kw) File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 527, in figure **kwargs) File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 84, in new_figure_manager return new_figure_manager_given_figure(num, figure) File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 92, in new_figure_manager_given_figure window = Tk.Tk() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1818, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: couldn't connect to display ":0.0" Aborted (core dumped)

I can run the code correctly in debian,but there are some qusetions when i use a new ubantu.could not display ":0.0", It can not show the figure.can you give me some suggestions?

can not run properly with display error

Dear SIr
I am using your singularity image to run some simulation. But I get problem with running even single_runer case with followling error, can you please help me to fix that?

vagrant@vagrant:/vagrant/Cylinder2DFlowControlDRL/Cylinder2DFlowControlWithRL/baseline_flow$ python single_runner.py

[[52445,1],0]: A high-performance Open MPI point-to-point messaging module
was unable to find any relevant network interfaces:

Module: OpenFabrics (openib)
Host: vagrant

Another transport will be used instead, although this may result in
lower performance.

iUFL can be obtained from https://github.com/MiroK/ufl-interpreter
resume env
--- call init ---
mesh_file = mesh/turek_2d.h5
-0.2 0.21
total_number_of_probes = 151
--- done init ---
define network specs
define agent
environment.states = {'shape': (151,), 'type': 'float'}
environment.actions = {'max_value': 0.01, 'shape': (2,), 'min_value': -0.01, 'type': 'float'}
network_spec = [{'type': 'dense', 'size': 512}, {'type': 'dense', 'size': 512}]
2019-06-15 00:57:31.474054: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-06-15 00:57:31.508053: E tensorflow/stream_executor/cuda/cuda_driver.cc:406] failed call to cuInit: CUDA_ERROR_UNKNOWN
2019-06-15 00:57:31.508848: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:145] kernel driver does not appear to be running on this host (vagrant): /proc/driver/nvidia/version does not exist
Trained Network not found...
start simulation
2019-06-15 00:57:32.020531: W tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc:1441] Failed to build SimpleGraphView.
2019-06-15 00:57:32.022051: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:586] Iteration = 0, topological sort failed with message: Non-existent input ^ConstantFoldingCtrl/ppo/cond/add/Switch_0 for node ConstantFolding/ppo/cond/strided_slice_1/stack_const_axis
2019-06-15 00:57:32.022916: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:586] Iteration = 1, topological sort failed with message: Non-existent input ^ConstantFoldingCtrl/ppo/cond/add/Switch_0 for node ConstantFolding/ppo/cond/strided_slice_1/stack_const_axis
Traceback (most recent call last):
File "single_runner.py", line 150, in
one_run()
File "single_runner.py", line 119, in one_run
state, terminal, reward = environment.execute(null_action)
File "/vagrant/Cylinder2DFlowControlDRL/Cylinder2DFlowControlWithRL/baseline_flow/../Env2DCylinder.py", line 799, in execute
self.visual_inspection()
File "/vagrant/Cylinder2DFlowControlDRL/Cylinder2DFlowControlWithRL/baseline_flow/../Env2DCylinder.py", line 461, in visual_inspection
plt.subplots(total_number_subplots, 1)
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 1177, in subplots
fig = figure(**fig_kw)
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 527, in figure
**kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 84, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 92, in new_figure_manager_given_figure
window = Tk.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1818, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":0.0"
Aborted (core dumped)

how to downlowd

well,dear professor!,I want to download the singularity,however ,the website you offered is not avaliable .

problems about singularity container parts

Hello Professor, I want to download the singularity container fragment, but the integrity of the segments is not correct. What is the reason


> (base) lzy@lzy-virtual-machine:~$ cd /home/lzy/Cylinder2DFlowControlDRL/container
> (base) lzy@lzy-virtual-machine:~/Cylinder2DFlowControlDRL/container$ cat fenics-and-more.img_part.?? > fenics-and-more.img
> (base) lzy@lzy-virtual-machine:~/Cylinder2DFlowControlDRL/container$ sha256sum fenics-and-more.img
> 141a0faf677f1d24d2e7643a9c763c355a18e34a7ccfc33d7ce4ef65524c004a  fenics-and-more.img
> 

About Q<0.06

hello:
I found that you set up |Q|<0.06,to prevent non-physically large actuation.And I can not find where the programm to achieve this function.
It would be nice if you can tell me where I can find The Q in programm

higher Reynolds problem

Hi,Sir. I am interested in this work you did, I carefully read your code and articles and lectures on Youtube.I also successfully run your code on linux, and I try to simulate an new cylinder simulation at higher Reynolds number, so I change the value of Um in line 61 of empty_simulation/env.py. After trying that, I found that when Um exceeds 1.5*1.3 there will be an error in simulation running information,Rec Area, drag and lift all three variables are invalid. And I checked the code of probes.py and have no clue, if you still remember the code, can you elaborate? The code running information is in the following:

Simu_lift | Ep N: 0, step: 0, Rec Area: 0.0977, drag: -2.2200, lift: -0.0144
/home/triwonsx/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/empty_simulation/../probes.py:325: RuntimeWarning: invalid value encountered in less
mask = np.where(coefs0 < self.threshold)[0] # This is local to coefs0 numbering
/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
return umr_maximum(a, axis, None, out, keepdims)
/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
return umr_minimum(a, axis, None, out, keepdims)
/usr/lib/python2.7/dist-packages/matplotlib/quiver.py:627: RuntimeWarning: Mean of empty slice.
amean = a[~self.Umask].mean()
/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:80: RuntimeWarning: invalid value encountered in double_scalars
ret = ret.dtype.type(ret / rcount)
/usr/lib/python2.7/dist-packages/matplotlib/quiver.py:701: RuntimeWarning: invalid value encountered in less
short = np.repeat(length < minsh, 8, axis=1)
/usr/lib/python2.7/dist-packages/matplotlib/quiver.py:711: RuntimeWarning: invalid value encountered in less
tooshort = length < self.minlength
/usr/lib/python2.7/dist-packages/matplotlib/colors.py:941: UserWarning: Warning: converting a masked element to nan.
vmin = float(vmin)
/usr/lib/python2.7/dist-packages/matplotlib/colors.py:942: UserWarning: Warning: converting a masked element to nan.
vmax = float(vmax)
Simu_lift | Ep N: 0, step: 100, Rec Area: 0.0000, drag: nan, lift: nan
Simu_lift | Ep N: 0, step: 200, Rec Area: 0.0000, drag: nan, lift: nan
Simu_lift | Ep N: 0, step: 300, Rec Area: 0.0000, drag: nan, lift: nan
Simu_lift | Ep N: 0, step: 400, Rec Area: 0.0000, drag: nan, lift: nan
Simu_lift | Ep N: 0, step: 500, Rec Area: 0.0000, drag: nan, lift: nan

Could not open image; image format not recognized

Hi,

I installed the Singularity and put the segments from the container folder together.
Then I tried to run the following line, but I got a Fatal Error:

singularity shell ~/Cylinder2DFlowControlDRL-master/container/fenics-and-more.img -c "export DISPLAY=:0.0 && export PATH="~/gmsh-3.0.6-Linux64/bin:$PATH" && /bin/bash"

FATAL:   could not open image /home/zww/Cylinder2DFlowControlDRL-master/container/fenics-and-more.img: image format not recognized

would you please give me some ideas about this?

Thanks very much.

No file in mesh directory

Hi Jean,
I was able to get the singularity image working and I can properly import everything however I believe that there was some type of problem with how I have gmsh setup.

These are the files in the current directory:

ls
fenics-and-more.img  
Cylinder2DFlowControlDRL-master    gmsh-3.0.6-Linux64

And this is the command I ran to setup singularity and gmsh:

singularity shell fenics-and-more.img -c "export DISPLAY=:0.0 && export PATH="gmsh-3.0.6-Linux64/bin:$PATH" && /bin/bash"

Then I ran single_runner.py in the empty_simulation folder to get this error output.

IOError                                   Traceback (most recent call last)
<ipython-input-2-6dc4ee2a2e60> in <module>()
     20 printi("resume env")
     21 
---> 22 environment = resume_env(dump=10, single_run=True)
     23 deterministic=True
     24 

/home/vagrant/vboxshare/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/empty_simulation/env.pyc in resume_env(plot, step, dump, remesh, random_start, single_run)
    179                                     reward_function=reward_function,
    180                                     number_steps_execution=number_steps_execution,
--> 181                                     simu_name = simu_name)
    182 
    183     return(env_2d_cylinder)

/home/vagrant/vboxshare/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/empty_simulation/../Env2DCylinder.pyc in __init__(self, path_root, geometry_params, flow_params, solver_params, output_params, optimization_params, inspection_params, n_iter_make_ready, verbose, size_history, reward_function, size_time_state, number_steps_execution, simu_name)
    130         self.initialized_visualization = False
    131 
--> 132         self.start_class(complete_reset=True)
    133 
    134         printi("--- done init ---")

/home/vagrant/vboxshare/Cylinder2DFlowControlDRL-master/Cylinder2DFlowControlWithRL/empty_simulation/../Env2DCylinder.pyc in start_class(self, complete_reset)
    203                         printi("Load buffer history")
    204 
--> 205                     with open('mesh/dict_history_parameters.pkl', 'rb') as f:
    206                         self.history_parameters = pickle.load(f)
    207 

IOError: [Errno 2] No such file or directory: 'mesh/dict_history_parameters.pkl'

It can't find some file that is supposed to be in the mesh folder, my best guess is that gmsh isn't generating the file that it is looking for. But I don't know what I could have done incorrectly with gmsh.
Thanks for the help

How to define Neumann boundary condition

Hello:
I want to know how to define Neumann boundary condition with fenics such as (du/dy=0),are there any examples to refer to,a more easier example?(I didn't understand the example in fenics-manual-2011).
Thank you for your help!
Best wishes!

question when made a new mesh

hello ,i want to make a new simulation of my own.When i run make_mesh.py,here is a mistake .

iUFL can be obtained from https://github.com/MiroK/ufl-interpreter
Make converge initial state for 10000 iterations
--- call init ---
Traceback (most recent call last):
File "make_mesh.py", line 2, in
env.resume_env(plot=False, remesh=True)
File "/home/yang/Downloads/jet_angle5/Cylinder2DFlowControlWithRL/empty_simulation/env.py", line 181, in resume_env
simu_name = simu_name)
File "/home/yang/Downloads/jet_angle5/Cylinder2DFlowControlWithRL/empty_simulation/../Env2DCylinder.py", line 132, in init
self.start_class(complete_reset=True)
File "/home/yang/Downloads/jet_angle5/Cylinder2DFlowControlWithRL/empty_simulation/../Env2DCylinder.py", line 183, in start_class
generate_mesh(self.geometry_params, template=self.geometry_params['template'])
File "/home/yang/Downloads/jet_angle5/Cylinder2DFlowControlWithRL/empty_simulation/generate_msh.py", line 11, in generate_mesh
printiv(template)
File "/usr/local/lib/python2.7/dist-packages/printind/printind_function.py", line 38, in printiv
string = inspect.getframeinfo(frame[0]).code_context[0].strip()
TypeError: 'NoneType' object has no attribute 'getitem'
Aborted (core dumped)

it is really appreciated for your help! and i am really sorry to trouble you for a debug question.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.