Parameterize Input Velocity or Nu?

I’m still in the learning phase, but I have a working fluid flow simulation (currently zero equation turbulence) and I’d like to run it over a range of Reynolds number values.

What would be the better/faster approach, parameterize my input velocity or parameterize my viscosity ‘nu’ value? It seems like there are examples for parameterizing input boundary conditions and geometries, but I can’t find any for parameterization of nu (or similar).

Maybe this is intentional? Or is it possible to evaluate a trained network for different nu values?

Thanks in advance!

Hi @patterson

Theoretically you could do both, but personally I use the different nu parameterization. nu would just be an additional input for your neural network model (e.g. for 2D steady state maybe you have (u,v,p) = NN(x,y,nu)). This would allow for the flow velocity to stay in the same approximate range between Reynolds numbers, likely making it a little easy for your model to converge.

Remember to start with a smaller range (maybe even just having a constant Reynolds number) then increase the complexity to the range you desire. Parameterized problems are more tricky.

Thanks @ngeneva , I’ll give it a try.

If I specify nu as one of the input keys when instantiating the architecture, which I think is the right approach, would I still specify a single value when initializing the ZeroEquation (which then feeds into my NS)?

Have a good weekend!

Hi @patterson

Yes you would want nu (or some scaled version of nu) to be an input key for the neural network. nu would then be provided through the parameterization parameter of a constraint. Any variables provided in the parameterization input are provided to all nodes inside a constraint (just like spatial coords from a geometry). So both your neural network and turbulence model nodes would have access to it.

For more info, a good example of this is in the 3 fin example where complex parameterization are defined in the geometry file then used in the constraint.

There is also some discussion regarding the parameterization use at the bottom of this post:

Hi @ngeneva

It’s a bit sad, but it took me this long to get around to testing out parameterization.

I did the following:
added “nu” as an input key for the constructed architecture (tried Fully Connected and Fourier Net)
set up parameterization using pr = Parameterization(Symbol(“nu”), (0.000003, 0.00005)) and use it as the parameterization arg for each of my constraints

It runs without error!.. until I add a monitor or inferencer that needs velocity or pressure. I run into the same type of issue that you included in your response, that it could not unroll graph.

In looking at the errors, it shows that u, v, w, and p are no longer computable variables. As a straight forward physics problem, I understand how computing any of these without a given nu value would be impossible. Because of this I tried passing Symbol(“nu”) and, separately, a single number (0.000025) as the nu value to ZeroEquation. Also, I tried changing the nu parameter range to a single value.

Here’s a simplified version of my parameter and architecture construction:

input_keys=[Key("x"), Key("y"), Key("z"), Key("nu")] 
pr = Parameterization({Symbol("nu"): (0.000003, 0.00005)}) 

zeroEq = ZeroEquation(nu=Symbol("nu"), dim = 3, time = False, max_distance=10.0 / 2.0)  
ns = NavierStokes(nu=zeroEq.equations["nu"], rho=1.0, dim=3, time=False)
flow_net = instantiate_arch(
	output_keys=[Key("u"), Key("v"), Key("w"), Key("p")],
nodes = (
	+ zeroEq.make_nodes()
	+ [flow_net.make_node(name="flow_network")]

I feel like I’m close, but I also feel like I barely understand the parameterization component so I might not be close at all.

I realize that I need to train the network initially and then can run it in eval run_mode to get results for the range of nu values. Because I am setting up nu as a parameter, do I wait to add any monitors/inferencers until I’m ready to run for evaluation?

Any help is appreciated.

Hello again,

Responding to myself, but I think I misunderstood what to provide to the network. I modified it so that I was still sending the parameterized nu to each of the constraints, but changed the actual ‘input_keys’ to only include x,y,z as I had for the single nu case. This appears to be closer to what is discussed in the linked post which @ngeneva provided.

It runs now, which gives me a small level of confidence that it is closer to correct. I need to incorporate the evaluation portion to run post-training but I can post back when I have results.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.