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

Example for varible offset first wall #784

Open
shimwell opened this issue Mar 24, 2021 · 3 comments
Open

Example for varible offset first wall #784

shimwell opened this issue Mar 24, 2021 · 3 comments

Comments

@shimwell
Copy link
Collaborator

shimwell commented Mar 24, 2021

random_offsets

Threw together a quick example for a variable offset firstwall from a plasma that might be handy to add to the examples scripts as a PR

from numpy.lib.function_base import angle
import paramak
import random
import subprocess

# removes old files
subprocess.call(['rm', 'random_offset_*.svg'])

for counter in range(10):

    # gets 5 random numbers for the offsets
    offset_1 = random.uniform(10, 80)
    offset_2 = random.uniform(10, 80)
    offset_3 = random.uniform(10, 80)
    offset_4 = random.uniform(10, 80)
    offset_5 = random.uniform(10, 80)

    offsets = [offset_1, offset_2, offset_3, offset_4, offset_5, offset_1]

    # Simple plasma to offset, other more complex parametric plasma shapes are availbe, see the docs
    # https://paramak.readthedocs.io/en/main/paramak.parametric_components.html#plasmaboundaries
    plasma = paramak.Plasma(
            rotation_angle=35,
            minor_radius=150.0,
            major_radius=450.0,
            triangularity=0.55,
            elongation=2.0,
    )
    
    # shape build around plasma with non uniform offsets in this case
    firstwall = paramak.BlanketFP(
        plasma=plasma,
        rotation_angle=35,
        thickness=1,
        start_angle=0,
        stop_angle=360,
        offset_from_plasma=offsets  # uses a list in this case but accepts a single number, list or function
    )

    both_shapes = paramak.Reactor([plasma, firstwall])

    filename = 'random_offset_'+str(counter).zfill(3)+'.svg'

    # saves 3d geomery as svg image, could also be saved as html, stl, or stp
    both_shapes.export_svg(
        filename=filename,
        projectionDir=(5,-5,0),
        showHidden=True,
    )


# converts svg images to igf
subprocess.check_call(
    ["convert", "-delay", "40", "random_offset_*.svg", "random_offsets.gif"])
@RemDelaporteMathurin
Copy link

It seems the thickness of the blanket is not constant. Is it normal ?

@billingsley-john
Copy link

It seems the thickness of the blanket is not constant. Is it normal ?

I think it looks like the thickness is not constant because of the viewing plane of the svg image. Exporting stp files and viewing on correct plane shows constant thickness

@RemDelaporteMathurin
Copy link

@billingsley-john @shimwell I get it, this is a compound of a plasma and a very very thin blanket.

Maybe runing it with a thickness of 10 makes the distinction between plasma and blanket clearer?

image

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

No branches or pull requests

3 participants