Wolfram FEM | Things to Try
Wolfram FEM | Things to Try
Make edits and run any piece of code by clicking inside the code and pressing .
+
Finite Element Method. For beginners to experts, Wolfram FEM captures the behavior of your design by providing multiphysics partial differential equation models, solvers and seamless post-processing functions, fully integrated with advanced geometry and visualization capabilities.
Fluid Dynamics
Fluid Dynamics
Set up a Navier–Stokes equation with a symbolic Reynolds number ℛℯ, fluid velocities u v p |
In[]:=
vars={{u[x,y],v[x,y],p[x,y]},{x,y}};pars=<|"ReynoldsNumber"->ℛℯ|>;
Create a geometry with a hole in the middle: |
In[]:=
Ω=RegionDifference[Rectangle[],Disk[{1/2,1/2},1/5]];
Define the PDE and boundary conditions: |
In[]:=
pde=FluidFlowPDEComponent[vars,pars]=={0,0,0};bcs={DirichletCondition[{u[x,y]1,v[x,y]0},y1],DirichletCondition[{u[x,y]0,v[x,y]0},y<1],DirichletCondition[p[x,y]0,x0&&y0]};
Create a Navier–Stokes solver depending on the parameter ℛℯ: |
In[]:=
navierStokesSolver=ParametricNDSolveValue[{pde,bcs},{u[x,y],v[x,y],p[x,y]},{x,y}∈Ω,ℛℯ,Method{"FiniteElement","InterpolationOrder"{u2,v2,p1}}];
Solve the Navier–Stokes equation for a Reynolds number ℛℯ=100: |
In[]:=
{xVelocity,yVelocity,pressure}=navierStokesSolver[100];
Make a stream plot of the fluid velocities: |
In[]:=
StreamPlot[{xVelocity,yVelocity},{x,y}∈Ω]
More to Try
More to Try
◼
Use a Reynolds number, ℛℯ, equal to 1000 (this method should converge well until about 5000).
◼
Change the geometry by moving the hole in the solution region.
◼
Next Steps
Next Steps
Explore the fluid dynamics application models and monographs or the FluidFlowPDEComponent reference page.
Coupled Heat Transfer and Mass Transport
Coupled Heat Transfer and Mass Transport
Multiphysics models combine different aspects of the same physical system into one coupled model. For example, a temperature- and concentration-dependent chemical reaction:
︷ ∂T(t,x) ∂t | = | 0 |
︷ ∂c(t,x) ∂t | = | 0 |
Solve a coupled heat and mass transport model on the interval .
x∈[0,1]
Set up the heat transfer mass transport model variables temperature T c t |
In[]:=
hvars={T[t,x],t,{x}};mvars={c[t,x],t,{x}};
Specify model parameters with thermal conductivity k d Q R |
In[]:=
pars=<|"ThermalConductivity"0.01,"DiffusionCoefficient"0.01,"HeatSource"0.2*R,"MassSource"R,R->-10^-3*T[t,x]*c[t,x]|>;
Set up the coupled PDEs and initial conditions: |
In[]:=
pdes={HeatTransferPDEComponent[hvars,pars]0,MassTransportPDEComponent[mvars,pars]0};ics={T[0,x]200+800x,c[0,x]800};
Solve the model: |
In[]:=
{Tfun,cfun}=NDSolveValue[{pdes,ics},{T,c},{t,0,10},{x}∈Line[{{0},{1}}]];
Explore how the solution evolves in time: |
In[]:=
ManipulatePlot{cfun[t,x],Tfun[t,x]},{x}∈Line[{{0},{1}}],,{{t,1.3},0,10},
More to Try
More to Try
◼
Modify the initial conditions or the parameter R.
◼
Set up, solve and visualize the problem in two spatial dimensions.
Next Steps
Next Steps
Explore the heat transfer application models and monographs,the mass transport application models and monographs or the HeatTransferPDEComponent or MassTransportPDEComponent reference pages.
Quantum Mechanics
Quantum Mechanics
Set up a 1D time-dependent problem with a harmonic potential: |
In[]:=
vars={Ψ[t,x],t,{x}};pars=<|"ReducedPlanckConstant"->1,"SchrodingerPotential"->|>;
2
x
2
Define the PDE, with a coherent state as initial condition: |
In[]:=
pde=SchrodingerPDEComponent[vars,pars]==0;ic=Ψ[0,x]==;
1
4
1
π
-
2
(x-1)
2
Solve the resulting model: |
In[]:=
solution=NDSolveValue[{pde,ic},Ψ,{t,0,20},{x,-4,4}]
Visualize the coherent state oscillating between the classical turning points: |
In[]:=
AnimatePlot,,{x,-4,4},,{t,0,20},
2
Norm[solution[t,x]]
2
x
2
More to Try
More to Try
◼
Change the potential and initial state to study a scattering problem.
◼
Compute eigenfunctions of a time-independent Hamiltonian.
◼
Model a quantum system in two or three spatial dimensions.
Next Steps
Next Steps
Explore the physics application models and monographs or the SchrodingerPDEComponent reference page.