Ah yes, the common mode problem. welcome to 'real opamps' as opposed to 'simulated drab'
the TL071 does not really need a negative supply. No opamp does. An opamp has only 2 power supply pins. You'll ofteen see mentioning of symmetrical supplies , assymetrical supplies etc. that is all nonsense. An opamp has a power input and a power return pin (the rails : we call the power supply pins of an opamp the 'rails' to avoid confusion with + and - input).
The opamp amplifies the delta between its inputs. this amplification is very large by default and you can control this ( bring it down ) by applying external components.
In your case the output should indeed be 2 volts. Why ?
You have one input tied to a certain point ( in this case '0 volts' or 'ground' ) so the opamp would like to see the same potential on its other input. simple ohms lawa application teaches us that :
- if that input is indeed 0 , there will be -2 volts across the first resistor. this gives -2/10k = -0.2 milliampere. this current has to go somewhere. since the input of the opamp is high impedant ( but not infinite ! there is a bias current to take into account but with fet input opamps like the tl071 it is very small ) this current can only flow through the other resistor. so there we have a drop of 2 volts ( current sign changes ) . so the output sits at 2 volts.
now in reality this is only true if a number of other conditions are met:
1) the output can indeed swing to such level. if the output would have needed to go to 100 volt and the opamp is only powered with 5 volts on its rails ... it ain't gonna work....
2) you are inside the input operating range.... for a TL071 the input stops working when you come closer than 4 volts from its negative power rail. Since you tied this also to '0 volts' the opamp works only correctly if the inputs are 4 volts or more ... this is called the common mode range of an opamp and is given in the datasheets. Most simulators 'forget this'... because they suck (the models are incomplete) Really good simulators with correct and complete models are not cheap....
For a tl071 powered with 30 volts the operational range is 4 volt to 30 volt, this is given in the datasheet
The reason behind this has to do with the construction of the opamp. I wrote a whole explanation in another topic on this forum. Basically you want to see where the current pump sits. An opamp is made with to matched transsistors and a reference current generator (the current pump). There is a voltage drop across this current generator. if this pump sits between -rail and the transistors then you cannot work lower than the drop across the pump of the -rail. if the pump sits topside, between +rail and the transsitors then you will get into trouble if your input signals get closer to the +rail than the drop across the pump).
3) the ouput can deliver enough current. there is a limit to what the output can do ... overload it and all bets are off.
4) the bias currents do not mess up your circuitry. the higher resistance values you are using the more impact there will be because of bias currents. this current can be positive or negative depending on the construction of the opamp ( jfet, cmos , bipolar ) and screw up really bad your system
For AC signals things get even more complicated. the you get frequency dependent behaviour. the opamp has a reaction time. if you go too fast , it will react too slow and it will screw up again ....
So, to solve your problem : you can disconnect -rail from '0 volt and tie it to -4 volts or so and the beastie should behave. Or, you make a bias generator and 'lift' both inputs away from '0 volts' and tie them to the bias voltage.