Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local coordinate system based on W vector and global Y axis #429

Open
ettaka opened this issue Dec 7, 2023 · 2 comments
Open

Local coordinate system based on W vector and global Y axis #429

ettaka opened this issue Dec 7, 2023 · 2 comments
Assignees
Labels

Comments

@ettaka
Copy link
Contributor

ettaka commented Dec 7, 2023

Sometimes local coordinate system is needed in coil formulations.
Currently we can define that by using the thickness direction and height direction in rectangular coils.
If those are not available (ambiguous thickness or height), one option could be to use W Vector direction and a user defined vector.

Let's try to implement that alternative option in this issue.

FYI @jvencels

@ettaka ettaka added the feature label Dec 7, 2023
@ettaka ettaka self-assigned this Dec 7, 2023
@raback
Copy link
Contributor

raback commented Dec 7, 2023

Would it make sense to have this as Elemental subroutine to hide some complexity. So there would be some additional structure that would be initialized and then rotation would be done automatically.

The annoying thing is that rotation may be given in many ways. If it is a full tensor you need 2 vectors, if there is some symmetry 1 vector is enough, and often one rotation angle is enough. So how to add the different possibilities in a generic way? Ideally one would not need to change anything for the elemental routines. Or maybe there could be just one additional command in style.

TYPE(Rotate_t) :: Rotate
IF(Init) CALL ListInitRotation(Model, Rotate)

MagnetizationAtIp = ListGetElementReal3D(Mag_h,Basis,Element,...)
CALL ListGetElementRotate(Rotate,MagnetizationAtIp)

Maybe the way the rotation is defined could be solver-specific. Maybe listing the types of use cases would be good way to start....

I know that the elemental stuff is not much used around AV solver but the old ListGetReal results to guite a bit of extra code for features like this. There are already routines hiding grad, div etc.

FUNCTION ListGetElementRealParent
FUNCTION ListGetElementReal
FUNCTION ListGetElementIm
FUNCTION ListGetElementComplex
FUNCTION ListGetElementReal3D
FUNCTION ListGetElementRealGrad
FUNCTION ListGetElementRealDiv
FUNCTION ListGetElementComplex3D
FUNCTION ListGetElementRealVec

@ettaka
Copy link
Contributor Author

ettaka commented Dec 12, 2023

@raback
Excellent idea! The way we do it now on WhitneyAV side is that we call to get the transformation matrix RotM

CALL GetElementRotM(Element, RotM, n)

Then that is used to transform the conductivity tensor

C = MATMUL(MATMUL(RotMLoc, C),TRANSPOSE(RotMLoc))

But you are right. We should have what you propose so that any tensor could be transformed before it even gets to the solver routine. However, I feel that is a slightly different issue. In the current issue we just need to redefine the way we compute the local coordinate system:
Alpha:


Beta

RotM

So now we do $$\gamma = \alpha \times \beta$$ but if we assume that $\alpha$ and $\beta$ are ambiguous, we could do $$w=\gamma$$ and $\beta$ (coil axis) is set by the user.

Back to your point. I think we should definitely create an issue for your idea, for the future. I think we should refactor the RotM functionality out of AV solver following your concept and use it as a library feature. Then it could be used in any solver. We can then define the RotM transformation matrix as we do in the coil example, or it can be defined some other way.

ettaka added a commit that referenced this issue Jan 26, 2024
The main application for the y-axis and w based local coordinate system
is the stranded homogenization model where the homogenization parameters
are oriented using the RotM transformation. The RotM transformation
needs a local coordinate system and the wish is to be able to define it
without direction solvers (in case of arbitrary wire cross-sections).

A test case derived from `circuits_harmonic_stranded_homogenization` is
added. The original case computes the skin and proximity losses for
a stranded coilcurrent via so called homogenization, where the strands
are not geometrically in the model but their frequency responce is
estimated using `sigma` and `nu` parameters that are gotten from the
elementary solutions of 2D computations (transversal fields and
perpendicular current). In 3D the cross-section needs to be oriented
using the RotM transformation that requires the definition of a local
coordinate system. For that we have previously used the direction
solvers (`Alpha` and `Beta`).

The main point now is to get rid of the direction solvers.
The other major change is to use `CoilSolver` solution to drive
the circuit (instead of `WSolver`). There are many benefits for
using the `CoilSolver`, for example, one can calculate closed coils.

The important new keywords (with respect to ) here are:
 1. `Body: Local Coordinate System Beta Reference and Gamma = Logical True`
   * CoordinateTransform computes alpha = beta x gamma:
     where beta is set to "Beta Reference" and
     Gamma is set to "coilcurrent e" computed by `CoilSolver`
 2. `Component: Coil Normal(3) = Real 0. 0. 1.`
   * `CoilSolver` needs to know how the coil is oriented
 3. `Component: Desired Current Density = Real 1.0`
   * `CoilSolver` will set a certain current density over the coil
 4. `Component: Coil Use W Vector = Logical True`
   * Coil uses a defined `W Vector` for which a name can be provided
   * The `W Vector` set here is used for driving the component with circuits
 5. `Component: W Vector Variable Name = String "CoilCurrent e"`
   * Here we choose the correct field for `W Vector`
 6. `Boundary: Coil Start = Logical True`
   * `CoilSolver` needs a boundary for knowing where coil starts (if not closed)
 7. `Boundary: Coil End = Logical True`
   * `CoilSolver` needs a boundary for knowing where coil ends (if not closed)

Issue #429
ettaka added a commit that referenced this issue Mar 15, 2024
The main application for the y-axis and w based local coordinate system
is the stranded homogenization model where the homogenization parameters
are oriented using the RotM transformation. The RotM transformation
needs a local coordinate system and the wish is to be able to define it
without direction solvers (in case of arbitrary wire cross-sections).

A test case derived from `circuits_harmonic_stranded_homogenization` is
added. The original case computes the skin and proximity losses for
a stranded coilcurrent via so called homogenization, where the strands
are not geometrically in the model but their frequency responce is
estimated using `sigma` and `nu` parameters that are gotten from the
elementary solutions of 2D computations (transversal fields and
perpendicular current). In 3D the cross-section needs to be oriented
using the RotM transformation that requires the definition of a local
coordinate system. For that we have previously used the direction
solvers (`Alpha` and `Beta`).

The main point now is to get rid of the direction solvers.
The other major change is to use `CoilSolver` solution to drive
the circuit (instead of `WSolver`). There are many benefits for
using the `CoilSolver`, for example, one can calculate closed coils.

The important new keywords (with respect to ) here are:
 1. `Body: Local Coordinate System Beta Reference and Gamma = Logical True`
   * CoordinateTransform computes alpha = beta x gamma:
     where beta is set to "Beta Reference" and
     Gamma is set to "coilcurrent e" computed by `CoilSolver`
 2. `Component: Coil Normal(3) = Real 0. 0. 1.`
   * `CoilSolver` needs to know how the coil is oriented
 3. `Component: Desired Current Density = Real 1.0`
   * `CoilSolver` will set a certain current density over the coil
 4. `Component: Coil Use W Vector = Logical True`
   * Coil uses a defined `W Vector` for which a name can be provided
   * The `W Vector` set here is used for driving the component with circuits
 5. `Component: W Vector Variable Name = String "CoilCurrent e"`
   * Here we choose the correct field for `W Vector`
 6. `Boundary: Coil Start = Logical True`
   * `CoilSolver` needs a boundary for knowing where coil starts (if not closed)
 7. `Boundary: Coil End = Logical True`
   * `CoilSolver` needs a boundary for knowing where coil ends (if not closed)

Issue #429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants