Skip to content

The ability to turn DOFs "on" and "off" #14

@djinpatch

Description

@djinpatch

Being able to target specific dofs is sometimes useful during optimization. This allows for only optimizing for current, only optimizing for coil shapes, or only optimizing specific coil shapes. Here is an example of how this is done in simsopt:

if current_opt == True: # only target current
        # fix all geometric dofs 
        for c in coils_opt:
            c.curve.fix_all()

.
.
.

# unfix all geometric dofs 
        for c in coils_opt:
            c.unfix_all()
            
            if ellipse_only == True: # only let specific dofs optimize       
                for c in  bs_opt.coils:
                    c.curve.fix_all()

                    # allow coil to slide on z -axis 
                    c.curve.unfix(f'zc(0)') 

                    # allow coil to make an ellipse in the xy plane
                    c.curve.unfix(f'xc(1)') 
                    c.curve.unfix(f'ys(1)') 

                    # allow coil to bend in z plane 
                    c.curve.unfix(f'zc(2)') 

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions