Permutation of indices in fortran

Click For Summary

Discussion Overview

The discussion revolves around the assignment of weights to a set of angular directions in a numerical quadrature scheme used for solving equations in two dimensions. Participants explore the formulation of the function related to angular variables and the implications of permuting indices in the context of weight assignment.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant describes a function ##\psi_m(x,y,\Omega_m)## with angular variables ##\Omega_m=(\Omega_{x,i},\Omega_{y,j})## and discusses the need to assign weights to these variables based on a quadrature scheme.
  • Another participant points out a contradiction in the notation used to define ##\Omega_m## and requests a clearer specification of the function.
  • A subsequent reply acknowledges the notation error and suggests using different indices for clarity, proposing that ##i,j=1,2,3...,N##.
  • Further, a participant questions the relationships between indices ##i## and ##j## as functions of ##m##, expressing concern over the intuitiveness of the proposed relationships and the need for clarity on the behavior for larger values of ##m##.
  • Another participant mentions the use of Gauss-Legendre quadrature and discusses the numerical evaluation of an integral involving the angular variables, indicating a potential misunderstanding in the discretization scheme.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the relationships between indices or the clarity of the function specification. Multiple competing views and uncertainties about the formulation and index relationships remain evident throughout the discussion.

Contextual Notes

Limitations include unclear definitions of the relationships between indices, potential misunderstandings in the discretization scheme, and unresolved mathematical expressions related to the assignment of weights.

Telemachus
Messages
820
Reaction score
30
Hi there. I am working with a numerical quadrature in some scheme to solve a set of equations. At this point I am working in two dimensions. The thing is that I have some function ##\psi_m(x,y,\Omega_m)## with ##\Omega_m=(\Omega_{x,i},\Omega_{y,j})## with ##\displaystyle m=1,2,...,N,N+1,...,M=\frac{N(N+2)}{2}## where I am using a quadrature for the angular variables ##\Omega##, and the index N denotes the number of discrete directions cosines in each direction, N for x, and N for y.

Now, I have to give a determined weight to each set of the ##\Omega_m## (the weights comes from the angular quadrature of an integral), such that, for example ##\Omega_1=(\Omega_{x,1},\Omega_{y,1})## has assigned the weight ##w_1##, then for ##\Omega_2=(\Omega_{x,2},\Omega_{y,2})## we have ##w_2##,..., and for ##\Omega_N=(\Omega_{x,N},\Omega_{y,N})## we have ##w_N##. But the story continues, when I have ##\Omega_{N+1}=(\Omega_{x,1},\Omega_{y,2})##, this will have the weight ##w_{N+1}##, ##\Omega_{N+2}=(\Omega_{x,1},\Omega_{y,3})## this will have the weight t ##w_{N+2}##, and so on. But then, when I get, for example the direction ##\Omega_{2N+1}=(\Omega_{x,2},\Omega_{y,1})##, this weight must be equal to the one with the permuted indices, id est: ##w(\Omega_{x,2},\Omega_{y,1})=w(\Omega_{x,1},\Omega_{y,2})=w_{N+1}## and, in general ##w(\Omega_{x,i},\Omega_{y,j})=w(\Omega_{x,j},\Omega_{y,i})##.

This whole thing comes into a program I have written, which is automatized to solve the equation for an arbitrary set of directions M. I don't really know how to do this assignment of weights, specially the part of permuting the indices.

I thought perhaps somebody here could give me some idea.

Thanks in advance.
 
Last edited:
Technology news on Phys.org
I'm afraid I can't make sense of the problem as it's described. In the first para it says ##\Omega_m=(\Omega_{x,m},\Omega_{y,m})## for ##1\leq m\leq N(N+1)/2##. But then in the second para it says ##\Omega_{N+1}=(\Omega_{x,1},\Omega_{y,2})##, which contradicts that, since ##1\neq 2##.

What is needed is a clear, comprehensive specification of the function ##\Omega##.
 
  • Like
Likes   Reactions: Telemachus
Yes, I know, my notation was just stupid. I should use different letters ##\Omega_m=(\Omega_{x,i},\Omega_{x,j})## with ##i,j=1,2,3...,N## and ##m=1,2,...,M=\frac{N(N+2)}{2}##
 
Last edited:
It looks like ##i## and ##j## are supposed to be functions of ##m##. What are those functions?
So far you have specified that:
  • for ##1\leq m\leq N##: ##i=j=m##
  • for ##N+1\leq m\leq 2N-1##: ##i=1## and ##j=m-N+1##
Are you sure that's the relation you want? It looks very unintuitive to me. Also, what is the relation for ##m\geq 2N##? It has to change there, otherwise ##j## will exceed ##N##.
 
I am willing to use a Gauss-Legendre quadrature set in two dimensions, by discretizing the directions, I obtain a set of discrete directions cosines in both directions. You are right, the correct expression would be a function of the direction cosines ##\hat \Omega_m=\hat \Omega_m(\hat \Omega_{x,m}, \hat \Omega_{y,m})## that's how it is written in the book). I might have misunderstood something in the discretization scheme. I have an integral of this type:

##\int_0^{2\pi} \Psi (x,y,\Omega_x,\Omega_y) d\phi## which I am willing to evaluate numerically by discretization of the angular variables.

The equation I am solving is: ##\displaystyle \Omega_x \frac{\partial \Psi}{\partial x} + \Omega_y \frac{\partial \Psi}{\partial y}+\sigma_t \Psi=\sigma_s \int_0^{2\pi} \Psi (x,y,\Omega_x,\Omega_y) d\phi+q(x,y,\Omega_x,\Omega_y)##
 

Similar threads

Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
Replies
31
Views
4K
Replies
4
Views
2K
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
38
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K