File size: 4,836 Bytes
33ddc1f
 
a60cae4
33ddc1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a60cae4
 
 
 
 
33ddc1f
a60cae4
33ddc1f
a60cae4
 
 
33ddc1f
a60cae4
 
 
 
 
 
 
 
 
 
33ddc1f
a60cae4
 
 
33ddc1f
a60cae4
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import gradio as gr

# Quiz data
quiz_questions = [
    {
        "question": "In our study, we applied a magnetic encapsulation technique. What primary physical phenomenon does this technique aim to suppress?",
        "options": ["Taylor-Couette Instability", "Kelvin-Helmholtz Instability", "Rayleigh–Plateau Instability (RPI)", "Marangoni Effect"],
        "answer": "Rayleigh–Plateau Instability (RPI)",
        "hint": "Think about the instability that makes a stream of falling water break into droplets.",
        "explanation": "✅ Correct! The Rayleigh–Plateau Instability causes liquid jets to break into droplets. Magnetic encapsulation stabilizes the flow, preventing this breakup."
    },
    {
        "question": "According to the study's stability analysis, what condition must the magnetic Bond number (Bom) satisfy to keep the liquid-liquid interface stable?",
        "options": ["Bom ≈ 0", "Bom < 1", "Bom = 1", "Bom > 1"],
        "answer": "Bom > 1",
        "hint": "Stability is achieved when stabilizing magnetic forces overcome destabilizing surface tension forces.",
        "explanation": "✅ Correct! The interface remains stable when magnetic forces are stronger than surface tension, so Bom > 1."
    },
    {
        "question": "The study shows that a stable flow can be switched to an unstable one using an external trigger. How is this achieved?",
        "options": ["By locally heating the ferrofluid with light irradiation", "By rapidly increasing the flow rate of the inner liquid", "By adding a surfactant to the inner glycerol liquid", "By turning off the external magnets completely"],
        "answer": "By locally heating the ferrofluid with light irradiation",
        "hint": "The instability occurs when the stabilizing magnetic force is weakened. Think about a property of the ferrofluid that can be externally altered.",
        "explanation": "✅ Correct! Local heating of the ferrofluid reduces its magnetic susceptibility, weakening the stabilizing magnetic force and triggering instability."
    },
    {
        "question": "For the liquid-liquid interface to remain stable, what must be true about the growth rate of perturbations, τ(k), for all perturbation wave numbers k?",
        "options": ["τ(k) must be negative", "τ(k) must be positive", "τ(k) must be a complex number", "τ(k) must be equal to zero"],
        "answer": "τ(k) must be negative",
        "hint": "Consider whether a small ripple on the interface should grow or shrink for the jet to remain stable.",
        "explanation": "✅ Correct! A negative growth rate means any small perturbation decays over time, keeping the interface stable."
    },
    {
        "question": "What is a significant advantage of the magnetic confinement method over conventional techniques like flow focusing, especially at very low flow rates?",
        "options": ["It requires a continuous and high-velocity flow of the outer sheath liquid", "It can only function at extremely high Reynolds numbers", "It completely eliminates the dripping failure mode at static or near-static conditions", "It is only stable for a very short axial length"],
        "answer": "It completely eliminates the dripping failure mode at static or near-static conditions",
        "hint": "Think about what happens to a dripping tap when the flow is extremely slow.",
        "explanation": "✅ Correct! Magnetic confinement stabilizes the liquid-liquid interface even at near-static conditions, preventing the usual dripping failure seen in conventional flow focusing."
    }
]

# Function to check answer
def check_answer(question_index, selected_option):
    question = quiz_questions[question_index]
    if selected_option == question["answer"]:
        return f"Correct! 🎉\n\n{question['explanation']}"
    else:
        return f"Incorrect ❌\n\n{question['explanation']}"

# Function to show hint
def show_hint(question_index):
    return quiz_questions[question_index]["hint"]

# Build interface for each question
def create_question_block(i, q):
    with gr.Blocks() as block:
        gr.Markdown(f"### Question {i+1}: {q['question']}")
        options_dropdown = gr.Radio(q["options"], label="Select your answer")
        output = gr.Markdown("")
        with gr.Row():
            gr.Button("Submit Answer").click(fn=lambda x: check_answer(i, x), inputs=options_dropdown, outputs=output)
            gr.Button("Show Hint").click(fn=lambda: show_hint(i), inputs=None, outputs=output)
    return block

# Create all questions in tabs
question_blocks = [create_question_block(i, q) for i, q in enumerate(quiz_questions)]
quiz_interface = gr.TabbedInterface(question_blocks, ["Q1", "Q2", "Q3", "Q4", "Q5"])

# Launch the app
quiz_interface.launch()